Last Page Footer
Suppose we want to create an invoice form – or another report template for this matter – with some details, e.g. invoice total amounts at the bottom of the last page. How can we achieve this with Docentric?
If this document is printed on one page only, the Totals are printed at the bottom of the first page. If there are more pages, it appears only at the bottom of the last page.
When designing SSRS reports there is no Report footer either, but you can achieve it using a workaround with Page footer and the Visibility expression using Global variables – Globals!PageNumber and Globals!TotalPages. Let’s now see how we can accomplish this with Docentric.
With such a requirement, your first thought might be if Word supports this natively – i.e. can we format a last page footer? Unfortunately, there is no such built-in MS Word functionality as of now.
MS Word allows us to format three sets of headers and footers per section. Each section can have different headers and footers for the first page, even pages and all other pages. Unfortunately, there is no option to set a header/footer for the last page, which would be exactly what we need in this scenario.
Workaround using a Text Box
There is a workaround to achieve exactly this with Docentric Designer by using a floating Text Box. This Text Box will contain our Totals value.
You can do this if you follow the following steps.
- Move the cursor to the last paragraph in your template.
- Then insert a new text box – in the following example we have inserted a Simple Text Box.
- Next, we have to lock the anchor of this text box and position it to the bottom of the page. By doing so we only ensure the text box’s anchor will not move when we will be positioning the text box. To do so, just right-click on the box and select See more from Layout options:
A dialog box will open where you can Lock the anchor of this Text Box and then set it to Absolute position on the page – select the values that work in your case. You can also set the alignment.
This way, the floating text box will always be positioned at the bottom of the last page, since this where the (last) paragraph containing the anchor is positioned.
- You can then resize and add any Word or Docentric elements to this newly created text box and format them according to your wishes. For testing purposes, we have inserted only a simple table with totals and the Field tagging element bound to the InvoiceAmount data field.
We suggest turning on the Live Preview pane to instantly observe any changes in the template. We also recommend to load different data sources (DDSP files) into the template in order to test use cases with a different number of resulting pages.