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

Free Support Forum - aspose.com

Remove space occupied by merge field

im using latest version of aspose and in .net

i have a merge field that will be field using


the problem is it occupies space even though i had used

doc.MailMerge.CleanupOptions = MailMergeCleanupOptions.RemoveUnusedFields;

its not just the merge fields ex
but also IF conditions
this occupies space as well

may i know how to remove them


Hi there,

Thanks for your inquiry. I suggest you please read following documentation link for your kind reference. Hope this helps you.

You can use multiple cleanup options as shown below. Please let us know if you have any more queries.

doc.MailMerge.CleanupOptions = MailMergeCleanupOptions.RemoveContainingFields;
doc.MailMerge.CleanupOptions |= MailMergeCleanupOptions.RemoveStaticFields;
doc.MailMerge.CleanupOptions |= MailMergeCleanupOptions.RemoveEmptyParagraphs;
doc.MailMerge.CleanupOptions |= MailMergeCleanupOptions.RemoveUnusedRegions;
doc.MailMerge.CleanupOptions |= MailMergeCleanupOptions.RemoveUnusedFields;

hmmm you guys should edit it as it will accept a list or something cause people might think it can only accept 1 enum…

anyway it works like a charm!


Hi there,

Thanks for your feedback. We will update the documentation for using multiple MailMergeCleanupOptions.

Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.