Skip to content

Instantly share code, notes, and snippets.

@bjoerntx

bjoerntx/test.cs Secret

Created July 5, 2023 13:57
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/f149c3c2fc571fcfcfe9835addeb9b41 to your computer and use it in GitHub Desktop.
Save bjoerntx/f149c3c2fc571fcfcfe9835addeb9b41 to your computer and use it in GitHub Desktop.
byte[] document;
using (TXTextControl.ServerTextControl tx = new TXTextControl.ServerTextControl()) {
tx.Create();
tx.Load("App_Data/vaccination_form.tx", TXTextControl.StreamType.InternalUnicodeFormat);
using (TXTextControl.DocumentServer.MailMerge mm =
new TXTextControl.DocumentServer.MailMerge()) {
mm.TextComponent = tx;
mm.FormFieldMergeType = TXTextControl.DocumentServer.FormFieldMergeType.Preselect;
mm.RemoveEmptyFields = false;
// pre-select form fields with known data and merge
// data into merge fields
mm.MergeObject(data);
}
tx.Save(out document, TXTextControl.BinaryStreamType.InternalUnicodeFormat);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment