Free Support Forum -

Different behavior in MailMerge after merge

As we are upgrading our application from Aspose.Words 15.10 to the (near) latest version 18.4, we discovered a different behavior of MailMerging been done by Aspose.Words.

The problem arises whenever a mergefield exists within the TRUE or FALSE region of an IF field. In the old version, both mergefields would be called in the IFieldMergingCallback.
However, in the newer version (I guess even before version 18.4), if the IF statement would result in a TRUE or FALSE state, only that mergefield would be merged (and called in the callback).

In our application, we call some code to enhance the IF condition, even after merging. That could cause the IF statement to have a different result, which then results in a non-merged mergefield.

To clarify:

  • Pre merging: IF “condition with MergeFieldA” “MergeFieldB” “MergeFieldC”
  • MailMerge: condition would result in false, so only MergeFieldC is merged with MailMerge data
  • After merging: fixup condition (removing unwanted stuff): condition results in true now, but MergeFieldB is not merged.

To further clarify: a test application is added making use of the Nuget packages of Aspose (switching between v15.10 and 18.4 displays an alternate result).
Update : can’t attach test application.

I guess from the side of Aspose, this change could have been introduced for performance reasons. However, from our side, there is no chance of fixing up the conditions pre-merging.

Could there be a property to indicate whether it is possible to either mailmerge all, or mailmerge only true/false expressions (with the latter as default, of course)?

Kind regards,


Thanks for your inquiry.

There is no API for this requirement.

Please note that Aspose.Words mimics the behavior of MS Word. Aspose.Words does not populate merge fields inside false part of IF field. The cleanup options are not applied too. So, false part of the IF field remains unchanged, like in MS Word mail merge preview.