Merges given data into the loaded document template. The supported format of the merge fields can be found in the ASP.
public void Merge(System.Data.DataTable mergeData, bool append);
Public Sub Merge(ByVal mergeData As System.Data.DataTable, ByVal append As Boolean)
public void Merge(System.Data.DataTable mergeData);
Public Sub Merge(ByVal mergeData As System.Data.DataTable)
public void Merge(bool append);
Public Sub Merge(ByVal append As Boolean)
public void Merge();
Public Sub Merge()
Parameter | Description |
---|---|
merge |
Specifies a System. |
append | Specifies whether the single documents should be merged into one document or split into separate documents. |
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);
Dim MailMerge1 As New TXTextControl.DocumentServer.MailMerge()
Dim MergeData As 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)
Dim SSettings As New TXTextControl.SaveSettings()
MailMerge1.SaveDocument("results.pdf", TXTextControl.StreamType.AdobePDF, SSettings)