We're sorry AsposeCloud doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.cloud

Microsoft Word Document MailMerge not working

Being able to see the json and word document might help others out… This might address the exact issue I am having - anyway to make those visible?


You can check out sample templates and data from the GitHub repo of Aspose.Words Cloud SDKs. Hopefully, it will help you accomplish the task.


Yea, none of the examples really helped - they all used on the fly template generation, or there was a template and a data - but the data didn’t really match the template…

as per your example in that folder was " TestExecuteTemplate.doc"
It has “{{#foreach root}}{{data}}{{/foreach root}}”

And in “TestExecuteTemplateData.txt” It does not reference, root, nor data.

Please find my template, and output… below is my data…
{“name”:“Bruce”,“contact.name-primary”:“Adam”,“contact.address-primary”:“Mars”,“contact.phone-primary”:“111-222-3333”,“TableStart:list”:“Some start text”,“Number”:“1, 2, 3”,“TableEnd:list”:“End of text”}

{“name”:“Bruce”,“contact.name-primary”:“Adam”,“contact.address-primary”:“Mars”,“contact.phone-primary”:“111-222-3333”,“list”: [{“Number”: “1”}, {“Number”:“2”}, {“Number”:“3”}]}

And I’ve tried other ways, but all end up with the same output…
mydoc.docx (12.9 KB)
template.docx (13.0 KB)


Thanks for sharing your template and data. Please note that your JSON data file has two types of data: normal data and list(region) data. So there are two solutions to the issue. If you want to keep the existing template and data file, then you need to call the MailMege API twice: once withregions parameter false and later updating the output file using withregions parameter value true.

The second solution is to enclose your data in a parent list(Region) as follows, update your templatetemplate_updated.docx (13.0 KB) accordingly and call the MailMerge API with the true value of withregions parameter.result.Docx (10.4 KB)

{"RegionData": [{
	"name": "Bruce",
	"contact.name-primary": "Adam",
	"contact.address-primary": "Mars",
	"contact.phone-primary": "111-222-3333",
	"list": [{
		"Number": "1"
	}, {
		"Number": "2"
	}, {
		"Number": "3"

I cannot view either of the attachments…


Please check now and confirm.

1 Like