I want to create a custom LibreOffice Writer template for our company. This template should include the following code on the last page of each document.
In our existing M $ Word template, we use a field with "IF ({current page} = {last page}; ...", but LibreOffice does not seem 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 section numbers, in a condition expression.
Using a custom page style for the last page also does not seem to be a good solution, because if someone inserts too much content into this βlast pageβ and causes the page to break automatically, he gets a disclaimer twice.
How to create a footer in LibreOffice, which will be automatically displayed on the last page of the document, but not on any other page?
edit: I was able to write a macro that can insert a page break for the last page. Still not a complete solution, but there may 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
source share