Free Support Forum -

Conditional Statements in Mail Merge

Our choice for using Aspose was for it to handle the processing that Word would do for mail-merges. Our analysts create Word Documents with merge fields and simple if statements if merge field value = x put this otherwise put that. It is absolutley necessary for this product to handle these conditional statements. If it is not and will not be supported can anyone please suggest another tool that will support this feature.


Evaluation of expressions in IF and other fields will be supported by Aspose.Words in the future, hopefully sometime in 2006.

Dear Aspose development team,

thank you for such great work! Any news on this feature?

My requirement is simple - support for an expression like the following:

{ IF “{MERGEFIELD business_name}” <> “”
“{MERGEFIELD business_name}”}

The intent is to suppress the line feed if the merge value is an empty string.

If the feature will not be added anytime soon, do you recommend a workaround?

Best regards!

Try setting MailMerge.RemoveEmptyParagraphs = true; before mailmerge execution. This parameter is used to remove paragraphs that contained mail merge fields with no data.

IF fields evaluation is not implemented yet. This feature will probably be added later this year.

I am looking for this feature, too.

While it might be fine if I were to programmatically creates all my documents, my application (law firm documents generator) requires highly flexible in terms of certain clauses to be put into the document based on different scenarios. Each law firm might comes up with their own clauses so the conditional evaluation ability is essential. I could probably do something for suppressing sentences but certainly not altering the clauses. Do you have a timeline for this?

Yes, we understand fully the importance of adding this feature for the tasks like you have described.

We will try our best to implement this feature in 2006. Sorry, I cannot provide more exact timeline yet.

Best regards,

I would like to note that I am yet one more user looking for this feature. I spent some time this evening seeking to implement some conditional language in a template document only to discover this feature has not yet been implemented by Aspose. I was able to find a workaround to this particular situation by creating a second template and choosing between the two templates. However, not having the Word { IF } field logic available is a significant limitation.

I have a need for this feature also. It seems to be a standard mail merge feature in Microsoft Word, but when I use this in Aspose.Words it resolves the merge fields but leaves the surrounding conditional statement in the output document.

Thanks for your request. This feature is standing high in our priority least. We will try to implement it early in 2007 as soon as we are done with other features that are already in development.

Best regards,