Page number fields

TX Text Control X9 introduced a new ready-to-use dialog and context menus to insert and manipulate page numbers. Additionally, a new type of page numbers has been implemented to show the total number of pages. This page number field is updated automatically when pages are added or removed.

TX Text Control page number dialog

These fields are completely compatible to MS Word and can be exported and imported to and from DOC, DOCX or RTF.

For each section in the document, page numbers can either be continued from the previous section or can be restarted with a certain start number.

The new dialog can be used to change the type of the page number field and to adjust the number format and the section behavior.

The following C# code shows how to insert a new header and two page number fields. The first field shows the current page number and the second field represents the total number of pages in the document.

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

HeaderFooter hfHeader =
    textControl1.Sections.GetItem().HeadersAndFooters.GetItem(
    HeaderFooterType.Header);

PageNumberField currentPageNumber =
   new PageNumberField(1, NumberFormat.ArabicNumbers);

hfHeader.PageNumberFields.Add(currentPageNumber);

hfHeader.Selection.Text = " of ";

PageNumberField totalPageNumbers = new PageNumberField();
totalPageNumbers.ShowNumberOfPages = true;

hfHeader.PageNumberFields.Add(totalPageNumbers);

The following screenshot shows the page number fields in the inserted page header:

TX Text Control page number fields

Start today and download a fully featured, 30 day trial version