addTableContents
- addBackgroundImage
- addFooter
- addHeader
- addLineNumbering
- addPageBorders
- addProperties
- addSection
- createDocx
- createCharacterStyle
- createListStyle
- createParagraphStyle
- createTableStyle
- docxSettings
- embedFont
- importHeadersAndFooters
- importStyles
- modifyPageLayout
- removeFooters
- removeHeaders
- setBackgroundColor
- setDefaultFont
- setDocumentDefaultStyles
- setEncodeUTF8
- setLanguage
- setMarkAsFinal
- setRTL
- addBibliography
- addBookmark
- addBreak
- addChart
- addCitation
- addComment
- addCrossReference
- addDateAndHour
- addEndnote
- addExternalFile
- addFootnote
- addFormElement
- addHeading
- addImage
- addLink
- addList
- addMathEquation
- addMergeField
- addOLE
- addPageNumber
- addShape
- addSimpleField
- addSource
- addStructuredDocumentTag
- addTable
- addTableContents
- addText
- addTextBox
- addWordML
- embedHTML
- clearBlocks
- deleteTemplateBlock
- getTemplateVariables
- getTemplateVariablesType
- modifyInputFields
- modifyMergeFields
- processTemplate
- removeTemplateVariable
- replaceListVariable
- replacePlaceholderImage
- replaceTableVariable
- replaceVariableByExternalFile
- replaceVariableByHtml
- replaceVariableByText
- replaceVariableByWordFragment
- replaceVariableByWordML
- setTemplateSymbol
- tickCheckbox
addTableContents
BASIC / ADVANCED / PREMIUM
Inserts a Table of Contents (TOC) into the Word document.
Description
public void addTableContents(OptionsTableContents options, WordFragment legend) throws Exception
public void addTableContents(OptionsTableContents options, WordFragment legend, String stylesTOC) throws Exception
This method allows you to include a Table of Contents in you Word document.
Parameters
options
Option | Type | Description |
---|---|---|
autoUpdate | Boolean | If true it will try to update the TOC when first opened. |
displayLevels | String | Must be of the form "1-3" where the first number is the start level an the second the end level. If not defined all existing levels are shown. |
legend
Key | Type | Description |
---|---|---|
legend | WordFragment | The placeholder text that will be shown if the autoupdate option is not activated. |
stylesTOC
Key | Type | Description |
---|---|---|
stylesTOC | String | Path to a DOCX. This optional parameter allows to extract the TOC styles from an existing Word document so the embedded TOC can be fully customized. |
Code samples
Example #1