Created
January 14, 2021 21:40
-
-
Save bjoerntx/732202ae58a6a937fb8ca30441c1dbd2 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
public static string MergeWorkorder(Workorder workorder) { | |
using (TXTextControl.ServerTextControl tx = new TXTextControl.ServerTextControl()) { | |
tx.Create(); | |
// load the work order template | |
tx.Load(HttpContext.Current.Server.MapPath( | |
"~/App_Data/workorder.tx"), | |
TXTextControl.StreamType.InternalUnicodeFormat); | |
MailMerge mm = new MailMerge() { | |
TextComponent = tx | |
}; | |
// merge the data into the template | |
mm.MergeObject(workorder); | |
// generate a unique filename and save the work order | |
var sFileName = Helpers.GenerateUID(5); | |
tx.Save(HttpContext.Current.Server.MapPath("~/App_Data/" + sFileName + ".tx"), | |
TXTextControl.StreamType.InternalUnicodeFormat); | |
return sFileName; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment