 | OO-Snippets: Table of ContentsCommons| Keywords | table of contents, contents |
|---|
| Language | ooRexx |
|---|
| Application | Writer |
|---|
| Authors | Matthias Prem (initial)
|
|---|
| Supported Versions | 2.0.x |
|---|
| Supported OS | All |
|---|
| Question | How can I insert a Table of Contents?
|
|---|
| Answer | |
|---|
xScriptContext=uno.getScriptContext()
oDoc=xScriptContext~getDocument
xTextDoc=oDoc~XTextDocument
xServiceManager=oDoc~XMultiServiceFactory
toc = xServiceManager~createInstance("com.sun.star.text.ContentIndex")
tocPS = toc~XPropertySet
tocPS~setPropertyValue("Level", box("Short", "10"))
tocPS~setPropertyValue("CreateFromOutline", box("boolean" ,.true))
tocTC = toc~XTextContent()
xText=xTextDoc~getText()
xCursor=xTextDoc~getText~createTextCursor()
xText~insertTextContent(xCursor, tocTC, .false)
xDocIndex=toc~XDocumentIndex
xDocIndex~update()
::requires UNO.CLS
|
Changelog| Date | User | Modification |
|---|
| 2006-07-10 | matthiasprem | Initial version |
|