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

Free Support Forum - aspose.cloud

Word Document Mail Merge Cleanup issue in Apex/Salesforce using Aspose.Words REST API


I am using Aspose for Cloud to generate documents and PDF in my Salesforce environment. Everything was working perfectly fine until I figured the following weird issue in production.

Issue is with Aspose exported files. A lot of times my sales reps downloads the
contracts on their machine and manually changes the data in it. While they are able
to change and save, it reverts back to old information on printing it. So when
we send the updated info back to client and client prints it, it shows old
info. They mainly changes the dates on the contract.

I am attaching one such
contract here. We tried changing “Service Period” date from 01/31/2018 to 07/31/2017. But as
soon we do print (Ctrl + P) or save as it reverts back to 01/31/2018 and saves / prints it
that way. I saved it with 07/31/2017 but when you try to print it, it will
revert it back to 01/31/2018.

This is happening only with files generated using Aspose service.

Please let me know why it’s behaving like this.


Naimish Dave

Hi Naimish,

Thanks for your inquiry. I used “Microsoft XPS Document Writer” printer to print your “ThomasNet__Service_Contract-ThomasNet_Display_NewContract080520161485248000069.docx” to XPS file by using MS Word 2016 over Windows 10 and attached it here for your reference. I am afraid, I could not observe the problem in this XPS file. Can you please attach the screenshot highlighting the problematic area in this XPS?

Can you please list complete steps which enable us to reproduce this same issue on our end using this “ThomasNet__Service_Contract-ThomasNet_Display_NewContract080520161485248000069.docx”?

Best regards,

Hi Awais,

I am not sure about XPS document printer, my users were trying to print it on actual printer.

  1. Open the document
  2. Update any date under Service Period column (note down the original value)
  3. Press Ctrl + P to open print preview
  4. Verify the date you changed in 2nd step - it’s reverting back to the original value for all my users
Let me know if you are still unable to reproduce it.


Naimish Dave

Hi Naimish,

Thanks for your inquiry.

The problem occurs because the content of problematic row is not static instead it is contained inside an IF field. You may try specifying mail merge cleanup options to specify some items should be removed during mail merge.

As far as the attached “ThomasNet__Service_Contract-ThomasNet_Display_NewContract080520161485248000069.docx” is concerned, you can fix it by running an empty mail merge with cleanup options. See the following code and attached output.

Document doc = new Document(MyDir

doc.MailMerge.CleanupOptions = MailMergeCleanupOptions.RemoveContainingFields |

MailMergeCleanupOptions.RemoveUnusedFields |


doc.MailMerge.Execute(new string[] { "" }, new object[] { "" });

doc.Save(MyDir + @"17.1.0.docx");

Hoe, this helps.

Best regards,

Hi Awais,

This document has already passed through the following cleanups. What else should I try?



Naimish Dave

Hi Naimish,

Thanks for your inquiry. You need to specify following cleanup options:

  • ContainingFields
  • UnusedFields
  • StaticFields

Unfortunately, the StaticFields option is not available yet. We have logged an issue in our issue tracking system to implement it. The ID of this issue is WORDSCLOUD-157. Our product team will further look into the details of this problem and we will keep you updated on the status of this issue. We apologize for your inconvenience.

Best regards,

Hi Awais,

Due to another Aspose bug (WORDSCLOUD-152) I am not able to use ContainingFields option in request to Aspose API - it fails with object reference error if it’s there in cleanup. I am already waiting for fix on it.

Cleanup seems to be very buggy and should have never been made available in production by Aspose!

Long waiting period to get fix on Aspose issues is raising doubts over Aspose credibility.

I am already waiting for fix on WORDSCLOUD-152 from last 3 weeks - WORDSCLOUD-157 is the last thing I would have expected to happen from Aspose!

Why do PAID customers have to wait for soooooo long for fixes in production environment??

Hi Naimish,

Thanks for being patient.

We have a good news for you i.e. our product team has resolved your issue (WORDSCLOUD-157) and they have planned to include the fix to this issue in next [17.2.0] release of Aspose.Words for Cloud. We will inform you via this thread as soon as next release containing the fix of this issue will be published during this week.

Regarding WORDSCLOUD-152, we are in coordination with product team to get answer pertaining to your queries. Soon you will be updated with the required information.

We apologize for your inconvenience.

Best regards,

Hi Awais,

We are already in a second week of Feb.
  1. WHEN is magical 17.2.0 going to release?
  2. HOW many more weeks do we have to wait for resolution on such critical issue WORDSCLOUD-157?
DON’T apologies or thank - just tell me the date when above issues will be released to production?
Hi Naimish,

We are in coordination with product team to get answer pertaining to your queries. Soon you will be updated with the required information.

Best regards,

The issues you have found earlier (filed as WORDSCLOUD-157) have been fixed in this Aspose.Words for Cloud 17.2.0 update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.