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

Free Support Forum - aspose.com

Mail Merge with IF statements

I have a word MailMerge doc that has 3 different sections based on a value from the Merge Fields. There are IF statements embedded in the body of the doc that decide which text to show. Below is the body of the doc with the IF statements shown and the 3 different sections.

{IF {MERGEFIELD STATUS} = 1 This is the 1st section of the doc}{IF {MERGEFIELD STATUS} = 2 This is the 2nd section of the doc}{IF {MERGEFIELD STATUS} = 3 This is the 3rd section of the doc}

When I do the doc.MailMerge with a datatable, It decides on the first row which section to show and it always shows that section. It never re-evaluates the IF statement and changes the text.

When I do this in MS-Word manually, it works fine.

I have attached the full word doc and sample mail merge file I am using.

Any help would be appreciated. Thanks.

Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. Currently Aspose.Words does not evaluate IF fields in the document. Please see the following forum thread to learn more about this issue.

Best regards.