TX Text Control .NET Server

ParagraphCollection Object

Object|Introduced in 28.0

Description

A ParagraphCollection contains all paragraphs in a Text Control document or part of the document.

Syntax

ParagraphCollection

Examples

The following example demonstrates ParagraphCollection in a practical document-editing workflow. A ParagraphCollection contains all paragraphs in a Text Control document or part of the document.

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

TXTextControl.textParts.getMainText(function(mainText) {
    const paragraphs = mainText.paragraphs;
    paragraphs.getItem(
        -1,
        function(result) {
            if (!result) {
                console.warn("No paragraph was returned.");
                return;
            }
            
            console.log("get item result:", result);
        },
        onTxError
    );
}, onTxError);

Members

Methods

MethodDescription
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 a particular Paragraph from the collection.
getItemAtLocationGets the Paragraph at a certain geometrical position.

Further Reading