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

Free Support Forum - aspose.com

How to create mail merge with region template with parent and child fields in same table row

Hi there,

I’m trying to create a table with nested mailmerge regions by merging into a document template. I have a dataset with parent-child tables. My requirement is for parent data to show up in the first column of first row only and child data to repeat in 2nd column. i.e. I do not want the parent data to be repeated in each child row.

Can you please confirm if this is achievable and hopefully provide some help on how to achieve this if possible. Example table below:

Header 1 Header 2
parent 1 child 1
child 2
child 3
parent 2 child 4
child 5
child 6

@amar.chelli

Yes, you can achieve your requirement using mail merge with region. Please read the following article.
How to Use Nested Mail Merge Regions

In your case, you need to create nested table to achieve your requirement. To create the template document, please follow the steps mention below.

  1. Create a table with two cells and one row.
  2. Insert parent mail merge field in first cell of table.
  3. Create nested table in the second cell of table with one row and one cell.
  4. Insert the child mail merge field in it.

We have modified and attached the template document used in code example mention in above article for your kind reference. Hope this helps you. Invoice Template.zip (47.1 KB)

Thankyou for your prompt response Tahir. Much appreciated.
I will give it a go and report back.

@amar.chelli

Thanks for your feedback. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.