TX Text Control .NET Server

TextCharCollection Object

Object|Introduced in 28.0

Description

Contains all characters in a Text Control document or part of the document.

Syntax

TextCharCollection

Examples

The following example demonstrates TextCharCollection in a practical document-editing workflow. It contains all characters in a Text Control document or part of the document.

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

function inspectTextCharCollection(textChars) {
    textChars.getItem(
        { x: 1440, y: 720 },
        true,
        function(textChar) {
            if (!textChar) {
                console.warn("No text char was returned.");
                return;
            }
            
            console.log("get item result:", textChar);
        },
        onTxError
    );
}

Members

Methods

MethodDescription
addInserts a character at the specified position using the specified font.
addControlCharInserts a control character at the specified 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 a particular character from the collection specified through a certain geometrical position.
removeRemoves the character by number.