本帖最后由 Richard.Ma 于 2022-11-30 19:11 编辑
在线文档也是一样的,可以下载后再去加载就行,比如通过下面的xhrequest方法来加载一个网上的xlsx
- var excelIo = new GC.Spread.Excel.IO();
- xhrequest("https://gdr.openei.org/files/672/Z_GC.xlsx",function(bolb){
- excelIo.open(bolb, function (json) {
- var workbookObj = json;
- spread.fromJSON(workbookObj);
- }, function (e) {
- // process error
- console.log(e);
- });
- });
复制代码
- async function xhrequest(url,callback) {
- let data = await fetch(url)
- .then((response) => response.blob())
- .then((res) => {
- console.log(res);
- let blob = new Blob([res]);
- callback(blob);
- });
- return data;
- }
复制代码
|