An instance of the HeaderFooter class represents a header or footer in a Text Control document. A header or footer can be obtained through the TextControl.HeadersAndFooters or through the Section.HeadersAndFooters property. The collection obtained through the TextControl.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. The HeaderFooter.ConnectedToPrevious property of these headers and footers is set to true. The collection obtained through the Section.HeadersAndFooters property contains headers and footers which are single to this section. Changing the contents of such a header or footer does not change the contents of other headers and footers.

The TextControl class has events that inform about different occurrences like activation or deactivation of a header or footer. The HeaderFooter class implements the IFormattedText interface.

Syntax

public class HeaderFooter : IFormattedText
Public Class HeaderFooter
  Implements IFormattedText

Examples

The following examples shows how to insert a header to the first section.

textControl1.ViewMode = TXTextControl.ViewMode.PageView;
textControl1.Sections[1].HeadersAndFooters.Add(TXTextControl.HeaderFooterType.Header);

TXTextControl.HeaderFooter header = textControl1.Sections[1].HeadersAndFooters.GetItem( TXTextControl.HeaderFooterType.Header); 

header.Selection.Text = "TX Text Control"; 
header.Selection.Start = 3; 
header.Selection.Length = 4; 
header.Selection.Bold = true;
TextControl1.ViewMode = TXTextControl.ViewMode.PageView 

TextControl1.Sections(1).HeadersAndFooters.Add(TXTextControl.HeaderFooterType.Header) 

Dim header As TXTextControl.HeaderFooter = TextControl1.Sections(1).HeadersAndFooters.GetItem( _ TXTextControl.HeaderFooterType.Header) 

header.Selection.Text = "TX Text Control" 
header.Selection.Start = 3
header.Selection.Length = 4 
header.Selection.Bold = True

Methods

Method Description
Activate Activates a header or a footer.
AddUndoUnit Adds the current state of the header or footer to the undo stack.
Deactivate Deactivates a header or a footer.
Find Finds a text string in a header or footer.
GetTextFields Returns a collection containing text fields of the specified types.

Properties

Property Description
ApplicationFields Gets a collection of all Microsoft Word or Heiler HighEdit fields that have been created or imported from a Microsoft Word or RTF document.
Barcodes Gets a collection of all barcodes contained in a header or footer.
Charts Gets a collection of all charts contained in a header or footer.
Comments Gets a collection of all comments in the header or footer.
ConnectedToPrevious Gets or sets a value specifying whether the header or footer is connected with the header or footer of the previous section.
Distance Gets or sets the distance, in twips, of a header or footer to the top or bottom of the page.
DocumentLinks Gets a collection of all links in a header or footer which point to targets in the same document.
DocumentTargets Gets a collection of all targets in a header or footer.
Drawings Gets a collection of all drawings contained in a header or footer.
EditableRegions Gets a collection of all editable regions in the header or footer.
FormFields Gets a collection of all form fields contained in a header or footer.
Frames Gets a collection of all images, textframes, charts, barcodes and drawings in a header or footer.
HypertextLinks Gets a collection of all hypertext links the header or footer contains.
Images Gets a collection of all images the header or footer contains.
Lines Gets a collection of all text lines the header or footer contains.
MisspelledWords Gets a collection of all misspelled words the header or footer contains.
PageNumberFields Gets a collection of page number fields in the header or footer.
Paragraphs Gets a collection of all paragraphs the header or footer contains.
SectionNumber Returns the number of the section to which the header or footer belongs.
Selection Gets or sets the current selection in a header or footer.
SubTextParts Gets a collection of all subtextparts in the header or footer.
Tables Gets a collection of all tables in the header or footer.
TablesOfContents Gets a collection of all tables of contents in the header or footer.
TextChars Gets a collection of all characters the header or footer contains.
TextFields Gets a collection of all standard text fields in the header or footer.
TextFrames Gets a collection of all text frames contained in a header or footer.
TrackedChanges Gets a collection of all changes made in the header or footer.
Type Gets the type of the header or footer.

Further Reading

Learn more about the TXTextControl.HeaderFooter Class in the Text Control Blog: