@awais.hafeez Thanks for your feedback and the workaround.
After we evaluated the workaround, we have to say no to this workaround.
This ticket as well as ticket How to make all the merge fields merged I submitted before are for the same purpose, to workaround your library behavior change with IF expression. With the lib 15.2 we are using, all the merge fields in an IF expression will be merged, but they will not with Aspose.words 17.4 and later.
We have logic to check if a template is fully merged after call document.getMailMerge().execute() like below,
If there are unmerged fields return, we assume something wrong with the final document. But with current Aspose.words, there are some unmerged fields in IF expression is reasonable, which always break our logic.
To make your work around works, we also need to write a lot of code and test with our thousands of templates in production to avoid any regression issue to our customers. It doesn’t make sense to us to spend so much effort on the workaround which we already know having limitations.
I have an alternative request, if you can provide a fix like that, it will be perfect.
As I said in above, we call document.getMailMerge().getFieldNames() to get all the unmerged fields, if you can build a similar method for example document.getMailMerge().getUnmergedFieldNames(), with this method only the merge fields need to be merged but not are returned, namely the merge fields in IF expression which don’t conform to IF condition are not returned. In this way, our issue can be resolved perfectly. Can you investigate this way?
Any more questions please let me know.