Free Support Forum - aspose.com

Aspose XML Mail Merge - Grouping issue

Aspose XML Mail Merge – We are facing a problem using mail merging through Aspose UI Framework. With grouping we see that all group items of all groups show up in each group.

IF the XML Structure is:

MasterItem
MasterItem1:Item1
MasterItem1:Item2
MasterItem1:Item3
MasterItem
MasterItem
MasterItem2:Item1
MasterItem2:Item2
MasterItem2:Item3
MasterItem

after merging in the document we get the following table Layout

MasterItem
MasterItem1:Item1
MasterItem1:Item2
MasterItem1:Item3
MasterItem2:Item1
MasterItem2:Item2
MasterItem2:Item3
MasterItem
MasterItem
MasterItem:Item1
MasterItem:Item2
MasterItem:Item3
MasterItem:Item1
MasterItem:Item2
MasterItem:Item3
MasterItem

As the conclusion, we are actually getting items from both tags in the mail merge Document and thereby we need to have the functionality to filter out the second tag from the mail merge.

Any clue what we do wrong or is this functionality not supported?

@hclout,

Thanks for your inquiry. To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input Word document and XML.
  • Please attach the output Word file that shows the undesired behavior.
  • Please attach the expected output Word file that shows the desired behavior.
  • Please share the code example (source code without compilation errors) that you are using to generate the document.

As soon as you get these pieces of information ready, we’ll start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip and upload them.

Hi Tahir,

My developer did add the requested documentation. He also wanted to send the full solution but that did exceed the maximum upload capacity. If that is required we need to fidn a way to send it.

I hope this helps to understand our issue. Feel free to reach out.
Cheers
Herbert

Aspose Action Items - Royal Philips - Herbert Clout.zip (86.6 KB)

@hclout,

Thanks for sharing the detail. You have not shared the input Word document. Please share it for testing. The “input Word document.docx” and “Output File Showing Undesirable Behaviour.docx” are same.

Hi Tahir,

Sorry, my developper missed it. Find the new pack attached.

Cheers
Herbert Clout

Aspose Action Items - Royal Philips - Herbert Clout V2.zip (90.5 KB)

@hclout,

Thanks for sharing the document. We are investigating this issue and will get back to you soon.

@hclout,

Your template (input) document is not correct. We have created the template document according to your requirement and have attached it with this post for your kind reference. template.zip (40.2 KB)

We suggest you please read following articles.
Mail Merge with Regions Explained
How to Use Nested Mail Merge Regions

Please use the following code example to get the desired output.

Document doc = new Document(MyDir + "template.docx");
              
// Create the Dataset and read the XML.
DataSet xmldataDs = new DataSet();
xmldataDs.ReadXml(MyDir + "input XML.xml");
                 
doc.MailMerge.ExecuteWithRegions(xmldataDs);
                  
doc.Save(MyDir + "18.5.docx", Aspose.Words.SaveFormat.Docx);