Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Created December 9, 2015 10:05
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/a28c74a08511d7490d02 to your computer and use it in GitHub Desktop.
Save bjoerntx/a28c74a08511d7490d02 to your computer and use it in GitHub Desktop.
[HttpPost]
public bool SaveTemplate(DocumentViewModel model)
{
string name = model.DocumentName;
byte[] document = Convert.FromBase64String(model.BinaryDocument);
using (TXTextControl.ServerTextControl tx =
new TXTextControl.ServerTextControl())
{
tx.Create();
tx.Load(document, TXTextControl.BinaryStreamType.InternalUnicodeFormat);
tx.Save(Server.MapPath("/App_Data/documents/" + model.DocumentName),
TXTextControl.StreamType.WordprocessingML);
}
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment