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

Free Support Forum - aspose.com

Insert Page field in the document footer with right alignment using C#

i am using the below code to add page number to the document. This code is adding page number to the left corner of the footer.is there a way to move the page number to the right corner of the footer
// Add fields for current page number
docBuilder.InsertField(“PAGE”, “”);
thank you


Please set the paragraph alignment as right to get the desired output. Please check the following code example. Hope this helps you.

Document doc = new Document();
DocumentBuilder docBuilder = new DocumentBuilder(doc);
docBuilder.ParagraphFormat.Alignment = ParagraphAlignment.Right;
docBuilder.InsertField(FieldType.FieldPage, false);

doc.Save(MyDir + "20.2.docx");