参考下方代码:
- var spread = new GC.Spread.Sheets.Workbook(document.getElementById('ss'), {
- sheetCount: 1
- });
- var sheet = spread.getActiveSheet();
- sheet.setValue(0, 0, "a");
- sheet.setValue(1, 0, "b");
- sheet.setValue(2, 0, "c");
- // 隐藏B列
- sheet.setColumnVisible(1, false);
- //复制新spread
- var newSpread = new GC.Spread.Sheets.Workbook();
- newSpread.fromJSON(JSON.parse(JSON.stringify(spread.toJSON())));
- // 删除B列
- newSpread.getActiveSheet().deleteColumns(1, 1);
- // 对新spread做导出excel处理,此处省略
- console.log(newSpread.toJSON());
复制代码 |