MailMergeCleanupOptions Enum

Wordize.MailMerging.MailMergeCleanupOptions enum. Specifies options that determine what items are removed during mail merge.

MailMergeCleanupOptions enumeration

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

[Flags]
public enum MailMergeCleanupOptions

Values

NameValueDescription
None0Specifies a default value.
RemoveEmptyParagraphs1Specifies 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.
RemoveUnusedRegions2Specifies whether unused mail merge regions should be removed from the document.
RemoveUnusedFields4Specifies whether unused merge fields should be removed from the document.
RemoveContainingFields8Specifies whether fields that contain merge fields (for example, IFs) should be removed from the document if the nested merge fields are removed.
RemoveStaticFields10Specifies 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 ListNum, Symbol, etc.) are not considered to be static.
RemoveEmptyTableRows20Specifies whether empty rows that contain mail merge regions should be removed from the document.
RemoveEmptyTables40Specifies whether to remove from the document tables that contain mail merge regions that were removed using either the RemoveUnusedRegions or the RemoveEmptyTableRows option.

Examples

Shows how to fill template with data by executing simple mail merge with DataRow data source with mail merge options.

DataTable dt = new DataTable();
dt.Columns.Add("FirstName");
dt.Columns.Add("SecondName");
dt.Columns.Add("Position");
DataRow dr = dt.Rows.Add("James", "Bond", "");

MailMergeOptions mailMergeOptions = new MailMergeOptions();
// Instruct Wordize to remove empty paragraphs produced upon executing mail merge.
mailMergeOptions.CleanupOptions = MailMergeCleanupOptions.RemoveEmptyParagraphs;

MailMerger.Execute(MyDir + "MailMergeTemplate.docx", ArtifactsDir + "MailMerger.Execute.DataRow.pdf", SaveFormat.Pdf, dr, mailMergeOptions);

See Also