Client-side data source
Design with JSON loaded in JavaScript
The editor starts empty and receives the invoice data after the page loads. Use the Reporting ribbon to insert fields, nested values, and repeating blocks from that live data source.
Data source ready in the browserJSON API
Try fields such as Customer_Customer.Name and the repeating Sales_SalesOrderDetail block. The data is loaded by TXTextControl.loadJsonData.
Ready to tryUse the controls above to interact with this demo.
What this demonstrates
Data Source from JavaScript
This sample demonstrates the client-side half of a reporting workflow: the page obtains JSON asynchronously, passes it to the editor, and lets users design the template with the Reporting ribbon.
Key members
Load the JSON data source
TXTextControl.loadJsonData
Open the Reporting ribbon
TXTextControl.ribbon.selectedTab
How it works
The browser fetches the converted invoice JSON and passes it to TXTextControl.loadJsonData after the editor and Reporting ribbon are ready. Root properties become fields, nested objects expose dot-notation members such as Customer_Customer.Name, and arrays such as Sales_SalesOrderDetail supply repeating merge blocks.
Because the source is loaded in JavaScript, an application can obtain it from an API, let a user choose a record, or refresh it without rebuilding the Razor view. The same JSON shape can later be reused by server-side MailMerge.MergeJsonData.
const response = await fetch("/data-source");
const json = await response.text();
TXTextControl.loadJsonData(json, () => {
TXTextControl.ribbon.selectedTab = "tabReports";
}, showError);
NuGet packages
TXTextControl.TextControl.Core.SDK
34.0.4
Provides the core document model and server-side document processing APIs.
dotnet add package TXTextControl.TextControl.Core.SDK --version 34.0.4
Provides the browser-based TX Text Control document editor and JavaScript API.
dotnet add package TXTextControl.Web --version 34.4.0
TXTextControl.Web.DocumentEditor.Backend
34.4.0
Hosts the WebSocket-based backend used by the browser document editor.
dotnet add package TXTextControl.Web.DocumentEditor.Backend --version 34.4.0