TX Text Control .NET Server

HeaderFooter Object

Object|Introduced in 28.0

Description

Represents a header or footer in the document. A header or footer can be obtained through the TXTextControl.headersAndFooters property. The collection obtained through the TXTextControl.headersAndFooters property contains headers and footers which are common to all sections of the document. If a header or footer is added to this collection all sections of the document have the same header or footer. These headers and footers are connected, which means that changing the contents of such a header or footer also changes the content of all other section's headers or footers.

Syntax

HeaderFooter

Examples

The following example demonstrates HeaderFooter in a practical document-editing workflow. It represents a header or footer in the document. A header or footer can be obtained through the TXTextControl.headersAndFooters property. The collection obtained through the TXTextControl.headersAndFooters property contains headers and footers which are common to all sections of the document. If a header or footer is added to this collection all sections of the document have the same header or footer. These headers and footers are connected, which means that changing the contents of such a header or footer also changes the content of all other section's headers or footers.

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

function inspectHeaderFooter(headerFooter) {
    headerFooter.getConnectedToPrevious(
        function(result) {
            if (result) {
                console.log("get connected to previous is available.");
            } else {
                console.warn("get connected to previous is not available in the current document state.");
            }
        },
        onTxError
    );
}

Members

Properties

PropertyDescription
applicationFieldsGets a collection of all Microsoft Word fields that have been created or imported from a Microsoft Word or RTF document. (Inherited from FormattedText.)
commentsGets a collection of all comments in this text part. (Inherited from FormattedText.)
documentLinksGets a collection of all links which point to targets in the same document. (Inherited from FormattedText.)
documentTargetsGets a collection of all document targets. (Inherited from FormattedText.)
editableRegionsGets a collection of all editable regions. (Inherited from FormattedText.)
formFieldsGets a collection of all form fields in the text part. (Inherited from FormattedText.)
framesGets a collection of all frames in the document. (Inherited from FormattedText.)
hypertextLinksGets a collection of all hypertext links. (Inherited from FormattedText.)
linesGets a collection of all text lines. (Inherited from FormattedText.)
misspelledWordsGets a collection of all misspelled words. (Inherited from FormattedText.)
pageNumberFieldsA collection of page number fields in the header or footer.
paragraphsGets a collection of all paragraphs. (Inherited from FormattedText.)
selectionGets the current selection. (Inherited from FormattedText.)
subTextPartsGets the current subtextparts. (Inherited from FormattedText.)
tablesGets a collection of all tables. (Inherited from FormattedText.)
tablesOfContentsGets the current tables of contents. (Inherited from FormattedText.)
textCharsGets a collection of all text characters. (Inherited from FormattedText.)
textFieldsGets a collection of all standard text fields. (Inherited from FormattedText.)
textPartTypeGets the Text part type. Possible values are "mainText", "headerFooter" and "textFrame". (Inherited from FormattedText.)
trackedChangesGets a collection of all tracked changes. (Inherited from FormattedText.)

Methods

MethodDescription
activateActivates the this header or footer.
deactivateDeactivates the this header or footer.
findFinds a text string. The search starts at the specified position. (Inherited from FormattedText.)
getConnectedToPreviousGets a value specifying whether the header or footer is connected with the header or footer of the previous section. If headers or footers are connected, they have always the same contents.
getDistanceGets the distance, in twips, of a header or footer to the top or bottom of the page.
getTextFieldsByTypeReturns an array of static text field information objects. (Inherited from FormattedText.)
getTypeGets the type of the header or footer.
setConnectedToPreviousSets a value specifying whether the header or footer is connected with the header or footer of the previous section. If headers or footers are connected, they have always the same contents.
setDistanceSets the distance, in twips, of a header or footer to the top or bottom of the page.