Free Support Forum -

Create New Pages in Mail Merge With Regions

Hi Aspose.Words team,

I am just wondering if you could help me with this mail merge question?

I have 2 word document template files where the 1st file has 2 pages (test_doc1.doc) and the 2nd file has 1 page (test_doc2.doc) , where in the 1st file there is a Merge word object with region in a table.

I would like to do,

  1. Mail merge the the 1st file (i.e. test_doc1.doc) with data and insert new page from the 2nd file (i.e. test_doc2.doc) in the Mail merge process.
  2. Then, continue Feeding data into the same Mail merge region in the new page (i.e. the new inserted page)

My objective is, when the mail merge data has reached the second page, I want to use different header and footer.

Could you please let me know the better way to do this by using Aspose.Words api?

Currently I am using Visual Studio 2005,, and with the latest Aspose.Words version.

Thank you.



Please mind that there are three types of headers/footers that can be defined for the section of the document: primary (used for all pages if other types of headers/footers are not defined or only for odd pages if they are defined), for the first page, for even pages.

So to display different header/footer on the second page you can simply define separate header/footer pair for the first page and other header/footer pair as primary.

If you need to do this dynamically then you can use ImportNode method to move header/footer from secondary document to the primary document. You can do this before mail merge is commenced.

There are plenty of examples and technical articles on header/footer manipulation and node import in API Reference and Programmer's Guide. Please check for them.

MergeField event handler can be used to do actions during MailMerge process, although I don't see the point of using it here.

Hope this will help.

thanks Vladimir for your help.