addTableContents

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