0

I'm developing a PowerPoint add-in with the feature to upload a presentation to the web server. I have a presentation with 100MB exact size. I used the guidelines for using GetFileAsync in Office docs. It is working for small presentation files. But the add-in message of not responding when I select largely presentation file. I did break point to the code and I found out that the cause of not responding is in js due to the large array slices. There is no problem with getting the slices of a large file. But the problem in when slices array concat to be one array.

Here's the code came from Office docs where the issue occurred.

function onGotAllSlices(docdataSlices) {
  var docdata = [];

  for (var i = 0; i < docdataSlices.length; i++) {
    docdata = docdata.concat(docdataSlices[i]);
  }

  var fileContent = new String();

  for (var j = 0; j < docdata.length; j++) {
    fileContent += String.fromCharCode(docdata[j]);
  }

  // Now all the file content is stored in 'fileContent' variable,
  // you can do something with it, such as print, fax...
}

I don't know if it is a bug or issue on the part of Office Add-in. I hope someone helps me.

Thanks in advance.

UPDATES:

I simplify the given function like this:

function onGotAllSlices(docdataSlices) {

  var fileContent = new String();

  for(var i = 0; i < docdataSlices.length; i++) {
    var docdata = docdataSlides[i];

    for(var j = 0; j < docdata.length; j++) {
      fileContent += String.fromCharCode(docdata[j]);
    }
  }

  var base64String = window.btoa(fileContent);
}

So far, there is no 'out of memory' issue at all. But there is another issue with error message of '8007000e. “Not enough storage is available to complete this operation”' when the fileContent convert in base64String.

dhaz
  • 33
  • 3
  • Have you ever found a solution for this? I'm getting the same “Not enough storage is available to complete this operation” error when trying to get an email and/or attachment that is bigger then 6mB. Clien : Office2013 (uses IE11) – Lumpenstein Nov 27 '19 at 14:48

1 Answers1

0

This looks like it's a performance problem. Have you checked How to extend an existing JavaScript array with another array, without creating a new array? ? .concat will create a new array from the previous two ones, which you're re-assigning. Perhaps there's a better way of doing this?

Mavi Domates
  • 4,262
  • 2
  • 26
  • 45
  • Thanks for this. I try it but there still out of memory issue. Is it possible to set or extend the memory used by the js or browser? MS Office host IE (I don't know the version) for window client based. – dhaz Aug 16 '17 at 01:11
  • I don't think that's possible mate – Mavi Domates Aug 16 '17 at 10:00