DS Server

TableOfContentsCollection Object

Object|Introduced in 29.0

Description

Contains all tables of contents in a certain part of the document.

Syntax

TableOfContentsCollection

Examples

The following example demonstrates TableOfContentsCollection in a practical document-editing workflow. It contains all tables of contents in a certain part of the document.

function onTxError(error) {
    console.error("TX Text Control error:", error.msg);
    error.handled = true;
}

function inspectTableOfContentsCollection(tableOfContentss) {
    tableOfContentss.getItem(
        function(toc) {
            if (!toc) {
                console.warn("No table of contents was returned.");
                return;
            }
            
            console.log("get item result:", toc);
        },
        onTxError,
        25
    );
}

Members

Methods

MethodDescription
addAdds a new table of contents to the document at the current text input position.
elementAtReturns the element at a specified index in the collection. (Inherited from Collection.)
forEachExecutes a callback function for each element. (Inherited from Collection.)
getCountGets the number of elements contained in the collection. (Inherited from Collection.)
getItemGets the table of contents at the current input position or the table of contents with the specified identifier.
getItemByNameGets the table of contents with the specified name.
removeRemoves a table of contents from the collection including all its text and including all DocumentTargets to where the table's links point.