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

Free Support Forum - aspose.com

IF fields with mergefield to remove


Is it possible to have an option to fix the result of If fields.

If i have the following:

In the document generated, I would like to have the value of {MERGEFIELD Z} or “” depending on condition result. But if user do Alt-F9, he should not see the {IF … } Fields

Thanks for your help.

Best regards

Hi Stephan,

Thanks for your inquiry. Please refer to the following article:

How to Remove Unmerged Fields and Empty Paragraphs during Mail Merge

Hope, this helps.

Best regards,

we already do it but it doesn’t work, removed everything except If statement

m_words.MailMerge.CleanupOptions = Aspose.Words.MailMerging.MailMergeCleanupOptions.RemoveUnusedRegions |
Aspose.Words.MailMerging.MailMergeCleanupOptions.RemoveUnusedFields | Aspose.Words.MailMerging.MailMergeCleanupOptions.RemoveStaticFields |
Aspose.Words.MailMerging.MailMergeCleanupOptions.RemoveEmptyParagraphs | Aspose.Words.MailMerging.MailMergeCleanupOptions.RemoveContainingFields;
Hi Stephan,

Thanks for your inquiry. To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input Word document
  • Aspose.Words version 16.1.0 generated output document which shows the undesired behavior
  • Your expected document. We will investigate the structure of your expected document as to how you want your final output be generated like. You can create expected document using Microsoft Word.
  • Please create a standalone console application (source code without compilation errors) that helps us reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we'll start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip them and Click 'Reply' button that will bring you to the 'reply page' and there at the bottom you can include any attachments with that post by clicking the 'Add/Update' button.

Best regards,