Products Technologies Demo Docs Blog Support Company

Restart the Page Numbering Fields Per Section

Version X9 allows you to restart the page numbering per section. This is very useful, if different documents are concatenated to a large document for a printing job. Each separate partial document should have its own page numbering in this case. A new boolean property - RestartPageNumbering - has been added to the SectionFormat class to specify whether the numbering should be restarted or not. The following code inserts a new section, restarts the numbering and inserts the current page…

Restart the Page Numbering Fields Per Section
Restart page numbering per section

Version X9 allows you to restart the page numbering per section. This is very useful, if different documents are concatenated to a large document for a printing job. Each separate partial document should have its own page numbering in this case.

A new boolean property - RestartPageNumbering - has been added to the SectionFormat class to specify whether the numbering should be restarted or not.

The following code inserts a new section, restarts the numbering and inserts the current page number and the total number of pages field into the footer:

textControl1.Sections.Add(SectionBreakKind.BeginAtNewPage);

Section sec = textControl1.Sections.GetItem();

sec.Format.RestartPageNumbering = true;
sec.HeadersAndFooters.Add(HeaderFooterType.Footer);

HeaderFooter footer =
    sec.HeadersAndFooters.GetItem(HeaderFooterType.Footer);
footer.ConnectedToPrevious = false;

footer.Selection.Text = "Page ";

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

footer.Selection.Text = " of ";

PageNumberField pageCount = new PageNumberField(1, NumberFormat.ArabicNumbers);
pageCount.ShowNumberOfPages = true;

footer.PageNumberFields.Add(pageCount);

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.