Created
March 21, 2024 13:35
-
-
Save bjoerntx/4a8109d836c3da66cc942fdd4f83828a 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
loadDocument(name: string) { | |
// Call HTTP GET with the name of the document as a query parameter | |
this.http.get<DocumentData>('/document/load', { | |
params: { | |
name: name | |
} | |
}).subscribe( | |
(result) => { | |
this.selectedDocument = result; | |
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.loadDocument(streamType, this.selectedDocument.data, () => { | |
TXTextControl.setEditMode(1); | |
}); | |
}, | |
(error) => { | |
console.error(error); | |
} | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment