We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Individual page numbering in sections

Hi,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

I’m wondering if it is possible to get individual page numbering for each section?

So when a new section begins the page number restarts at 1.

Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your inquiry. I think that you can try using RestartPageNumbering. See the following code for example.

Document doc = new Document();

DocumentBuilder builder = new DocumentBuilder(doc);

//Set start number

builder.PageSetup.PageStartingNumber = 1;

//Page numbers will be restarted for each section

builder.PageSetup.RestartPageNumbering = true;

//Insert PAGE fiel into the header

builder.MoveToHeaderFooter(HeaderFooterType.HeaderPrimary);

builder.InsertField("PAGE", string.Empty);

builder.MoveToDocumentEnd();

//Insert page break

builder.InsertBreak(BreakType.PageBreak);

//Insert section break

builder.InsertBreak(BreakType.SectionBreakNewPage);

doc.Save(@"Test077\out.doc");

Hope this helps.

Best regards.

A post was merged into an existing topic: Individual page numbers for different sections