We are using Aspose.Words 19.10 in .NET Framework v4.5.2.
When merging templates created by our customers, we are seeing logical errors with IF tag evaluation during MailMerge. I compared the outcome vs the same merge for the same template done by Word.exe. Aspose is giving the exact opposite result, when MERGERFIELD tags are included.
Template and comparison attached. As you can see from the example below:
- Basic MERGEFIELD tags work correctly
- Basic IF tags work correctly, when the values involved are simple constants
- But, when I use a MERGEFIELD as the subject of the IF tag, Aspose returns the exact OPPOSITE result
What’s happening and how can we fix it?
I tried to look at this behavior using the IFieldMergingCallback Callback. I expected to get callbacks for field types FieldIf = 7 (and/or FieldNextIf = 42 and/or FieldSkipIf = 43), but I got NO CALLBACKS durring the IF evaluations.
I tested MailMerge.UnconditionalMergeFieldsAndRegions, but it made no difference.
The solution can NOT involve humans modifying the templates. These are created by our customers, and MUST give the SAME output in Aspose as they do in when merged by Word.exe. Subtle Font differences are OK, we can live with that, but logical errors can NOT be tolerated.