Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function LoadDocument(template) {
- var serviceURL = "/ReportingCloud/Template?TemplateName=" + template;
- // call the "GET Template" controller method with a template name
- $.ajax({
- type: "GET",
- url: serviceURL,
- contentType: 'application/json',
- success: successFunc,
- error: errorFunc
- });
- function successFunc(data, status) {
- streamType = TXTextControl.StreamType.InternalUnicodeFormat;
- // create the proper StreamType based on the extension
- if (template.endsWith("docx")) {
- streamType = TXTextControl.StreamType.WordprocessingML;
- }
- else if (template.endsWith("doc")) {
- streamType = TXTextControl.StreamType.MSWord;
- }
- else if (template.endsWith("rtf")) {
- streamType = TXTextControl.StreamType.RichTextFormat;
- }
- // load the document into the widget
- textControl1.loadDocument(streamType, data);
- // enable the save button and set heading
- $("#saveBtn").removeAttr("disabled");
- loadedDocument = template;
- $("#documentName").text(loadedDocument);
- }
- function errorFunc(data, success) {
- console.log(data);
- }
- }
Add Comment
Please, Sign In to add comment