• DR-IT Software
  • Products
  • Documentation
  • Product page
  • Examples
  • API reference
  • Support
Show / Hide Table of Contents

Class MailMerge

Executes mail merges against a document.

Inheritance
object
MailMerge
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
Namespace: DRIT.Document
Assembly: DRIT.Document.dll
Syntax
public sealed class MailMerge

Properties

CleanupOptions

Gets or sets cleanup operations applied after a merge.

Declaration
public MailMergeCleanupOptions CleanupOptions { get; set; }
Property Value
Type Description
MailMergeCleanupOptions

Document

Gets the document associated with this merge engine.

Declaration
public Document Document { get; }
Property Value
Type Description
Document

FieldMappings

Gets field-name mappings applied before source lookup.

Declaration
public IDictionary<string, string> FieldMappings { get; }
Property Value
Type Description
IDictionary<string, string>

Methods

Analyze()

Analyzes the active-story merge template without changing the document.

Declaration
public MailMergeTemplateAnalysis Analyze()
Returns
Type Description
MailMergeTemplateAnalysis

The static template analysis.

Analyze(object)

Analyzes the template against a supplied data source without changing the document.

Declaration
public MailMergeTemplateAnalysis Analyze(object dataSource)
Parameters
Type Name Description
object dataSource

The object, dictionary, or custom data source to inspect.

Returns
Type Description
MailMergeTemplateAnalysis

The template and source compatibility analysis.

Analyze(object, DocumentMailMergeOptions)

Analyzes the template against a supplied source and binding options.

Declaration
public MailMergeTemplateAnalysis Analyze(object dataSource, DocumentMailMergeOptions options)
Parameters
Type Name Description
object dataSource

The object, dictionary, or custom data source to inspect.

DocumentMailMergeOptions options

The field mapping and resolver options to apply.

Returns
Type Description
MailMergeTemplateAnalysis

The template and source compatibility analysis.

Execute(DataTable)

Executes a merge using the first row of a data table.

Declaration
public int Execute(DataTable dataSource)
Parameters
Type Name Description
DataTable dataSource

The table containing the merge record.

Returns
Type Description
int

The number of merge fields replaced.

Execute(IDataReader)

Executes a merge using the first row returned by a data reader.

Declaration
public int Execute(IDataReader dataSource)
Parameters
Type Name Description
IDataReader dataSource

The reader containing the merge values.

Returns
Type Description
int

The number of merge fields replaced.

Execute(IDataRecord)

Executes a merge using the current row of a data record.

Declaration
public int Execute(IDataRecord dataSource)
Parameters
Type Name Description
IDataRecord dataSource

The data record containing the merge values.

Returns
Type Description
int

The number of merge fields replaced.

Execute(object)

Executes a merge using the supplied data source.

Declaration
public int Execute(object dataSource)
Parameters
Type Name Description
object dataSource

The object, dictionary, or enumerable data source.

Returns
Type Description
int

The number of merge fields replaced.

Execute(object, DocumentMailMergeOptions)

Executes a merge using the supplied data source and options.

Declaration
public int Execute(object dataSource, DocumentMailMergeOptions options)
Parameters
Type Name Description
object dataSource

The object, dictionary, or enumerable data source.

DocumentMailMergeOptions options

The merge options to apply.

Returns
Type Description
int

The number of merge fields replaced.

ExecuteWithRegions(DataSet)

Executes a region merge using each table in a data set as a named region.

Declaration
public int ExecuteWithRegions(DataSet dataSource)
Parameters
Type Name Description
DataSet dataSource

The data set whose table names identify merge regions.

Returns
Type Description
int

The number of merge fields replaced.

ExecuteWithRegionsResult(DataSet)

Executes a region merge and returns counts and diagnostics.

Declaration
public MailMergeResult ExecuteWithRegionsResult(DataSet dataSource)
Parameters
Type Name Description
DataSet dataSource

The data set whose table names identify merge regions.

Returns
Type Description
MailMergeResult

The result of the merge.

ExecuteWithResult(DataTable)

Executes a merge using the first row of a data table and returns its result.

Declaration
public MailMergeResult ExecuteWithResult(DataTable dataSource)
Parameters
Type Name Description
DataTable dataSource

The table containing the merge record.

Returns
Type Description
MailMergeResult

The result of the merge, or an empty result when the table has no rows.

ExecuteWithResult(IDataReader)

Executes a merge using the first row from a data reader.

Declaration
public MailMergeResult ExecuteWithResult(IDataReader dataSource)
Parameters
Type Name Description
IDataReader dataSource

The reader containing the merge values.

Returns
Type Description
MailMergeResult

The result of the merge, or an empty result when the reader has no rows.

ExecuteWithResult(IDataRecord)

Executes a merge using a data record and returns its result.

Declaration
public MailMergeResult ExecuteWithResult(IDataRecord dataSource)
Parameters
Type Name Description
IDataRecord dataSource

The data record containing the merge values.

Returns
Type Description
MailMergeResult

The result of the merge.

ExecuteWithResult(object)

Executes a merge and returns counts and diagnostics.

Declaration
public MailMergeResult ExecuteWithResult(object dataSource)
Parameters
Type Name Description
object dataSource

The object, dictionary, or enumerable data source.

Returns
Type Description
MailMergeResult

The result of the merge.

ExecuteWithResult(object, DocumentMailMergeOptions)

Executes a merge with options and returns counts and diagnostics.

Declaration
public MailMergeResult ExecuteWithResult(object dataSource, DocumentMailMergeOptions options)
Parameters
Type Name Description
object dataSource

The object, dictionary, or enumerable data source.

DocumentMailMergeOptions options

The merge options to apply.

Returns
Type Description
MailMergeResult

The result of the merge.

GetMergeFieldNames()

Gets the distinct scalar merge-field names in the active story.

Declaration
public IEnumerable<string> GetMergeFieldNames()
Returns
Type Description
IEnumerable<string>

Field names in first-occurrence order.

Events

FieldMerging

Raised before a scalar merge field is written.

Declaration
public event EventHandler<FieldMergingEventArgs> FieldMerging
Event Type
Type Description
EventHandler<FieldMergingEventArgs>

ImageFieldMerging

Raised when a merge value is a byte or stream image source.

Declaration
public event EventHandler<ImageFieldMergingEventArgs> ImageFieldMerging
Event Type
Type Description
EventHandler<ImageFieldMergingEventArgs>
Back to top

DR-IT Software documentation

DR-IT Software · Products · Documentation index · Product page · Downloads · Support · Licensing

Generated by DocFX