Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Created November 15, 2016 14:17
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/e48b4a30d6794f7f95b662fdecf7f173 to your computer and use it in GitHub Desktop.
Save bjoerntx/e48b4a30d6794f7f95b662fdecf7f173 to your computer and use it in GitHub Desktop.
private void cbPreview_CheckedChanged(object sender, EventArgs e)
{
// preview the mail merge document
if (cbPreview.Checked)
{
// save the template
gbMergeElements.Enabled = false;
textControl1.EditMode = TXTextControl.EditMode.ReadAndSelect;
textControl1.Save(out previewTemplate,
TXTextControl.BinaryStreamType.InternalUnicodeFormat);
// merge the template using the DataSourceManager
IList<byte[]> documents =
dsManager.Merge(previewTemplate, textControl1);
// load the merged document into TextControl
textControl1.Load(documents[0],
TXTextControl.BinaryStreamType.InternalUnicodeFormat);
}
else
{
// load back the stored template
gbMergeElements.Enabled = true;
textControl1.EditMode = TXTextControl.EditMode.Edit;
textControl1.Load(previewTemplate,
TXTextControl.BinaryStreamType.InternalUnicodeFormat);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment