多个sheet,导出指定的sheet。我现在是复制这个spread,在删除其它sheet然后导出(代码如下),但是导出的excel没有数据。
const tempSpread = new GC.Spread.Sheets.Workbook();
const jsonTmp = spread.toJSON();
tempSpread.fromJSON(jsonTmp);
const checkSheetNames: string[] = [];
tempSpread.sheets.forEach((item) => {
checkSheetNames.push(item.name());
});
checkSheetNames.splice(checkSheetNames.indexOf(sheetName), 1);
checkSheetNames.forEach((item) => {
tempSpread.removeSheet(tempSpread.getSheetIndex(item));
});
const json = tempSpread.toJSON(serializationOption || defaultSerializationOption);
excelIo.save(json, (blob: any) => {
saveAs(blob, fileName);
});
|
|