The reporting engine MailMerge is used to merge templates with data. In combination with the HTML5 based MVC editor Web.TextControl, the created template can be merged in the MVC controller and loaded back into the view.

The following HttpPost method Merge accepts the model DocumentViewModel which contains the template encoded as a Base64 string. The data source is loaded into a new DataSet object. Finally, the template is loaded into a new instance of the MailMerge class and merged with the loaded DataSet. The created document is returned to the view.

Loading...

The contoller method is called from the Javascript function Merge. The current document is saved into a Base64 encoded string and is being sent using AJAX to the controller method Merge.

When the controller method returns successfully, the merged document is loaded into the editor.

Loading...

Download the sample from GitHub and test it on your own.

GitHub

Download and Fork This Sample on GitHub

We proudly host our sample code on GitHub.com/TextControl.

Please fork and contribute.

Requirements for This Sample

  • Visual Studio 2012 or better
  • TX Text Control .NET Server for ASP.NET (trial sufficient)