Skip to content

Instantly share code, notes, and snippets.

@dajare
Last active April 30, 2018 11:15
Show Gist options
  • Save dajare/09a2c3209800def897fd8101f62ec058 to your computer and use it in GitHub Desktop.
Save dajare/09a2c3209800def897fd8101f62ec058 to your computer and use it in GitHub Desktop.
LibreOffice macro to insert "number range" user variable field + surrounding text -- recorded on Ubuntu 18.04
sub PatentParaNumU
' recorded on Ubuntu 18.04
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment