Free Support Forum - aspose.com

Aspose.words dynamic footer

Hi,

I'm using aspose.words to load a 3 page word template and using MailMerge to dynamically insert text into the template. This is fine, but, I need a way to modify the footer. I like the footer to look different on the last page of the word document. The other page footer should look the same but the last page is different. How do I go about this? Any idea is greatly appreciated.

Jim

Basically, headers/footers can be of three types:

  • Odd/Primary - which is displayed for all pages if other headers/footers are not defined or for odd pages if they are defined;
  • Even - for even pages;
  • First - for the first page.

The headers/footers belong to a section not to a document. Which means that you can define a different set of headers/footers for any section in the document. In your case you should make the last page of your template to be in different section and redefine the primary footer for this section. The new section in the document can be inserted by using MS Word menu command Insert | Break | Section Break Types: New Page. Then uncheck Link to previous in Header and Footer toolbar and edit the footer according to your needs.

Best regards,