Merge Method
- Namespace
TXTextControl.DocumentServer
- Package
TXTextControl.asTextControl. Core. SDK TXDocumentServer.from the private NuGet feed or Text Control Offline PackagesCore. dll
- Also in
TXTextControl.asTextControl. ASP. SDK TXDocumentServer.dll
Description
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.
Syntax
Merge(DataTable, bool)
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.
public void Merge(DataTable mergeData, bool append);Public Sub Merge(mergeData As DataTable, append As Boolean)| Parameter | Description |
|---|---|
| mergeData | Specifies a |
| append | Specifies whether the single documents should be merged into one document or split into separate documents. |
Merge(DataTable)
Does the same as Merge(System.Data.DataTable mergeData, bool append) with parameter “append” set to true.
public void Merge(DataTable mergeData);Public Sub Merge(mergeData As DataTable)| Parameter | Description |
|---|---|
| mergeData | Specifies a |
Merge(bool)
Merges data into the template using a data base connection given through a data source configuration file or data source configuration XML data. (See also ReportDataSourceConfigFile property and ReportDataSourceConfig property)
Only in TXTextControl.TextControl.ASP.SDK.
public void Merge(bool append);Public Sub Merge(append As Boolean)| Parameter | Description |
|---|---|
| append | Specifies whether the single documents should be merged into one document or split into separate documents. |
Merge()
Does the same as method Merge(bool append) with parameter “append” set to true.
Only in TXTextControl.TextControl.ASP.SDK.
public void Merge();Public Sub Merge()Examples
The following example merges a template that contains two merge fields: name and company.
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 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)The following example uses Merge in a focused Mail Merge workflow. The created object is then available to the surrounding document workflow.
mailMerge.Merge(new System.Data.DataTable(), true);
Console.WriteLine("Mail Merge is ready for use.");mailMerge.Merge(New System.Data.DataTable(), True)
Console.WriteLine("Mail Merge is ready for use.")