Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Created April 17, 2024 17:29
Show Gist options
  • Save bjoerntx/ea339400b308b0e115831e29afc0c9f3 to your computer and use it in GitHub Desktop.
Save bjoerntx/ea339400b308b0e115831e29afc0c9f3 to your computer and use it in GitHub Desktop.
public IActionResult Index()
{
using (var tx = new TXTextControl.ServerTextControl())
{
var filename = "computers.docx";
tx.Create();
tx.Load($"Documents/{filename}", TXTextControl.StreamType.WordprocessingML);
var styleManager = new StyleManager(tx);
styleManager.ApplyStyles();
var saveSettings = new TXTextControl.SaveSettings
{
CssSaveMode = TXTextControl.CssSaveMode.Inline
};
tx.Save($"Documents/{filename}.htm",
TXTextControl.StreamType.HTMLFormat,
saveSettings);
using (var sr = new StreamReader($"Documents/{filename}.htm"))
{
ViewBag.Document = sr.ReadToEnd();
}
}
return View();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment