table的column 没有celltype的绑定。
您可以设计模板的时候把table提前设置好单元格类型。或者绑定后通过代码添加到其他行。
- var tables = sheet.tables.all();
- if(tables){
- for (var i = 0; i < tables.length; i++){
- copyTableStyle(sheet, tables[i])
- }
- }
复制代码
- function copyTableStyle(sheet, table){
- var range = table.dataRange();
- var rowHeight = sheet.getRowHeight(range.row);
- for (var i = 1; i < range.rowCount; i++) {
- // Copy Style
- sheet.copyTo(range.row + i - 1, range.col, range.row + i, range.col, 1, range.colCount, GC.Spread.Sheets.CopyToOptions.style);
- // Copy Formula
- sheet.copyTo(range.row + i - 1, range.col, range.row + i, range.col, 1, range.colCount, GC.Spread.Sheets.CopyToOptions.formula);
- // Set Row Height
- sheet.setRowHeight(range.row + i, rowHeight);
- //copyCustomerTableRowHeader
- sheet.copyTo(range.row + i - 1, 0, range.row + i, 0, 1, range.col, GC.Spread.Sheets.CopyToOptions.style);
- sheet.copyTo(range.row + i - 1, 0, range.row + i, 0, 1, range.col, GC.Spread.Sheets.CopyToOptions.value);
- }
- }
复制代码 |