1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
| import { Disposable, ICommandService, IUniverInstanceService, UniverInstanceType, Workbook } from '@univerjs/core';
| import { SetSelectionsOperation } from '@univerjs/sheets';
|
| export class JnpfSheetsRangeService extends Disposable {
| constructor(
| @IUniverInstanceService private readonly _univerInstanceService: IUniverInstanceService,
| @ICommandService private readonly _commandService: ICommandService,
| ) {
| super();
| }
|
| // 恢复选区
| public recoveryRange(row: number, col: number) {
| const unit = this._univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET);
| const unitId = unit!.getUnitId();
| const sheet = unit!.getActiveSheet();
| const subUnitId = sheet?.getSheetId();
|
| this._commandService
| .executeCommand(SetSelectionsOperation.id, {
| selections: [
| {
| range: {
| endColumn: col,
| endRow: row,
| rangeType: 0,
| startColumn: col,
| startRow: row,
| },
| },
| ],
| subUnitId,
| type: 2,
| unitId,
| })
| .then();
| }
| }
|
|