Hiii Guys,
I want to start page number from third page.from third page it will start page number like 1,2,3 …n.
For first 2 page i need to add page number like i,ii(in roman) first 2 page is fixed.
For first 2 page i need page number in roman and from third page i need to start page number from first and it’s normal.
Hi,
Thanks for your inquiry. I have attached a couple of sample input/output Word documents here for your reference. The input document has two sections i.e. the first section contains two pages while the second section comprises of the remaining pages. Please use the following code to generate two different page numbering schemes:
Document doc = new Document(@"C:\Temp\in.docx");
DocumentBuilder builder = new DocumentBuilder(doc);
builder.MoveToSection(0);
builder.MoveToHeaderFooter(HeaderFooterType.HeaderPrimary);
builder.Write("Page ");
builder.InsertField("PAGE", "");
Section section = doc.Sections[0];
section.PageSetup.RestartPageNumbering = true;
section.PageSetup.PageStartingNumber = 1;
section.PageSetup.PageNumberStyle = NumberStyle.LowercaseRoman;
builder.MoveToSection(1);
builder.MoveToHeaderFooter(HeaderFooterType.HeaderPrimary);
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;
builder.Write(" - ");
builder.InsertField("PAGE", "");
builder.Write(" - ");
section = doc.Sections[1];
section.PageSetup.PageStartingNumber = 1;
section.PageSetup.RestartPageNumbering = true;
section.PageSetup.PageNumberStyle = NumberStyle.Arabic;
doc.Save(@"C:\Temp\out.docx");
I hope, this helps.
Best regards,
Hi awais,
Thanks for your reply.
It’s works fine.
Actually i didn’t have 2 separate sections.so i created 2 documents and apply your code.
working fine
Thanks
Hi,
It’s great you were able to find what you were looking for. Please let us know any time you have any further queries.
Best regards,