附件demo实现思路您可以参考下,主要封装方法代码如下:
- // 封装方法,实现表头向上插入行
- function addRowColHeader(row, rowCount) {
- sheet.suspendPaint();
- var oldRowCount = sheet.getRowCount(GC.Spread.Sheets.SheetArea.colHeader);
- sheet.setRowCount(oldRowCount + rowCount, GC.Spread.Sheets.SheetArea.colHeader);
- //修改列头单元格value
- for(var c = 0; c < sheet.getColumnCount(); c++) {
- var value = sheet.getValue(0, c, GC.Spread.Sheets.SheetArea.colHeader);
- sheet.setValue(oldRowCount + rowCount - 1, c, value, GC.Spread.Sheets.SheetArea.colHeader);
- sheet.setValue(0,c,null, GC.Spread.Sheets.SheetArea.colHeader);
- }
- sheet.resumePaint();
- }
复制代码
|