Free Support Forum - aspose.com

Urgent - How to mail merge a table into a document?

We are using Aspose.Words to take client *.doc templates, merge the medical data in to the fields, and convert it to PDF. Generally speaking, this is working fine. We used to do all this “by hand”, creating a new *.doc in memory and adding fields as required.

The problem I’m having is that one of the fields I need to populate during the merge, I need to insert a table of data. I can’t figure out how to make this work.

First I tried creating an HTML table, hoping that Word would “figure it out and convert it”, but it is inserting the text verbatim, so all I see is “

” etc.

Then I tried creating a Word “table” object in memory, and posting that as the field to insert. Maybe I’m doing it wrong, but it just inserts some text describing the Object, not the table and data itself.

Can this be done? How?
some data…

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. You should use MergeFieldEvenHandler to achieve this. Please see the following link for more information.

http://www.aspose.com/documentation/.net-components/aspose.words-for-.net-and-java/aspose.words.reporting.mergefieldeventhandler.html

Best regards.