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

Free Support Forum - aspose.com

Footer page numbers

How can I create a footer with the Page number on the left hand side and the date/time on the right hand side on the same line. I used the following code but text is on two lines. I tried to using a table with two cells, but how can I get table to autosize to page width for portrait and landscape pages.

Builder.MoveToHeaderFooter(HeaderFooterType.FooterPrimary)
Text = "Page No: "
Builder.Write(Text)
Builder.InsertField("PAGE", "")
Builder.ParagraphFormat.Alignment = ParagraphAlignment.Left
Builder.InsertBreak(BreakType.ParagraphBreak)
Text = "Created on: " & Now.ToString("dd/MM/yyyy hh:mm:ss")
Builder.ParagraphFormat.Alignment = ParagraphAlignment.Right
Builder.Write(Text)

That is a very good question. It was asked several times on the forum so I guessed it was a time to put the answer in our Wiki. The article is now available on the following link:

https://docs.aspose.com/words/net/working-with-headers-and-footers/

Please review it and let me know if it covers all that you wished to know about dynamic headers/footers creation.

The code example given in the article should also solve the problem submitted in your ‘DifferentFirstPageHeaderFooter’ post.

Please use the updated version of the code in

https://docs.aspose.com/words/net/working-with-headers-and-footers/

The update eliminates some problems that can arise when exporting the created headers/footers to PDF or HTML.

Best regards,