Mail Merge XML data into Microsoft Word Template with regions using Aspose.Words REST API

I’m attempting to perform a mail-merge with invoice data against an invoice Word document.

Attached to this post is Invoice.docx, which contains the document I’m working on. I’m using the TableStart and TableEnd fields according to the instructions here ( Types of Mail Merge Operation in C#|Aspose.Words for .NET ) which also applies to Words-for-Cloud.

Here is the XML data I’m wanting to merge:

<?xml version="1.0" encoding="utf-8"?>

23

Nelson Street
Howick
Auckland

543 1234


Line 1
1
100.00


Line 2
2
1000.00


Line 3
4
33.00


Line 4
8
-7.50




However when I run the mail-merge (using /words/Invoice.docx/mailMergeFieldNames?withRegions=True ) none of the fields are merged and the document is essentially unchanged.

Hi David,

The name of repeating table in your template is 'InvoiceItems' but 'Item' repeating tag is used in XML. Name of repeating table in the template and name of repeating tag in the XML should be same. I have changed the name of repeating table in your template to 'Item' and now it is working with this XML.

Please find attached the updated template and feel free to contact us in case you have further comments or questions.

Best Regards,

Huzzah! That worked, thank you!


Can you amend the documentation so that this quirk is clearer? Thanks!

Hi David,

Thanks for your feedback. We will improve the description of mail merge features to address this issue and let you know.

Best Regards,