According to the golden rules of user experience design, when long-running processes are being executed, it is a good practice to provide feedback to users, for example, updating a progress bar.

Merging hundreds of data rows with merge blocks and various merge fields can take some time. TX Text Control's MailMerge component provides events when data rows or block rows are merged, that can be used to perform a step on a progress bar.

Reporting: Updating a progress bar during Merge processes

Consider a master table that contains 50 data rows that should be merged into your template. The maximum value of the ProgressBar is the number of DataRows in the master table.

DataSet ds = new DataSet();
ds.ReadXml("sample_db.xml", XmlReadMode.ReadSchema);

progress = new frmProgress();

progress.progressBar1.Maximum = ds.Tables[0].Rows.Count - 1;
progress.progressBar1.Value = 0;
progress.progressBar1.Step = 1;



The DataRowMerged event is fired when a data row has been merged successfully. In this event, we simply increase the value of the progress bar by 1.

private void mailMerge1_DataRowMerged(object sender,
    TXTextControl.DocumentServer.MailMerge.DataRowMergedEventArgs e)

Download this Visual Studio project and try it on your own. A TX Text Control .NET for Windows Forms X10 (20.0) full or trial version is required.