Skip to content

Instantly share code, notes, and snippets.

@dajare
Last active April 30, 2018 11:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dajare/f2fd1b8d378d4fb745af37769c598142 to your computer and use it in GitHub Desktop.
Save dajare/f2fd1b8d378d4fb745af37769c598142 to your computer and use it in GitHub Desktop.
LibreOffice macro to insert "number range" user variable field + surrounding text -- recorded on OSX 10.10.5 with LibO Vanilla 6.0.3.2
sub PatentParaNum
' recorded on OSX 10.10.5
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "Text"
args1(0).Value = "[00"
dispatcher.executeDispatch(document, ".uno:InsertText", "", 0, args1())
rem ----------------------------------------------------------------------
dim args2(0) as new com.sun.star.beans.PropertyValue
args2(0).Name = "Group"
args2(0).Value = "mytexts*1"
dispatcher.executeDispatch(document, ".uno:SetActGlossaryGroup", "", 0, args2())
rem ----------------------------------------------------------------------
dim args3(0) as new com.sun.star.beans.PropertyValue
args3(0).Name = "Group"
args3(0).Value = "mytexts*1"
dispatcher.executeDispatch(document, ".uno:SetActGlossaryGroup", "", 0, args3())
rem ----------------------------------------------------------------------
dim args4(0) as new com.sun.star.beans.PropertyValue
args4(0).Name = "Group"
args4(0).Value = "mytexts*1"
dispatcher.executeDispatch(document, ".uno:SetActGlossaryGroup", "", 0, args4())
rem ----------------------------------------------------------------------
dim args5(1) as new com.sun.star.beans.PropertyValue
args5(0).Name = "Group"
args5(0).Value = "mytexts*1"
args5(1).Name = "ShortName"
args5(1).Value = "M+"
dispatcher.executeDispatch(document, ".uno:InsertGlossary", "", 0, args5())
rem ----------------------------------------------------------------------
dim args6(0) as new com.sun.star.beans.PropertyValue
args6(0).Name = "Text"
args6(0).Value = "] "
dispatcher.executeDispatch(document, ".uno:InsertText", "", 0, args6())
end sub
@dajare
Copy link
Author

dajare commented Apr 29, 2018

Responding to this question on AskLibO: "4 digit paragraph enumeration"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment