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

Free Support Forum - aspose.com

SUM two IF statements together

I have a client who has the following within a letter (pre Aspose)

{IF { = ({ IF MERGEFIELD FIELD1 } > 0 1 0 } + { IF {MERGEFIELD FIELD2 } <> "" 1 0 })} >= 1

Is Aspose able to use the SUM function to add the two IF statement results (1 or 0) together?

If so, would the syntax be...

{IF { = (=SUM({ IF MERGEFIELD FIELD1 } > 0 1 0 } , { IF {MERGEFIELD FIELD2 } <> "" 1 0 }))} >= 1

Hi Mike,


Thanks for your inquiry. Yes, Aspose.Words supports SUM, IF and MERGEFIELD fields. Please find attached couple of input/output documents and execute the following code:

Document doc = new Document(MyDir + @“input.docx”);

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

doc.Save(MyDir + @“out.pdf”);


Best regards,