TX Text Control .NET Server

HypertextLinkCollection Object

Object|Introduced in 28.0

Description

The HypertextLinkCollection object contains all hypertext links in a Text Control document.

Syntax

HypertextLinkCollection

Examples

The following example demonstrates HypertextLinkCollection in a practical document-editing workflow. The HypertextLinkCollection object contains all hypertext links in a Text Control document.

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

TXTextControl.textParts.getMainText(function(mainText) {
    const hypertextLinks = mainText.hypertextLinks;
    hypertextLinks.getItem(
        function(result) {
            if (!result) {
                console.warn("No hypertext link was returned.");
                return;
            }
            
            console.log("get item result:", result);
        },
        onTxError,
        25
    );
}, onTxError);

Members

Methods

MethodDescription
addInserts a new hypertext link at the current 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 the hypertext link with the specified id.
removeRemoves a hypertext link from a Text Control document.