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

doc.MailMerge.Execute(
mergeNames,
mergeValues);

the problem is it occupies space even though i had used

doc.MailMerge.CleanupOptions = MailMergeCleanupOptions.RemoveUnusedFields;

its not just the merge fields ex
«AtWillEmploymentStatus»
but also IF conditions
http://c2n.me/3peeFkF
this occupies space as well
http://c2n.me/3peeUDO

may i know how to remove them

thanks

Hi there,

Thanks for your inquiry. I suggest you please read following documentation link for your kind reference. Hope this helps you.
https://docs.aspose.com/words/net/clean-up-before-or-during-mail-merge/

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!

thanks

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.