Mail Merge on a Nested Region in Word Document from XML Data with Parent Child Tables having Same Names (Java)

After fixing the last bug with an simple upgrade, we now got the problem that cell data in nested mail mergefields dispears if the parent tables has the name as the child.

java.zip (17.5 KB)

Best regards!

@bennetpe,

Please download these Resources.zip (24.5 KB) and try running the following code with 20.10 version of Aspose.Words for Java:

DataSet dataSet = new DataSet();
dataSet.readXml("C:\\Temp\\java\\bsp.xml");
Document doc = new Document("C:\\Temp\\java\\bsp.docx");
doc.getMailMerge().executeWithRegions(dataSet);
doc.save("C:\\temp\\java\\awjava-20.10.pdf");

You can see in “awjava-20.10.pdf” that the merge field inside mail merge region is getting populated with ‘Test’ value correctly.

Hello @awais.hafeez,
I’m sorry there is something missing in the source xml…
It should like this to get this behaviour.
grafik.png (2.7 KB)

Best regards

@bennetpe,

We can also reproduce this issue when using the following XML as data source on our end:

<?xml version="1.0" encoding="UTF-8"?>
<root>
    <a>
      <a />
      <b>TEST</b>
    </a>
</root>

Aspose.Words for Java code is same:

DataSet dataSet = new DataSet();
dataSet.readXml("C:\\Temp\\java\\bsp.xml");
Document doc = new Document("C:\\Temp\\java\\bsp.docx");
doc.getMailMerge().executeWithRegions(dataSet);
doc.save("C:\\temp\\java\\awjava-20.10.pdf");

The ID of this issue is WORDSJAVA-2488. We will further look into the details of this problem and will keep you updated on the status of the linked issue. We apologize for any inconvenience.

1 Like

The issues you have found earlier (filed as WORDSJAVA-2488) have been fixed in this Aspose.Words for .NET 21.2 update and this Aspose.Words for Java 21.2 update.

1 Like