@univerjs/sheets 0.5.4 → 0.5.5-experimental.20250123-34738ff
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/facade.js +1 -1
- package/lib/cjs/index.js +3 -3
- package/lib/cjs/locale/en-US.js +1 -1
- package/lib/cjs/locale/fa-IR.js +1 -1
- package/lib/cjs/locale/fr-FR.js +1 -1
- package/lib/cjs/locale/ru-RU.js +1 -1
- package/lib/cjs/locale/vi-VN.js +1 -1
- package/lib/cjs/locale/zh-CN.js +1 -1
- package/lib/cjs/locale/zh-TW.js +1 -1
- package/lib/es/facade.js +2664 -1499
- package/lib/es/index.js +9211 -8683
- package/lib/es/locale/en-US.js +2 -2
- package/lib/es/locale/fa-IR.js +2 -2
- package/lib/es/locale/fr-FR.js +2 -2
- package/lib/es/locale/ru-RU.js +2 -2
- package/lib/es/locale/vi-VN.js +2 -2
- package/lib/es/locale/zh-CN.js +2 -2
- package/lib/es/locale/zh-TW.js +2 -2
- package/lib/types/basics/const/command-listener-const.d.ts +149 -13
- package/lib/types/commands/commands/remove-sheet.command.d.ts +1 -1
- package/lib/types/commands/commands/split-text-to-columns.command.d.ts +1 -1
- package/lib/types/commands/operations/selection.operation.d.ts +1 -0
- package/lib/types/commands/utils/selection-command-util.d.ts +1 -1
- package/lib/types/controllers/config.schema.d.ts +4 -0
- package/lib/types/facade/f-defined-name.d.ts +22 -16
- package/lib/types/facade/f-enum.d.ts +24 -0
- package/lib/types/facade/f-event.d.ts +474 -24
- package/lib/types/facade/f-permission.d.ts +141 -9
- package/lib/types/facade/f-range.d.ts +416 -98
- package/lib/types/facade/f-selection.d.ts +27 -1
- package/lib/types/facade/f-sheet-hooks.d.ts +3 -0
- package/lib/types/facade/f-univer.d.ts +39 -3
- package/lib/types/facade/f-workbook.d.ts +57 -60
- package/lib/types/facade/f-worksheet.d.ts +654 -209
- package/lib/types/facade/index.d.ts +2 -0
- package/lib/types/index.d.ts +2 -1
- package/lib/types/model/range-protection-rule.model.d.ts +1 -1
- package/lib/types/model/range-theme-util.d.ts +3 -3
- package/lib/types/services/permission/permission-point/const.d.ts +117 -4
- package/lib/types/services/permission/range-permission/range-protection.ref-range.d.ts +1 -1
- package/lib/types/services/permission/range-permission/range-protection.service.d.ts +1 -1
- package/lib/types/services/permission/worksheet-permission/worksheet-permission-rule.model.d.ts +1 -1
- package/lib/types/services/selections/selection-data-model.d.ts +7 -7
- package/lib/types/services/selections/selection.service.d.ts +4 -0
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +3 -3
- package/lib/umd/locale/en-US.js +1 -1
- package/lib/umd/locale/fa-IR.js +1 -1
- package/lib/umd/locale/fr-FR.js +1 -1
- package/lib/umd/locale/ru-RU.js +1 -1
- package/lib/umd/locale/vi-VN.js +1 -1
- package/lib/umd/locale/zh-CN.js +1 -1
- package/lib/umd/locale/zh-TW.js +1 -1
- package/package.json +8 -8
- package/LICENSE +0 -176
- package/lib/types/basics/__tests__/cell-type.spec.d.ts +0 -16
- package/lib/types/basics/__tests__/cell-value.spec.d.ts +0 -16
- package/lib/types/basics/__tests__/expand.data.d.ts +0 -2
- package/lib/types/basics/__tests__/expand.spec.d.ts +0 -16
- package/lib/types/basics/__tests__/rangeMerge.spec.d.ts +0 -16
- package/lib/types/basics/__tests__/row-column-value.spec.d.ts +0 -16
- package/lib/types/basics/__tests__/utils.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/add-merge-command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/clear-selection.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/copy-worksheet.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/create-command-test-bed.d.ts +0 -7
- package/lib/types/commands/commands/__tests__/delete-range.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/insert-range.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/insert-remove-rows-cols.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/move-range-commands.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/move-rows-cols.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/range-template-command.sepc.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/remove-rows-cols.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/remove-sheet.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/set-border.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/set-col-data.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/set-col-width.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/set-frozen.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/set-gridlines-command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/set-range-values.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/set-row-col-visible.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/set-row-data.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/set-row-height.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/set-style.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/set-tab-color.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/set-worksheet-default-style.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/set-worksheet-hide.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/set-worksheet-name.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/set-worksheet-order.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/set-worksheet-show.command.spec.d.ts +0 -16
- package/lib/types/commands/mutations/__tests__/create-command-test-bed.d.ts +0 -8
- package/lib/types/commands/mutations/__tests__/move-rows-cols.mutation.spec.d.ts +0 -16
- package/lib/types/commands/mutations/__tests__/remove-row-col.mutation.spec.d.ts +0 -16
- package/lib/types/controllers/__tests__/util.d.ts +0 -13
- package/lib/types/facade/__tests__/utils.spec.d.ts +0 -16
- package/lib/types/services/__tests__/move-active-cell.spec.d.ts +0 -16
- package/lib/types/services/__tests__/numfmt.service.test.d.ts +0 -16
- package/lib/types/services/__tests__/ref-range.setvice.spec.d.ts +0 -16
- package/lib/types/services/__tests__/util.d.ts +0 -14
- package/lib/types/services/ref-range/__tests__/__testing__.d.ts +0 -14
- package/lib/types/services/ref-range/__tests__/ref-range.service.spec.d.ts +0 -13
- package/lib/types/services/ref-range/__tests__/utils.spec.d.ts +0 -16
- package/lib/types/services/ref-range/__tests__/watch-range.spec.d.ts +0 -16
- package/lib/types/services/sheet-interceptor/__tests__/create-core-test-bed.d.ts +0 -13
- package/lib/types/services/sheet-interceptor/__tests__/sheet-interceptor.service.spec.d.ts +0 -16
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CustomData, ICellData, IColumnRange, IDisposable,
|
|
1
|
+
import { CustomData, ICellData, IColumnRange, IDisposable, IFreeze, IObjectArrayPrimitiveType, IRange, IRowRange, IStyleData, Nullable, Workbook, Worksheet, BooleanNumber, FBaseInitialable, ICommandService, ILogService, Injector, ObjectMatrix } from '@univerjs/core';
|
|
2
2
|
import { FDefinedName } from './f-defined-name';
|
|
3
3
|
import { FWorkbook } from './f-workbook';
|
|
4
4
|
import { SheetsSelectionsService } from '@univerjs/sheets';
|
|
@@ -9,7 +9,8 @@ interface IFacadeClearOptions {
|
|
|
9
9
|
formatOnly?: boolean;
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* A Facade API object bounded to a worksheet. It provides a set of methods to interact with the worksheet.
|
|
13
|
+
* @hideconstructor
|
|
13
14
|
*/
|
|
14
15
|
export declare class FWorksheet extends FBaseInitialable {
|
|
15
16
|
protected readonly _fWorkbook: FWorkbook;
|
|
@@ -19,404 +20,826 @@ export declare class FWorksheet extends FBaseInitialable {
|
|
|
19
20
|
protected readonly _selectionManagerService: SheetsSelectionsService;
|
|
20
21
|
protected readonly _logService: ILogService;
|
|
21
22
|
protected readonly _commandService: ICommandService;
|
|
22
|
-
constructor(_fWorkbook: FWorkbook, _workbook: Workbook, _worksheet: Worksheet, _injector: Injector, _selectionManagerService: SheetsSelectionsService, _logService: ILogService, _commandService: ICommandService);
|
|
23
|
-
getSheet(): Worksheet;
|
|
24
|
-
private _eventRegistry;
|
|
25
|
-
private _ensureEventRegistry;
|
|
26
23
|
/**
|
|
27
|
-
*
|
|
28
|
-
* @param
|
|
29
|
-
* @param
|
|
30
|
-
* @
|
|
31
|
-
* @
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
* });
|
|
36
|
-
* ```
|
|
24
|
+
* Creates a new worksheet facade instance
|
|
25
|
+
* @param {FWorkbook} _fWorkbook - The facade workbook instance
|
|
26
|
+
* @param {Workbook} _workbook - The workbook instance
|
|
27
|
+
* @param {Worksheet} _worksheet - The worksheet instance
|
|
28
|
+
* @param {Injector} _injector - The injector instance
|
|
29
|
+
* @param {SheetsSelectionsService} _selectionManagerService - The selection manager service
|
|
30
|
+
* @param {ILogService} _logService - The log service
|
|
31
|
+
* @param {ICommandService} _commandService - The command service
|
|
37
32
|
*/
|
|
38
|
-
|
|
33
|
+
constructor(_fWorkbook: FWorkbook, _workbook: Workbook, _worksheet: Worksheet, _injector: Injector, _selectionManagerService: SheetsSelectionsService, _logService: ILogService, _commandService: ICommandService);
|
|
39
34
|
/**
|
|
40
|
-
*
|
|
41
|
-
* @
|
|
42
|
-
* @param params {any} params of event
|
|
43
|
-
* @returns {boolean} should cancel
|
|
35
|
+
* Returns the worksheet
|
|
36
|
+
* @returns {Worksheet} The worksheet instance.
|
|
44
37
|
* @example
|
|
45
|
-
* ```
|
|
46
|
-
*
|
|
38
|
+
* ```typescript
|
|
39
|
+
* const sheet = univerAPI.getActiveWorkbook().getActiveSheet().getSheet();
|
|
47
40
|
* ```
|
|
48
41
|
*/
|
|
49
|
-
|
|
42
|
+
getSheet(): Worksheet;
|
|
50
43
|
/**
|
|
51
44
|
* Returns the injector
|
|
52
|
-
* @returns The injector
|
|
45
|
+
* @returns {Injector} The injector
|
|
46
|
+
* @example
|
|
47
|
+
* ```typescript
|
|
48
|
+
* const injector = univerAPI.getActiveWorkbook().getActiveSheet().getInject();
|
|
49
|
+
* ```
|
|
53
50
|
*/
|
|
54
51
|
getInject(): Injector;
|
|
55
52
|
/**
|
|
56
53
|
* Returns the workbook
|
|
57
54
|
* @returns {Workbook} The workbook instance.
|
|
55
|
+
* @example
|
|
56
|
+
* ```typescript
|
|
57
|
+
* const workbook = univerAPI.getActiveWorkbook().getWorkbook();
|
|
58
|
+
* ```
|
|
58
59
|
*/
|
|
59
60
|
getWorkbook(): Workbook;
|
|
60
61
|
/**
|
|
61
62
|
* Returns the worksheet id.
|
|
62
63
|
* @returns {string} The id of the worksheet.
|
|
64
|
+
* @example
|
|
65
|
+
* ```typescript
|
|
66
|
+
* const sheet = univerAPI.getActiveWorkbook().getActiveSheet();
|
|
67
|
+
* const id = sheet.getSheetId();
|
|
68
|
+
* ```
|
|
63
69
|
*/
|
|
64
70
|
getSheetId(): string;
|
|
65
71
|
/**
|
|
66
72
|
* Returns the worksheet name.
|
|
67
73
|
* @returns {string} The name of the worksheet.
|
|
74
|
+
* @example
|
|
75
|
+
* ```typescript
|
|
76
|
+
* const sheet = univerAPI.getActiveWorkbook().getActiveSheet();
|
|
77
|
+
* const name = sheet.getSheetName();
|
|
78
|
+
* ```
|
|
68
79
|
*/
|
|
69
80
|
getSheetName(): string;
|
|
70
81
|
/**
|
|
71
82
|
* Represents the selection ranges info of the worksheet.
|
|
72
83
|
* @returns {FSelection} return the current selections of the worksheet or null if there is no selection.
|
|
84
|
+
* @example
|
|
85
|
+
* ```typescript
|
|
86
|
+
* const sheet = univerAPI.getActiveWorkbook().getActiveSheet();
|
|
87
|
+
* const selections = sheet.getSelection();
|
|
88
|
+
* ```
|
|
73
89
|
*/
|
|
74
90
|
getSelection(): FSelection | null;
|
|
75
91
|
/**
|
|
76
92
|
* Get the default style of the worksheet
|
|
77
93
|
* @returns {IStyleData} Default style of the worksheet.
|
|
94
|
+
* @example
|
|
95
|
+
* ```typescript
|
|
96
|
+
* const sheet = workbook.getActiveSheet();
|
|
97
|
+
* const defaultStyle = sheet.getDefaultStyle();
|
|
98
|
+
* ```
|
|
78
99
|
*/
|
|
79
100
|
getDefaultStyle(): Nullable<IStyleData> | string;
|
|
80
101
|
/**
|
|
81
102
|
* Get the default style of the worksheet row
|
|
82
|
-
* @param {number} index The row index
|
|
83
|
-
* @param {boolean} [keepRaw] If true, return the raw style data maybe the style name or style data, otherwise return the data from row manager
|
|
84
|
-
* @returns {Nullable<IStyleData> | string} The default style of the worksheet row name or style data
|
|
103
|
+
* @param {number} index - The row index
|
|
104
|
+
* @param {boolean} [keepRaw] - If true, return the raw style data maybe the style name or style data, otherwise return the data from row manager
|
|
105
|
+
* @returns {(Nullable<IStyleData> | string)} The default style of the worksheet row name or style data
|
|
106
|
+
* @example
|
|
107
|
+
* ```typescript
|
|
108
|
+
* const sheet = univerAPI.getActiveWorkbook().getActiveSheet();
|
|
109
|
+
* // Get default style for row 0 (1)
|
|
110
|
+
* const rowStyle = sheet.getRowDefaultStyle(0);
|
|
111
|
+
* // Get raw style data for row 0
|
|
112
|
+
* const rawRowStyle = sheet.getRowDefaultStyle(0, true);
|
|
113
|
+
* ```
|
|
85
114
|
*/
|
|
86
115
|
getRowDefaultStyle(index: number, keepRaw?: boolean): Nullable<IStyleData> | string;
|
|
87
116
|
/**
|
|
88
117
|
* Get the default style of the worksheet column
|
|
89
|
-
* @param {number} index The column index
|
|
90
|
-
* @param {boolean} [keepRaw] If true, return the raw style data maybe the style name or style data, otherwise return the data from col manager
|
|
91
|
-
* @returns {Nullable<IStyleData> | string} The default style of the worksheet column name or style data
|
|
118
|
+
* @param {number} index - The column index
|
|
119
|
+
* @param {boolean} [keepRaw] - If true, return the raw style data maybe the style name or style data, otherwise return the data from col manager
|
|
120
|
+
* @returns {(Nullable<IStyleData> | string)} The default style of the worksheet column name or style data
|
|
121
|
+
* @example
|
|
122
|
+
* ```typescript
|
|
123
|
+
* const sheet = univerAPI.getActiveWorkbook().getActiveSheet();
|
|
124
|
+
* // Get default style for column 0 (A)
|
|
125
|
+
* const colStyle = sheet.getColumnDefaultStyle(0);
|
|
126
|
+
* // Get raw style data for column 0
|
|
127
|
+
* const rawColStyle = sheet.getColumnDefaultStyle(0, true);
|
|
128
|
+
* ```
|
|
92
129
|
*/
|
|
93
130
|
getColumnDefaultStyle(index: number, keepRaw?: boolean): Nullable<IStyleData> | string;
|
|
94
131
|
/**
|
|
95
132
|
* Set the default style of the worksheet
|
|
96
|
-
* @param {
|
|
97
|
-
* @returns {FWorksheet} This
|
|
133
|
+
* @param {string} style - The style to set
|
|
134
|
+
* @returns {FWorksheet} This worksheet instance for chaining
|
|
135
|
+
* @example
|
|
136
|
+
* ```typescript
|
|
137
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
138
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
139
|
+
* fWorksheet.setDefaultStyle('default');
|
|
140
|
+
* ```
|
|
98
141
|
*/
|
|
99
142
|
setDefaultStyle(style: string): FWorksheet;
|
|
100
143
|
/**
|
|
101
144
|
* Set the default style of the worksheet row
|
|
102
|
-
* @param {number} index The row index
|
|
103
|
-
* @param {string | Nullable<IStyleData>} style The style name or style data
|
|
145
|
+
* @param {number} index - The row index
|
|
146
|
+
* @param {string | Nullable<IStyleData>} style - The style name or style data
|
|
104
147
|
* @returns {FWorksheet} This sheet, for chaining.
|
|
148
|
+
* @example
|
|
149
|
+
* ```ts
|
|
150
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
151
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
152
|
+
* fWorksheet.setRowDefaultStyle(0, 'default');
|
|
153
|
+
* ```
|
|
105
154
|
*/
|
|
106
155
|
setColumnDefaultStyle(index: number, style: string | Nullable<IStyleData>): FWorksheet;
|
|
107
156
|
/**
|
|
108
157
|
* Set the default style of the worksheet column
|
|
109
|
-
* @param {number} index The column index
|
|
110
|
-
* @param {string | Nullable<IStyleData>} style The style name or style data
|
|
158
|
+
* @param {number} index - The column index
|
|
159
|
+
* @param {string | Nullable<IStyleData>} style - The style name or style data
|
|
111
160
|
* @returns {FWorksheet} This sheet, for chaining.
|
|
161
|
+
* @example
|
|
162
|
+
* ```ts
|
|
163
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
164
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
165
|
+
* fWorksheet.setColumnDefaultStyle(0, 'default');
|
|
166
|
+
* ```
|
|
112
167
|
*/
|
|
113
168
|
setRowDefaultStyle(index: number, style: string | Nullable<IStyleData>): FWorksheet;
|
|
114
169
|
/**
|
|
115
170
|
* Returns a Range object representing a single cell at the specified row and column.
|
|
116
|
-
* @param row The row index of the cell.
|
|
117
|
-
* @param column The column index of the cell.
|
|
118
|
-
* @returns A Range object representing the specified cell.
|
|
171
|
+
* @param {number} row - The row index of the cell.
|
|
172
|
+
* @param {number} column - The column index of the cell.
|
|
173
|
+
* @returns {FRange} A Range object representing the specified cell.
|
|
174
|
+
* @example
|
|
175
|
+
* ```typescript
|
|
176
|
+
* const sheet = workbook.getActiveSheet();
|
|
177
|
+
* // Get range for cell at row 0, column 0 (A1)
|
|
178
|
+
* const range = sheet.getRange(0, 0);
|
|
179
|
+
* ```
|
|
119
180
|
*/
|
|
120
181
|
getRange(row: number, column: number): FRange;
|
|
121
182
|
/**
|
|
122
183
|
* Returns a Range object representing a range starting at the specified row and column, with the specified number of rows.
|
|
123
|
-
* @param row The starting row index of the range.
|
|
124
|
-
* @param column The starting column index of the range.
|
|
125
|
-
* @param numRows The number of rows in the range.
|
|
126
|
-
* @returns A Range object representing the specified range.
|
|
184
|
+
* @param {number} row - The starting row index of the range.
|
|
185
|
+
* @param {number} column - The starting column index of the range.
|
|
186
|
+
* @param {number} numRows - The number of rows in the range.
|
|
187
|
+
* @returns {FRange} A Range object representing the specified range.
|
|
127
188
|
*/
|
|
128
189
|
getRange(row: number, column: number, numRows: number): FRange;
|
|
129
190
|
/**
|
|
130
191
|
* Returns a Range object representing a range starting at the specified row and column, with the specified number of rows and columns.
|
|
131
|
-
* @param row The starting row index of the range.
|
|
132
|
-
* @param column The starting column index of the range.
|
|
133
|
-
* @param numRows The number of rows in the range.
|
|
134
|
-
* @param numColumns The number of columns in the range.
|
|
135
|
-
* @returns A Range object representing the specified range.
|
|
192
|
+
* @param {number} row - The starting row index of the range.
|
|
193
|
+
* @param {number} column - The starting column index of the range.
|
|
194
|
+
* @param {number} numRows - The number of rows in the range.
|
|
195
|
+
* @param {number} numColumns - The number of columns in the range.
|
|
196
|
+
* @returns {FRange} A Range object representing the specified range.
|
|
136
197
|
*/
|
|
137
198
|
getRange(row: number, column: number, numRows: number, numColumns: number): FRange;
|
|
138
199
|
/**
|
|
139
200
|
* Returns a Range object specified by A1 notation.
|
|
140
|
-
* @param a1Notation A string representing a range in A1 notation.
|
|
141
|
-
* @returns A Range object representing the specified range.
|
|
201
|
+
* @param {string} a1Notation - A string representing a range in A1 notation.
|
|
202
|
+
* @returns {FRange} A Range object representing the specified range.
|
|
203
|
+
* @example
|
|
204
|
+
* ```typescript
|
|
205
|
+
* const sheet = workbook.getActiveSheet();
|
|
206
|
+
* // Get range for cells A1:C3
|
|
207
|
+
* const range = sheet.getRange("A1:C3");
|
|
208
|
+
* // Get range for a single cell
|
|
209
|
+
* const cell = sheet.getRange("B2");
|
|
210
|
+
* // Get range with sheet name
|
|
211
|
+
* const rangeWithSheet = sheet.getRange("Sheet1!A1:C3");
|
|
212
|
+
* ```
|
|
142
213
|
*/
|
|
143
214
|
getRange(a1Notation: string): FRange;
|
|
215
|
+
/**
|
|
216
|
+
* Returns a Range object for the specified range.
|
|
217
|
+
* @param {IRange} range - The range specification.
|
|
218
|
+
* @returns {FRange} A Range object representing the specified range.
|
|
219
|
+
*/
|
|
220
|
+
getRange(range: IRange): FRange;
|
|
144
221
|
/**
|
|
145
222
|
* Returns the current number of columns in the sheet, regardless of content.
|
|
146
223
|
* @returns {number} The maximum columns count of the sheet
|
|
224
|
+
* @example
|
|
225
|
+
* ```typescript
|
|
226
|
+
* const sheet = workbook.getActiveSheet();
|
|
227
|
+
* const totalColumns = sheet.getMaxColumns();
|
|
228
|
+
* console.log(`Sheet has ${totalColumns} columns`);
|
|
229
|
+
* ```
|
|
147
230
|
*/
|
|
148
231
|
getMaxColumns(): number;
|
|
149
232
|
/**
|
|
150
233
|
* Returns the current number of rows in the sheet, regardless of content.
|
|
151
234
|
* @returns {number}The maximum rows count of the sheet
|
|
235
|
+
* @example
|
|
236
|
+
* ```typescript
|
|
237
|
+
* const sheet = workbook.getActiveSheet();
|
|
238
|
+
* const totalRows = sheet.getMaxRows();
|
|
239
|
+
* console.log(`Sheet has ${totalRows} rows`);
|
|
240
|
+
* ```
|
|
152
241
|
*/
|
|
153
242
|
getMaxRows(): number;
|
|
154
243
|
/**
|
|
155
244
|
* Inserts a row after the given row position.
|
|
156
|
-
* @param {number} afterPosition The row after which the new row should be added, starting at 0 for the first row.
|
|
245
|
+
* @param {number} afterPosition - The row after which the new row should be added, starting at 0 for the first row.
|
|
157
246
|
* @returns {FWorksheet} This sheet, for chaining.
|
|
247
|
+
* @example
|
|
248
|
+
* ```typescript
|
|
249
|
+
* const sheet = workbook.getActiveSheet();
|
|
250
|
+
* // Insert 3 rows at row index 2 (before the third row)
|
|
251
|
+
* sheet.insertRowAfter(2);
|
|
252
|
+
* // Insert 1 row at row index 0 (before the first row)
|
|
253
|
+
* sheet.insertRowAfter(0);
|
|
254
|
+
* ```
|
|
158
255
|
*/
|
|
159
256
|
insertRowAfter(afterPosition: number): FWorksheet;
|
|
160
257
|
/**
|
|
161
258
|
* Inserts a row before the given row position.
|
|
162
|
-
* @param {number} beforePosition The row before which the new row should be added, starting at 0 for the first row.
|
|
259
|
+
* @param {number} beforePosition - The row before which the new row should be added, starting at 0 for the first row.
|
|
163
260
|
* @returns {FWorksheet} This sheet, for chaining.
|
|
261
|
+
* @example
|
|
262
|
+
* ```typescript
|
|
263
|
+
* const sheet = workbook.getActiveSheet();
|
|
264
|
+
* // Insert 3 rows at row index 2 (before the third row)
|
|
265
|
+
* sheet.insertRowBefore(2);
|
|
266
|
+
* // Insert 1 row at row index 0 (before the first row)
|
|
267
|
+
* sheet.insertRowBefore(0);
|
|
268
|
+
* ```
|
|
164
269
|
*/
|
|
165
270
|
insertRowBefore(beforePosition: number): FWorksheet;
|
|
166
271
|
/**
|
|
167
272
|
* Inserts one or more consecutive blank rows in a sheet starting at the specified location.
|
|
168
|
-
* @param rowIndex The index indicating where to insert a row, starting at 0 for the first row.
|
|
169
|
-
* @param numRows The number of rows to insert.
|
|
170
|
-
* @returns This sheet, for chaining.
|
|
273
|
+
* @param {number} rowIndex - The index indicating where to insert a row, starting at 0 for the first row.
|
|
274
|
+
* @param {number} numRows - The number of rows to insert.
|
|
275
|
+
* @returns {FWorksheet} This sheet, for chaining.
|
|
276
|
+
* @example
|
|
277
|
+
* ```typescript
|
|
278
|
+
* const sheet = workbook.getActiveSheet();
|
|
279
|
+
* // Insert 3 rows at row index 2 (before the third row)
|
|
280
|
+
* sheet.insertRows(2, 3);
|
|
281
|
+
* // Insert 1 row at row index 0 (before the first row)
|
|
282
|
+
* sheet.insertRows(0);
|
|
283
|
+
* ```
|
|
171
284
|
*/
|
|
172
285
|
insertRows(rowIndex: number, numRows?: number): FWorksheet;
|
|
173
286
|
/**
|
|
174
287
|
* Inserts a number of rows after the given row position.
|
|
175
|
-
* @param afterPosition The row after which the new rows should be added, starting at 0 for the first row.
|
|
176
|
-
* @param howMany The number of rows to insert.
|
|
177
|
-
* @returns This sheet, for chaining.
|
|
288
|
+
* @param {number} afterPosition - The row after which the new rows should be added, starting at 0 for the first row.
|
|
289
|
+
* @param {number} howMany - The number of rows to insert.
|
|
290
|
+
* @returns {FWorksheet} This sheet, for chaining.
|
|
291
|
+
* @example
|
|
292
|
+
* ```typescript
|
|
293
|
+
* const sheet = workbook.getActiveSheet();
|
|
294
|
+
* // Insert 3 rows at row index 2 (before the third row)
|
|
295
|
+
* sheet.insertRowsAfter(2, 3);
|
|
296
|
+
* // Insert 1 row at row index 0 (before the first row)
|
|
297
|
+
* sheet.insertRowsAfter(0);
|
|
298
|
+
* ```
|
|
178
299
|
*/
|
|
179
300
|
insertRowsAfter(afterPosition: number, howMany: number): FWorksheet;
|
|
180
301
|
/**
|
|
181
302
|
* Inserts a number of rows before the given row position.
|
|
182
|
-
* @param beforePosition The row before which the new rows should be added, starting at 0 for the first row.
|
|
183
|
-
* @param howMany The number of rows to insert.
|
|
184
|
-
* @returns This sheet, for chaining.
|
|
303
|
+
* @param {number} beforePosition - The row before which the new rows should be added, starting at 0 for the first row.
|
|
304
|
+
* @param {number} howMany - The number of rows to insert.
|
|
305
|
+
* @returns {FWorksheet} This sheet, for chaining.
|
|
306
|
+
* @example
|
|
307
|
+
* ```typescript
|
|
308
|
+
* const sheet = workbook.getActiveSheet();
|
|
309
|
+
* // Insert 3 rows at row index 2 (before the third row)
|
|
310
|
+
* sheet.insertRowsBefore(2, 3);
|
|
311
|
+
* // Insert 1 row at row index 0 (before the first row)
|
|
312
|
+
* sheet.insertRowsBefore(0);
|
|
313
|
+
* ```
|
|
185
314
|
*/
|
|
186
315
|
insertRowsBefore(beforePosition: number, howMany: number): FWorksheet;
|
|
187
316
|
/**
|
|
188
317
|
* Deletes the row at the given row position.
|
|
189
|
-
* @param rowPosition The position of the row, starting at 0 for the first row.
|
|
190
|
-
* @returns This sheet, for chaining.
|
|
318
|
+
* @param {number} rowPosition - The position of the row, starting at 0 for the first row.
|
|
319
|
+
* @returns {FWorksheet} This sheet, for chaining.
|
|
320
|
+
* @example
|
|
321
|
+
* ```typescript
|
|
322
|
+
* const sheet = workbook.getActiveSheet();
|
|
323
|
+
* // Delete 3 rows at row index 2 (rows 3-5)
|
|
324
|
+
* sheet.deleteRow(2);
|
|
325
|
+
* // Delete 1 row at row index 0 (first row)
|
|
326
|
+
* sheet.deleteRow(0);
|
|
327
|
+
* ```
|
|
191
328
|
*/
|
|
192
329
|
deleteRow(rowPosition: number): FWorksheet;
|
|
193
330
|
/**
|
|
194
331
|
* Deletes a number of rows starting at the given row position.
|
|
195
|
-
* @param rowPosition The position of the first row to delete, starting at 0 for the first row.
|
|
196
|
-
* @param howMany The number of rows to delete.
|
|
197
|
-
* @returns This sheet, for chaining.
|
|
332
|
+
* @param {number} rowPosition - The position of the first row to delete, starting at 0 for the first row.
|
|
333
|
+
* @param {number} howMany - The number of rows to delete.
|
|
334
|
+
* @returns {FWorksheet} This sheet, for chaining.
|
|
335
|
+
* @example
|
|
336
|
+
* ```typescript
|
|
337
|
+
* const sheet = workbook.getActiveSheet();
|
|
338
|
+
* // Delete 3 rows at row index 2 (rows 3-5)
|
|
339
|
+
* sheet.deleteRows(2, 3);
|
|
340
|
+
* // Delete 1 row at row index 0 (first row)
|
|
341
|
+
* sheet.deleteRows(0);
|
|
342
|
+
* ```
|
|
198
343
|
*/
|
|
199
344
|
deleteRows(rowPosition: number, howMany: number): FWorksheet;
|
|
200
345
|
/**
|
|
201
346
|
* Moves the rows selected by the given range to the position indicated by the destinationIndex. The rowSpec itself does not have to exactly represent an entire row or group of rows to move—it selects all rows that the range spans.
|
|
202
|
-
* @param rowSpec A range spanning the rows that should be moved.
|
|
203
|
-
* @param destinationIndex The index that the rows should be moved to. Note that this index is based on the coordinates before the rows are moved. Existing data is shifted down to make room for the moved rows while the source rows are removed from the grid. Therefore, the data may end up at a different index than originally specified. Use 0-index for this method.
|
|
204
|
-
* @returns This sheet, for chaining.
|
|
347
|
+
* @param {FRange} rowSpec - A range spanning the rows that should be moved.
|
|
348
|
+
* @param {number} destinationIndex - The index that the rows should be moved to. Note that this index is based on the coordinates before the rows are moved. Existing data is shifted down to make room for the moved rows while the source rows are removed from the grid. Therefore, the data may end up at a different index than originally specified. Use 0-index for this method.
|
|
349
|
+
* @returns {FWorksheet} This sheet, for chaining.
|
|
350
|
+
* @example
|
|
351
|
+
* ```typescript
|
|
352
|
+
* const sheet = workbook.getActiveSheet();
|
|
353
|
+
* // Move 3 rows at row index 2 (rows 3-5) to row index 0
|
|
354
|
+
* sheet.moveRows(rowSpec, 0);
|
|
355
|
+
* // Move 1 row at row index 0 (first row) to row index 2
|
|
356
|
+
* sheet.moveRows(rowSpec, 2);
|
|
357
|
+
* ```
|
|
205
358
|
*/
|
|
206
359
|
moveRows(rowSpec: FRange, destinationIndex: number): FWorksheet;
|
|
207
360
|
/**
|
|
208
361
|
* Hides the rows in the given range.
|
|
209
|
-
* @param row The row range to hide.
|
|
210
|
-
* @returns This sheet, for chaining.
|
|
362
|
+
* @param {FRange} row - The row range to hide.
|
|
363
|
+
* @returns {FWorksheet} This sheet, for chaining.
|
|
364
|
+
* @example
|
|
365
|
+
* ```typescript
|
|
366
|
+
* const sheet = workbook.getActiveSheet();
|
|
367
|
+
* // Hide 3 rows starting from row index 1 (rows 2-4)
|
|
368
|
+
* sheet.hideRow(1);
|
|
369
|
+
* // Hide single row at index 0 (first row)
|
|
370
|
+
* sheet.hideRow(0);
|
|
371
|
+
* ```
|
|
211
372
|
*/
|
|
212
373
|
hideRow(row: FRange): FWorksheet;
|
|
213
374
|
/**
|
|
214
|
-
* Hides one or more consecutive rows starting at the given index. Use 0-index for this method
|
|
215
|
-
* @param {number} rowIndex The starting index of the rows to hide
|
|
216
|
-
* @param {number}
|
|
375
|
+
* Hides one or more consecutive rows starting at the given index. Use 0-index for this method
|
|
376
|
+
* @param {number} rowIndex - The starting index of the rows to hide
|
|
377
|
+
* @param {number} numRow - The number of rows to hide
|
|
217
378
|
* @returns {FWorksheet} This sheet, for chaining.
|
|
379
|
+
* @example
|
|
380
|
+
* ```typescript
|
|
381
|
+
* const sheet = workbook.getActiveSheet();
|
|
382
|
+
* // Hide 3 rows starting from row index 1 (rows 2-4)
|
|
383
|
+
* sheet.hideRows(1, 3);
|
|
384
|
+
* // Hide single row at index 0 (first row)
|
|
385
|
+
* sheet.hideRows(0);
|
|
386
|
+
* ```
|
|
218
387
|
*/
|
|
219
|
-
hideRows(rowIndex: number,
|
|
388
|
+
hideRows(rowIndex: number, numRow?: number): FWorksheet;
|
|
220
389
|
/**
|
|
221
390
|
* Make the row in the given range visible.
|
|
222
|
-
* @param {FRange} row The range to unhide, if hidden.
|
|
391
|
+
* @param {FRange} row - The range to unhide, if hidden.
|
|
223
392
|
* @returns {FWorksheet} This sheet, for chaining.
|
|
393
|
+
* @example
|
|
394
|
+
* ```typescript
|
|
395
|
+
* const sheet = workbook.getActiveSheet();
|
|
396
|
+
* // Unhide 3 rows starting from row index 1 (rows 2-4)
|
|
397
|
+
* sheet.unhideRow(1);
|
|
398
|
+
* // Unhide single row at index 0 (first row)
|
|
399
|
+
* sheet.unhideRow(0);
|
|
400
|
+
* ```
|
|
224
401
|
*/
|
|
225
402
|
unhideRow(row: FRange): FWorksheet;
|
|
226
403
|
/**
|
|
227
404
|
* Scrolling sheet to make specific rows visible.
|
|
228
|
-
* @param {number} rowIndex The starting index of the rows
|
|
229
|
-
* @param {number}
|
|
230
|
-
* @returns {FWorksheet} This
|
|
405
|
+
* @param {number} rowIndex - The starting index of the rows
|
|
406
|
+
* @param {number} numRow - The number of rows
|
|
407
|
+
* @returns {FWorksheet} This worksheet instance for chaining
|
|
408
|
+
* @example
|
|
409
|
+
* ```typescript
|
|
410
|
+
* const sheet = workbook.getActiveSheet();
|
|
411
|
+
* // Show 3 rows starting from row index 1 (rows 2-4)
|
|
412
|
+
* sheet.showRows(1);
|
|
413
|
+
* // Show single row at index 0 (first row)
|
|
414
|
+
* sheet.showRows(0);
|
|
415
|
+
* ```
|
|
231
416
|
*/
|
|
232
|
-
showRows(rowIndex: number,
|
|
417
|
+
showRows(rowIndex: number, numRow?: number): FWorksheet;
|
|
233
418
|
/**
|
|
234
419
|
* Sets the row height of the given row in pixels. By default, rows grow to fit cell contents. If you want to force rows to a specified height, use setRowHeightsForced(startRow, numRows, height).
|
|
235
|
-
* @param {number} rowPosition The row position to change.
|
|
236
|
-
* @param {number} height The height in pixels to set it to.
|
|
237
|
-
* @returns {FWorksheet} This
|
|
420
|
+
* @param {number} rowPosition - The row position to change.
|
|
421
|
+
* @param {number} height - The height in pixels to set it to.
|
|
422
|
+
* @returns {FWorksheet} This worksheet instance for chaining
|
|
423
|
+
* @example
|
|
424
|
+
* ```typescript
|
|
425
|
+
* const sheet = workbook.getActiveSheet();
|
|
426
|
+
* // Set the height of the second row to 30 pixels
|
|
427
|
+
* sheet.setRowHeight(1, 30);
|
|
428
|
+
* // Set the height of the first row to 20 pixels
|
|
429
|
+
* sheet.setRowHeight(0, 20);
|
|
430
|
+
* ```
|
|
238
431
|
*/
|
|
239
432
|
setRowHeight(rowPosition: number, height: number): FWorksheet;
|
|
433
|
+
/**
|
|
434
|
+
* Make certain row wrap and auto height.
|
|
435
|
+
* @param rowPosition
|
|
436
|
+
* @param auto
|
|
437
|
+
* @returns {FWorksheet} this
|
|
438
|
+
* @example
|
|
439
|
+
* ```ts
|
|
440
|
+
const fWorkbook = univerAPI.getActiveWorkbook();
|
|
441
|
+
const fWorkSheet = fWorkbook.getActiveSheet();
|
|
442
|
+
fWorkSheet.autoFitRow(24);
|
|
443
|
+
* ```
|
|
444
|
+
*/
|
|
445
|
+
autoFitRow(rowPosition: number, auto?: BooleanNumber): FWorksheet;
|
|
240
446
|
/**
|
|
241
447
|
* Sets the height of the given rows in pixels.
|
|
242
448
|
* By default, rows grow to fit cell contents. If you want to force rows to a specified height, use setRowHeightsForced(startRow, numRows, height).
|
|
243
|
-
* @param {number} startRow The starting row position to change
|
|
244
|
-
* @param {number} numRows The number of rows to change
|
|
245
|
-
* @param {number} height The height in pixels to set it to
|
|
246
|
-
* @returns {FWorksheet} This
|
|
449
|
+
* @param {number} startRow - The starting row position to change
|
|
450
|
+
* @param {number} numRows - The number of rows to change
|
|
451
|
+
* @param {number} height - The height in pixels to set it to
|
|
452
|
+
* @returns {FWorksheet} This worksheet instance for chaining
|
|
453
|
+
* @example
|
|
454
|
+
* ```typescript
|
|
455
|
+
* const sheet = workbook.getActiveSheet();
|
|
456
|
+
* sheet.setRowHeights(1, 10, 30);
|
|
457
|
+
* ```
|
|
247
458
|
*/
|
|
248
459
|
setRowHeights(startRow: number, numRows: number, height: number): FWorksheet;
|
|
460
|
+
/**
|
|
461
|
+
* Sets the height of the given rows to auto.
|
|
462
|
+
* @param {number} startRow - The starting row position to change
|
|
463
|
+
* @param {number} numRows - The number of rows to change
|
|
464
|
+
* @returns {FWorksheet} This worksheet instance for chaining
|
|
465
|
+
* @example
|
|
466
|
+
* ```typescript
|
|
467
|
+
* const sheet = workbook.getActiveSheet();
|
|
468
|
+
* sheet.setRowAutoHeight(1, 10);
|
|
469
|
+
* ```
|
|
470
|
+
*/
|
|
471
|
+
setRowAutoHeight(startRow: number, numRows: number): FWorksheet;
|
|
249
472
|
/**
|
|
250
473
|
* Sets the height of the given rows in pixels. By default, rows grow to fit cell contents. When you use setRowHeightsForced, rows are forced to the specified height even if the cell contents are taller than the row height.
|
|
251
|
-
* @param {number} startRow The starting row position to change
|
|
252
|
-
* @param {number} numRows The number of rows to change
|
|
253
|
-
* @param {number} height The height in pixels to set it to
|
|
254
|
-
* @returns {FWorksheet} This
|
|
474
|
+
* @param {number} startRow - The starting row position to change
|
|
475
|
+
* @param {number} numRows - The number of rows to change
|
|
476
|
+
* @param {number} height - The height in pixels to set it to
|
|
477
|
+
* @returns {FWorksheet} This worksheet instance for chaining
|
|
478
|
+
* @example
|
|
479
|
+
* ```typescript
|
|
480
|
+
* const sheet = workbook.getActiveSheet();
|
|
481
|
+
* sheet.setRowHeightsForced(1, 10, 30);
|
|
482
|
+
* ```
|
|
255
483
|
*/
|
|
256
484
|
setRowHeightsForced(startRow: number, numRows: number, height: number): FWorksheet;
|
|
257
485
|
/**
|
|
258
486
|
* Set custom properties for given rows.
|
|
259
|
-
* @param custom The custom properties to set
|
|
260
|
-
* @returns This
|
|
487
|
+
* @param {IObjectArrayPrimitiveType<CustomData>} custom - The custom properties to set
|
|
488
|
+
* @returns {FWorksheet} This worksheet instance for chaining
|
|
489
|
+
* @example
|
|
490
|
+
* ```typescript
|
|
491
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
492
|
+
* const fWorkSheet = fWorkbook.getActiveSheet();
|
|
493
|
+
* fWorkSheet.setRowCustom({ key: 'value' });
|
|
494
|
+
* ```
|
|
261
495
|
*/
|
|
262
496
|
setRowCustom(custom: IObjectArrayPrimitiveType<CustomData>): FWorksheet;
|
|
263
497
|
/**
|
|
264
498
|
* Inserts a column after the given column position.
|
|
265
|
-
* @param afterPosition The column after which the new column should be added, starting at 0 for the first column
|
|
266
|
-
* @returns This
|
|
499
|
+
* @param {number} afterPosition - The column after which the new column should be added, starting at 0 for the first column
|
|
500
|
+
* @returns {FWorksheet} This worksheet instance for chaining
|
|
501
|
+
* @example
|
|
502
|
+
* ```typescript
|
|
503
|
+
* const sheet = workbook.getActiveSheet();
|
|
504
|
+
* // Insert 3 columns at column index 2 (before column C)
|
|
505
|
+
* sheet.insertColumnAfter(2);
|
|
506
|
+
* // Insert 1 column at column index 0 (before column A)
|
|
507
|
+
* sheet.insertColumnAfter(0);
|
|
508
|
+
* ```
|
|
267
509
|
*/
|
|
268
510
|
insertColumnAfter(afterPosition: number): FWorksheet;
|
|
269
511
|
/**
|
|
270
512
|
* Inserts a column before the given column position.
|
|
271
|
-
* @param beforePosition The column before which the new column should be added, starting at 0 for the first column
|
|
272
|
-
* @returns This
|
|
513
|
+
* @param {number} beforePosition - The column before which the new column should be added, starting at 0 for the first column
|
|
514
|
+
* @returns {FWorksheet} This worksheet instance for chaining
|
|
515
|
+
* @example
|
|
516
|
+
* ```typescript
|
|
517
|
+
* const sheet = workbook.getActiveSheet();
|
|
518
|
+
* // Insert 3 columns at column index 2 (before column C)
|
|
519
|
+
* sheet.insertColumnBefore(2);
|
|
520
|
+
* // Insert 1 column at column index 0 (before column A)
|
|
521
|
+
* sheet.insertColumnBefore(0);
|
|
522
|
+
* ```
|
|
273
523
|
*/
|
|
274
524
|
insertColumnBefore(beforePosition: number): FWorksheet;
|
|
275
525
|
/**
|
|
276
526
|
* Inserts one or more consecutive blank columns in a sheet starting at the specified location.
|
|
277
|
-
* @param columnIndex The index indicating where to insert a column, starting at 0 for the first column
|
|
278
|
-
* @param numColumns The number of columns to insert
|
|
279
|
-
* @returns This sheet, for chaining
|
|
527
|
+
* @param {number} columnIndex - The index indicating where to insert a column, starting at 0 for the first column
|
|
528
|
+
* @param {number} numColumns - The number of columns to insert
|
|
529
|
+
* @returns {FWorksheet} This sheet, for chaining
|
|
530
|
+
* @example
|
|
531
|
+
* ```typescript
|
|
532
|
+
* const sheet = workbook.getActiveSheet();
|
|
533
|
+
* // Insert 3 columns at column index 2 (before column C)
|
|
534
|
+
* sheet.insertColumns(2, 3);
|
|
535
|
+
* // Insert 1 column at column index 0 (before column A)
|
|
536
|
+
* sheet.insertColumns(0);
|
|
537
|
+
* ```
|
|
280
538
|
*/
|
|
281
539
|
insertColumns(columnIndex: number, numColumns?: number): FWorksheet;
|
|
282
540
|
/**
|
|
283
541
|
* Inserts a given number of columns after the given column position.
|
|
284
|
-
* @param afterPosition The column after which the new
|
|
285
|
-
* @param howMany The number of columns to insert
|
|
286
|
-
* @returns This sheet, for chaining
|
|
542
|
+
* @param {number} afterPosition - The column after which the new columns should be added, starting at 0 for the first column
|
|
543
|
+
* @param {number} howMany - The number of columns to insert
|
|
544
|
+
* @returns {FWorksheet} This sheet, for chaining
|
|
545
|
+
* @example
|
|
546
|
+
* ```typescript
|
|
547
|
+
* const sheet = workbook.getActiveSheet();
|
|
548
|
+
* // Insert 3 columns at column index 2 (before column C)
|
|
549
|
+
* sheet.insertColumnsAfter(2, 3);
|
|
550
|
+
* // Insert 1 column at column index 0 (before column A)
|
|
551
|
+
* sheet.insertColumnsAfter(0, 1);
|
|
552
|
+
* ```
|
|
287
553
|
*/
|
|
288
554
|
insertColumnsAfter(afterPosition: number, howMany: number): FWorksheet;
|
|
289
555
|
/**
|
|
290
556
|
* Inserts a number of columns before the given column position.
|
|
291
|
-
* @param beforePosition The column before which the new
|
|
292
|
-
* @param howMany The number of columns to insert
|
|
293
|
-
* @returns This sheet, for chaining
|
|
557
|
+
* @param {number} beforePosition - The column before which the new columns should be added, starting at 0 for the first column
|
|
558
|
+
* @param {number} howMany - The number of columns to insert
|
|
559
|
+
* @returns {FWorksheet} This sheet, for chaining
|
|
560
|
+
* @example
|
|
561
|
+
* ```typescript
|
|
562
|
+
* const sheet = workbook.getActiveSheet();
|
|
563
|
+
* // Insert 3 columns at column index 2 (before column C)
|
|
564
|
+
* sheet.insertColumnsBefore(2, 3);
|
|
565
|
+
* // Insert 1 column at column index 0 (before column A)
|
|
566
|
+
* sheet.insertColumnsBefore(0, 1);
|
|
567
|
+
* ```
|
|
294
568
|
*/
|
|
295
569
|
insertColumnsBefore(beforePosition: number, howMany: number): FWorksheet;
|
|
296
570
|
/**
|
|
297
571
|
* Deletes the column at the given column position.
|
|
298
|
-
* @param columnPosition The position of the column, starting at 0 for the first column
|
|
299
|
-
* @returns This sheet, for chaining
|
|
572
|
+
* @param {number} columnPosition - The position of the column, starting at 0 for the first column
|
|
573
|
+
* @returns {FWorksheet} This sheet, for chaining
|
|
574
|
+
* @example
|
|
575
|
+
* ```typescript
|
|
576
|
+
* const sheet = workbook.getActiveSheet();
|
|
577
|
+
* // Delete column C
|
|
578
|
+
* sheet.deleteColumn(2);
|
|
579
|
+
* // Delete column A
|
|
580
|
+
* sheet.deleteColumn(0);
|
|
581
|
+
* ```
|
|
300
582
|
*/
|
|
301
583
|
deleteColumn(columnPosition: number): FWorksheet;
|
|
302
584
|
/**
|
|
303
585
|
* Deletes a number of columns starting at the given column position.
|
|
304
|
-
* @param columnPosition The position of the first column to delete, starting at 0 for the first column
|
|
305
|
-
* @param howMany The number of columns to delete
|
|
306
|
-
* @returns This sheet, for chaining
|
|
586
|
+
* @param {number} columnPosition - The position of the first column to delete, starting at 0 for the first column
|
|
587
|
+
* @param {number} howMany - The number of columns to delete
|
|
588
|
+
* @returns {FWorksheet} This sheet, for chaining
|
|
589
|
+
* @example
|
|
590
|
+
* ```typescript
|
|
591
|
+
* const sheet = workbook.getActiveSheet();
|
|
592
|
+
* // Delete 3 columns at column index 2 (columns C, D, E)
|
|
593
|
+
* sheet.deleteColumns(2, 3);
|
|
594
|
+
* // Delete 1 column at column index 0 (column A)
|
|
595
|
+
* sheet.deleteColumns(0, 1);
|
|
596
|
+
* ```
|
|
307
597
|
*/
|
|
308
598
|
deleteColumns(columnPosition: number, howMany: number): FWorksheet;
|
|
309
599
|
/**
|
|
310
600
|
* Moves the columns selected by the given range to the position indicated by the destinationIndex. The columnSpec itself does not have to exactly represent an entire column or group of columns to move—it selects all columns that the range spans.
|
|
311
|
-
* @param columnSpec A range spanning the columns that should be moved
|
|
312
|
-
* @param destinationIndex The index that the columns should be moved to. Note that this index is based on the coordinates before the columns are moved. Existing data is shifted right to make room for the moved columns while the source columns are removed from the grid. Therefore, the data may end up at a different index than originally specified. Use 0-index for this method
|
|
313
|
-
* @returns This sheet, for chaining
|
|
601
|
+
* @param {FRange} columnSpec - A range spanning the columns that should be moved
|
|
602
|
+
* @param {number} destinationIndex - The index that the columns should be moved to. Note that this index is based on the coordinates before the columns are moved. Existing data is shifted right to make room for the moved columns while the source columns are removed from the grid. Therefore, the data may end up at a different index than originally specified. Use 0-index for this method
|
|
603
|
+
* @returns {FWorksheet} This sheet, for chaining
|
|
604
|
+
* @example
|
|
605
|
+
* ```typescript
|
|
606
|
+
* const sheet = workbook.getActiveSheet();
|
|
607
|
+
* // Move columns C, D, E to column index 2 (columns B, C, D)
|
|
608
|
+
* sheet.moveColumns({ startColumn: 2, endColumn: 4 }, 1);
|
|
609
|
+
* // Move column A to column index 0 (column A)
|
|
610
|
+
* sheet.moveColumns({ startColumn: 0, endColumn: 0 }, 0);
|
|
611
|
+
* ```
|
|
314
612
|
*/
|
|
315
613
|
moveColumns(columnSpec: FRange, destinationIndex: number): FWorksheet;
|
|
316
614
|
/**
|
|
317
615
|
* Hides the column or columns in the given range.
|
|
318
|
-
* @param column The column range to hide
|
|
319
|
-
* @returns This sheet, for chaining
|
|
616
|
+
* @param {FRange} column - The column range to hide
|
|
617
|
+
* @returns {FWorksheet} This sheet, for chaining
|
|
618
|
+
* @example
|
|
619
|
+
* ```typescript
|
|
620
|
+
* const sheet = workbook.getActiveSheet();
|
|
621
|
+
* // Hide columns C, D, E
|
|
622
|
+
* sheet.hideColumn({ startColumn: 2, endColumn: 4 });
|
|
623
|
+
* // Hide column A
|
|
624
|
+
* sheet.hideColumn({ startColumn: 0, endColumn: 0 });
|
|
625
|
+
* ```
|
|
320
626
|
*/
|
|
321
627
|
hideColumn(column: FRange): FWorksheet;
|
|
322
628
|
/**
|
|
323
|
-
* Hides one or more consecutive columns starting at the given index. Use 0-index for this method
|
|
324
|
-
* @param columnIndex The starting index of the columns to hide
|
|
325
|
-
* @param
|
|
326
|
-
* @returns This sheet, for chaining
|
|
629
|
+
* Hides one or more consecutive columns starting at the given index. Use 0-index for this method
|
|
630
|
+
* @param {number} columnIndex - The starting index of the columns to hide
|
|
631
|
+
* @param {number} numColumn - The number of columns to hide
|
|
632
|
+
* @returns {FWorksheet} This sheet, for chaining
|
|
633
|
+
* @example
|
|
634
|
+
* ```typescript
|
|
635
|
+
* const sheet = workbook.getActiveSheet();
|
|
636
|
+
* // Hide columns C, D, E
|
|
637
|
+
* sheet.hideColumns(2, 3);
|
|
638
|
+
* // Hide column A
|
|
639
|
+
* sheet.hideColumns(0, 1);
|
|
640
|
+
* ```
|
|
327
641
|
*/
|
|
328
|
-
hideColumns(columnIndex: number,
|
|
642
|
+
hideColumns(columnIndex: number, numColumn?: number): FWorksheet;
|
|
329
643
|
/**
|
|
330
644
|
* Show the column in the given range.
|
|
331
|
-
* @param column The range to unhide, if hidden
|
|
332
|
-
* @returns This sheet, for chaining
|
|
645
|
+
* @param {FRange} column - The range to unhide, if hidden
|
|
646
|
+
* @returns {FWorksheet} This sheet, for chaining
|
|
647
|
+
* @example
|
|
648
|
+
* ```typescript
|
|
649
|
+
* const sheet = workbook.getActiveSheet();
|
|
650
|
+
* // Unhide columns C, D, E
|
|
651
|
+
* sheet.unhideColumn({ startColumn: 2, endColumn: 4 });
|
|
652
|
+
* // Unhide column A
|
|
653
|
+
* sheet.unhideColumn({ startColumn: 0, endColumn: 0 });
|
|
654
|
+
* ```
|
|
333
655
|
*/
|
|
334
656
|
unhideColumn(column: FRange): FWorksheet;
|
|
335
657
|
/**
|
|
336
|
-
* Show one or more consecutive columns starting at the given index. Use 0-index for this method
|
|
337
|
-
* @param columnIndex The starting index of the columns to unhide
|
|
338
|
-
* @param
|
|
339
|
-
* @returns This sheet, for chaining
|
|
658
|
+
* Show one or more consecutive columns starting at the given index. Use 0-index for this method
|
|
659
|
+
* @param {number} columnIndex - The starting index of the columns to unhide
|
|
660
|
+
* @param {number} numColumn - The number of columns to unhide
|
|
661
|
+
* @returns {FWorksheet} This sheet, for chaining
|
|
662
|
+
* @example
|
|
663
|
+
* ```typescript
|
|
664
|
+
* const sheet = workbook.getActiveSheet();
|
|
665
|
+
* // Unhide columns C, D, E
|
|
666
|
+
* sheet.unhideColumns(2, 3);
|
|
667
|
+
* // Unhide column A
|
|
668
|
+
* sheet.unhideColumns(0, 1);
|
|
669
|
+
* ```
|
|
340
670
|
*/
|
|
341
|
-
showColumns(columnIndex: number,
|
|
671
|
+
showColumns(columnIndex: number, numColumn?: number): FWorksheet;
|
|
342
672
|
/**
|
|
343
673
|
* Sets the width of the given column in pixels.
|
|
344
|
-
* @param columnPosition The position of the given column to set
|
|
345
|
-
* @param width The width in pixels to set it to
|
|
346
|
-
* @returns This sheet, for chaining
|
|
674
|
+
* @param {number} columnPosition - The position of the given column to set
|
|
675
|
+
* @param {number} width - The width in pixels to set it to
|
|
676
|
+
* @returns {FWorksheet} This sheet, for chaining
|
|
677
|
+
* @example
|
|
678
|
+
* ```typescript
|
|
679
|
+
* const sheet = workbook.getActiveSheet();
|
|
680
|
+
* // Set width of column B to 100 pixels
|
|
681
|
+
* sheet.setColumnWidth(1, 100);
|
|
682
|
+
* ```
|
|
347
683
|
*/
|
|
348
684
|
setColumnWidth(columnPosition: number, width: number): FWorksheet;
|
|
349
685
|
/**
|
|
350
686
|
* Sets the width of the given columns in pixels.
|
|
351
|
-
* @param startColumn The starting column position to change
|
|
352
|
-
* @param
|
|
353
|
-
* @param width The width in pixels to set it to
|
|
354
|
-
* @returns This sheet, for chaining
|
|
687
|
+
* @param {number} startColumn - The starting column position to change
|
|
688
|
+
* @param {number} numColumn - The number of columns to change
|
|
689
|
+
* @param {number} width - The width in pixels to set it to
|
|
690
|
+
* @returns {FWorksheet} This sheet, for chaining
|
|
691
|
+
* @example
|
|
692
|
+
* ```typescript
|
|
693
|
+
* const sheet = workbook.getActiveSheet();
|
|
694
|
+
* // Set width of columns B-D (index 1-3) to 100 pixels
|
|
695
|
+
* sheet.setColumnWidths(1, 3, 100);
|
|
696
|
+
* ```
|
|
355
697
|
*/
|
|
356
|
-
setColumnWidths(startColumn: number,
|
|
698
|
+
setColumnWidths(startColumn: number, numColumn: number, width: number): FWorksheet;
|
|
357
699
|
/**
|
|
358
700
|
* Set custom properties for given columns.
|
|
359
|
-
* @param custom The custom properties to set
|
|
360
|
-
* @returns This
|
|
701
|
+
* @param {IObjectArrayPrimitiveType<CustomData>} custom - The custom properties to set
|
|
702
|
+
* @returns {FWorksheet} This worksheet instance for chaining
|
|
703
|
+
* @example
|
|
704
|
+
* ```ts
|
|
705
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
706
|
+
* const fWorkSheet = fWorkbook.getActiveSheet();
|
|
707
|
+
* fWorkSheet.setColumnCustom({ 0: { key: 'value' } });
|
|
708
|
+
* ```
|
|
361
709
|
*/
|
|
362
710
|
setColumnCustom(custom: IObjectArrayPrimitiveType<CustomData>): FWorksheet;
|
|
363
711
|
/**
|
|
364
712
|
* Get all merged cells in the current sheet
|
|
365
|
-
* @returns all merged cells
|
|
713
|
+
* @returns {FRange[]} all merged cells
|
|
714
|
+
* @example
|
|
715
|
+
* ```typescript
|
|
716
|
+
* const sheet = workbook.getActiveSheet();
|
|
717
|
+
* // Get all merged ranges in the sheet
|
|
718
|
+
* const mergedRanges = sheet.getMergedRanges();
|
|
719
|
+
* // Process each merged range
|
|
720
|
+
* mergedRanges.forEach(range => {
|
|
721
|
+
* console.log(range.getA1Notation());
|
|
722
|
+
* });
|
|
723
|
+
* ```
|
|
366
724
|
*/
|
|
367
725
|
getMergedRanges(): FRange[];
|
|
368
726
|
/**
|
|
369
727
|
* Get the merged cell data of the specified row and column.
|
|
370
|
-
* @param {number} row The row index
|
|
371
|
-
* @param {number} column The column index
|
|
372
|
-
* @returns {FRange|undefined} The merged cell data, or undefined if the cell is not merged
|
|
728
|
+
* @param {number} row - The row index
|
|
729
|
+
* @param {number} column - The column index
|
|
730
|
+
* @returns {FRange|undefined} The merged cell data, or undefined if the cell is not merged
|
|
731
|
+
* @example
|
|
732
|
+
* ```ts
|
|
733
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
734
|
+
* const fWorkSheet = fWorkbook.getActiveSheet();
|
|
735
|
+
* const merge = fWorkSheet.getCellMergeData(0, 0);
|
|
736
|
+
* if (merge) {
|
|
737
|
+
* console.log('Merged range:', merge.getA1Notation());
|
|
738
|
+
* }
|
|
739
|
+
* ```
|
|
373
740
|
*/
|
|
374
741
|
getCellMergeData(row: number, column: number): FRange | undefined;
|
|
375
742
|
/**
|
|
376
743
|
* Returns the selected range in the active sheet, or null if there is no active range.
|
|
377
|
-
* @returns the active range
|
|
744
|
+
* @returns {FRange | null} the active range
|
|
745
|
+
* @example
|
|
746
|
+
* ```typescript
|
|
747
|
+
* const sheet = workbook.getActiveSheet();
|
|
748
|
+
* // Get the currently active range
|
|
749
|
+
* const activeRange = sheet.getActiveRange();
|
|
750
|
+
* if (activeRange) {
|
|
751
|
+
* console.log('Active range:', activeRange.getA1Notation());
|
|
752
|
+
* }
|
|
753
|
+
* ```
|
|
378
754
|
*/
|
|
379
755
|
getActiveRange(): FRange | null;
|
|
380
756
|
/**
|
|
381
757
|
* Sets the active selection region for this sheet.
|
|
382
|
-
* @param {FRange} range The range to set as the active selection
|
|
383
|
-
* @returns {FWorksheet} This sheet, for chaining
|
|
758
|
+
* @param {FRange} range - The range to set as the active selection
|
|
759
|
+
* @returns {FWorksheet} This sheet, for chaining
|
|
760
|
+
* @example
|
|
761
|
+
* ```ts
|
|
762
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
763
|
+
* const fWorkSheet = fWorkbook.getActiveSheet();
|
|
764
|
+
* fWorkSheet.setActiveRange(fWorkSheet.getRange('A1'));
|
|
765
|
+
* ```
|
|
384
766
|
*/
|
|
385
767
|
setActiveRange(range: FRange): FWorksheet;
|
|
386
768
|
/**
|
|
387
769
|
* Sets the active selection region for this sheet.
|
|
388
|
-
* @param range The range to set as the active selection
|
|
770
|
+
* @param range - The range to set as the active selection
|
|
771
|
+
* @returns This sheet, for chaining
|
|
772
|
+
* @example
|
|
773
|
+
* ```ts
|
|
774
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
775
|
+
* const fWorkSheet = fWorkbook.getActiveSheet();
|
|
776
|
+
* fWorkSheet.setActiveRange(fWorkSheet.getRange('A1'));
|
|
777
|
+
* ```
|
|
389
778
|
*/
|
|
390
779
|
setActiveSelection: (range: FRange) => FWorksheet;
|
|
391
780
|
/**
|
|
392
781
|
* Sets the frozen state of the current sheet.
|
|
393
|
-
* @param freeze - the scrolling viewport start range and count of freezed rows and columns.
|
|
782
|
+
* @param {IFreeze} freeze - the scrolling viewport start range and count of freezed rows and columns.
|
|
394
783
|
* that means if you want to freeze the first 3 rows and 2 columns, you should set freeze as { startRow: 3, startColumn: 2, xSplit: 2, ySplit: 3 }
|
|
395
784
|
* @deprecated use `setFrozenRows` and `setFrozenColumns` instead.
|
|
396
|
-
* @returns
|
|
785
|
+
* @returns {FWorksheet} This worksheet instance for chaining
|
|
786
|
+
* @example
|
|
787
|
+
* ```typescript
|
|
788
|
+
* const sheet = workbook.getActiveSheet();
|
|
789
|
+
* // Freeze first 3 rows and 2 columns
|
|
790
|
+
* sheet.setFreeze({
|
|
791
|
+
* startRow: 3,
|
|
792
|
+
* startColumn: 2,
|
|
793
|
+
* xSplit: 2,
|
|
794
|
+
* ySplit: 3
|
|
795
|
+
* });
|
|
796
|
+
* ```
|
|
397
797
|
*/
|
|
398
798
|
setFreeze(freeze: IFreeze): FWorksheet;
|
|
399
799
|
/**
|
|
400
800
|
* Cancels the frozen state of the current sheet.
|
|
401
|
-
* @returns
|
|
801
|
+
* @returns {FWorksheet} This worksheet instance for chaining
|
|
802
|
+
* @example
|
|
803
|
+
* ```typescript
|
|
804
|
+
* const sheet = workbook.getActiveSheet();
|
|
805
|
+
* // Cancel freeze
|
|
806
|
+
* sheet.cancelFreeze();
|
|
807
|
+
* ```
|
|
402
808
|
*/
|
|
403
809
|
cancelFreeze(): FWorksheet;
|
|
404
810
|
/**
|
|
405
811
|
* Get the freeze state of the current sheet.
|
|
406
|
-
* @returns The freeze state of the current sheet
|
|
407
|
-
* @
|
|
812
|
+
* @returns {IFreeze} The freeze state of the current sheet
|
|
813
|
+
* @example
|
|
814
|
+
* ```typescript
|
|
815
|
+
* const sheet = workbook.getActiveSheet();
|
|
816
|
+
* // Get the freeze state of the current sheet
|
|
817
|
+
* const freeze = sheet.getFreeze();
|
|
818
|
+
* console.log(freeze);
|
|
819
|
+
* ```
|
|
408
820
|
*/
|
|
409
821
|
getFreeze(): IFreeze;
|
|
410
822
|
/**
|
|
411
823
|
* Set the number of frozen columns.
|
|
412
|
-
* @param columns The number of columns to freeze.
|
|
824
|
+
* @param columns - The number of columns to freeze.
|
|
413
825
|
* To unfreeze all columns, set this value to 0.
|
|
826
|
+
* @returns {FWorksheet} This FWorksheet instance.
|
|
827
|
+
* @example
|
|
828
|
+
* ```typescript
|
|
829
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
830
|
+
* const fWorkSheet = fWorkbook.getActiveSheet();
|
|
831
|
+
* // freeze the first 3 columns.
|
|
832
|
+
* fWorkSheet.setFrozenColumns(3);
|
|
833
|
+
* ```
|
|
414
834
|
*/
|
|
415
835
|
setFrozenColumns(columns: number): FWorksheet;
|
|
416
836
|
/**
|
|
417
837
|
* Set freeze column, then the range from startColumn to endColumn will be fixed.
|
|
418
838
|
* e.g. setFrozenColumns(0, 2) will fix the column range from 0 to 2.
|
|
419
839
|
* e.g. setFrozenColumns(2, 3) will fix the column range from 2 to 3, And column from 0 to 1 will be invisible.
|
|
840
|
+
* @param startColumn - The start column of the range to freeze
|
|
841
|
+
* @param endColumn - The end column of the range to freeze
|
|
842
|
+
* @returns {FWorksheet} This FWorksheet instance.
|
|
420
843
|
* @example
|
|
421
844
|
* ```typescript
|
|
422
845
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
@@ -424,50 +847,88 @@ export declare class FWorksheet extends FBaseInitialable {
|
|
|
424
847
|
* // freeze the first too columns.
|
|
425
848
|
* fWorkSheet.setFrozenColumns(0, 2);
|
|
426
849
|
* ```
|
|
427
|
-
* @param startColumn - The start column of the range to freeze.
|
|
428
|
-
* @param endColumn - The end column of the range to freeze.
|
|
429
|
-
* @returns {FWorksheet} This FWorksheet instance.
|
|
430
850
|
*/
|
|
431
851
|
setFrozenColumns(startColumn: number, endColumn: number): FWorksheet;
|
|
432
852
|
/**
|
|
433
853
|
* Set the number of frozen rows.
|
|
434
|
-
* @param rows The number of rows to freeze.
|
|
854
|
+
* @param rows - The number of rows to freeze.
|
|
435
855
|
* To unfreeze all rows, set this value to 0.
|
|
856
|
+
* @returns {FWorksheet} This FWorksheet instance.
|
|
857
|
+
* @example
|
|
858
|
+
* ```typescript
|
|
859
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
860
|
+
* const fWorkSheet = fWorkbook.getActiveSheet();
|
|
861
|
+
* // freeze the first 3 rows.
|
|
862
|
+
* fWorkSheet.setFrozenRows(3);
|
|
863
|
+
* ```
|
|
436
864
|
*/
|
|
437
865
|
setFrozenRows(rows: number): FWorksheet;
|
|
438
866
|
/**
|
|
439
867
|
* Set freeze row, then the range from startRow to endRow will be fixed.
|
|
440
868
|
* e.g. setFrozenRows(0, 2) will fix the row range from 0 to 2.
|
|
441
869
|
* e.g. setFrozenRows(2, 3) will fix the row range from 2 to 3, And row from 0 to 1 will be invisible.
|
|
442
|
-
* @param startRow - The start row of the range to freeze
|
|
443
|
-
* @param endRow - The end row of the range to freeze
|
|
870
|
+
* @param startRow - The start row of the range to freeze
|
|
871
|
+
* @param endRow - The end row of the range to freeze
|
|
872
|
+
* @returns {FWorksheet} This FWorksheet instance.
|
|
444
873
|
* @example
|
|
445
|
-
* ```
|
|
874
|
+
* ```typescript
|
|
446
875
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
447
876
|
* const fWorkSheet = fWorkbook.getActiveSheet();
|
|
448
877
|
* // freeze the first too rows.
|
|
449
878
|
* fWorkSheet.setFrozenRows(0, 2);
|
|
450
879
|
* ```
|
|
451
880
|
*/
|
|
452
|
-
setFrozenRows(
|
|
881
|
+
setFrozenRows(startRow: number, endRow: number): FWorksheet;
|
|
453
882
|
/**
|
|
454
883
|
* Get the number of frozen columns.
|
|
455
|
-
* @returns The number of frozen columns, returns 0 if no columns are frozen.
|
|
884
|
+
* @returns {number} The number of frozen columns, returns 0 if no columns are frozen.
|
|
885
|
+
* @example
|
|
886
|
+
* ```typescript
|
|
887
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
888
|
+
* const fWorkSheet = fWorkbook.getActiveSheet();
|
|
889
|
+
* // Get the number of frozen columns
|
|
890
|
+
* const frozenColumns = fWorkSheet.getFrozenColumns();
|
|
891
|
+
* console.log(frozenColumns);
|
|
892
|
+
* ```
|
|
456
893
|
*/
|
|
457
894
|
getFrozenColumns(): number;
|
|
458
895
|
/**
|
|
459
896
|
* Get the number of frozen rows.
|
|
460
|
-
* @returns The number of frozen rows. returns 0 if no rows are frozen.
|
|
897
|
+
* @returns {number} The number of frozen rows. returns 0 if no rows are frozen.
|
|
898
|
+
* @example
|
|
899
|
+
* ```typescript
|
|
900
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
901
|
+
* const fWorkSheet = fWorkbook.getActiveSheet();
|
|
902
|
+
* // Get the number of frozen rows
|
|
903
|
+
* const frozenRows = fWorkSheet.getFrozenRows();
|
|
904
|
+
* console.log(frozenRows);
|
|
905
|
+
* ```
|
|
461
906
|
*/
|
|
462
907
|
getFrozenRows(): number;
|
|
463
908
|
/**
|
|
464
909
|
* Get freezed rows.
|
|
465
910
|
* @returns {IRowRange} The range of the frozen rows.
|
|
911
|
+
* @example
|
|
912
|
+
* ```ts
|
|
913
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
914
|
+
* const fWorkSheet = fWorkbook.getActiveSheet();
|
|
915
|
+
* // Get the range of the frozen rows
|
|
916
|
+
* const frozenRows = fWorkSheet.getFrozenRowRange();
|
|
917
|
+
* console.log(frozenRows);
|
|
918
|
+
* ```
|
|
466
919
|
*/
|
|
467
920
|
getFrozenRowRange(): IRowRange;
|
|
468
921
|
/**
|
|
469
922
|
* Get freezed columns
|
|
470
923
|
* @returns {IColumnRange} The range of the frozen columns.
|
|
924
|
+
* @example
|
|
925
|
+
* ```ts
|
|
926
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
927
|
+
* const fWorkSheet = fWorkbook.getActiveSheet();
|
|
928
|
+
* // Get the range of the frozen columns
|
|
929
|
+
* const frozenColumns = fWorkSheet.getFrozenColumnRange();
|
|
930
|
+
* console.log(frozenColumns);
|
|
931
|
+
* ```
|
|
471
932
|
*/
|
|
472
933
|
getFrozenColumnRange(): IColumnRange;
|
|
473
934
|
/**
|
|
@@ -486,7 +947,7 @@ export declare class FWorksheet extends FBaseInitialable {
|
|
|
486
947
|
hasHiddenGridLines(): boolean;
|
|
487
948
|
/**
|
|
488
949
|
* Hides or reveals the sheet gridlines.
|
|
489
|
-
* @param {boolean} hidden If `true`, hide gridlines in this sheet; otherwise show the gridlines.
|
|
950
|
+
* @param {boolean} hidden - If `true`, hide gridlines in this sheet; otherwise show the gridlines.
|
|
490
951
|
* @returns {FWorksheet} Returns the current worksheet instance for method chaining
|
|
491
952
|
* @example
|
|
492
953
|
* ``` ts
|
|
@@ -499,7 +960,7 @@ export declare class FWorksheet extends FBaseInitialable {
|
|
|
499
960
|
setHiddenGridlines(hidden: boolean): FWorksheet;
|
|
500
961
|
/**
|
|
501
962
|
* Set the color of the gridlines in the sheet.
|
|
502
|
-
* @param {string|undefined} color The color to set for the gridlines.Undefined or null to reset to the default color.
|
|
963
|
+
* @param {string|undefined} color - The color to set for the gridlines.Undefined or null to reset to the default color.
|
|
503
964
|
* @returns {FWorksheet} Returns the current worksheet instance for method chaining
|
|
504
965
|
* @example
|
|
505
966
|
* ```ts
|
|
@@ -513,11 +974,18 @@ export declare class FWorksheet extends FBaseInitialable {
|
|
|
513
974
|
/**
|
|
514
975
|
* Get the color of the gridlines in the sheet.
|
|
515
976
|
* @returns {string | undefined} The color of the gridlines in the sheet or undefined. The default color is 'rgb(214, 216, 219)'.
|
|
977
|
+
* @example
|
|
978
|
+
* ```ts
|
|
979
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
980
|
+
* const fWorkSheet = fWorkbook.getActiveSheet();
|
|
981
|
+
* // get the gridlines color of the sheet
|
|
982
|
+
* console.log(fWorkSheet.getGridLinesColor());
|
|
983
|
+
* ```
|
|
516
984
|
*/
|
|
517
985
|
getGridLinesColor(): string | undefined;
|
|
518
986
|
/**
|
|
519
987
|
* Sets the sheet tab color.
|
|
520
|
-
* @param {string|null|undefined} color A color code in CSS notation (like '#ffffff' or 'white'), or null to reset the tab color.
|
|
988
|
+
* @param {string|null|undefined} color - A color code in CSS notation (like '#ffffff' or 'white'), or null to reset the tab color.
|
|
521
989
|
* @returns {FWorksheet} Returns the current worksheet instance for method chaining
|
|
522
990
|
* @example
|
|
523
991
|
* ```ts
|
|
@@ -542,37 +1010,11 @@ export declare class FWorksheet extends FBaseInitialable {
|
|
|
542
1010
|
*/
|
|
543
1011
|
getTabColor(): string | undefined;
|
|
544
1012
|
/**
|
|
545
|
-
*
|
|
546
|
-
* @param callback - The callback function to be executed when the cell data changes.
|
|
547
|
-
* @returns - A disposable object to unsubscribe from the event.
|
|
548
|
-
* @example
|
|
549
|
-
* ```ts
|
|
550
|
-
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
551
|
-
* const fWorkSheet = fWorkbook.getActiveSheet();
|
|
552
|
-
* // subscribe to the cell data change event
|
|
553
|
-
* const disposable = fWorkSheet.onCellDataChange((cellValue) => {
|
|
554
|
-
* console.log(cellValue.toArray());
|
|
555
|
-
* });
|
|
556
|
-
* // unsubscribe from the event
|
|
557
|
-
* disposable.dispose();
|
|
558
|
-
* ```
|
|
1013
|
+
* @deprecated use `univerAPI.addEvent(univerAPI.Event.SheetValueChanged, callback)` instead
|
|
559
1014
|
*/
|
|
560
1015
|
onCellDataChange(callback: (cellValue: ObjectMatrix<Nullable<ICellData>>) => void): IDisposable;
|
|
561
1016
|
/**
|
|
562
|
-
*
|
|
563
|
-
* @param callback - The callback function to be executed before the cell data changes.
|
|
564
|
-
* @returns - A disposable object to unsubscribe from the event.
|
|
565
|
-
* @example
|
|
566
|
-
* ```ts
|
|
567
|
-
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
568
|
-
* const fWorkSheet = fWorkbook.getActiveSheet();
|
|
569
|
-
* // subscribe to the cell data change event
|
|
570
|
-
* const disposable = fWorkSheet.onBeforeCellDataChange((cellValue) => {
|
|
571
|
-
* console.log(cellValue.toArray());
|
|
572
|
-
* });
|
|
573
|
-
* // unsubscribe from the event
|
|
574
|
-
* disposable.dispose();
|
|
575
|
-
* ```
|
|
1017
|
+
* @deprecated use `univerAPI.addEvent(univerAPI.Event.SheetValueChanged, callback)` instead
|
|
576
1018
|
*/
|
|
577
1019
|
onBeforeCellDataChange(callback: (cellValue: ObjectMatrix<Nullable<ICellData>>) => void): IDisposable;
|
|
578
1020
|
/**
|
|
@@ -606,7 +1048,7 @@ export declare class FWorksheet extends FBaseInitialable {
|
|
|
606
1048
|
isSheetHidden(): boolean;
|
|
607
1049
|
/**
|
|
608
1050
|
* Sets the sheet name.
|
|
609
|
-
* @param {string} name The new name for the sheet.
|
|
1051
|
+
* @param {string} name - The new name for the sheet.
|
|
610
1052
|
* @returns {FWorksheet} Returns the current worksheet instance for method chaining
|
|
611
1053
|
* @example
|
|
612
1054
|
* ```ts
|
|
@@ -619,7 +1061,7 @@ export declare class FWorksheet extends FBaseInitialable {
|
|
|
619
1061
|
setName(name: string): FWorksheet;
|
|
620
1062
|
/**
|
|
621
1063
|
* Activates this sheet. Does not alter the sheet itself, only the parent's notion of the active sheet.
|
|
622
|
-
* @returns Current sheet, for chaining.
|
|
1064
|
+
* @returns {FWorksheet} Current sheet, for chaining.
|
|
623
1065
|
*/
|
|
624
1066
|
activate(): FWorksheet;
|
|
625
1067
|
/**
|
|
@@ -637,9 +1079,9 @@ export declare class FWorksheet extends FBaseInitialable {
|
|
|
637
1079
|
getIndex(): number;
|
|
638
1080
|
/**
|
|
639
1081
|
* Clears the sheet of content and formatting information.Or Optionally clears only the contents or only the formatting.
|
|
640
|
-
* @param {IFacadeClearOptions} [options] Options for clearing the sheet. If not provided, the contents and formatting are cleared both.
|
|
641
|
-
* @param {boolean} [options.contentsOnly] If true, the contents of the sheet are cleared. If false, the contents and formatting are cleared. Default is false.
|
|
642
|
-
* @param {boolean} [options.formatOnly] If true, the formatting of the sheet is cleared. If false, the contents and formatting are cleared. Default is false.
|
|
1082
|
+
* @param {IFacadeClearOptions} [options] - Options for clearing the sheet. If not provided, the contents and formatting are cleared both.
|
|
1083
|
+
* @param {boolean} [options.contentsOnly] - If true, the contents of the sheet are cleared. If false, the contents and formatting are cleared. Default is false.
|
|
1084
|
+
* @param {boolean} [options.formatOnly] - If true, the formatting of the sheet is cleared. If false, the contents and formatting are cleared. Default is false.
|
|
643
1085
|
* @returns {FWorksheet} Returns the current worksheet instance for method chaining
|
|
644
1086
|
* @example
|
|
645
1087
|
* ```ts
|
|
@@ -656,7 +1098,7 @@ export declare class FWorksheet extends FBaseInitialable {
|
|
|
656
1098
|
* Clears the sheet of contents, while preserving formatting information.
|
|
657
1099
|
* @returns {FWorksheet} Returns the current worksheet instance for method chaining
|
|
658
1100
|
* @example
|
|
659
|
-
* ```
|
|
1101
|
+
* ```typescript
|
|
660
1102
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
661
1103
|
* const fWorkSheet = fWorkbook.getActiveSheet();
|
|
662
1104
|
* // clear the sheet of content only
|
|
@@ -668,7 +1110,7 @@ export declare class FWorksheet extends FBaseInitialable {
|
|
|
668
1110
|
* Clears the sheet of formatting, while preserving contents.
|
|
669
1111
|
* @returns {FWorksheet} Returns the current worksheet instance for method chaining
|
|
670
1112
|
* @example
|
|
671
|
-
* ```
|
|
1113
|
+
* ```typescript
|
|
672
1114
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
673
1115
|
* const fWorkSheet = fWorkbook.getActiveSheet();
|
|
674
1116
|
* // clear the sheet of formatting only
|
|
@@ -743,7 +1185,7 @@ export declare class FWorksheet extends FBaseInitialable {
|
|
|
743
1185
|
getLastRow(): number;
|
|
744
1186
|
/**
|
|
745
1187
|
* Judge whether provided FWorksheet is equal to current.
|
|
746
|
-
* @param {FWorksheet} other the FWorksheet to compare with.
|
|
1188
|
+
* @param {FWorksheet} other - the FWorksheet to compare with.
|
|
747
1189
|
* @returns {boolean} true if the FWorksheet is equal to the current FWorksheet, false otherwise.
|
|
748
1190
|
* @example
|
|
749
1191
|
* ```ts
|
|
@@ -769,7 +1211,8 @@ export declare class FWorksheet extends FBaseInitialable {
|
|
|
769
1211
|
getDefinedNames(): FDefinedName[];
|
|
770
1212
|
/**
|
|
771
1213
|
* Set custom metadata of worksheet
|
|
772
|
-
* @param {CustomData | undefined} custom custom metadata
|
|
1214
|
+
* @param {CustomData | undefined} custom - custom metadata
|
|
1215
|
+
* @returns {FWorksheet}
|
|
773
1216
|
* @example
|
|
774
1217
|
* ```ts
|
|
775
1218
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
@@ -780,8 +1223,9 @@ export declare class FWorksheet extends FBaseInitialable {
|
|
|
780
1223
|
setCustomMetadata(custom: CustomData | undefined): FWorksheet;
|
|
781
1224
|
/**
|
|
782
1225
|
* Set custom metadata of row
|
|
783
|
-
* @param {number} index row index
|
|
784
|
-
* @param {CustomData | undefined} custom custom metadata
|
|
1226
|
+
* @param {number} index - row index
|
|
1227
|
+
* @param {CustomData | undefined} custom - custom metadata
|
|
1228
|
+
* @returns {FWorksheet} Current worksheet, for chaining.
|
|
785
1229
|
* @example
|
|
786
1230
|
* ```ts
|
|
787
1231
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
@@ -792,8 +1236,9 @@ export declare class FWorksheet extends FBaseInitialable {
|
|
|
792
1236
|
setRowCustomMetadata(index: number, custom: CustomData | undefined): FWorksheet;
|
|
793
1237
|
/**
|
|
794
1238
|
* Set custom metadata of column
|
|
795
|
-
* @param {number} index column index
|
|
796
|
-
* @param {CustomData | undefined} custom custom metadata
|
|
1239
|
+
* @param {number} index - column index
|
|
1240
|
+
* @param {CustomData | undefined} custom - custom metadata
|
|
1241
|
+
* @returns {FWorksheet} Current worksheet, for chaining.
|
|
797
1242
|
* @example
|
|
798
1243
|
* ```ts
|
|
799
1244
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
@@ -804,7 +1249,7 @@ export declare class FWorksheet extends FBaseInitialable {
|
|
|
804
1249
|
setColumnCustomMetadata(index: number, custom: CustomData | undefined): FWorksheet;
|
|
805
1250
|
/**
|
|
806
1251
|
* Get custom metadata of row
|
|
807
|
-
* @param {number} index row index
|
|
1252
|
+
* @param {number} index - row index
|
|
808
1253
|
* @returns {CustomData | undefined} custom metadata
|
|
809
1254
|
* @example
|
|
810
1255
|
* ```ts
|
|
@@ -816,7 +1261,7 @@ export declare class FWorksheet extends FBaseInitialable {
|
|
|
816
1261
|
getRowCustomMetadata(index: number): CustomData | undefined;
|
|
817
1262
|
/**
|
|
818
1263
|
* Get custom metadata of column
|
|
819
|
-
* @param {number} index column index
|
|
1264
|
+
* @param {number} index - column index
|
|
820
1265
|
* @returns {CustomData | undefined} custom metadata
|
|
821
1266
|
* @example
|
|
822
1267
|
* ```ts
|