Can we have special characters along with page number in dot net Aspose word?

Hi Team,

We have a requirement where page number needs to be displayed like this “-1-” in dot net Aspose word. I am not sure if this is feasible at first place. could please confirm if this could be achieved in Aspose word and if yes kindly share a sample code snippet as well.

Thanks & Regards

@Karthik_Test_account Sure, you can achieve this by setting PageSetup.PageNumberStyle value to NumberStyle.NumberInDash. For example see the following code:

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.PageSetup.PageNumberStyle = NumberStyle.NumberInDash;
builder.MoveToHeaderFooter(HeaderFooterType.HeaderPrimary);
builder.InsertField(FieldType.FieldPage, true);
doc.Save(@"C:\Temp\out.docx");

Thank you !!! This works :slight_smile:

1 Like