Free Support Forum - aspose.com

Newbie: Mail Merge With Regions and Simple Mail Merge

Hi,

I'm picking up aspose.words for the first time and considering my best options for priniting onto word templates. It seems that there is a range of options when considering how to prepare your data source, passing the data and designing your word templates. I'm using ASP.Net.

My main requirement is to show repeating data within the printed document e.g. I have a letter with any number of Cc's at the bottom. Currently, the letter data and CC data are stored in separate datatables in my ASP.Net application.

After reading the documentation, I think I need to do a simple mail merge with the letter data and then a mail merge with regions for the Cc's.

My question is therefore: Is it possible/advisable to do two merges on the same document i.e. firstly a simple merge and then a mail merger with regions? OR should I just perform one mail merge with regions and set up a second region for the letter data?

Many thanks in advance.

Generally, it is up to you how many mail merges are done in the document. Please take the following considerations into account however:

The mail merge is basically a process of substituting merge fields with data from the data source. The match is done by field name with data column name.

It is already worth to know that in simple merge when there are several data records in a data source the merge fields can be field in sets, substituted with a {NEXT} filed. There can be only one set of merge fields in the document ({NEXT} fields not present).

If the number of data records exceeds the number of merge field sets then the full copy of the initial document is made and appended to the end. That can actually be seen well in the demos.

And during mail merge with regions only the region sector is copied.

So it is definitely possible to do a subsequent mail merges on the document. Just pay attention that each mail merge should involve merging fileds with different set of names.

Hope this helps,

Thanks for your reply. I’ve got it working with multiple merges.