HeaderFooter Class
- Namespace
TXTextControl
- Package
TXTextControl.from the private NuGet feed or Text Control Offline PackagesTextControl. Core. SDK
- Assembly
TXTextControl.Core. dll
- Install
dotnet add package TXTextControl..NET 8 and later. For .NET Framework, referenceTextControl. Core. SDK TXTextControl.from the setup.dll
- Also in
TXTextControl.asTextControl. ASP. SDK TXTextControl.dll
- Implements
- IFormatted
Text
Description
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 : IFormattedTextPublic Class HeaderFooter
Implements IFormattedTextExamples
The following example 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 = TrueThe following example creates a header for the first section and configures its content or layout.
HeaderFooterCollection headers = textControl.Sections[1].HeadersAndFooters;
headers.Add(HeaderFooterType.Header);
HeaderFooter headerFooter = headers.GetItem(HeaderFooterType.Header);
headerFooter.Selection.Text = "Quarterly report";Dim headers As HeaderFooterCollection = textControl.Sections(1).HeadersAndFooters
headers.Add(HeaderFooterType.Header)
Dim headerFooter As HeaderFooter = headers.GetItem(HeaderFooterType.Header)
headerFooter.Selection.Text = "Quarterly report"Members
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. The property value is an object of the type ApplicationFieldCollection. Before loading a document the LoadSettings.ApplicationFieldFormat property must be set, otherwise this collection is empty. |
| Barcodes | Gets a collection of all barcodes contained in a header or footer. The property value is an object of the type DataVisualization.BarcodeCollection. The collection can be used to get or to alter a barcode's attributes and to add barcodes to or to remove barcodes from a header or footer. |
| Charts | Gets a collection of all charts contained in a header or footer. The property value is an object of the type DataVisualization.ChartCollection. The collection can be used to get or to alter a chart's attributes and to add charts to or to remove charts from a header or footer. |
| Comments | Gets a collection of all comments in the header or footer. The property's value is an object of the type CommentCollection. |
| ConnectedToPrevious | Gets or 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. |
| Distance | Gets or sets the distance, in twips, of a header or footer to the top or bottom of the page. For headers it is the distance between the top of the header and the top of the page. For footers it is the distance between the bottom of the footer and the bottom of the page. The default value is 567 twips = 1 cm. |
| DocumentLinks | Gets a collection of all links in a header or footer which point to targets in the same document. The property value is an object of the type DocumentLinkCollection. |
| DocumentTargets | Gets a collection of all targets in a header or footer. The property value is an object of the type DocumentTargetCollection. |
| Drawings | Gets a collection of all drawings contained in a header or footer. The property value is an object of the type DataVisualization.DrawingCollection. The collection can be used to get or to alter a drawing's attributes and to add drawings to or to remove drawings from a header or footer. |
| EditableRegions | Gets a collection of all editable regions in the header or footer. The property's value is an object of the type EditableRegionCollection. |
| FormFields | Gets a collection of all form fields contained in a header or footer. The property's value is an object of the type FormFieldCollection. |
| Frames | Gets a collection of all images, textframes, charts, barcodes and drawings in a header or footer. The property value is an object of the type FrameCollection. The collection can be used to get or to alter common attributes. |
| HypertextLinks | Gets a collection of all hypertext links the header or footer contains. The property's value is an object of the type HypertextLinkCollection. |
| Images | Gets a collection of all images the header or footer contains. The property value is an object of the type ImageCollection. |
| Lines | Gets a collection of all text lines the header or footer contains. The property value is an object of the type LineCollection. |
| MisspelledWords | Gets a collection of all misspelled words the header or footer contains. The property value is an object of the type MisspelledWordCollection. |
| PageNumberFields | Gets a collection of page number fields in the header or footer. The property's value is an object of the type PageNumberFieldCollection. |
| Paragraphs | Gets a collection of all paragraphs the header or footer contains. The property value is an object of the type ParagraphCollection. |
| Section | Not described in the reference. public int Section { get; } |
| SectionNumber | Returns the number of the section to which the header or footer belongs. The sections of the document are numbered beginning with 1. This property returns zero, if the header or footer object does not represent a single header or footer. |
| Selection | Gets or sets the current selection in a header or footer. The property value is an object of the type Selection. For more information see the description of the Selection class. |
| SubTextParts | Gets a collection of all subtextparts in the header or footer. The property's value is an object of the type SubTextPartCollection. |
| Tables | Gets a collection of all tables in the header or footer. The property's value is an object of the type TableCollection. |
| TablesOfContents | Gets a collection of all tables of contents in the header or footer. The property's value is an object of the type TableOfContentsCollection. |
| TextChars | Gets a collection of all characters the header or footer contains. The property value is an object of the type TextCharCollection. |
| TextFields | Gets a collection of all standard text fields in the header or footer. The property's value is an object of the type TextFieldCollection. |
| TextFrames | Gets a collection of all text frames contained in a header or footer. The property value is an object of the type TextFrameCollection. |
| TrackedChanges | Gets a collection of all changes made in the header or footer. The property's value is an object of the type TrackedChangeCollection. |
| Type | Gets the type of the header or footer. It is a value of the HeaderFooterType enumeration. |
Methods
| Method | Description |
|---|---|
| Activate | Activates a header or a footer. |
| AddUndoUnit | Adds the current state of the header or footer to the undo stack. Programmatic changes performed with the header's or footer's properties and methods are not automatically added to a TextControl's undo stack. Calling this method is not necessary, when the header's or footer's text and/or formatting is changed. |
| 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. |