The ASP.NET Core NuGet packages for DS Server provide all required components to create and merge templates with JSON data. This sample shows how to merge a template server-side with JSON data that has been created with the DocumentEditor.
The following model is used as the merge data model that is loaded into the editor to provide the proper merge field names and also for merging the final document server-side:
In the HomeController, JSON data is loaded and passed as the view model to the actual view that contains the editor:
╰ TXTextControl Object
╰ saveDocument Method
Saves the current document in a certain format and sends the result back asynchronously by calling a given callback function. method in the internal TX Text Control format in order to send it to the controller HTTP POST endpoint Merge:
In the controller method Merge, the document is being sent with JSON data to the DS Server Web API using the Merge ╰ TX Text Control DS Server
╰ DocumentServices.DocumentProcessing Namespace
╰ DocumentProcessing Class
╰ Merge Method
Merges a given template document with merge data. method of DocumentProcessing.
After the sample is started, find the merge fields in the Reporting tab. Insert some text, fields or repeating merge blocks:
After clicking the button Merge Template, the merged document is loaded back into the editor:
Try this on your own, create a trial token and download the sample from our GitHub account.