Skip to content

Can Base64 conversion be handled within the code? #23

@SKALIDHASAN

Description

@SKALIDHASAN

Thanks for the Update on IE10, One more suggestion is to handle the Base64 conversion with in the code. Currently you have given an option to paste the Base64 string, can this be dynamically generated via the code accessing the variable "f" in the below code snippet?

function b64it(xlsxFile) {

    var xlsx = XLSX.readFile(xlsxFile, {type: 'file'});//<--How the base64 conversion should be handled
    process_xlsx(xlsx);
}

function handleDrop(e) {
    e.stopPropagation();
    e.preventDefault();
    var files = e.dataTransfer.files;
    var i,f;
    for (i = 0, f = files[i]; i != files.length; ++i) {
    b64it(f);//<-- f represents one of the files in the List

    /*
        var reader = new FileReader();
        var name = f.name;
        reader.onload = function(e) {
            var data = e.target.result;
            //var xlsx = XLSX.read(data, {type: 'binary'});
            var arr = String.fromCharCode.apply(null, new Uint8Array(data));
            var xlsx = XLSX.read(btoa(arr), {type: 'base64'});
            process_xlsx(xlsx);
        };
        //reader.readAsBinaryString(f);
        reader.readAsArrayBuffer(f);
    */  

    }//for

}//handleDrop

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions