 | OO-Snippets: Adding formatted TextCommons| Keywords | fontname, fontcolor, fontfamily, font |
|---|
| Language | ooRexx |
|---|
| Application | Writer |
|---|
| Authors | Matthias Prem (initial)
|
|---|
| Supported Versions | 2.0.x |
|---|
| Supported OS | All |
|---|
| Question | How can I add formatted text?
|
|---|
| Answer | |
|---|
xScriptContext=uno.getScriptContext()
oDoc=xScriptContext~getDocument
xTextDoc=oDoc~XTextDocument
xTextCursor=xTextDoc~getText~createTextCursor
CursorProperties=xTextCursor~XPropertySet
CursorProperties~setPropertyValue("CharFontName", "Times New Roman")
CursorProperties~setPropertyValue("CharWeight", box("float", bsf.getConstant("com.sun.star.awt.FontWeight", "BOLD")))
CursorProperties~setPropertyValue("CharHeight", box("float", "15"))
CursorProperties~setPropertyValue("CharUnderline", box("short", bsf.getConstant("com.sun.star.awt.FontUnderline", "DOUBLE")))
xTextDoc~getText~getEnd~setString("This is OORexx formatted text!")
::requires UNO.CLS
|
Changelog| Date | User | Modification |
|---|
| 2006-07-06 | matthiasprem | Initial version |
|