// 获取附件信息
getExcelInfo = async () => {
const res = await getExcelById(4514460312260224);
console.log(res, '文件流信息');
this.setState({ file: res });
let excelIo = new Excel.IO();
this.spread = GC.Spread.Sheets.findControl(document.getElementById('spreadDom')); //初始化spread
excelIo.open(res, json => {
this.spread.fromJSON(json);
const sheet = this.spread.getActiveSheet();
this.appendColumnData(sheet);
});
}; componentDidMount() {
// 创建spreadWorkbook
GC.Spread.Common.CultureManager.culture('zh-cn'); //设置中文
this.getExcelInfo();
this.spreadWorkbook = new GC.Spread.Sheets.Workbook(this.spreadDom);
this.spreadWorkbook && this.initSpreadWorkbook(this.spreadWorkbook);
} |