Products Technologies Demo Docs Blog Support Company

Use XML Schemas in TX Text Control Words

TX Text Control Words connects to databases via MS SQL Server, ADO.NET, or ODBC, or loads XML schema files to provide field names and data relations for reporting templates. Exporting a DataSet schema to XML with WriteXmlSchema gives designers access to the full data structure.

Use XML Schemas in TX Text Control Words

With Text Control Reporting, the royalty-free template designer TX Text Control Words is where everything starts and a new report is born. You create templates in a well-known MS Word compatible editor with typical word processing elements such as tables, headers and footers and text frames. Connecting to data sources enables the insertion of proper field names and matching merge block elements.

Supported data sources are connections to existing installed databases such as MS SQL Server, all ADO.NET and ODBC connections and other installed adapters. Additionally, you can load XML files as data sources.

Use XML schemas in TX Text Control Words

When a data source is loaded, not only the data is available for a report preview, but also the structure and data relations to insert proper field names for prefixed fields (what's this?) and merge blocks (what's this?).

Consider the following simple DataSet structure:

Use XML schemas in TX Text Control Words

Instead of providing your users access to the actual databases, an XML schema of databases without data can be created and used in TX Text Control Words. The following code shows how to export the data structure as XML from a DataSet:

DataSet ds = new DataSet();

DataTable dtCustomer = new DataTable("customer");
dtCustomer.Columns.Add("id");
dtCustomer.Columns.Add("company");
dtCustomer.Columns.Add("name");

DataTable dtInvoice = new DataTable("invoice");
dtInvoice.Columns.Add("id");
dtInvoice.Columns.Add("customerID");
dtInvoice.Columns.Add("invoiceNumber");

ds.Tables.AddRange(new DataTable[] { dtCustomer, dtInvoice });

DataRelation drCustomerInvoice = new DataRelation(
    "CustomerInvoice",
    dtCustomer.Columns["id"],
    dtInvoice.Columns["customerID"]);

ds.Relations.Add(drCustomerInvoice);

ds.WriteXmlSchema("dataset.xml");

If you want to create a dumb of the data as well, you can export the data and the structure with the following code:

ds.WriteXml("dataset.xml", XmlWriteMode.WriteSchema);

When loading this XML file using the Load XML File menu item of the Select Data Source drop-down button, the data structure, field names and data relations are available in the designer.

Use XML schemas in TX Text Control Words

When inserting a new field from the main table customer, the related table invoice is visible in the tree view automatically.

Use XML schemas in TX Text Control Words

Providing your users an XML file is a safe and reliable way to enable the available data structure in TX Text Control Words. Try it on your own and download your trial version today.

Stay in the loop!

Subscribe to the newsletter to receive the latest updates.

Reporting

The Text Control Reporting Framework combines powerful reporting features with an easy-to-use, MS Word compatible word processor. Users can create documents and templates using ordinary Microsoft Word skills. The Reporting Framework is included in all .NET based TX Text Control products including ASP.NET, Windows Forms and WPF.

See Reporting products

Related Posts

ASP.NETReportingHTML5

Creating Your First ASP.NET Reporting Application

The MailMerge and ServerTextControl components of TX Text Control .NET Server for ASP.NET enable server-side reporting in Web Forms. A template.docx merges with XML data via a button click…


ASP.NETReportingTutorial

New Online Sample: Build your First Report

A new interactive online demo walks through building a report with TX Text Control in three steps: preparing JSON data in a live editor, creating a template with merge fields and repeating blocks,…


ReportingDocumentationReportingCloud

Create your First Document with ReportingCloud

ReportingCloud documentation now includes interactive tutorials for creating documents without code. Users enter an API key, choose a format such as PDF or DOCX, customize the merge data payload,…


CloudReportingMail Merge

MailMerge: Starting Each Merge Block on a New Page

Merge blocks in TX Text Control repeat based on matching data rows. Applying ParagraphFormat.PageBreakBefore to the first paragraph of a block forces each repetition onto a new page. Section…


ReportingTutorialWeb API

Using MailMerge with JSON Data

Merge document templates with JSON data using TX Text Control MailMerge by converting nested JSON strings into DataSet objects via Newtonsoft.Json. The JSON is first transformed to XML, then…

Share on this blog post on: