christopher23 General User

Joined: 25 Feb 2010 Posts: 19
|
Posted: Tue Mar 23, 2010 6:00 am Post subject: set default font family en size of entire document |
|
|
Is it possible to set the entire document to one font family and size without having to redeclare it everytime you create a textcursor?
At the moment I need to do something like this everytime I need new text.
| Code: | cursor = text.createTextCursor()
cursor.setPropertyValue("CharFontName", "Arial")
cursor.setPropertyValue("CharHeight", 9) |
Java and Basic examples are also welcome. hopefully this is possible |
|
JohnV Administrator

Joined: 07 Mar 2003 Posts: 8995 Location: Lexinton, Kentucky, USA
|
Posted: Tue Mar 23, 2010 7:16 am Post subject: |
|
|
| Code: | Sub Main
CtrlA_CtrlM() 'remove direct formatting with recorded macro
oDoc = ThisComponent
PS = oDoc.getStyleFamilies.getByName("ParagraphStyles")
For i = 0 to PS.Count-1
thisPS = PS.getByIndex(i)
If thisPS.isInUse then
thisPS.CharFontName = "Tahoma"
thisPS.CharHeight = 16
EndIf
Next
End Sub
Sub CtrlA_CtrlM
dim document as object
dim dispatcher as object
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
dispatcher.executeDispatch(document, ".uno:SelectAll", "", 0, Array())
dispatcher.executeDispatch(document, ".uno:ResetAttributes", "", 0, Array())
End Sub |
|
|