Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internet explorer: The data area passed to a system call is too small. #36

Open
LeachBogdan opened this issue Jul 28, 2014 · 3 comments

Comments

@LeachBogdan
Copy link

I get this error when trying to set window.location to result.href() but only in IE. Everything works fine in Chrome or Firefox.

var data_arr = factory.prepareData(data, coldefs);
var sheet = {
    creator: userCredentials.Name,
    lastModifiedBy: userCredentials.Name,
    worksheets: [
        {
        data: data_arr,
        table: true,
        name: name
        }
    ]
};

window.location = xlsx(sheet).href(); 

is how i'm creating the sheet.

@gbelmm
Copy link

gbelmm commented Jul 29, 2014

+1 please

@nirajkrz
Copy link

i am also facing the same problem (Only In IE). Did you find any workaround for this?

@LeachBogdan
Copy link
Author

I've worked around the problem by getting the base64 and turning it into a blob using this function:

    factory.b64toBlob = function (b64Data, contentType, sliceSize) {
        contentType = contentType || '';
        sliceSize = sliceSize || 512;

        var byteCharacters = atob(b64Data);
        var byteArrays = [];

        for (var offset = 0; offset < byteCharacters.length; offset += sliceSize) {
            var slice = byteCharacters.slice(offset, offset + sliceSize);

            var byteNumbers = new Array(slice.length);
            for (var i = 0; i < slice.length; i++) {
                byteNumbers[i] = slice.charCodeAt(i);
            }

            var byteArray = new Uint8Array(byteNumbers);

            byteArrays.push(byteArray);
        }

        var blob = new Blob(byteArrays, {type: contentType});
        return blob;
    };

And then saving it using a FileSave script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants