How to know the current viewed page and line in writer

Fernand Vanrie sos at
Tue Jul 16 10:26:13 PDT 2013

  Ptyl ,

the secret is the vieuwcursor object who can tel you where you are in 
the document , page,or X-Y position etc...

For basic code :

     oDoc =  ThisComponent
     oText = oDoc.getText()
     oCursor = oDoc.CurrentController.getViewCursor()
     oCursor.gotoRange(oCursor.getEnd(), false)


> Hello
> We would like to implement a new GUI element (for mobile), so to show 
> the current viewed location in writer.
> For this, we need to know:
> 1. Which line the writer GUI is currently showing (which may be 
> different from the line the caret / cursor is on - such as when 
> scrolling, for example)
> 2. How many lines there are in total, in the writer document
> What is the simplest way to get this information?
> is it available through UNO, and if not, how can we attain it?
> Additionally, as a fallback, we would like to simply to know which 
> page writer is showing, and how many pages there are in total.
> What is the simplest way to get this data?
> If there are no already existing accessors for this information, can 
> you please direct me to methods and files to hack into or modify to 
> get this data?
> Thank you in advance
> Ptyl
> _______________________________________________
> LibreOffice mailing list
> LibreOffice at

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the LibreOffice mailing list