Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Created March 21, 2024 13:38
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/9f2a0b780f2c1d974626f66b367f6232 to your computer and use it in GitHub Desktop.
Save bjoerntx/9f2a0b780f2c1d974626f66b367f6232 to your computer and use it in GitHub Desktop.
saveDocument(name: string) {
let streamType = TXTextControl.StreamType.InternalUnicodeFormat;
switch (this.selectedDocument?.name.split('.').pop()) {
case 'docx':
streamType = TXTextControl.StreamType.WordprocessingML;
break;
case 'rtf':
streamType = TXTextControl.StreamType.RichTextFormat;
break;
case 'doc':
streamType = TXTextControl.StreamType.MSWord;
break;
}
TXTextControl.saveDocument(streamType, (document: any) => {
if (this.selectedDocument) {
this.selectedDocument.data = document.data;
// Send a POST request to the server
this.http.post('/document/save', this.selectedDocument).subscribe(
(result) => {
alert("Document saved successfully");
this.getFilenames();
}
);
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment