Libre Office Writer character border macro not working

I’ve created a macro for a code block (alters selected paragraph style):

code block

I also tried creating the same macro for in-line code (alters selected character style) but with no success - the macro doesn’t apply the border:

inline code

This is what I want the end result to be:

inline code with a border

The macro doesn’t apply the border style to the selected characters. Even though it’s done through the same interface that I used for the paragraph styling.

Below is the macro code that is generated when adding a simple border around selected text.

Any ideas as to why the border doesn’t get applied?

sub addBorder
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

Please stick to the essentials. Don’t force people to read a lot of code that isn’t relevant to your question.

The code is only there for reference, this forum doesn’t have a folding of code blocks so it shows all of it. I purposefully put everything on top of the page. I don’t see a problem.

I too struggled with this until I finally and got it to work. Here is the key point:

  • Sometimes the ‘Record Macro’ doesn’t work for clicking on toolbar shortcuts and you have to record going through the menus.

Example: What follows is an example to get a thick bottom border

sub BottomLineHeavy

rem ---- This macro was recorded using:
rem -- "Format (Alt+'0'), Cells (Alt+'l'+'Enter'), User-defined (Alt+'u' then use cursor keys
rem -- to navigate and spacebar to select sides - also note that the left side may be
rem -- selected by default - pressing the spacebar three times cycles through your
rem -- choices), Tab to Style (cursor up and down to select) then tab to Width to set
rem -- line thickness."

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,0,0,0,0)
args1(1).Name = "BorderOuter.LeftDistance"
args1(1).Value = 0
args1(2).Name = "BorderOuter.RightBorder"
args1(2).Value = Array(0,0,0,0,0,0)
args1(3).Name = "BorderOuter.RightDistance"
args1(3).Value = 0
args1(4).Name = "BorderOuter.TopBorder"
args1(4).Value = Array(0,0,0,0,0,0)
args1(5).Name = "BorderOuter.TopDistance"
args1(5).Value = 0
args1(6).Name = "BorderOuter.BottomBorder"
args1(6).Value = Array(0,0,44,0,0,44)
args1(7).Name = "BorderOuter.BottomDistance"
args1(7).Value = 0

dispatcher.executeDispatch(document, ".uno:BorderOuter", "", 0, args1())

end sub