Products Technologies Demo Docs Blog Support Company

Inserting MS Word Compatible 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. 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…

Inserting MS Word Compatible Page Number Fields
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

Stay in the loop!

Subscribe to the newsletter to receive the latest updates.

Related Posts

Windows FormsWPF.NET

Create a Table of Contents in Windows Forms using C#

This article explains how to create a table of contents in Windows Forms using the ribbon or programmatically. Creating a table of contents is required to organize large documents.


ASP.NETWindows FormsWPF

Official TX Text Control .NET Sample Applications Are Now Hosted on GitHub

This article gives a quick overview of the new repositories, their structure and our plans for the future.


ASP.NETJavaScriptDocument Editor

Detect Toggle Button Changes Using a MutationObserver

This article shows how to detect changes of toggle buttons in the ribbon of the web editor using a MutationObserver. The state of a toggle button in the ribbon visualizes the state of a certain…


Windows FormsList.NET

Two Ways to Restart Numbered Lists in TX Text Control

In TX Text Control, numbered lists are continued by default and need to be reset when required. There is more than one way if you want to restart numbered lists in a document. In this article, two…


Windows FormsSampleShortcuts

Zoom Tricks: Disabling CTRL + MOUSE WHEEL and More

This article shows how to disable CTRL + MOUSE WHEEL, implement zooming with keyboard and reset the zoom factor to its default value.