I'm trying to translate to OpenOffice Basic the macros I have in MSOffice, which I use to automate some repetitive tasks. For that, I have designed a form with several check boxes, which will position in given order in the document all the associated AutoText entries. The code in MS VBA looks like this:
Code: Select all
If Accident = True Then
NormalTemplate.AutoTextEntries("Accident merit").Insert _
Where:=ActiveDocument.Bookmarks("merit").Range, RichText:=True
NormalTemplate.AutoTextEntries("medical expert's fees").Insert _
Where:=ActiveDocument.Bookmarks("expertFees").Range, RichText:=True
End If
I have searched all around but haven't yet found out how to do so in LibreOffice. I know it has something to do with the service com.sun.star.text.XAutoTextEntry or XText, but I haven't figured out the actual code that will insert the AutoText in the document. Ideally, I'd like to replace some markup text such as "<merit>" with the AutoText entry instead of using Bookmarks as I did in MS VBA, because otherwise I'd also have to delete all Bookmarks afterwards, and that's something else I haven't figured out how to do as well...
-GRV.
Windows 7 and 10
LibreOffice Portable 5.2.1