Free Support Forum - aspose.com

Merging XML data onto a template File

I have an XML in a particular format and have created .docx template with merge fields and am trying the mailmerge.execute and mailmerge.executewithregions and both don't seem to work. I do not get an error but no merge happens. I have attached the XML file and Template. Please let me know what is going on.

Hi there,


Thanks for your inquiry.

Your template contains no regions (TableStart and TableEnd merge fields) so you would only be using MailMerge.Execute. However, I’m afraid the structure of your data source is incorrect which is the reason for mail merge not working.

Please the following article for details on executing simple mail merge from an XML data source: http://www.aspose.com/documentation/.net-components/aspose.words-for-.net/howto-mail-merge-from-xml-using-dataset.html

You can also find the full code and input documents in the sample archive: http://www.aspose.com/community/files/51/.net-components/aspose.words-for-.net/category1177.aspx

Thanks,

thanks for the reply. but our format cannot be modified. so this will not work on this XML format, i assume?

Hi

Thanks for your inquiry. I think, in your case, you can use IMailMergeDataSource. Please see the following link to learn more

http://www.aspose.com/documentation/.net-components/aspose.words-for-.net/aspose.words.reporting.imailmergedatasource.html

Hope this helps.

Best regards,