A key concept and advantage of Text Control Reporting is the fact that the template doesn't store any database connection information which makes a template reusable, even if your database changes.

A template simply contains merge field and table names for merge blocks. When a new database structure is in use, all you need to do is to change the field names. Also, when reusing legacy templates from MS Word, you can easily change the field names and use this template for the merging process using TX Text Control.

As part of a feasibility study for a customer in our consulting unit, we created a dialog prototype that helps users to remap merge fields to new data sources.

We thought to share this project as it might be helpful for your own applications. The following screenshot shows this dialog in action:

[Click image to enlarge]

The creation of the dialog is very easy. As parameters, a DataSet for the new data and the template path is required:

Loading...

The dialog itself is very easy to use. Using the Next and Back buttons, you can navigate through the merge fields. The selected field can be replaced with a new data column name by clicking a field name in the left hand side list view box. The drop-down box Select Data Table can be used to switch between the available DataTables.

On closing the dialog, the template changes can be saved.

This sample project shows a lot of tricks and nice little features such as how to scroll to and highlight a field or how to navigate through existing fields in a document.

Download or fork the project on GitHub and browse the commented code. Feel free to use this sample for your own applications. Happy coding!

GitHub

Download and Fork This Sample on GitHub

We proudly host our sample code on github.com/TextControl.

Please fork and contribute.

Requirements for This Sample

  • Visual Studio 2012 or better
  • TX Text Control .NET Server for ASP.NET (trial sufficient)