TableOfContents Object
Description
A TableOfContents object defines the position and the properties of a table of contents. A table of contents can be automatically genarated from the structure levels defined for each paragraph in the document. A document can contain multiple tables of contents consisting of paragraphs with different levels. To generate a new table of contents the TableOfContentsCollection.add method can be used.
Syntax
TableOfContentsExamples
The following example demonstrates TableOfContents in a practical document-editing workflow. A TableOfContents object defines the position and the properties of a table of contents. A table of contents can be automatically genarated from the structure levels defined for each paragraph in the document. A document can contain multiple tables of contents consisting of paragraphs with different levels. To generate a new table of contents the TableOfContentsCollection.add method can be used.
function onTxError(error) {
console.error("TX Text Control error:", error.msg);
error.handled = true;
}
function inspectTableOfContents(tableOfContents) {
tableOfContents.getID(
function(result) {
console.log("get id result:", result);
},
onTxError
);
}Members
Methods
| Method | Description |
|---|---|
| getHasLinks | Gets value specifying whether each entry in the table of contents is a DocumentLink with a corresponding DocumentTarget. |
| getHasPageNumbers | Gets a value specifying whether the table of contents contains page numbers. |
| getHasRightAlignedPageNumbers | Gets a value specifying whether the page numbers in the table of contents are right-aligned. |
| getHighlightColor | Gets the highlight color for the table of contents. |
| getHighlightMode | Gets a value indicating whether the table of contents is highlighted. |
| getID | Gets an identifier for a table of contents. |
| getLength | Gets the number of characters which belong to the table of contents. |
| getMaximumStructureLevel | Gets the maximum structure level for this table of contents. The table of contents contains all paragraphs with a structure level less than or equal this value. It must be between 1 and 10. |
| getMinimumStructureLevel | Gets the minimum structure level for this table of contents. The table of contents contains all paragraphs with a structure level less than or equal this value. It must be between 1 and 10. |
| getName | Gets a name for the table of contents. |
| getNumber | Gets the number of the table of contents in the text. The first table of contents has the number 1. The number is defined through the textflow. A table of contents with a smaller start position has a smaller number. |
| getStart | Gets the index (one-based) of the first character which belongs to the table of contents. |
| getText | Gets the text of the table of contents. |
| getTitle | Gets a title for the table of contents. |
| save | Saves the TableOfContents in a certain format and sends the result back asynchronously by calling a given callback function. |
| scrollTo | Sets the current input position to the beginning of a table of contents and scrolls it into the visible part of the document. |
| setHasLinks | Sets a value specifying whether each entry in the table of contents is a DocumentLink with a corresponding DocumentTarget. |
| setHasPageNumbers | Sets a value specifying whether the table of contents contains page numbers. |
| setHasRightAlignedPageNumbers | Sets a value specifying whether the page numbers in the table of contents are right-aligned. |
| setHighlightColor | Sets the highlight color for the table of contents. |
| setHighlightMode | Sets a value indicating whether the table of contents is highlighted. |
| setID | Sets an identifier for the table of contents. |
| setMaximumStructureLevel | Sets the maximum structure level for this table of contents. The table of contents contains all paragraphs with a structure level less than or equal this value. It must be between 1 and 10. |
| setMinimumStructureLevel | Sets the minimum structure level for this table of contents. The table of contents contains all paragraphs with a structure level less than or equal this value. It must be between 1 and 10. |
| setName | Sets a name for the table of contents. |
| setTitle | Sets a title for the table of contents. An empty string indicates that the table of contents has no title. |
| update | Updates the content and the page numbers of the table of contents. |