活动单元格右移引起的新增列发生在ColumnChanged事件之后,可以加上setTimeout处理一下。
示例代码:
- sheet.bind(GC.Spread.Sheets.Events.ColumnChanged, function (e, info) {
- console.log(info);
- setTimeout(() => {
- console.log(sheet.getSelections())
- var intIndex = sheet.getSelections()[0].col;
- sheet.copyTo(0, intIndex + 1, 0, intIndex, sheet.getRowCount(), 1, GC.Spread.Sheets.CopyToOptions.style);
- }, 0);
- });
复制代码
|