Start Writer and create a new document from the default template.
Insert a page count field (Insert > Field > Page Count).
Notice the field shows 1.
Below this field, type "foo" followed by an endnote (Insert > Footnote and Endnote > Endnote).
Type some text for the endnote itself (for example, "bar").
Return to your "foo". Notice that you have 2 pages now, but the page count field above "foo" still shows 1.
Below "foo", insert another page count field. Notice it shows 2.
So in other words here is what you will end up
This is bad. Both counters should update automatically.
Press F9 to update all fields. Now you have
You may think pressing F9 resolves the issue partly, but actually it doesn't. For example, save this document and close it. Then open it again. Bam! You have
The real life case:
I have a template for technical writing with the following protected section in the very beginning of the first page:
<here is the field for title>
<here is the field for page count>
<here is the field for assigned template>
Each time I open a document with endnotes, the page count field shows me the wrong number of pages.
Steps to Reproduce:
User Profile Reset: No
Confirmed on LibO 188.8.131.52 https://gerrit.libreoffice.org/gitweb?p=core.git;a=log;h=ce769e3009755dcf0082844e386f5dca4c8ecb2f in Ubuntu Linux 20. The page count field updates automatically when you add pages in the "normal" area, but not when you add an endnotes section. You have to do Tools - Update - Fields (or F9) to force the page count to update in some other way. Once updated, it will automatically update when you add so many endnotes that the text wraps to a second endnotes page.
I'm not sure if this would count as a bug. I don't know how much auto-updating for such cases would cost in terms of time spent checking if the page count needs to be updated. Not auto-updating the ToC makes sense to me - it'd probably mean that Writer would have to check at virtually every new paragraph whether it's a paragraph that has to be added to the ToC. But it's definitely something that may give some users a headache. Do we want that?
> I'm not sure if this would count as a bug. [...]
The main problem is that even if you update a field by pressing F9 and save your document, the field will revert to its un-updated state once you open the document again.
There is no such an issue with ToC. Once you updated it, you can safely close the document and open it again. Updating ToC is boring at times, but it works reliably and predictabely.
In case of page count the issue is different and is much worse.
(In reply to John from comment #2)
> > I'm not sure if this would count as a bug. [...]
> The main problem is that even if you update a field by pressing F9 and save
> your document, the field will revert to its un-updated state once you open
> the document again.
> There is no such an issue with ToC. Once you updated it, you can safely
> close the document and open it again. Updating ToC is boring at times, but
> it works reliably and predictabely.
> In case of page count the issue is different and is much worse.
After saving the field value is still correct. Do you save in docx format?
Created attachment 175126 [details]
(In reply to Peter Roelofsen from comment #3)
No, I save it as ODT.
I have just attached a test file. I hope with the test file it will be easier to understand what I mean.
Confirmed with 184.108.40.206 under Fedora Linux 34
When I reopen the test file (.odt) the first page count is wrong, the second one is correct.
I wouldn't mind manually updating the fields (as I usually do) as long as the restored values (when opening the file) are consistent.
Am I the single person here who thinks this is a bug?
That Page Count doesn't update on insert doesn't seem like a bug. It would be resource intensive.
But that Page Count opens wrong after F9 and save and close, seems like a bug.
Repro in recent master build:
Version: 220.127.116.11.alpha0+ (X86_64) / LibreOffice Community
Build ID: ef3b7b7118c854d8ca67cc2249b6c08ddc1885eb
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US