How to remove unused Mail Merge fields in Word document template using Aspose.Words REST API

Hello,

I’m trying to remove unused merge fields using your simple merge API (no regions, not mustache), but even when I use all the cleanup parameters at once, the unused fields are never removed.

I think it may be because I am using <<next_record>>, as in a page of labels.

I also tried using mailMergeFieldNames with DELETE, but I get a 405 METHOD NOT ALLOWED error. The same call with GET gives me the expected result described in the docs, but obviously does not solve my problem.

I have attached my word template and some XML.

Here is the call I make to start the merge with cleanup params:

POST https://api.aspose.com/v1.1/words/labels.docx/executeMailMerge?appSID=xxxx&folder=myfolder&cleanup=ContainingFields,EmptyParagraphs,UnusedFields,UnusedRegions&signature=yyyy

Here is the call I make to try to remove the merge fields after the fact when cleanup doesn’t do anything

DELETE https://api.aspose.com/v1.1/words/labels.74caa718-12bb-4670-ba88-6c4cd212d679.docx/mailMergeFieldNames?appSID=xxxx&folder=myfolder&signature=yyyy

Thank you so much for any help you can provide,

Nathan

Hi Nathan,

Thanks for your inquiry.

I have tested the scenario and have managed to reproduce the same issue at my side. For the sake of correction, I have logged this problem in our issue tracking system as SAASWORDS-126. I have linked this forum thread to the same issue and you will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

The issues you have found earlier (filed as SAASWORDS-126) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

@NathanStults

Kindly note since API Version V4.0, there are several breaking changes introduced in Aspose.Words Cloud. Along with other changes, please note MailMerge APIs are simplified. Now Mail Merge fields and Mustache template APIs are combined. So a single API can be used for both types of templates.

In the new API, versions we have changed PUT 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 now.