PageSetupPageNumberStyle Property

Gets or sets the page number format.

Namespace:  Aspose.Words
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.10.0

ExpandedSyntax

public NumberStyle PageNumberStyle { get; set; }

Property Value

Type: NumberStyle

ExpandedExamples

Shows how to control page numbering per section.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

builder.Writeln("Section 1");
builder.InsertBreak(BreakType.SectionBreakNewPage);
builder.Writeln("Section 2");

// Use document builder to create a header with a page number field for the first section
// The page number will look like "Page V"
builder.MoveToSection(0);
builder.MoveToHeaderFooter(HeaderFooterType.HeaderPrimary);
builder.Write("Page ");
builder.InsertField("PAGE", "");

// Set first section page numbering
PageSetup pageSetup = doc.Sections[0].PageSetup;
pageSetup.RestartPageNumbering = true;
pageSetup.PageStartingNumber = 5;
pageSetup.PageNumberStyle = NumberStyle.UppercaseRoman;

// Create a header for the section
// The page number will look like " - 10 - ".
builder.MoveToSection(1);
builder.MoveToHeaderFooter(HeaderFooterType.HeaderPrimary);
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;
builder.Write(" - ");
builder.InsertField("PAGE", "");
builder.Write(" - ");

// Set second section page numbering
pageSetup = doc.Sections[1].PageSetup;
pageSetup.PageStartingNumber = 10;
pageSetup.RestartPageNumbering = true;
pageSetup.PageNumberStyle = NumberStyle.Arabic;

doc.Save(ArtifactsDir + "PageSetup.PageNumbering.docx");

ExpandedSee Also