TXTextControl.PageNumberField Class

The PageNumberField class represents a field in a header or footer of a Text Control document that automatically displays the current page number. The class inherits all properties and methods from the TextField class. Additionally it implements the properties in the following list. For more information see the technical article Text Fields and Hypertext Links.

Syntax

[C#]
public class PageNumberField : TextField
[Visual Basic]
Public Class PageNumberField
  Inherits TextField

Constructors

Constructor Description
PageNumberField Overloaded. Creates a new instance of the PageNumberField class.

Properties

Property Description
NumberFormat Gets or sets the number format.
ShowNumberOfPages Gets or sets a value indicating whether the field shows the page number or the total number of pages.
StartNumber Gets or sets the page number for the first page.

Methods

Method Description
PageNumberDialog Opens a dialog box to alter the formatting and numbering attributes of the page number field.

Example

The following example shows how to add a page number field to a header.

[C#]
textControl1.ViewMode = TXTextControl.ViewMode.PageView;

textControl1.Sections.GetItem().HeadersAndFooters.Add(
    TXTextControl.HeaderFooterType.Header);
TXTextControl.HeaderFooter header = 
    textControl1.Sections.GetItem().HeadersAndFooters.GetItem(
    TXTextControl.HeaderFooterType.Header);

header.Selection.Text = "Page ";
header.PageNumberFields.Add(new TXTextControl.PageNumberField(
    1, TXTextControl.NumberFormat.ArabicNumbers));
[Visual Basic]
TextControl1.ViewMode = TXTextControl.ViewMode.PageView

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

header.Selection.Text = "Page "
header.PageNumberFields.Add(New TXTextControl.PageNumberField( _
    1, TXTextControl.NumberFormat.ArabicNumbers))

See Also