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:


Section sec = textControl1.Sections.GetItem();

sec.Format.RestartPageNumbering = true;

HeaderFooter footer =
footer.ConnectedToPrevious = false;

footer.Selection.Text = "Page ";

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

footer.Selection.Text = " of ";

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