How do I Make Totals Appear on the Last Page Only?

The simplest way

Don't use footers, put the totals at the bottom of the template body and let it naturally flow

To make totals appear on only the last page of the document is to place the total placeholders in the body of the document rather than in the footer of the document.  The footer will normally repeat for each page of the document whereas if you simply place your totals in the body of the document, after the repeating placeholders, then they will naturally appear on the last page only.  There are other ways in OpenOffice/LibreOffice to use firstpage and lastpage styles to achieve the totals on last page effect, but placing the totals within the body after the repeating tags is the simplest.  While this is the simplest method, it does carry the following limitations:

  • The totals on the last page will 'float up' the last page depending on the number of detail lines displayed in the document.
  • Unless you set the properties of the paragraph or table containing the totals so that it will not break across pages, depending on the number of rows displayed on the page, the total lines may break across two pages.

 

The less simple, slightly more complex but much better way

Don't use footers and force a fixed size grid using increment and finalincrement

Due to a current limitation in OpenOffice/Libre Office, it is not possible to use footers, footnotes or endnotes to model a different footer on the last page of the document.  To simulate this effect, you should use {repeat} tags with the increment and finalincrement parameters.   A description of this technique is documented in the article Form Design: Using Repeat Tags.

The basic idea is that you will use the repeat tag with increment and finalincrement parameters to display a fixed number of rows on each page (a grid).  The grid for all but the last page of the document will be set to the number of rows specified by the increment parameter.  The last page will be set to the number of rows specified by the finalincrement parameter.  Using these parameters, you can simple place the totals in a row below the repeated row or in a separate table or text area below the table.  The position of the totals will be preserved by the fixed spacing achieved by the increment and finalincrement parameters.  In other words, the last page will have fewer displayed rows that the prior pages so this will allow room for your total rows or text areas on the page.