Is it possible to use the page number of a cross-reference in a formula or text function?

Is it possible to use the page number of a cross-reference in a formula or text function? Fields can give numerical values (page number, page count, time, etc) and I know that using the text function bar I can insert “page-1”. To get one page less, or the offset. I also want the result to be roman numerals. So essentially =ROMAN (cross-reference (bookmark1) - 1). I dont know the correct syntax for libre or know if it is possible.

I found that I can use the syntax “page” from a users comment but cant find and list of syntax’s for other document fields. Is there a list of syntax for document fields or does anyone know any other document field syntax’s that I can use?

My purpose for asking for syntax is because once I learn it, it will have multiple uses in my documents. The main reason I want it in my current document is so that I can easily have section page counts from the cross-referenced bookmark. I have multiple sections with i, ii, iii… and others with 1, 2, 3… Although I can reference bookmark to get the page number, because of the page style I can’t turn the section page count into roman numerals. I have looked through many ‘solutions’ but none of them do exactly what I want. The syntax, if able should suit my needs perfectly.

If there is a method to change cross referenced page numbers into roman numerals but only that reference on the page, that would be a quick fix for me.

Thanks for any help and information people provide.

Fields can’t be used in a formula or function.

However, Insert>Fields>Other allow you to format (= display) the value differently.

There at least two requests in your question.

  • Offsetting page references

You can’t change a bookmark page number. The reason is a bookmark tags a specific location in your document, why would you have it designate another location? It is more reliable to move the bookmark.

Offsetting the current page number is relevant only for expressions like “see next page #” where you quote the page number. In the fields dialog, tab Document offers current (Page numbers), previous (Previous page) and next (Next page) page numbers. You can apply an Offset to these page numbers and Writer will return the designated page number if it exists or an empty value. Why this? If you’re on the last page of your document, Next page returns “void” because there is no next page.

Don’t use an offset for anything else or you’ll get unexpected results.

  • Formatting a page reference

    • Current pagenumber (or previous/next)

The current page number is available in tab Document, Type Page. Column Format offers a choice of formats. By default, As Page Style is selected, meaning the number is displayed the same as was selected for this part of the document. You can force something different by choosing another format.

  • Cross-references

The defined bookmarks are available in tab Cross-references, Type Bookmarks. Formatting choice is limited. If Page is selected in Insert reference to, the age number is returned as Arabic numerals. Select As Page Style to have it the same as the numbering format of the page in which the bookmark is defined.

It is possible to enlarge the choice but it involves trying to outwit Writer which is error-prone, not easy for a newbie and causes editing trouble to the document. I shall not describe the tricks needed here.

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!

If you need more information, ask either editing your question, or with a comment but don’t use an answer. This is not a forum and “answers” get reordered, thus losing the time relationship. It then becomes difficult to know which “answer” was a follow-on question and which “answer” (only one per user) answered it.