Created
March 21, 2024 13:38
-
-
Save bjoerntx/9f2a0b780f2c1d974626f66b367f6232 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
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