TX Text Control .NET Server

Javascript: HeaderFooterCollection.getItem Method

Method|Introduced in 28.0

Description

Gets a particular header or footer from the collection.

Syntax

<void> HeaderFooterCollection.getItem(<HeaderFooterType> headerFooterType, <RequestHeaderFooterCallback> callback, [<ErrorCallback> errorCallback])

Parameters

ParameterDescription
headerFooterType

Specifies the header or footer to return.

callback

Receives the particular header or footer.

errorCallback

Optional. Is called when the operation failed with an error.

Examples

The following example demonstrates HeaderFooterCollection.getItem in a practical document-editing workflow. It gets a particular header or footer from the collection.

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

TXTextControl.headersAndFooters.getItem(
    TXTextControl.HeaderFooterType.Header,
    function(headerFooter) {
        if (!headerFooter) {
            console.warn("No header footer was returned.");
            return;
        }
        
        console.log("get item result:", headerFooter);
    },
    onTxError
);