Bug 71583 - FORMATTING: There is no page count field for different page styles or sections
Summary: FORMATTING: There is no page count field for different page styles or sections
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: Other All
: medium enhancement
Assignee: Oliver Specht (CIB)
URL: https://bugs.documentfoundation.org/s...
Whiteboard: BSA target:25.8.0
Keywords:
: 50210 105668 141763 (view as bug list)
Depends on:
Blocks: Writer-Enhancements Writer-Page-Break Writer-Styles-Page Fields-Page-Count
  Show dependency treegraph
 
Reported: 2013-11-13 16:13 UTC by Matti Lammi
Modified: 2025-03-24 15:26 UTC (History)
17 users (show)

See Also:
Crash report or crash signature:


Attachments
EXample file from Word 2016 with several types of section breaks and SectionPages field in header/footer (17.22 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2024-12-19 16:28 UTC, Gabor Kelemen (allotropia)
Details
Example document (11.78 KB, application/vnd.oasis.opendocument.text)
2024-12-20 07:59 UTC, Heiko Tietze
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Matti Lammi 2013-11-13 16:13:05 UTC
LibreOffice Writer is missing an important feature; A page counts like field 
which counts pages of a specific style only instead of counting all the pages 
of the whole document. This feature would be very useful.

Sometimes users want to or are required to have different sections in their 
document with page numbering like this: 

Page X of Y, 

where X is a page number and Y is a page count for that specific section. For 
example:

Appendix 1 page 3 of 8
Appendix 2 page 1 of 3
Appendix 3 page 5 of 6

Currently, implementing the example above is not as simple as it should be. One 
way is to use bookmarks and cross-references like this:

1. Make a bookmark on the last line of a style: Insert > Bookmark

2. Name it like "LastPageSTYLENAME" where STYLENAME is the name of the corresponding style.

3. Make a cross-reference to it where you want the "page count for style field" 
to be: Insert > Cross-reference

4. Select type "Bookmark", select the bookmark you made, select "Page" for the 
"Insert reference to" option and click insert.

This is not that hard to do when you know how, but it is tiresome. Also, many 
users don't know how to do this workaround. A simple field would be much better: 

Insert > Fields > Page Count for style

Users would select a place where they want this field to appear (a header most 
likely but not always), select "Page Count for style" in the menu and, from the 
opening window, select a style upon which the page count field should operate. 
The options should be something like this:

 () this style (default) 

 () other style  [=========]

 () other styles [=========]

where () is a radio button and [=========] is a dropdown panel where all the styles 
used in the corresponding document are listed. 

It is useful to be able to select the style(s) the page count field should operate 
with. For example, users might need to tell the reader how many appendix pages they 
have in total like this:

"My document is 132 pages long including 14 appendix pages."

Is this feature implementable?

Operating System: All
Version: 4.1.0.4 release
Comment 1 Owen Genat (retired) 2013-11-13 23:05:57 UTC
I am confirming this bug. Status set to NEW. Severity set to enhancement as this is seeking to implement functionality that has never existed. The related AskLO thread is:

http://ask.libreoffice.org/en/question/24941/separate-page-count-for-each-style/

The use of "style" in the title is not entirely accurate. The request is for page counts according to sub-divisions of a document i.e., part, chapter, section, etc. It would seem unlikely that this would based on a page style. I will repeat here what I stated in the related AskLO thread:

> There is currently no field available to obtain a page count for a part / 
> chapter / section within a document as this is not supported by the ODF v1.2 
> specification. Instead <text:page-count> (7.5.18.2) relates to the document as 
> a whole:

This is what the ODF v1.2 spec states under 7.5.18.2:

> The <text:page-count> element displays the value of the meta:page-count 
> attribute of the <meta:document-statistic> element of a document. 19.332

One workaround at the moment is to use bookmarks and cross-references as indicated in the description.
Comment 2 Cor Nouws 2016-05-20 14:04:27 UTC
or a field that counts the total starting from the place where a new page numbering in started (typically that is in the first paragraph of a page with page break before)
Comment 3 Tim Chambers 2016-05-31 03:42:32 UTC Comment hidden (me-too)
Comment 4 Cor Nouws 2016-05-31 07:40:15 UTC Comment hidden (off-topic)
Comment 5 Buovjaga 2017-02-12 10:06:42 UTC
*** Bug 105668 has been marked as a duplicate of this bug. ***
Comment 6 Xisco Faulí 2019-11-29 13:28:47 UTC Comment hidden (noise)
Comment 7 pierre_aussaguel 2020-09-15 08:24:40 UTC Comment hidden (me-too)
Comment 8 Dieter 2021-10-29 08:29:13 UTC
*** Bug 50210 has been marked as a duplicate of this bug. ***
Comment 9 Heiko Tietze 2022-01-18 07:32:00 UTC
*** Bug 141763 has been marked as a duplicate of this bug. ***
Comment 10 Heiko Tietze 2023-02-01 10:58:03 UTC
Bug 153259 requests a way to exclude pages from counting so one could have a title page, for example, that is not counted for the total number of pages. We should realize this by adding an option to the page style "[x] Include this page style for numbering". It would only partially solve this use case but is a generic and straightforward solution.
Comment 11 Peter Lairo 2023-06-28 19:57:44 UTC
I hope this bug applies to both the "Page Number" and the "Page Count".

I think a very typical use-case is for documents that have several different sections that need to be page-counted completely independently of each-other. 

For instance, a document can typically have: 
- Title Page
- Table of Contents (ToC) (e.g. covering 3 pages)
- Main Body (e.g. covering 100 pages)

It would be very useful to be able place the page number and page count (in the footer) the following way:

Let's say that the entire document has 700 pages, the Title Page is 1 page, the ToC has 3 pages, and the Main Body has 100 pages (and the remaining pages are appendixes).

It should be (easily) possible to show the Page Numbers and the Page Counts the following way:

The first page of the ToC shows as: Page i of iii

The second page of the Main Body shows as: Page 2 of 100

The most (semi) intuitive way I can think of is by using Page Styles, where there would be a Combo-Box in the Page Style settings for:

   ( ) Continue page numbering from previous Page Style Section
   (o) Start new page numbering from [ 1 ]

Another (hacky) way would be to allow users to add and subtract numbers from the  Page Numbers and the Page Counts, e.g. by adding the following functionality to the "Edit Field" dialog:

1. Allow negative values for "Offset" for the "Page Number".
2. Add the "Offset" option to the dialog for Page Count (Strangely called "Statistics / Pages" instead of "Page Count"), and allow for negative values there too.
Comment 12 Gabor Kelemen (allotropia) 2024-12-19 16:28:20 UTC
Created attachment 198178 [details]
EXample file from Word 2016 with several types of section breaks and SectionPages field in header/footer

For reference, this is what Word can do: count number of pages until the next section break of the "Next Page/Continuous/Even Page/Odd Page" type.
Comment 13 Heiko Tietze 2024-12-20 07:59:34 UTC
Created attachment 198186 [details]
Example document

The expectation is to count page up to 6 and the new field "page count per section" (or whatever it will be named) to 3 for the page style A and from 1 to 3 for PgS B.
Comment 14 Oliver Specht (CIB) 2024-12-23 07:39:04 UTC
(In reply to Heiko Tietze from comment #13)
> Created attachment 198186 [details]
> Example document
> 
> The expectation is to count page up to 6 and the new field "page count per
> section" (or whatever it will be named) to 3 for the page style A and from 1
> to 3 for PgS B.
That would generally not work as requested in the initial bug description.

Page styles are in no way related to Sections in Word. A document as described in comment #0 would probably use the same page styles for Appendix 1-3
And it might use left page / right page to create the body.

Counting pages should be synchronized with page numbers. 
So each restart of page numbering also restarts page counting.
Comment 15 Heiko Tietze 2025-01-06 12:28:34 UTC
(In reply to Oliver Specht (CIB) from comment #14)
> That would generally not work as requested in the initial bug description.
We struggle on Gerrit to find a good name. "Page count in section" or some kind of transliteration of "page-count-in-current-page-number-range" is on the table - where average users probably not understand what that means (in contrast to "Page Count per Style"). This is an indicator of a usability issue.

(In reply to Oliver Specht (CIB) from comment #14)
> So each restart of page numbering also restarts page counting.
How about counting until the next page break whether using the same style or a different. The label could be "Page Count Before Break". And in case of left/right or title/content or foo/bar it would be no (manual) break.
Comment 16 Regina Henschel 2025-02-26 13:52:58 UTC
The ODF TC has discussed the related attribute on 2025-02-24. The resolution is now (see URL),
"Add a new 7.5.18.x <text:page-count-range>
The element displays the number of pages in the current page numbering range. A page numbering range starts with the use of 20.328 style:page-number, and at the start of the document."

That means, that a new page numbering range starts even if page numbering does not restart but continues, which is the attribute style:page-number="auto".
Comment 17 Commit Notification 2025-03-08 14:00:16 UTC
Oliver Specht committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/554d2769d1c8c5b2fa03d2c72e91c92a94fb3cd8

tdf#71583 Add page count of ranges with consecutive page numbering

It will be available in 25.8.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 18 Commit Notification 2025-03-13 13:08:58 UTC
Gabor Kelemen committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/help/commit/9218bcbfa5f67ffe3243a1e5f942eb290d213610

tdf#71583 Add a tip to Insert Manual Break page
Comment 19 Commit Notification 2025-03-13 13:56:10 UTC
Gabor Kelemen committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/help/commit/ca3dcbc01b5b6b72cc3d9869a76b2c7170cf2aa5

tdf#71583 Describe the new checkbox in Page Number Wizard dialog
Comment 20 Commit Notification 2025-03-14 10:02:17 UTC
Gabor Kelemen committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/08a83c88b2838e0aa4ed0c3b5e3ef2e21efe4b2e

tdf#71583 (related) Add ext. tooltip to floating menu

It will be available in 25.8.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 21 Gabor Kelemen (allotropia) 2025-03-24 15:26:29 UTC
I believe we can consider this fixed now.