- $(document).ready(
- function() {
- var workbook = new GC.Spread.Sheets.Workbook(document
- .getElementById("ss"));
- //ImportFile();
- var excelIo = new GC.Spread.Excel.IO();
- var excelFilePath = 'http://localhost:8080/file/1.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;
- spread.fromJSON(workbookObj);
- alert(json)
- }, function (e) {
- // process error
- alert(e.errorMessage);
- }, {});
- }
- };
- xhr.send();
- });
复制代码
用了上面的方法报上传格式不正确 |