daily pastebin goal
3%
SHARE
TWEET

Untitled

a guest Jul 18th, 2018 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function LoadDocument(template) {
  2.   var serviceURL = "/ReportingCloud/Template?TemplateName=" + template;
  3.  
  4.   // call the "GET Template" controller method with a template name
  5.   $.ajax({
  6.       type: "GET",
  7.       url: serviceURL,
  8.       contentType: 'application/json',
  9.       success: successFunc,
  10.       error: errorFunc
  11.   });
  12.  
  13.   function successFunc(data, status) {
  14.  
  15.       streamType = TXTextControl.StreamType.InternalUnicodeFormat;
  16.  
  17.       // create the proper StreamType based on the extension
  18.       if (template.endsWith("docx")) {
  19.           streamType = TXTextControl.StreamType.WordprocessingML;
  20.       }
  21.       else if (template.endsWith("doc")) {
  22.           streamType = TXTextControl.StreamType.MSWord;
  23.       }
  24.       else if (template.endsWith("rtf")) {
  25.           streamType = TXTextControl.StreamType.RichTextFormat;
  26.       }
  27.  
  28.       // load the document into the widget
  29.       textControl1.loadDocument(streamType, data);
  30.  
  31.       // enable the save button and set heading
  32.       $("#saveBtn").removeAttr("disabled");
  33.       loadedDocument = template;
  34.       $("#documentName").text(loadedDocument);
  35.   }
  36.  
  37.   function errorFunc(data, success) {
  38.       console.log(data);
  39.   }
  40. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top