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 void Merge(System.Data.DataTable mergeData);
public void Merge(bool append);
public void 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);