mercredi 28 décembre 2011

macro oppenoffice code


REM ***** BASIC *****

Sub Main

End Sub


sub code
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 = "CharBackgroundExt"
args1(0).Value = false

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

rem ----------------------------------------------------------------------
dim args2(0) as new com.sun.star.beans.PropertyValue
args2(0).Name = "Bold"
args2(0).Value = true

dispatcher.executeDispatch(document, ".uno:Bold", "", 0, args2())

rem ----------------------------------------------------------------------
dim args3(2) as new com.sun.star.beans.PropertyValue
args3(0).Name = "FontHeight.Height"
args3(0).Value = 10
args3(1).Name = "FontHeight.Prop"
args3(1).Value = 100
args3(2).Name = "FontHeight.Diff"
args3(2).Value = 0

dispatcher.executeDispatch(document, ".uno:FontHeight", "", 0, args3())

rem ----------------------------------------------------------------------
dim args4(4) as new com.sun.star.beans.PropertyValue
args4(0).Name = "CharFontName.StyleName"
args4(0).Value = ""
args4(1).Name = "CharFontName.Pitch"
args4(1).Value = 1
args4(2).Name = "CharFontName.CharSet"
args4(2).Value = -1
args4(3).Name = "CharFontName.Family"
args4(3).Value = 0
args4(4).Name = "CharFontName.FamilyName"
args4(4).Value = "Courier New"

dispatcher.executeDispatch(document, ".uno:CharFontName", "", 0, args4())


end sub

Aucun commentaire:

Enregistrer un commentaire