本帖最后由 Derrick.Jiao 于 2021-7-23 17:11 编辑
您可以用getSelections获取当前的选区,然后通过遍历该选区的行列去setStyle
例如
- var selections = sheet.getSelections();
- var selectionIndex = 0, selectionCount = selections.length;
- for (; selectionIndex < selectionCount; selectionIndex++) {
- var selection = selections[selectionIndex];
- for (var i = selection.row; i < (selection.row + selection.rowCount); i++) {
- for (var j = selection.col; j < (selection.col + selection.colCount); j++) {
- sheet.setStyle(i, j, style, GC.Spread.Sheets.SheetArea.viewport);
- }
- }
- }
复制代码
|