OO-Snippets: Change existing Text

Commons

Keywordsfont, font family
LanguageooRexx
ApplicationWriter
AuthorsMatthias Prem (initial)
Supported Versions2.0.x  
Supported OSAll  
QuestionHow can I change the font family of an existing text?
Answer

Code-Snippet-Listing (snippet-source)

/* ChangingFormattedText.rex */
/* Macro */

/* get the script context, the Desktop and the XTextDocument interface */
xScriptContext=uno.getScriptContext()
xDesktop=xScriptContext~getDesktop

/* get the xModel from the current Component and the xViewCursor */
xComponent = xDesktop~getCurrentComponent()
xModel = xComponent~xModel
xController = xModel~getCurrentController()
xViewCursorSupplier = xController~XTextViewCursorSupplier
xViewCursor = xViewCursorSupplier~getViewCursor()

/* set the properties for the xViewCursor */
xCursorPropertySet = xViewCursor~XPropertySet
xCursorPropertySet~setPropertyValue("CharFontName", "Courier New")

::requires UNO.CLS

Changelog

DateUserModification
2006-07-10matthiaspremInitial version

and