Könnte mir jemand hier am folgenden Beispiel zeigen, wie man ein aufgezeichnetes Writer-Makro in eine elegante Form umschreibt?
Das Makro fügt nur drei Zeichen (|A|), allerdings in rot, fett, unterstrichen und gelb hervorgehoben, in den Text ein.
Vielen Dank im Voraus!
Z.
Code: Alles auswählen
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 = "|A|"
dispatcher.executeDispatch(document, ".uno:InsertText", "", 0, args1())
rem ----------------------------------------------------------------------
dim args2(1) as new com.sun.star.beans.PropertyValue
args2(0).Name = "Count"
args2(0).Value = 3
args2(1).Name = "Select"
args2(1).Value = true
dispatcher.executeDispatch(document, ".uno:GoLeft", "", 0, args2())
rem ----------------------------------------------------------------------
dim args5(0) as new com.sun.star.beans.PropertyValue
args5(0).Name = "Bold"
args5(0).Value = true
dispatcher.executeDispatch(document, ".uno:Bold", "", 0, args5())
rem ----------------------------------------------------------------------
dim args6(2) as new com.sun.star.beans.PropertyValue
args6(0).Name = "Underline.LineStyle"
args6(0).Value = 1
args6(1).Name = "Underline.HasColor"
args6(1).Value = false
args6(2).Name = "Underline.Color"
args6(2).Value = -1
dispatcher.executeDispatch(document, ".uno:Underline", "", 0, args6())
rem ----------------------------------------------------------------------
dim args7(0) as new com.sun.star.beans.PropertyValue
args7(0).Name = "Color"
args7(0).Value = 13181214
dispatcher.executeDispatch(document, ".uno:Color", "", 0, args7())
rem ----------------------------------------------------------------------
dim args8(0) as new com.sun.star.beans.PropertyValue
args8(0).Name = "BackColor"
args8(0).Value = 16776960
dispatcher.executeDispatch(document, ".uno:CharBackgroundExt", "", 0, args8())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:Escape", "", 0, Array())
end sub