Useful codes for special characters in Open(Libre) office macros

Useful codes for special characters in Open(Libre) office macros

Last updated:

bullet point

CHR$(8226)

regular whitespace

CHR$(09)

example: simulate the prepending of a bullet point to every paragraph whose style is called Heading 2

Sub Teste2
    oEnum = ThisComponent.Text.createEnumeration()
    Do While oEnum.hasMoreElements()
        oPar = oEnum.nextElement()
        If oPar.supportsService("com.sun.star.text.Paragraph") Then
            If oPar.ParaStyleName = "Heading 2" Then
                dim str
                str = oPar.getString()
                str  = CHR$(8226) & str
                oPar.String = CHR$(09) & str
            End If
        End If
    Loop
End Sub