Hello, I’ve been trying to create a macro that adds a border around the selected text.
I’ve used the macro recorder but to my knowledge it doesn’t support character borders.
This is the code that is generated for a paragraph border macro:
sub ParagraphBorder
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(7) as new com.sun.star.beans.PropertyValue
args1(0).Name = "BorderOuter.LeftBorder"
args1(0).Value = Array(0,0,2,0,0,2)
args1(1).Name = "BorderOuter.LeftDistance"
args1(1).Value = 49
args1(2).Name = "BorderOuter.RightBorder"
args1(2).Value = Array(0,0,2,0,0,2)
args1(3).Name = "BorderOuter.RightDistance"
args1(3).Value = 49
args1(4).Name = "BorderOuter.TopBorder"
args1(4).Value = Array(0,0,2,0,0,2)
args1(5).Name = "BorderOuter.TopDistance"
args1(5).Value = 49
args1(6).Name = "BorderOuter.BottomBorder"
args1(6).Value = Array(0,0,2,0,0,2)
args1(7).Name = "BorderOuter.BottomDistance"
args1(7).Value = 49
dispatcher.executeDispatch(document, ".uno:BorderOuter", "", 0, args1())
rem ----------------------------------------------------------------------
dim args2(3) as new com.sun.star.beans.PropertyValue
args2(0).Name = "BorderShadow.Location"
args2(0).Value = com.sun.star.table.ShadowLocation.NONE
args2(1).Name = "BorderShadow.Width"
args2(1).Value = 180
args2(2).Name = "BorderShadow.IsTransparent"
args2(2).Value = false
args2(3).Name = "BorderShadow.Color"
args2(3).Value = 8421504
dispatcher.executeDispatch(document, ".uno:BorderShadow", "", 0, args2())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:BorderInner", "", 0, Array())
rem ----------------------------------------------------------------------
dim args4(0) as new com.sun.star.beans.PropertyValue
args4(0).Name = "NumberingStart"
args4(0).Value = false
dispatcher.executeDispatch(document, ".uno:NumberingStart", "", 0, args4())
rem ----------------------------------------------------------------------
dim args5(0) as new com.sun.star.beans.PropertyValue
args5(0).Name = "NumNewStartAt"
args5(0).Value = 65535
dispatcher.executeDispatch(document, ".uno:NumNewStartAt", "", 0, args5())
end sub
And this is the code that is generated for a character border macro:
sub CharacterBorder
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 ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:BorderInner", "", 0, Array())
end sub
I don’t know enough LibreOffice basic to be able to write a macro from scratch, but I would appreciate if someone could at least point out how one would go about writing such a macro.