Free Support Forum - aspose.com

Mail Merge with differnt table but same field names

How can I create merge fields that wil come from different tables, but has the same field name. for an example field name "first name", however i have 2 tables that needs to be merge into a template and I need to merge for both table that hae the same fields names? How d i get ready the template?

You can actually map data field names in the data sourse to mergefield names in the document using MailMerge.MappedDataFields collection. This collection should be set anew before merging each data table.

But the simplest way is to make datatables with differing field names on the stage of retrieving data from database, by using aliases in SQL query. For example,

SELECT FirstName as FirstName1 FROM Names

Hope this helps,

ok thanks for the idea.

Olivier