MailMergeCleanupOptions Enumeration

Specifies options that determine what items are removed during mail merge.

Namespace:  Aspose.Words.MailMerging
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.7.0


public enum MailMergeCleanupOptions


  Member nameValueDescription
None0 Specifies a default value.
RemoveEmptyParagraphs1 Specifies whether paragraphs that contained mail merge fields with no data should be removed from the document. When this option is set, paragraphs which contain region start and end merge fields which are otherwise empty are also removed.
RemoveUnusedRegions2 Specifies whether unused mail merge regions should be removed from the document.
RemoveUnusedFields4 Specifies whether unused merge fields should be removed from the document.
RemoveContainingFields8 Specifies whether fields that contain merge fields (for example, IFs) should be removed from the document if the nested merge fields are removed.
RemoveStaticFields16 Specifies whether static fields should be removed from the document. Static fields are fields, which results remain the same upon any document change. Fields, which do not store their results in a document and are calculated on the fly (like FieldListNum, FieldSymbol, etc.) are not considered to be static.
RemoveEmptyTableRows32 Specifies whether empty rows that contain mail merge regions should be removed from the document.


Shows how to automatically remove unmerged merge fields during mail merge.
doc.MailMerge.CleanupOptions = MailMergeCleanupOptions.RemoveUnusedFields;
Shows how to make sure empty paragraphs that result from merging fields with no data are removed from the document.
doc.MailMerge.CleanupOptions = MailMergeCleanupOptions.RemoveEmptyParagraphs;
Shows how to instruct the mail merge engine to remove any containing fields from around a merge field during mail merge.
doc.MailMerge.CleanupOptions = MailMergeCleanupOptions.RemoveContainingFields;

See Also