4

I want to create a custom LibreOffice Writer template of our company. This template should include a disclamer in the footer of the last page of each document.

In our existing M$ Word template we use a field with "IF({current page}={last page};...", but LibreOffice seems not to be able to use the current page number in conditional texts. The LibreOffice Help page says:

You cannot use internal variables, such as page and chapter numbers, in condition expression.

Using a custom page style for the last page also seems not to be a good decision, because if someone inserts too much content into that "last page" and causes an automatic page break then he gets the disclamer twice.

How can I create a footer in LibreOffice that will automatically be shown on the last page of a document, but not on any other page?


edit: I managed to write a macro that can insert a page break for the last page. Still not the complete solution, but might be a way to go:

Sub PageBreakForLastPage

  ' create cursor
  Cursor = ThisComponent.CurrentController.getViewCursor

  ' move to start of last page
  Cursor.jumpToLastPage
  Cursor.jumpToStartOfPage

  ' create page break
  Cursor.BreakType = com.sun.star.style.BreakType.PAGE_BEFORE
  Cursor.PageDescName = "First Page"

End Sub
slartidan
  • 20,403
  • 15
  • 83
  • 131

1 Answers1

0

We had the same issue using the OpenOffice template engine (i suppose it's the same :D) and the only way to solve this problem was to add a footer with a custom field for the page number and fill this after each page is created.