PageNumberField 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
- Inherits
- Text
Field - Page
Number Field
- Text
Description
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
public class PageNumberField : TextFieldPublic Class PageNumberField
Inherits TextFieldExamples
The following example shows how to add a page number field to a header.
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));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))The following example creates a current-page field and inserts it into the document footer.
textControl.HeadersAndFooters.Add(HeaderFooterType.Footer);
HeaderFooter footer = textControl.HeadersAndFooters.GetItem(HeaderFooterType.Footer);
PageNumberField pageNumberField = new(1, NumberFormat.ArabicNumbers);
footer.PageNumberFields.Add(pageNumberField);textControl.HeadersAndFooters.Add(HeaderFooterType.Footer)
Dim footer As HeaderFooter = textControl.HeadersAndFooters.GetItem(HeaderFooterType.Footer)
Dim pageNumberField As New PageNumberField(1, NumberFormat.ArabicNumbers)
footer.PageNumberFields.Add(pageNumberField)Members
Constructors
| Constructor | Description |
|---|---|
| PageNumberField | Creates a new instance of the PageNumberField class. |
| TextField | Creates a new instance of the TextField class. (Inherited from TextField.) |
Properties
| Property | Description |
|---|---|
| Bounds | Gets the bounding rectangle of a text field. The bounding rectangle is the smallest rectangle which contains all characters of the field's text. The rectangle is given in twips with an origin at the upper left corner of the document. (Inherited from TextField.) |
| ContainsInputPosition | Returns true, if the Textfield contains the current text input position. (Inherited from TextField.) |
| Deleteable | Specifies whether a text field can be deleted by the end-user while a TX Text Control document is being edited. The default setting of this property is true. (Inherited from TextField.) |
| DoubleClickEvent | Specifies whether a TextControl.TextFieldDoubleClicked event is raised, if the end-user doubleclicks the text field. If an event is raised, the normal double-click processing, which selects a single word in the text is suppressed. The default setting of this property is true. (Inherited from TextField.) |
| DoubledInputPosition | Specifies whether a text field has a doubled input position in front of its first character and behind its last character. This enables an end-user to decide whether inserted text at these positions will belong to the text field or not. The default setting of this property is false. For all form fields to work properly this property is set to true and cannot be changed to false. (Inherited from TextField.) |
| Editable | Specifies whether the text of a text field can be changed by the end-user while a TX Text Control document is being edited. The default setting of this property is true. (Inherited from TextField.) |
| FormattingBounds | Gets the formatting rectangle of a text field. The formatting rectangle is the largest rectangle to which the area covered by the field can grow. The rectangle is given in twips with an origin at the upper left corner of the document. (Inherited from TextField.) |
| HighlightColor | Gets or sets the highlight color for the text field. The color's alpha value must be less than 255 (opaque) so that the text field's text remains visible. The default value is black with an alpha value of 60 (light gray). (Inherited from TextField.) |
| HighlightMode | Gets or sets a value indicating when the text field is highlighted. (Inherited from TextField.) |
| ID | Gets or sets an identifier for a text field. This identifier can be used to uniquely identify a text field. (Inherited from TextField.) |
| IsSpellCheckingEnabled | Specifies whether a text field's text is checked on misspelled words. The default setting of this property is true. (Inherited from TextField.) |
| Length | Gets the number of characters in a text field. (Inherited from TextField.) |
| Name | Relates a user-defined name to a text field. This can be any kind of text. This name can be used to uniquely identify a text field. (Inherited from TextField.) |
| NumberFormat | Gets or sets the number format. The property's value is a member of the NumberFormat enumeration. |
| ShowActivated | Obsolete. Specifies whether a text field toggles its background to gray, if the current input position is in the field. The default setting of this property is false. This property is obsolete and has been superseded by the HighlightColor and HighlightMode properties. (Inherited from TextField.) |
| ShowNumberOfPages | Gets or sets a value indicating whether the field shows the page number or the total number of pages. |
| Start | Gets the first character position (one-based) of a text field. (Inherited from TextField.) |
| StartNumber | Gets or sets the page number for the first page. |
| Text | Returns or sets the text which is contained within a text field. This property is not supported for the DocumentTarget class. (Inherited from TextField.) |
Methods
| Method | Description |
|---|---|
| PageNumberDialog | Opens a dialog box to alter the formatting and numbering attributes of the page number field. |
| ScrollTo | Sets the current input position to the beginning of a text field and scrolls it into the visible part of the document. (Inherited from TextField.) |