Start At For Page Numbering


#1

Is there a way to set the Start At option for page numbering? I am doing another proof of concept for a client.

In Word, go to Insert...Page Numbers...Format...Start At, and fill in 1.

Derek


#2

Yes, it corresponds to Section.PageSetup.PageStartingNumber property.


#3

Hi Vladimir,

I am going back to a proof of concept that I was working with you before on. If you remember, the problem with combining documents happens when each document should have its own page numbering. When combining documents, I was thinking the Start At feature could be used in the combining documents code, to ALWAYS start each newly added document at page 1. I am going in circles trying to demo this. Can you help? Do you need me to send you the code from the previous posts?

Derek Hart


#4

Also, when I do this by hand, it works great in Word. See attached document.


#5

The documents like the one attached can easily be created in Aspose.Words.

Here is a sample code:

Document doc = new Document();

DocumentBuilder builder = new DocumentBuilder(doc);

builder.MoveToHeaderFooter(HeaderFooterType.FooterPrimary);

builder.Write("Page ");

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

builder.MoveToDocumentStart();

builder.Writeln("Page 1");

builder.InsertBreak(BreakType.SectionBreakNewPage);

builder.Writeln("Page 2");

builder.InsertBreak(BreakType.SectionBreakNewPage);

builder.Writeln("Page 3");

builder.InsertBreak(BreakType.SectionBreakNewPage);

builder.Writeln("Start over at page 1");

builder.CurrentSection.PageSetup.RestartPageNumbering = true;

builder.CurrentSection.PageSetup.PageStartingNumber = 1;

builder.InsertBreak(BreakType.SectionBreakNewPage);

builder.CurrentSection.PageSetup.RestartPageNumbering = false;

builder.Writeln("Page 2");

builder.InsertBreak(BreakType.SectionBreakNewPage);

builder.Writeln("Page 3");

Best regards,