SectionCollection Object
Description
Contains all sections of a document. A document has at least one section.
Syntax
SectionCollectionExamples
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
| Method | Description |
|---|---|
| add | Adds 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. |
| addAtTextPosition | Adds 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. |
| elementAt | Returns the element at a specified index in the collection. (Inherited from Collection.) |
| forEach | Executes a callback function for each element. (Inherited from Collection.) |
| getCount | Gets the number of elements contained in the collection. (Inherited from Collection.) |
| getItem | Gets the section at the current input position or or the section in the collection with the given number. |