Version X14 comes with pre-configured ribbon tabs for all typical tasks of TX Text Control. One of these ribbon tabs is the RibbonReportingTab. It provides a fully featured ribbon tab to create MS Word compatible templates for the Text Control Reporting Framework. Data sources such as MS SQL, ODBC and ADO.NET can be loaded, the master table can be set and available merge blocks and merge fields can be inserted.
This new ribbon tab is based on the new public class DataSourceManager that encapsulates the complete handling, logic and ready-to-use dialog boxes for the reporting template creation task. The following diagram shows the new classes in detail:
Essentially, the DataSourceManager provides all information required to create a fully-featured template designer. Like with MailMerge, a data source can be loaded from a DataSet, DataTable, Json, an object or XML. In this sample, a simple .NET class is used as a data source:
This sample shows the typical work-flow of a template designer:
After clicking the button Load Data Source, a new instance of the DataSourceManager is created and the data object is loaded.
When a data source is loaded into the DataSourceManager, a ComboBox is bound to all available DataTables. Additionally, the events PossibleMergeFieldColumnsChanged and PossibleMergeBlockTablesChanged are attached to update two other ComboBoxes that list the available merge fields and merge blocks.
When the internal master table is changed, the ComboBoxes are updated with the available fields and blocks:
If the input position is inside a merge block, only the available fields and blocks inside this block should be available. Therefore, the SubTextPartEntered event is used to define a new internal master table. The ComboBoxes are updated automatically through the attached events.
When clicking the Preview button, the new Merge method of the DataSourceManager is used to merge the data into the template:
Using the DataSourceManager, the complete task of designing mail merge templates can be realized. The class encapsulates the work-flow, logic and all required dialog boxes and preview functionality.
Stay tuned for more details about X14!