Created
November 16, 2023 14:11
-
-
Save bjoerntx/f9599004d0de3232c4efb976def9a241 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[HttpGet] | |
[Route("Home/LoadDocument")] | |
public IActionResult LoadDocument() | |
{ | |
byte[] document; | |
using (var tx = new TXTextControl.ServerTextControl()) | |
{ | |
tx.Create(); | |
tx.Load("App_Data/invoice.tx", TXTextControl.StreamType.InternalUnicodeFormat); | |
var jsonData = System.IO.File.ReadAllText("App_Data/data.json"); | |
using (var mailMerge = new MailMerge { TextComponent = tx }) | |
{ | |
mailMerge.MergeJsonData(jsonData, true); | |
} | |
tx.Save(out document, TXTextControl.BinaryStreamType.InternalUnicodeFormat); | |
} | |
return new JsonResult(document); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment