Ask Your Question

Writer: will I ever be able to define conditions using internal variables? [closed]

asked 2018-05-16 01:07:46 +0200

febrile gravatar image

updated 2018-05-16 01:08:10 +0200

Will it ever be possible to define conditions using internal variables (page, section numbers,...)? e.g. Page == Pages for conditional text in last page footer.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2021-05-09 10:11:12.305677

3 Answers

Sort by » oldest newest most voted

answered 2018-05-16 14:25:32 +0200

pierre-yves samyn gravatar image


+1 with @Jim K & @Mike Kaganski

However, it is at least possible:

  • To display text on all but the last page. A common example is to display PTO (please turn over). For this just insert a field ▸Document tab▸Type: Page▸Select: Next page▸Format: Text▸Value: type your text. See TextExceptOnLastPage.odt
  • To display footer only if the document has more than 1 page. For this insert Hidden Paragraph field with condition page==1 . See ConditionalFooter.odt (add one or more pages to see the footer).

HTH - Regards

edit flag offensive delete link more


The Next_page text trick is just what I needed. A good succinct explanation plus an example document too - very much appreciated. Thanks.

febrile gravatar imagefebrile ( 2018-05-18 09:08:59 +0200 )edit

answered 2018-05-16 12:56:18 +0200

Jim K gravatar image

updated 2018-05-16 13:27:12 +0200

Instead of fields, create a different page style for the last page. Then enter whatever is needed in the footer.

Headers and footers are the same across all pages with that style. So a condition like currentpage == page is not possible in the footer. Note that page confusingly refers to the total number of pages.

Furthermore, as you apparently know, there is no such variablecurrentpage. According to

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

To me, this seems unlikely to change and would require a great deal of effort to implement. However, you could file an enhancement request and see if anyone is willing to tackle it.

A workaround to determine in the text body whether it is the last page is to increment a variable on each page. I do not see how this would be useful, but here is a sample file: Last Page condition.odt

edit flag offensive delete link more


Although you are correct that currently it's impossible, the reasoning behind that ("Headers and footers are the same across all pages with that style. So ... not possible in the footer") is not strictly valid, because if it were, we couldn't have page numbers or chapter titles in headers/footers. Dynamic fields could use dynamically changing stuff in headers; so in theory, it's not impossible.

Mike Kaganski gravatar imageMike Kaganski ( 2018-05-16 13:10:17 +0200 )edit

Thanks. Yes, this was the approach I'd tried before posting the question. It works fine provided you don't have paragraph/table content spanning between the last 2 pages, as this method requires a section break to change page_style.

febrile gravatar imagefebrile ( 2018-05-18 09:31:06 +0200 )edit

answered 2018-05-16 09:59:22 +0200

David gravatar image

updated 2018-05-16 10:08:57 +0200

You can do quite a lot already. See, for example, @JimK's useful sample for a conditional counter in an earlier Q&A

See also the help information on "Defining Conditions " and "Variables", and the internal links in those pages. It might well be possible to accomplish your scenario, though I haven't attempted that one myself.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2018-05-16 01:07:46 +0200

Seen: 388 times

Last updated: May 16 '18