Skype:TextControlSupport
Orders:877-462-4772
TX Text Control - word processing components.

MailMerge.Merge Method

Description:  Merges the loaded template with the data of a specific System.Data.DataTable. The second parameter specifies whether the single documents should be merged into one document or splitted into separate documents. The supported format of the merge fields can be found in the ASP.NET User's Guide.

Syntax: 
[C#]
public int Merge(DataTable mergeData, bool append);
[Visual Basic]
Public Function Merge(ByVal mergeData As DataTable, ByVal append As Boolean) As Integer
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.

Return Value:  If append parameter is false, it returns the currently merged row and -1, if the last data row has been merged. If he append parameter is true, it returns the number of merged rows.

Example:  The following example merges a template that contains two merge fields: name and company.
[C#]
DataTable mergeData = new DataTable();
mergeData.Columns.Add("name");
mergeData.Columns.Add("company");

mergeData.Rows.Add(new object[] { "Peter Jackson", "The Imaging Source Europe 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);
[Visual Basic]
Dim MergeData As New DataTable()
MergeData.Columns.Add("name")
MergeData.Columns.Add("company")

MergeData.Rows.Add(New Object() {"Peter Jackson", "The Imaging Source Europe 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)
See also:  Mail Merge, Graphical Overview.
External verification page for ISO 9000:2000 certificate
ISO 9001:2000
certified