fontname
fontcolor
fontfamily
font
Matthias Prem
How can I add formatted text?
/* AddingFormattedText.rex */
/* Macro */
/* Text shall be underlined, Times New Roman, size 15 and bold */
/* get the script context, the XModel and the XTextDocument interface */
xScriptContext=uno.getScriptContext()
oDoc=xScriptContext~getDocument
xTextDoc=oDoc~{%see com.sun.star.text.XTextDocument%XTextDocument}
/* get the TextCursor from the interface's Text*/
xTextCursor=xTextDoc~getText~createTextCursor
/* setting the properties of the cursor using the XPropertySet interface */
CursorProperties=xTextCursor~{%see com.sun.star.beans.XPropertySet%XPropertySet}
CursorProperties~setPropertyValue("CharFontName", "Times New Roman")
CursorProperties~setPropertyValue("CharWeight", box("float", bsf.getConstant("{%see com.sun.star.awt.FontWeight}", "BOLD"))) --Value is 150.0
CursorProperties~setPropertyValue("CharHeight", box("float", "15"))
CursorProperties~setPropertyValue("CharUnderline", box("short", bsf.getConstant("{%see com.sun.star.awt.FontUnderline}", "DOUBLE"))) --Value is 2
/* set text at the end of the document */
xTextDoc~getText~getEnd~setString("This is OORexx formatted text!")
::requires UNO.CLS
Initial version