title: downloading a docx file from ajaxResponse
body: <p>So I tried to download a docx document as a report . by converting ajax response to  a blob then an url ! the result is a document word that display a message , " we're sorry . we can't open because we found a problem with it's content .
  there the main : 
      onDownloadReport: function (oEvent) {</p>
  
  <pre><code>var oAjaxBody = {
      SessionId: this.getModel("sessionModel").getData().SessionId,
      CustomerName: encodeURIComponent(this.getModel("sessionModel").getData().CustomerName.split("\n")[0]),
      TenantInfo: encodeURIComponent(this.getModel("sessionModel").getData().TenantInfo)
          };
  var sServiceUrl = "/SDC_XS_TEMP/APPL/SDC/services/serviceRuntime/xsjs/SDC_REPORT_GENERATE_MM.xsjs";
  
  var me = this;
  $.ajax({
      url: sServiceUrl,
      type: "POST",
      responseType:'arraybuffer',
      contentType: "application/json",
      data: JSON.stringify(oAjaxBody),
      // dataType: "json",
      success: function (oAjaxResponse) {
          var content = oAjaxResponse;
          var fileName = 'rapport.docx'; // You can use the .txt extension if you want
          me.downloadwithpost(fileName, content);
      },
      error: function (oError) {
          console.log("failure");
      }
  
  });
  </code></pre>
  
  <p>and this is the function </p>
  
  <pre><code>downloadwithpost: function (filename, content) {
      var link = document.createElement('a');        
      var bytes = new Array(content.length);
      // var bytes = new Array(content.length);
      for (var i = 0; i &lt; content.length; i++) {
          bytes[i] = content.charCodeAt(i);
      }
      var byteArray = new Uint8Array(bytes);
      var blob = new Blob([byteArray], {
          type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document"                   
      });
      var url = URL.createObjectURL(blob);
      var oItem = {
          documentId: url,
          fileName: "rapport.docx",
          thumbnailUrl: "",
          url: url,
          selected: true
      };
      var oUploadCollection = this.getView().byId("uploadCollection");
      var newItem = new sap.m.UploadCollectionItem(oItem);
      oUploadCollection.addItem(newItem);
      oUploadCollection.downloadItem(newItem, true);
  }
  </code></pre>