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
Name | Value | Description |
---|---|---|
None | 0 | Specifies a default value. |
RemoveEmptyParagraphs | 1 | 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. |
RemoveUnusedRegions | 2 | Specifies whether unused mail merge regions should be removed from the document. |
RemoveUnusedFields | 4 | Specifies whether unused merge fields should be removed from the document. |
RemoveContainingFields | 8 | Specifies whether fields that contain merge fields (for example, IFs) should be removed from the document if the nested merge fields are removed. |
RemoveStaticFields | 10 | 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 ListNum, Symbol, etc.) are not considered to be static. |
RemoveEmptyTableRows | 20 | Specifies whether empty rows that contain mail merge regions should be removed from the document. |
RemoveEmptyTables | 40 | Specifies 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
- namespace Wordize.MailMerging
- assembly Wordize