font
font family
Matthias Prem
How can I change the font family of an existing text?
/* 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~{%see com.sun.star.frame.XModel%xModel}
xController = xModel~getCurrentController()
xViewCursorSupplier = xController~{%see com.sun.star.text.XTextViewCursorSupplier%XTextViewCursorSupplier}
xViewCursor = xViewCursorSupplier~getViewCursor()
/* set the properties for the xViewCursor */
xCursorPropertySet = xViewCursor~{%see com.sun.star.beans.XPropertySet%XPropertySet}
xCursorPropertySet~setPropertyValue("CharFontName", "Courier New")
::requires UNO.CLS
Initial version