Is there a way to have conditional text based on number of pages in document

We are developing a template with dynamic content that may cause the content to flow onto a second page. In the event the form does become a 2 page form we’d like to display the text “Continued on Next page”. However, if the form does not flow to a 2nd page we’d like the text hidden.

I have tried hidden text using ‘Pages’ as the conditional variable but haven’t had any luck. Is there some other variable I should be referencing in the conditional logic or is there a better way to do this?

Any input or insight from folks here would be greatly appreciated as I’m new to LibreOffice.

I’m afraid the answer is “no” because “interesting” entities like page number or count have no explicitly associated variable name. They can be accessed as fields, but due to the lack of variable name, you can’t encode them in a formula.

I tried various combinations with Insert>Field>Other fields in Document tab, Type Page, Select Next page which returns the number of the next page if it exists, void otherwise but I can’t add fixed text ("Continued on page ") to it.

As a workaround, I’d suggest to use a header or footer containing “Page x out of y” which makes explicit the current page number and the total page count. “x” is field Page Number and “y” Page Count.

To show the community your question has been answered, click the ✓ next to the correct answer, and “upvote” by clicking on the ^ arrow of any helpful answers. These are the mechanisms for communicating the quality of the Q&A on this site. Thanks!


If I understand the question It is possible. See my answer Ask#155084 and the TextExceptOnLastPage.odt exemple


I was able to use this to address my situation. Thanks for helping out a 'Noob" here. Much appreciated.