Merges given data into the loaded document template. The supported format of the merge fields can be found in the ASP.NET User's Guide.

Merge(System.Data.DataTable, Bool)

public void Merge(System.Data.DataTable mergeData, bool append);

Merge(System.Data.DataTable)

public void Merge(System.Data.DataTable mergeData);

Merge(Bool)

public void Merge(bool append);

Merge()

public void Merge();

Parameters

Parameter Description
mergeData Specifies a System.Data.DataTable that contains the merge data.
append Specifies whether the single documents should be merged into one document or split into separate documents.

Examples

The following examples merge a template that contains two merge fields: name and company.

TXTextControl.DocumentServer.MailMerge mailMerge1 = new TXTextControl.DocumentServer.MailMerge();
DataTable mergeData = new DataTable();

mergeData.Columns.Add("name");
mergeData.Columns.Add("company");
mergeData.Rows.Add(new object[] { "Peter Jackson", "Text Control GmbH" });
mergeData.Rows.Add(new object[] { "Jack Petersen", "The Imaging Source LLC" });
mailMerge1.LoadTemplate("template.doc", TXTextControl.DocumentServer.FileFormat.MSWord);
mailMerge1.Merge(mergeData, true);
TXTextControl.SaveSettings sSettings = new TXTextControl.SaveSettings();

mailMerge1.SaveDocument("results.pdf", TXTextControl.StreamType.AdobePDF, sSettings);