Created
July 18, 2018 11:42
-
-
Save bjoerntx/012649afc127e9498264f4607e4d51a3 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
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); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment