DS Server

Javascript: TableOfContents.setMaximumStructureLevel Method

Method|Introduced in 29.0

Description

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.

Syntax

<void> TableOfContents.setMaximumStructureLevel(<number> value, [<EmptyRequestCallback> callback], [<ErrorCallback> errorCallback])

Parameters

ParameterDescription
value

The property value.

callback

Optional. Is called when the operation completed.

errorCallback

Optional. Is called when the operation failed with an error.

Examples

The following example demonstrates TableOfContents.setMaximumStructureLevel in a practical document-editing workflow. It 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.

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

function configureMaximumStructureLevel(tableOfContents) {
    tableOfContents.setMaximumStructureLevel(
        1,
        function() {
            console.log("set maximum structure level completed.");
        },
        onTxError
    );
}