We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Page Number not getting in DOCX

I am trying to create a DOCX document using latest Aspose.Words version. When I open the same in Word 2007 the page number values are not getting displayed Instead its showing the fields name itself as PAGE & NUMPAGES.(Code is attached below)

Please suggest what needs to be done.

builder.MoveToHeaderFooter(HeaderFooterType.FooterFirst);
builder.Font.ClearFormatting();
builder.Font.Size = 12;
builder.Font.Color = System.Drawing.Color.Black;
builder.Font.Name = "Times New Roman";

builder.Write("Page ");
builder.InsertField("PAGE", "");
builder.Write(" of ");
builder.InsertField("NUMPAGES", "");
builder.CurrentParagraph.ParagraphFormat.Alignment = ParagraphAlignment.Left;

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. This occurs because you selected “Show fields codes instead of their values” option in MS Word (see the screenshot). This option of MS Word and it is not stored in a document, so you cannot set or reset it using Aspose.Words.

Best regards,

Hi Andrey,

Thanks for your quick reply. It solved my issue :-)