TX Text Control .NET for Windows Forms

MergeBlocks Method

MethodDeprecated|Introduced in 14.0
Obsolete
The assembly marks this as obsolete.
Namespace
TXTextControl.DocumentServer
Package
TXTextControl.TextControl.WinForms.SDK as TXDocumentServer.dll from the private NuGet feed or Text Control Offline Packages

Description

Merges all repeating blocks that are contained in the loaded template with the System.Data.DataTable instances contained in the given System.Data.DataSet. The name of the System.Data.DataTable must match the name of the block in the template. The supported format of the repeating blocks can be found in the ASP.NET User's Guide.

Syntax

[Obsolete]
public int MergeBlocks(DataSet mergeData);

Parameters

ParameterDescription
mergeData

Specifies a System.Data.DataSet that contains the merge data.

Return Value

Returns the number of successfully merged blocks.

Examples

The following example merges a block in a template.

DataSet mergeData = new DataSet();

DataTable blockData = new DataTable("section1");
blockData.Columns.Add("name");
blockData.Columns.Add("company");
blockData.Rows.Add(new object[] { "Peter Jackson", "Text Control GmbH" });
blockData.Rows.Add(new object[] { "Jack Peterson", "The Imaging Source LLC" });

mergeData.Tables.Add(blockData);
mailMerge1.MergeBlocks(mergeData);

The following example uses Merge Blocks in a focused Mail Merge workflow.

var result = mailMerge.MergeBlocks(new System.Data.DataSet());
Console.WriteLine($"Merge Blocks result: {result}");