Technical Solution
How to traverse programmatically in LibreOffice document?
LibreOffice uses Apache OpenOffice.org. It provides complete object model for the office documents. BASIC used as the programming language. In Basic macro the object 'ThisComponent' represents the active document.
First take 'ThisComponent'.
Create an enumeration object of the current document.
Call nextElement method. It will return text element by paragraphs. If you take String property of the text element you can see the unformatted text of that element. Following is the sample code for that.
REM ***** BASIC *****
Sub Main
Dim Doc As Object
Dim Enum As Object
Dim TextElm As Object
' Create document object
Doc = ThisComponent
' Create enumeration object
Enum = Doc.Text.createEnumeration
' loop over all text elements
While Enum.hasMoreElements
TextElm= Enum.nextElement
msgbox TextElm.String
Wend
End Sub
Please let us know if we can provide any further assistance.