TX Text Control .NET Server

TableOfContents Object

Object|Introduced in 29.0

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

TableOfContents

Examples

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

MethodDescription
getHasLinksGets value specifying whether each entry in the table of contents is a DocumentLink with a corresponding DocumentTarget.
getHasPageNumbersGets a value specifying whether the table of contents contains page numbers.
getHasRightAlignedPageNumbersGets a value specifying whether the page numbers in the table of contents are right-aligned.
getHighlightColorGets the highlight color for the table of contents.
getHighlightModeGets a value indicating whether the table of contents is highlighted.
getIDGets an identifier for a table of contents.
getLengthGets the number of characters which belong to the table of contents.
getMaximumStructureLevelGets 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.
getMinimumStructureLevelGets 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.
getNameGets a name for the table of contents.
getNumberGets 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.
getStartGets the index (one-based) of the first character which belongs to the table of contents.
getTextGets the text of the table of contents.
getTitleGets a title for the table of contents.
saveSaves the TableOfContents in a certain format and sends the result back asynchronously by calling a given callback function.
scrollToSets the current input position to the beginning of a table of contents and scrolls it into the visible part of the document.
setHasLinksSets a value specifying whether each entry in the table of contents is a DocumentLink with a corresponding DocumentTarget.
setHasPageNumbersSets a value specifying whether the table of contents contains page numbers.
setHasRightAlignedPageNumbersSets a value specifying whether the page numbers in the table of contents are right-aligned.
setHighlightColorSets the highlight color for the table of contents.
setHighlightModeSets a value indicating whether the table of contents is highlighted.
setIDSets an identifier for the table of contents.
setMaximumStructureLevelSets 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.
setMinimumStructureLevelSets 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.
setNameSets a name for the table of contents.
setTitleSets a title for the table of contents. An empty string indicates that the table of contents has no title.
updateUpdates the content and the page numbers of the table of contents.