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

Free Support Forum - aspose.com

Add footer after ExecuteWithRegions


I’m trying to insert a header, execute a mail merge with regions and then insert a footer after region loop has completed. The header is straight forward as I need just one at the start:

Section currentSectionHeader = documentBuilder.CurrentSection;
PageSetup pageSetup = currentSectionHeader.PageSetup;
pageSetup.DifferentFirstPageHeaderFooter = true;
pageSetup.HeaderDistance = 10;
documentBuilder.Write(“Header text…”);

There doesn’t appear to be a HeaderFooterType.FooterLast or something similar, my attempts always end up with a footer on the first page only or repeating for every page (using HeaderFooterType.FooterPrimary or FooterFirst).

Is there an alternate method to do this? Basically I need

Header Text
repeating mail merge with regions
Footer Text

Many thanks!

Hi Nicola,

Thanks for your inquiry. It would be great if you please share following detail for investigation purposes.

  • Please attach your input Word document.
  • Please

    create a standalone/runnable simple application (for example a Console
    Application Project
    ) that demonstrates the code (Aspose.Words code) you used to generate
    your output document

  • Please attach the output Word file that shows the undesired behavior.
  • Please
    attach your target Word document showing the desired behavior. You can
    use Microsoft Word to create your target Word document. I will
    investigate as to how you are expecting your final document be generated

As soon as you get these pieces of information to
us we’ll start our investigation into your issue.

Hi, I’ve figured out how to do what I wanted now, thanks for your reply

Hi Nicola,

Thanks for your feedback. It is nice to hear from you that you have found the solution of your query. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.