@univerjs/sheets 0.5.4 → 0.5.5-nightly.202501201336

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