Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Created March 25, 2021 11:08
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/b5284e427890d4119c305570d297787b to your computer and use it in GitHub Desktop.
Save bjoerntx/b5284e427890d4119c305570d297787b to your computer and use it in GitHub Desktop.
function loadDocument(document, filename) {
var st = TXTextControl.StreamType.InternalUnicodeFormat;
if (filename.endsWith(".docx") === true) {
st = TXTextControl.StreamType.WordprocessingML; }
else if (filename.endsWith(".doc") === true) {
st = TXTextControl.StreamType.MSWord; }
else if (filename.endsWith(".rtf") === true) {
st = TXTextControl.StreamType.RichTextFormat; }
else if (filename.endsWith(".html") === true) {
st = TXTextControl.StreamType.HTMLFormat; }
else if (filename.endsWith(".txt") === true) {
st = TXTextControl.StreamType.PlainText; }
TXTextControl.loadDocument(st, document);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment