Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Created June 9, 2023 13:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bjoerntx/c76ea192c4727803ebe77a0c6c45e537 to your computer and use it in GitHub Desktop.
Save bjoerntx/c76ea192c4727803ebe77a0c6c45e537 to your computer and use it in GitHub Desktop.
public IActionResult Index() {
byte[] data;
Claim claim = new Claim() {
name = "Tim Typer",
dob = new DateTime(2010, 5, 5),
};
using (TXTextControl.ServerTextControl tx = new TXTextControl.ServerTextControl()) {
tx.Create();
tx.Load("App_Data/claim_form.tx", TXTextControl.StreamType.InternalUnicodeFormat);
using (MailMerge mailMerge = new MailMerge()) {
mailMerge.TextComponent = tx;
mailMerge.FormFieldMergeType = FormFieldMergeType.Preselect;
mailMerge.MergeObject(claim);
}
tx.Save(out data, TXTextControl.BinaryStreamType.InternalUnicodeFormat);
}
return View(data);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment