Free Support Forum -

Word document Mail Merge Template with XML data using Aspose.Words REST API issue

executeTemplate xml fields order matter
name: “template.docx”,
withRegions: false,
cleanup: null,
filename: “template.pdf”,
storage: null,
useWholeParagraphAsRegion: false,
file: Encoding.UTF8.GetBytes(GetXml()),
folder: null);
GetXml() returns data from _simple_sample.xml (20.4 KB)

If I change order of “first” and “second” elements I’ll get expected output
expected_output.pdf (15.7 KB)


I am looking into this issue and will guide you shortly.


This issue is not because of fields order in XML, it is because of the same field first appearing twice at different levels (one as an outer and second as an inner field). If you replace inner or outer first field with some other name like third, this issue would not appear.

This may be a bug, I have logged this issue (WORDSCLOUD-340) in our internal tracking software for further investigation by our Development Team. I will update you here once I have feedback from our Development Team.

Thanks for confirming and logging the issue.

I got that the issue because of name duplication. But I think the same names on different levels should be allowed in any order. Right now depending on order functionality works differently


We understand your concerns and we will definitely fix it.


I am pleased to inform you that your reported issue (WORDSCLOUD-340) has been fixed.


We would like to update you that we have released a new API Version V4 since Aspose.Words Cloud 19.4. In this version, we have changed PUT requests to POST (and vice versa). From now on, all idempotent methods are PUT and non-idempotent ones are POST.

So MailMerge API methods are changed to PUT and also simplified the Mail Merge methods by combining ExecuteMailMerge” and “ExecuteTemplate” methods. Now API has only “mailmerge” method which can be used with both template types: “mailmerge fields” or “mustashe”. It is recommended to use the latest API version as it is more optimized in terms of memory management and API structure. Please feel free to ask for assistance in this regard.