Iterating through all Paragraphs - Open/Libre Office Macro

Last updated:

This will cycle through all Paragraphs in the current Text and will output the contents of that Paragraph in a Message Box

Sub Teste4
    oEnum = ThisComponent.Text.createEnumeration()
    Do While oEnum.hasMoreElements()
        oPar = oEnum.nextElement()
        If oPar.supportsService("com.sun.star.text.Paragraph") Then
            MsgBox oPar.getString()
        End If
    Loop
End Sub

Dialogue & Discussion