Hello team,
I have a Word document with multiple sections, and each section has different page numbers. For example, Section 1 has page numbers 1 to 4, and Section 2 has page numbers 6 to 9. How can I reset the page numbers for all sections in sequential order?
@AlpeshChaudhariDev You should set PageSetup.RestartPageNumbering
property to false
in all sections in the document:
Document doc = new Document(@"C:\Temp\in.docx");
foreach (Section s in doc.Sections)
s.PageSetup.RestartPageNumbering = false;
doc.Save(@"C:\Temp\out.docx");
1 Like
@alexey.noskov thanks,
But this snippet is not working on this document
Document.docx (202.6 KB)
@AlpeshChaudhariDev The code does not work because page numbers in the document are inserted as simple text instead of PAGE field:
1 Like
Thank you for the quick response. I understand the issue now.
1 Like