您好,因为表格后面与合并单元格相交了。当表格删除行的时候会影响合并单元格。
绑定前,调整下表格行数
- var sheet = spread.getActiveSheet();
- var tables = sheet.tables.all();
- for(var i = 0; i < tables.length; i++){
- var table = tables[i];
- var bindingPath = table.bindingPath();
- if(bindingPath){
- var tableData = data[bindingPath]
- var dataRange = table.dataRange()
- if(tableData && tableData.length){
- var tableRowCount = tableData.length;
- if(dataRange.rowCount == tableRowCount){
- continue;
- }
- else if(dataRange.rowCount > tableRowCount){
- sheet.deleteRows(dataRange.row, dataRange.rowCount - tableRowCount);
- }
- else{
- sheet.addRows(dataRange.row, tableRowCount - dataRange.rowCount);
- }
-
- }
- else{
- sheet.deleteRows(dataRange.row -1 , dataRange.rowCount);
- }
-
- }
- }
- sheet.setDataSource(new GC.Spread.Sheets.Bindings.CellBindingSource(data))
-
复制代码 |