2金币
本帖最后由 Richard.Huang 于 2023-10-20 10:11 编辑
产品:SpreadJS
版本:V16.1.2
模版配置好的列有样式,因为在模版前面又手动插入了几列,导致之前模版列头样式错乱对不上了,这个有什么api可以解决嘛
- for (let c = 0; c < tableCount; c++) {
- let dataField = table.getColumnDataField(c);
- let name = table.getColumnName(c);
- let tableColumn = new GC.Spread.Sheets.Tables.TableColumn();
- const colIndex = c + (startColumn - 1);
- const visible = activeSheet.getColumnVisible(colIndex);
- if (visible) {
- tableColumn.name(name);
- tableColumn.dataField(dataField);
- tableColumns.push(tableColumn);
- } else {
- unvisibleList.push(dataField);
- activeSheet.setColumnVisible(
- colIndex,
- true,
- GC.Spread.Sheets.SheetArea.viewport
- );
- activeSheet.setColumnVisible(
- colIndex + columnsCount,
- false,
- GC.Spread.Sheets.SheetArea.viewport
- );
- }
- }
- // 隐藏列
- console.log(unvisibleList, "unvisibleList");
- console.log(tableColumns, "tableColumns1");
- historyColumns.forEach((element) => {
- // 添加新的column
- let newTableColumn = new GC.Spread.Sheets.Tables.TableColumn();
- newTableColumn.name(element.name);
- newTableColumn.dataField(element.value);
- tableColumns.unshift(newTableColumn);
- activeSheet.setColumnWidth(0, width, GC.Spread.Sheets.SheetArea.viewpor);
- // table新增一列
- table.insertColumns(tableCount - 1, 1, true);
- });
- console.log(tableColumns, "tableColumns");
- table.bindColumns(tableColumns);
复制代码
|
|