HeaderFooter Object
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
HeaderFooterExamples
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
| Property | Description |
|---|---|
| applicationFields | Gets a collection of all Microsoft Word fields that have been created or imported from a Microsoft Word or RTF document. (Inherited from FormattedText.) |
| comments | Gets a collection of all comments in this text part. (Inherited from FormattedText.) |
| documentLinks | Gets a collection of all links which point to targets in the same document. (Inherited from FormattedText.) |
| documentTargets | Gets a collection of all document targets. (Inherited from FormattedText.) |
| editableRegions | Gets a collection of all editable regions. (Inherited from FormattedText.) |
| formFields | Gets a collection of all form fields in the text part. (Inherited from FormattedText.) |
| frames | Gets a collection of all frames in the document. (Inherited from FormattedText.) |
| hypertextLinks | Gets a collection of all hypertext links. (Inherited from FormattedText.) |
| lines | Gets a collection of all text lines. (Inherited from FormattedText.) |
| misspelledWords | Gets a collection of all misspelled words. (Inherited from FormattedText.) |
| pageNumberFields | A collection of page number fields in the header or footer. |
| paragraphs | Gets a collection of all paragraphs. (Inherited from FormattedText.) |
| selection | Gets the current selection. (Inherited from FormattedText.) |
| subTextParts | Gets the current subtextparts. (Inherited from FormattedText.) |
| tables | Gets a collection of all tables. (Inherited from FormattedText.) |
| tablesOfContents | Gets the current tables of contents. (Inherited from FormattedText.) |
| textChars | Gets a collection of all text characters. (Inherited from FormattedText.) |
| textFields | Gets a collection of all standard text fields. (Inherited from FormattedText.) |
| textPartType | Gets the Text part type. Possible values are "mainText", "headerFooter" and "textFrame". (Inherited from FormattedText.) |
| trackedChanges | Gets a collection of all tracked changes. (Inherited from FormattedText.) |
Methods
| Method | Description |
|---|---|
| activate | Activates the this header or footer. |
| deactivate | Deactivates the this header or footer. |
| find | Finds a text string. The search starts at the specified position. (Inherited from FormattedText.) |
| getConnectedToPrevious | Gets 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. |
| getDistance | Gets the distance, in twips, of a header or footer to the top or bottom of the page. |
| getTextFieldsByType | Returns an array of static text field information objects. (Inherited from FormattedText.) |
| getType | Gets the type of the header or footer. |
| setConnectedToPrevious | Sets 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. |
| setDistance | Sets the distance, in twips, of a header or footer to the top or bottom of the page. |