DS Server

SectionCollection Object

Object|Introduced in 28.0

Description

Contains all sections of a document. A document has at least one section.

Syntax

SectionCollection

Examples

The following example demonstrates SectionCollection in a practical document-editing workflow. It contains all sections of a document. A document has at least one section.

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

TXTextControl.sections.getItem(
    function(section) {
        if (!section) {
            console.warn("No section was returned.");
            return;
        }
        
        console.log("get item result:", section);
    },
    1,
    onTxError
);

Members

Methods

MethodDescription
addAdds a new section at the current text input position. The new section ends at the end position of the section containing the input position. If a new section is inserted in a paragraph or table, the paragraph or table is split into two paragraphs or tables.
addAtTextPositionAdds a new section at the specified text input position. The new section ends at the end position of the section containing the input position. If a new section is inserted in a paragraph or table, the paragraph or table is split into two paragraphs or tables.
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 section at the current input position or or the section in the collection with the given number.

Further Reading

  • How to Remove All Section Breaks in a Document? –