# Revision history [back]

Use getPage() with the view cursor. From https://wiki.openoffice.org/wiki/Documentation/DevGuide/Text/TextViewCursor:

[The com.sun.star.text.TextViewCursor] supports the following cursor capabilities that depend on having the necessary information about the current layout state, therefore it is not supported by the model cursor.

com.sun.star.text.XPageCursor

Use getPage() with the view cursor. From https://wiki.openoffice.org/wiki/Documentation/DevGuide/Text/TextViewCursor:

[The com.sun.star.text.TextViewCursor] supports the following cursor capabilities that depend on having the necessary information about the current layout state, therefore it is not supported by the model cursor.

com.sun.star.text.XPageCursor

Use getPage()   with the view cursor. From https://wiki.openoffice.org/wiki/Documentation/DevGuide/Text/TextViewCursor:

[The com.sun.star.text.TextViewCursor] supports the following cursor capabilities that depend on having the necessary information about the current layout state, therefore it is not supported by the model cursor.

com.sun.star.text.XPageCursor

Use getPage()  with  with the view cursor. From https://wiki.openoffice.org/wiki/Documentation/DevGuide/Text/TextViewCursor:

[The com.sun.star.text.TextViewCursor] supports the following cursor capabilities that depend on having the necessary information about the current layout state, therefore it is not supported by the model cursor.

com.sun.star.text.XPageCursor

Use getPage() with the view cursor. From https://wiki.openoffice.org/wiki/Documentation/DevGuide/Text/TextViewCursor:

[The com.sun.star.text.TextViewCursor] supports the following cursor capabilities that depend on having the necessary information about the current layout state, therefore it is not supported by the model cursor.

com.sun.star.text.XPageCursor

For a more complex solution, it may work to temporarily create a cross-reference field that displays the page number.

Use getPage() with the view cursor. From https://wiki.openoffice.org/wiki/Documentation/DevGuide/Text/TextViewCursor:

[The com.sun.star.text.TextViewCursor] supports the following cursor capabilities that depend on having the necessary information about the current layout state, therefore it is not supported by the model cursor.

com.sun.star.text.XPageCursor

For a more complex solution, it may work to temporarily create insert a cross-reference field that displays the page number.

Use getPage() with the view cursor. From https://wiki.openoffice.org/wiki/Documentation/DevGuide/Text/TextViewCursor:

[The com.sun.star.text.TextViewCursor] supports the following cursor capabilities that depend on having the necessary information about the current layout state, therefore it is not supported by the model cursor.

com.sun.star.text.XPageCursor

For a more complex solution, it may work to temporarily insert a cross-reference field that displays the page number.

EDIT:

Here is example code using the view cursor.

Sub PageOfBookmark
oDoc = ThisComponent
oVC = oDoc.getCurrentController().getViewCursor()
oBookmark = oDoc.getBookmarks().getByName("Bookmark 1")
oVC.gotoRange(oBookmark.getAnchor(), False)
MsgBox "Bookmark is on page " & oVC.getPage()
End Sub