Ask Your Question

Separate page count for each style? [closed]

asked 2013-11-07 16:47:19 +0200

ml gravatar image

updated 2013-11-13 21:27:46 +0200

manj_k gravatar image

My document has several styles with headers. I would like to have my headers in the following form:

Text X of Y

where X is the page number for the corresponding style and Y is the page count for that style so that my headers would look something like this:

Chapter 1 page 1 of 10
Chapter 2 page 4 of 23

I can manage changing the page numbers for each style but I don't know how to count all the pages of a certain style only rather than the whole document. Can you help?

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 2015-11-13 08:54:14.944652

3 Answers

Sort by » oldest newest most voted

answered 2013-11-08 13:31:00 +0200

ml gravatar image

updated 2013-11-09 03:51:30 +0200

oweng gravatar image

Problem solved with a workaround:

  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.
edit flag offensive delete link more


Well done. Good lateral thinking. I completely forgot about bookmarks and cross-references.

oweng gravatar imageoweng ( 2013-11-09 03:49:57 +0200 )edit

This workaround works pretty well but is sensitive to the bookmark being accidentally deleted, especially in a multi-user environment.

This feature would be particularly useful for documents with a header section (cover, table of contents etc) but where the main text is to be formatted with "page n of x", which is a structure we use at work for our reports.

I see the bug/feature request is still outstanding.

TimC gravatar imageTimC ( 2016-05-31 05:44:19 +0200 )edit

answered 2013-11-08 12:57:49 +0200

oweng gravatar image

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> ( relates to the document as a whole:

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

It is probably possible to write a macro to calculate a required page count, but you will need to write the macro.

edit flag offensive delete link more



Is there a workaround for this other than writing a macro? I read something about adding a bookmark somewhere and a cross-reference to it. Would it work?

Question 2:

How can I make a feature request for the LibreOffice developers to include a "Page count for style" feature in the future?

ml gravatar imageml ( 2013-11-08 13:11:08 +0200 )edit

You answered Q1. For Q2, there is currently no open or closed bug for an enhancement request relating to page+count. Please file an enhancement bug and provide as much information about this new feature as possible. Include a link to this thread if necessary. Don't forget to mark your bug as an 'enhancement'. The QA team will be happy to help you triage your feature request in the bugtracker. Please post a link to any bugs you file in a comment below using the format "fdo#123456".

oweng gravatar imageoweng ( 2013-11-09 03:56:28 +0200 )edit

Reported as Bug 71583.

ml gravatar imageml ( 2013-11-13 17:16:05 +0200 )edit

Thanks. I have confirmed the bug report.

oweng gravatar imageoweng ( 2013-11-14 00:07:50 +0200 )edit

Awesome. Let's hope the feature gets implemented.

ml gravatar imageml ( 2013-11-14 15:44:02 +0200 )edit

answered 2013-11-07 17:03:57 +0200

Thrax gravatar image

If you make different sections, and each section having a different stylem you should be able to page count by section and therefore by style?

edit flag offensive delete link more


I tried but it does not work. I get the total page count when I insert a page count field in one of my sections with a specific style which has only a few pages. I'm running LibreOffice Could that be the reason why it does not work?

ml gravatar imageml ( 2013-11-08 10:45:53 +0200 )edit

Question Tools



Asked: 2013-11-07 16:47:19 +0200

Seen: 2,650 times

Last updated: Nov 09 '13