While running code document.MailMerge.ExecuteWithRegions(DataTable table)
on table with MERGEFIELDS
with formulas, for example { IF "«Deals:Status»"="Invistigation" "«Deals:Company»" "«Deals:Company»" }
. Method IFieldMergingCallback.FieldMerging isn’t called for a second merge field «Deals:Company»
. Because of that fact object from DataTable
is used as raw value.ToSting()
without any formatting.
The case is relevant only for IF formula and when merge fields in formula result conditions are the same. (merge fields in formula are the same because bold text formatting is applied depending on «Deals:Status»
). How can I make IFieldMergingCallback.FieldMerging
be called for this case, and what kind of optimization do you apply inside your engine for rendering IF formula in word?
Thanks.
@Ulad You should specify MailMerge.UnconditionalMergeFieldsAndRegions
, in this case Aspose.Words will merge merge fields in both true and false values of IF
field.
Oh, seems exactly what I need. Sad news is that I am on Aspose.Words version 18.1.0 and waiting my organization to buy an updated licence. Seems I need to find some workaround. Anyway thanks for your help.
@Ulad This option has been introduced in 18.9 version of Aspose.Words:
https://releases.aspose.com/words/net/release-notes/2018/aspose-words-for-net-18-9-release-notes/
I’ve updated to 18.9, tried UnconditionalMergeFieldsAndRegions (with my current licence) and it works as expected. Thread can be marked as resolved/closed. That was really helpful support, thx)
1 Like