SpreadJs使用
初始化Spread实例
1 | let spread = new GC.Spread.Sheets.Workbook(document.getElementById('spread')) |
读取JSON模板 导入到spread里
1 | spread.fromJSON(require(`../../static/file/${fileNameData[tableName]}`)) |
浮动模式插入数据
1 | const floatForm = (spread, tableName, dataSource) => { |
事件绑定
1 | spread.bind(spreadNS.Events.CellClick, function (e, args) { |
所有单元格都不能编辑
1 | sheet.setIsProtected(true); |
导出操作
1 | const saveExcel = (spread, fileName) => { |
设置表格样式
1 | /** |
浮动绘制
1 | spreadUtil.dataRender = (spread, tableName, dataSource, sheetVal) => { |
spread对象转json
1 | spread.toJSON() |
获取单元格数据
1 | sheet.getValue(7,7); |
单元格删除数据
1 | sheet.clear(0, 0, 10, 10, GC.Spread.Sheets.SheetArea.viewport, GC.Spread.Sheets.StorageType.data); |
移动操作
1 | sheet.moveTo(0, 0, 14, 14, 7, 7, GC.Spread.Sheets.CopyToOptions.all); |