版本12.2.2
方法报错:excelIO.open(blob, function (json) {}
浏览器:谷歌最新版
代码:
openExcel () {
debugger
var excelIO = new ExcelIO.IO();
console.log(excelIO);
// Download Excel file
var excelFilePath = 'static/test.xlsx';
var xhr = new XMLHttpRequest();
xhr.open('GET', excelFilePath, true);
xhr.responseType = 'blob';
xhr.onload = function(e) {
if (this.status == 200) {
// get binary data as a response
var blob = this.response;
// convert Excel to JSON
excelIO.open(blob, function (json) {
var workbookObj = json;
this.spread.fromJSON(workbookObj);
console.log(json);
}, function (e) {
// process error
alert(e.errorMessage);
}, {});
}
};
xhr.send();
}
|
|