Mail Merge XML

Team,

I have a xml data which I need to merge into word using mail merge and generate a PDF. I tried to do what was prescribed in Problem with mail merge using XML - #16 by mtassinari and also tried to use XmlDataSourceSet and data source. But for some reason mail merge isn’t happening. I have attached the source code along with result.pdf where you can see mail merge isn’t happening. I have put the word template and test.xml.

Can you please let me know what I’m doing wrong here? AsposeWordXML.zip (184.1 KB)

Regards,
Sandesh

@sandesh.dsouza,

Please try using the following code:

Document doc = new Document("E:\\AsposeWordXML\\Updated.docx");
DataSet ds = new DataSet();
ds.readXml("E:\\AsposeWordXML\\test.xml");
doc.getMailMerge().execute(ds.getTables().get(0));
doc.save("E:\\AsposeWordXML\\awjava-19.7.pdf"); 

Hope, this helps.