helcim
helcim

Reputation: 819

How to recreate page references in LibreOffice

Before you dismiss this post as using LibreOffice documents THE WRONG WAY, let me explain what I'm trying to achieve. I am generating programatically ODT documents, which is mostly no big deal. I have hit the wall, however, trying to insert internal references into the documnt. It's quite simple to include an anchor in the content.xml with:

<text:reference-mark text:name="anchor"/>

inside <text:p> element. But when you want to reference it later LibreOffice inserts a reference with the page number. Obviously I don't know the page number where the anchor is, but I can easily include a reference to the anchor with

<text:reference-ref text:reference-format="page" text:ref-name="anchor"/>

The question is how to make LibreOffice recreate and insert page number on reading the document?

Upvotes: 1

Views: 58

Answers (1)

helcim
helcim

Reputation: 819

It turns out that LibreOffice does recreate page numbers provided there is actually any number included as contents of text:reference-ref

<text:reference-ref text:reference-format="page" text:ref-name="anchor">1</text:reference-ref>

When opened, upon a change of the file the page number is updated by LibreOffice.

Upvotes: 0

Related Questions