TX Text Control .NET for Windows Forms

GetItem Method

Method|Introduced in 24.0
Namespace
TXTextControl
Package
TXTextControl.TextControl.WinForms.SDK as TXTextControl.dll from the private NuGet feed or Text Control Offline Packages

Description

Gets a particular page number field from the collection.

Syntax

GetItem()

Gets the page number field at the current input position or null if there is no page number field at the current input position.

public PageNumberField GetItem();

GetItem(int)

Gets the page number field with the specified id. An id can be set with the PageNumberField.ID property.

public PageNumberField GetItem(int id);
ParameterDescription
id

Specifies the page number field's identifier. The method returns null, if a page number field with the specified identifier does not exist.

Examples

The following example retrieves the page-number field at the current input position and switches it to total-page mode.

textControl.HeadersAndFooters.Add(HeaderFooterType.Footer);
HeaderFooter footer = textControl.HeadersAndFooters.GetItem(HeaderFooterType.Footer);
PageNumberFieldCollection fields = footer.PageNumberFields;
fields.Add(new PageNumberField());
PageNumberField field = fields.GetItem();
if (field != null)
{
    field.ShowNumberOfPages = true;
}