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

Free Support Forum - aspose.com

Merge Fields in header and footer

I have to create a report using ASPOSE.Words and .net.
The report has to display some master detail kind of data and also it has some customized headers and footers.
I am herein attaching a template showing what I want.
At the bottom of every page I want to display the value of a product id and the current date whereas at the top of the page I want to display the Product name and product effective date that has to come from database.
The data within is a master-detail data which I think can *** up with TableStart and TableEnd as it would be repeating but what I am not sure of is that whether I will be able to customize my top and bottom of page.

I hope I am making some sense.
Please suggest.


Thanks for your request. Unfortunately, in the current version there is no “one step” way to populate a document with data that has parent-child relationships. Mail merge regions can only process one data table at a time.

It is possible, however, to generate the above reports by performing mail merge several times and building up a resulting document from several documents or fragments. The Product Catalog and Sales Invoice samples in the demo project supplied with Aspose.Words demonstrate the suggested techniques.

In addition, one of our customers implemented nested mail merge. Please see the following link for more information.

Maybe you can use the same approach.

Also, we are going to support nested mail merge in one of the future releases. I linked your request to the appropriate issue. You will be notified as soon as this feature is supported.

Best regards.

Thanks for the reply.
What I am more concerned was not the parent-child relationships but the header and footer the way I Want them to happen…?
Can I create 1 doucment for the headers and footers and one for the parent child stuff and merge them both…


Thanks for your inquiry. Yes, of course you can achieve this. For example, see the following link to learn how to copy headers/footers from one document to another:


Hope this helps. Please let me know in case of any issues, I will be glad to help you.

Best regards.

Hey Alexey
I was wondering that can we use mergefields in header and footer…


Hi Sara,

Thanks for your inquiry. Yes, of course, you can use merge fields in Header and Footer of your template.

Best regards.

Is it there in any of the samples…?


Thanks for your request. You can use mergefields in header and footer the same way as you use them in the main story. I created simple example for you. In the attached template I inserted few mergefields in the header and region in the main story. Here is code I used to fill this template with data:

// Create dummy datasource.
DataTable data = new DataTable("Languages");
data.Rows.Add(new object[] { "English", "Native" });
data.Rows.Add(new object[] { "German", "Secondary" });
data.Rows.Add(new object[] { "Russian", "Secondary" });
// Open template.
Document doc = new Document(@"Test001\in.doc");
// Execute mail merge with regions.
// Execute simple mail merge to fill mergefields outside teh region.
doc.MailMerge.Execute(new string[] { "FirstName", "LastName" }, new object[] { "Sam", "Smith" });
// Save output document.

Hope this helps.

Best regards.

The issues you have found earlier (filed as 39) have been fixed in this update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.