# 'Page count' field for a letter with inserted envelope(s)

I want to have page n of m in the bottom margin of each page of a multi page business letter with one or more inserted envelopes.

But the problem is that the page count is incorrect and includes both letter pages and envelopes.

For example: for a 2 page letter, with 2 envelopes at the top, the pages field is 4, but it should be 2.

In other words m should only count letter pages and not also inserted envelopes.

• Insert | Envelope at the top of the letter (4 times for my 4 envelopes), and then
• Insert | Field | Page count in the letter's footer, and
• Format | Paragraph | Text Flow | Breaks | Page number | 1 to make the first page of the letter have page # 1.

BTW: https://help.libreoffice.org/Writer/Page_Numbers#To_Start_With_a_Defined_Page_Number tells how to set n.

How do I correctly set m?

edit retag close merge delete

I have found this link and am studding it: https://superuser.com/questions/86321...

( 2019-06-06 20:16:47 +0200 )edit

I strongly advise against the trick given in the link. The use of a formula for a page number is a test for existence of a page at ±offset from the current page. If the page exists, the number is returned, other formula result is void. This feature is offered to insert texts like "continued on next page"/blank or "see previous page"/blank.

In your case, it may work if you are "sufficiently far away" from the document ends. But be prepared for void results because the offset references an nonexistent page (beyond the last one or before the first one).

( 2019-06-06 20:38:19 +0200 )edit

One can't do this. Here's the bug report.

( 2019-06-06 21:05:19 +0200 )edit

@ajlittoz, Not interested in introducing a problem to fix a problem. Thanks anyway.

( 2019-06-06 21:07:56 +0200 )edit

Sort by » oldest newest most voted

Short answer: you can't with field Page Count, which counts all pages allocated by Writer, no matter how they are "decorated" or otherwise numbered. Your envelopes are pages and included in total page count. Full stop.

Workaround

Since Page Count cannot be used, you must reference another "field".

At the very last position of your letter part, Insert>Bookmark and give it LetterLast name (or any other mnemotechnic for you). Where you used Page Count, replace with Insert>Cross-reference, type Bookmarks, selection LetterLast, insert reference to Page (or whatever you need).

Now, you can insert your envelopes before or after your "letter", it won't make any difference. However, don't forget to "refresh" the value from time to time with Tools>Update>Update all.

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!

more

Thanks, however as was pointed out in a comment here while this approach might work, it is susceptible to accidentally deleting the bookmark.

( 2019-06-07 00:23:29 +0200 )edit

Yes, that's the risk, but there's no free meal. To mitigate it, you may add a warning comment. Comment do not print unless you ask for that. So that's pretty innocuous.

( 2019-06-07 07:42:54 +0200 )edit