TX Text Control provides a ready-to-use Ribbon bar with fully functional ribbon tabs for various tasks including the RibbonReportingTab ╰ TX Text Control .NET for Windows Forms
╰ Windows.Forms.Ribbon Namespace
╰ RibbonReportingTab Class
The RibbonReportingTab class represents a Windows Forms ribbon tab to integrate mail merge and reporting functionality. to include reporting features.
The RibbonReportingTab can be connected to a DataSourceManager ╰ TX Text Control .NET for Windows Forms
╰ DocumentServer.DataSources Namespace
╰ DataSourceManager Class
The DataSourceManager class is designed for handling all existing kinds of data sources which can be used together with the MailMerge class. object that encapsulates the complete handling, logic and ready-to-use dialog boxes for the reporting template creation task.
When loading a data source into the DataSourceManager, the data structure is used to fill the Insert Merge Field drop-down lists. Consider the following simple JSON data object:
When loaded using the DataSourceManager, the drop-down list displays the data column names:
Even if the data column names in this example are not really cryptic, real-world database structures and naming can be complex and confusing for end-users. This concept shows how to change the drop-down item display text for merge fields to provide end-users additional information.
The first data row of the data source is used to change the drop-down items with user-friendly strings. The following data source is used in this example:
When changing the strings after the data has been loaded into the DataSourceManager, the drop-down items show user-friendly strings instead of the actual data column names.
When clicking on a merge field drop-down item, a valid field is inserted with the actual name and not the masked user-friendly string.
The following function can be called after data has been loaded into the DataSourceManager. It finds the Insert Merge Field drop-down button, gets the currently selected master table that is automatically returned by the DataSourceManager and calls the ApplyMaskedString method:
The ApplyMaskedString function loops through all merge field drop-down items in order to replace the text property with the first associated data from the first data row in the data source. In case of a child table, the ApplyMaskedString function is called recursively.
Try this on your own and download the sample from our GitHub repository.