@univerjs/sheets 0.5.3 → 0.5.4-experimental.20250114-7c09c35
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/es/facade.js +1526 -777
- package/lib/es/index.js +3904 -3276
- package/lib/types/basics/cell-style.d.ts +8 -0
- 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/permission/sheet-permission-check.controller.d.ts +33 -0
- package/lib/types/controllers/permission/sheet-permission-init.controller.d.ts +29 -0
- package/lib/types/controllers/permission/sheet-permission-view-model.controller.d.ts +13 -0
- package/lib/types/facade/f-defined-name.d.ts +61 -61
- package/lib/types/facade/f-event.d.ts +85 -1
- package/lib/types/facade/f-permission.d.ts +3 -20
- package/lib/types/facade/f-range.d.ts +486 -57
- package/lib/types/facade/f-univer.d.ts +56 -11
- package/lib/types/facade/f-workbook.d.ts +87 -17
- package/lib/types/facade/f-worksheet.d.ts +158 -59
- package/lib/types/facade/index.d.ts +0 -1
- package/lib/types/facade/utils.d.ts +38 -2
- package/lib/types/index.d.ts +2 -0
- package/lib/types/model/range-theme-util.d.ts +3 -3
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +3 -3
- package/package.json +7 -7
- package/LICENSE +0 -176
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CellValue, ICellData, IObjectMatrixPrimitiveType, IRange, IStyleData, Nullable, Workbook, Worksheet, FBaseInitialable, ICommandService, Injector, WrapStrategy } from '@univerjs/core';
|
|
1
|
+
import { CellValue, CustomData, ICellData, IDocumentData, IObjectMatrixPrimitiveType, IRange, IStyleData, Nullable, Workbook, Worksheet, FBaseInitialable, ICommandService, Injector, RichTextValue, WrapStrategy } from '@univerjs/core';
|
|
2
2
|
import { SplitDelimiterEnum } from '@univerjs/sheets';
|
|
3
3
|
import { FHorizontalAlignment, FVerticalAlignment } from './utils';
|
|
4
4
|
import { FormulaDataModel } from '@univerjs/engine-formula';
|
|
@@ -15,206 +15,634 @@ export declare class FRange extends FBaseInitialable {
|
|
|
15
15
|
constructor(_workbook: Workbook, _worksheet: Worksheet, _range: IRange, _injector: Injector, _commandService: ICommandService, _formulaDataModel: FormulaDataModel);
|
|
16
16
|
/**
|
|
17
17
|
* Get the unit ID of the current workbook
|
|
18
|
-
*
|
|
19
|
-
* @
|
|
18
|
+
* @returns {string} The unit ID of the workbook
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* univerAPI.getActiveWorkbook()
|
|
22
|
+
* .getActiveSheet()
|
|
23
|
+
* .getActiveRange()
|
|
24
|
+
* .getUnitId()
|
|
25
|
+
* ```
|
|
20
26
|
*/
|
|
21
27
|
getUnitId(): string;
|
|
22
28
|
/**
|
|
23
29
|
* Gets the name of the worksheet
|
|
24
|
-
*
|
|
25
|
-
* @
|
|
30
|
+
* @returns {string} The name of the worksheet
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* univerAPI.getActiveWorkbook()
|
|
34
|
+
* .getActiveSheet()
|
|
35
|
+
* .getActiveRange()
|
|
36
|
+
* .getSheetName()
|
|
37
|
+
* ```
|
|
26
38
|
*/
|
|
27
39
|
getSheetName(): string;
|
|
40
|
+
/**
|
|
41
|
+
* Gets the ID of the worksheet
|
|
42
|
+
* @returns {string} The ID of the worksheet
|
|
43
|
+
* @example
|
|
44
|
+
* ```ts
|
|
45
|
+
* univerAPI.getActiveWorkbook()
|
|
46
|
+
* .getActiveSheet()
|
|
47
|
+
* .getActiveRange()
|
|
48
|
+
* .getSheetId()
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
getSheetId(): string;
|
|
28
52
|
/**
|
|
29
53
|
* Gets the area where the statement is applied
|
|
30
|
-
*
|
|
31
|
-
* @
|
|
54
|
+
* @returns {IRange} The area where the statement is applied
|
|
55
|
+
* @example
|
|
56
|
+
* ```ts
|
|
57
|
+
* univerAPI.getActiveWorkbook()
|
|
58
|
+
* .getActiveSheet()
|
|
59
|
+
* .getActiveRange()
|
|
60
|
+
* .getRange()
|
|
61
|
+
* ```
|
|
32
62
|
*/
|
|
33
63
|
getRange(): IRange;
|
|
34
64
|
/**
|
|
35
65
|
* Gets the starting row number of the applied area
|
|
36
|
-
*
|
|
37
|
-
* @
|
|
66
|
+
* @returns {number} The starting row number of the area
|
|
67
|
+
* @example
|
|
68
|
+
* ```ts
|
|
69
|
+
* univerAPI.getActiveWorkbook()
|
|
70
|
+
* .getActiveSheet()
|
|
71
|
+
* .getActiveRange()
|
|
72
|
+
* .getRow()
|
|
73
|
+
* ```
|
|
38
74
|
*/
|
|
39
75
|
getRow(): number;
|
|
40
76
|
/**
|
|
41
77
|
* Gets the starting column number of the applied area
|
|
42
|
-
*
|
|
43
|
-
* @
|
|
78
|
+
* @returns {number} The starting column number of the area
|
|
79
|
+
* @example
|
|
80
|
+
* ```ts
|
|
81
|
+
* univerAPI.getActiveWorkbook()
|
|
82
|
+
* .getActiveSheet()
|
|
83
|
+
* .getActiveRange()
|
|
84
|
+
* .getColumn()
|
|
85
|
+
* ```
|
|
44
86
|
*/
|
|
45
87
|
getColumn(): number;
|
|
46
88
|
/**
|
|
47
89
|
* Gets the width of the applied area
|
|
48
|
-
*
|
|
49
|
-
* @
|
|
90
|
+
* @returns {number} The width of the area
|
|
91
|
+
* @example
|
|
92
|
+
* ```ts
|
|
93
|
+
* univerAPI.getActiveWorkbook()
|
|
94
|
+
* .getActiveSheet()
|
|
95
|
+
* .getActiveRange()
|
|
96
|
+
* .getWidth()
|
|
97
|
+
* ```
|
|
50
98
|
*/
|
|
51
99
|
getWidth(): number;
|
|
52
100
|
/**
|
|
53
101
|
* Gets the height of the applied area
|
|
54
|
-
*
|
|
55
|
-
* @
|
|
102
|
+
* @returns {number} The height of the area
|
|
103
|
+
* @example
|
|
104
|
+
* ```ts
|
|
105
|
+
* univerAPI.getActiveWorkbook()
|
|
106
|
+
* .getActiveSheet()
|
|
107
|
+
* .getActiveRange()
|
|
108
|
+
* .getHeight()
|
|
109
|
+
* ```
|
|
56
110
|
*/
|
|
57
111
|
getHeight(): number;
|
|
58
|
-
/**
|
|
59
|
-
* Return first cell model data in this range
|
|
60
|
-
* @returns The cell model data
|
|
61
|
-
*/
|
|
62
|
-
getCellData(): ICellData | null;
|
|
63
112
|
/**
|
|
64
113
|
* Return range whether this range is merged
|
|
65
|
-
* @returns if true is merged
|
|
114
|
+
* @returns {boolean} if true is merged
|
|
115
|
+
* @example
|
|
116
|
+
* ```ts
|
|
117
|
+
* univerAPI.getActiveWorkbook()
|
|
118
|
+
* .getActiveSheet()
|
|
119
|
+
* .getActiveRange()
|
|
120
|
+
* .isMerged()
|
|
121
|
+
* ```
|
|
66
122
|
*/
|
|
67
123
|
isMerged(): boolean;
|
|
68
124
|
/**
|
|
69
125
|
* Return first cell style data in this range
|
|
70
|
-
* @returns The cell style data
|
|
126
|
+
* @returns {IStyleData | null} The cell style data
|
|
127
|
+
* @example
|
|
128
|
+
* ```ts
|
|
129
|
+
* univerAPI.getActiveWorkbook()
|
|
130
|
+
* .getActiveSheet()
|
|
131
|
+
* .getActiveRange()
|
|
132
|
+
* .getCellStyleData()
|
|
133
|
+
* ```
|
|
71
134
|
*/
|
|
72
135
|
getCellStyleData(): IStyleData | null;
|
|
73
136
|
/**
|
|
74
|
-
*
|
|
75
|
-
* @returns The value of the cell.
|
|
137
|
+
* @deprecated use `getValueAndRichTextValue` instead. This api can't return rich text value.
|
|
76
138
|
*/
|
|
77
139
|
getValue(): CellValue | null;
|
|
78
140
|
/**
|
|
79
|
-
*
|
|
80
|
-
* Returns a two-dimensional array of values, indexed by row, then by column.
|
|
81
|
-
* @returns A two-dimensional array of values.
|
|
141
|
+
* @deprecated use `getValueAndRichTextValues` instead. This api can't return rich text value.
|
|
82
142
|
*/
|
|
83
143
|
getValues(): Nullable<CellValue>[][];
|
|
144
|
+
/**
|
|
145
|
+
* Return first cell model data in this range
|
|
146
|
+
* @returns {ICellData | null} The cell model data
|
|
147
|
+
* @example
|
|
148
|
+
* ```ts
|
|
149
|
+
* univerAPI.getActiveWorkbook()
|
|
150
|
+
* .getActiveSheet()
|
|
151
|
+
* .getActiveRange()
|
|
152
|
+
* .getCellData()
|
|
153
|
+
* ```
|
|
154
|
+
*/
|
|
155
|
+
getCellData(): ICellData | null;
|
|
84
156
|
/**
|
|
85
157
|
* Returns the cell data for the cells in the range.
|
|
86
|
-
* @returns A two-dimensional array of cell data.
|
|
158
|
+
* @returns {Nullable<ICellData>[][]} A two-dimensional array of cell data.
|
|
159
|
+
* @example
|
|
160
|
+
* ```ts
|
|
161
|
+
* univerAPI.getActiveWorkbook()
|
|
162
|
+
* .getActiveSheet()
|
|
163
|
+
* .getActiveRange()
|
|
164
|
+
* .getCellDatas()
|
|
165
|
+
* ```
|
|
166
|
+
*/
|
|
167
|
+
getCellDatas(): Nullable<ICellData>[][];
|
|
168
|
+
/**
|
|
169
|
+
* @deprecated use `getCellDatas` instead.
|
|
87
170
|
*/
|
|
88
171
|
getCellDataGrid(): Nullable<ICellData>[][];
|
|
172
|
+
/**
|
|
173
|
+
* Returns the rich text value for the cell at the start of this range.
|
|
174
|
+
* @returns {Nullable<RichTextValue>} The rich text value
|
|
175
|
+
* @example
|
|
176
|
+
* ```ts
|
|
177
|
+
* univerAPI.getActiveWorkbook()
|
|
178
|
+
* .getActiveSheet()
|
|
179
|
+
* .getActiveRange()
|
|
180
|
+
* .getRichTextValue()
|
|
181
|
+
* ```
|
|
182
|
+
*/
|
|
183
|
+
getRichTextValue(): Nullable<RichTextValue>;
|
|
184
|
+
/**
|
|
185
|
+
* Returns the rich text value for the cells in the range.
|
|
186
|
+
* @returns {Nullable<RichTextValue>[][]} A two-dimensional array of RichTextValue objects.
|
|
187
|
+
* @example
|
|
188
|
+
* ```ts
|
|
189
|
+
* univerAPI.getActiveWorkbook()
|
|
190
|
+
* .getActiveSheet()
|
|
191
|
+
* .getActiveRange()
|
|
192
|
+
* .getRichTextValues()
|
|
193
|
+
* ```
|
|
194
|
+
*/
|
|
195
|
+
getRichTextValues(): Nullable<RichTextValue>[][];
|
|
196
|
+
/**
|
|
197
|
+
* Returns the value and rich text value for the cell at the start of this range.
|
|
198
|
+
* @returns {Nullable<CellValue | RichTextValue>} The value and rich text value
|
|
199
|
+
* @example
|
|
200
|
+
* ```ts
|
|
201
|
+
* univerAPI.getActiveWorkbook()
|
|
202
|
+
* .getActiveSheet()
|
|
203
|
+
* .getActiveRange()
|
|
204
|
+
* .getValueAndRichTextValue()
|
|
205
|
+
* ```
|
|
206
|
+
*/
|
|
207
|
+
getValueAndRichTextValue(): Nullable<CellValue | RichTextValue>;
|
|
208
|
+
/**
|
|
209
|
+
* Returns the value and rich text value for the cells in the range.
|
|
210
|
+
* @returns {Nullable<CellValue | RichTextValue>[][]} A two-dimensional array of value and rich text value
|
|
211
|
+
* @example
|
|
212
|
+
* ```ts
|
|
213
|
+
* univerAPI.getActiveWorkbook()
|
|
214
|
+
* .getActiveSheet()
|
|
215
|
+
* .getActiveRange()
|
|
216
|
+
* .getValueAndRichTextValues()
|
|
217
|
+
* ```
|
|
218
|
+
*/
|
|
219
|
+
getValueAndRichTextValues(): Nullable<CellValue | RichTextValue>[][];
|
|
89
220
|
/**
|
|
90
221
|
* Returns the formulas (A1 notation) for the cells in the range. Entries in the 2D array are empty strings for cells with no formula.
|
|
91
|
-
* @returns A two-dimensional array of formulas in string format.
|
|
222
|
+
* @returns {string[][]} A two-dimensional array of formulas in string format.
|
|
223
|
+
* @example
|
|
224
|
+
* ```ts
|
|
225
|
+
* univerAPI.getActiveWorkbook()
|
|
226
|
+
* .getActiveSheet()
|
|
227
|
+
* .getActiveRange()
|
|
228
|
+
* .getFormulas()
|
|
229
|
+
* ```
|
|
92
230
|
*/
|
|
93
231
|
getFormulas(): string[][];
|
|
232
|
+
/**
|
|
233
|
+
* Returns true if the cell wrap is enabled
|
|
234
|
+
* @returns {boolean} True if the cell wrap is enabled
|
|
235
|
+
* @example
|
|
236
|
+
* ```ts
|
|
237
|
+
* univerAPI.getActiveWorkbook()
|
|
238
|
+
* .getActiveSheet()
|
|
239
|
+
* .getActiveRange()
|
|
240
|
+
* .getWrap()
|
|
241
|
+
* ```
|
|
242
|
+
*/
|
|
94
243
|
getWrap(): boolean;
|
|
244
|
+
/**
|
|
245
|
+
* Returns the text wrapping strategy for the top left cell of the range.
|
|
246
|
+
* @returns {WrapStrategy} The text wrapping strategy
|
|
247
|
+
* @example
|
|
248
|
+
* ```ts
|
|
249
|
+
* univerAPI.getActiveWorkbook()
|
|
250
|
+
* .getActiveSheet()
|
|
251
|
+
* .getActiveRange()
|
|
252
|
+
* .getWrapStrategy()
|
|
253
|
+
* ```
|
|
254
|
+
*/
|
|
95
255
|
getWrapStrategy(): WrapStrategy;
|
|
256
|
+
/**
|
|
257
|
+
* Returns the horizontal alignment for the top left cell of the range.
|
|
258
|
+
* @returns {string} The horizontal alignment
|
|
259
|
+
* @example
|
|
260
|
+
* ```ts
|
|
261
|
+
* univerAPI.getActiveWorkbook()
|
|
262
|
+
* .getActiveSheet()
|
|
263
|
+
* .getActiveRange()
|
|
264
|
+
* .getHorizontalAlignment()
|
|
265
|
+
* ```
|
|
266
|
+
*/
|
|
96
267
|
getHorizontalAlignment(): string;
|
|
268
|
+
/**
|
|
269
|
+
* Returns the vertical alignment for the top left cell of the range.
|
|
270
|
+
* @returns {string} The vertical alignment
|
|
271
|
+
* @example
|
|
272
|
+
* ```ts
|
|
273
|
+
* univerAPI.getActiveWorkbook()
|
|
274
|
+
* .getActiveSheet()
|
|
275
|
+
* .getActiveRange()
|
|
276
|
+
* .getVerticalAlignment()
|
|
277
|
+
* ```
|
|
278
|
+
*/
|
|
97
279
|
getVerticalAlignment(): string;
|
|
98
280
|
/**
|
|
99
|
-
* Set
|
|
100
|
-
* @param
|
|
281
|
+
* Set custom meta data for first cell in current range.
|
|
282
|
+
* @param {CustomData} data The custom meta data
|
|
283
|
+
* @returns {FRange} This range, for chaining
|
|
284
|
+
* ```ts
|
|
285
|
+
* univerAPI.getActiveWorkbook()
|
|
286
|
+
* .getActiveSheet()
|
|
287
|
+
* .getActiveRange()
|
|
288
|
+
* .setCustomMetaData({ key: 'value' });
|
|
289
|
+
* ```
|
|
290
|
+
*/
|
|
291
|
+
setCustomMetaData(data: CustomData): FRange;
|
|
292
|
+
/**
|
|
293
|
+
* Set custom meta data for current range.
|
|
294
|
+
* @param {CustomData[][]} datas The custom meta data
|
|
295
|
+
* @returns {FRange} This range, for chaining
|
|
296
|
+
* ```ts
|
|
297
|
+
* univerAPI.getActiveWorkbook()
|
|
298
|
+
* .getActiveSheet()
|
|
299
|
+
* .getActiveRange()
|
|
300
|
+
* .setCustomMetaDatas([[{ key: 'value' }]]);
|
|
301
|
+
* ```
|
|
302
|
+
*/
|
|
303
|
+
setCustomMetaDatas(datas: CustomData[][]): FRange;
|
|
304
|
+
/**
|
|
305
|
+
* Returns the custom meta data for the cell at the start of this range.
|
|
306
|
+
* @returns {CustomData | null} The custom meta data
|
|
101
307
|
* @example
|
|
102
308
|
* ```
|
|
103
|
-
* univerAPI.getActiveWorkbook()
|
|
309
|
+
* univerAPI.getActiveWorkbook()
|
|
310
|
+
* .getActiveSheet()
|
|
311
|
+
* .getActiveRange()
|
|
312
|
+
* .getCustomMetaData()
|
|
104
313
|
* ```
|
|
105
314
|
*/
|
|
106
|
-
|
|
315
|
+
getCustomMetaData(): CustomData | null;
|
|
316
|
+
/**
|
|
317
|
+
* Returns the custom meta data for the cells in the range.
|
|
318
|
+
* @returns {CustomData[][]} A two-dimensional array of custom meta data
|
|
319
|
+
* @example
|
|
320
|
+
* ```
|
|
321
|
+
* univerAPI.getActiveWorkbook()
|
|
322
|
+
* .getActiveSheet()
|
|
323
|
+
* .getActiveRange()
|
|
324
|
+
* .getCustomMetaDatas()
|
|
325
|
+
* ```
|
|
326
|
+
*/
|
|
327
|
+
getCustomMetaDatas(): Nullable<CustomData>[][];
|
|
107
328
|
/**
|
|
108
329
|
* Set background color for current range.
|
|
330
|
+
* @param {string} color The background color
|
|
331
|
+
* @returns {FRange} This range, for chaining
|
|
109
332
|
* @example
|
|
333
|
+
* ```ts
|
|
334
|
+
* univerAPI.getActiveWorkbook()
|
|
335
|
+
* .getActiveSheet()
|
|
336
|
+
* .getActiveRange()
|
|
337
|
+
* .setBackgroundColor('red')
|
|
110
338
|
* ```
|
|
339
|
+
*/
|
|
340
|
+
setBackgroundColor(color: string): FRange;
|
|
341
|
+
/**
|
|
342
|
+
* Set background color for current range.
|
|
343
|
+
* @param {string} color The background color
|
|
344
|
+
* @returns {FRange} This range, for chaining
|
|
345
|
+
* @example
|
|
346
|
+
* ```typescript
|
|
111
347
|
* univerAPI.getActiveWorkbook().getActiveSheet().getActiveRange().setBackground('red')
|
|
112
348
|
* ```
|
|
113
|
-
* @param color {string}
|
|
114
349
|
*/
|
|
115
350
|
setBackground(color: string): FRange;
|
|
116
351
|
/**
|
|
117
|
-
*
|
|
118
|
-
* @param value
|
|
352
|
+
* Set new value for current cell, first cell in this range.
|
|
353
|
+
* @param {CellValue | ICellData} value The value can be a number, string, boolean, or standard cell format. If it begins with `=`, it is interpreted as a formula. The value is tiled to all cells in the range.
|
|
354
|
+
* @returns {FRange} This range, for chaining
|
|
355
|
+
* ```ts
|
|
356
|
+
* univerAPI.getActiveWorkbook()
|
|
357
|
+
* .getActiveSheet()
|
|
358
|
+
* .getActiveRange()
|
|
359
|
+
* .setValue(1);
|
|
360
|
+
* ```
|
|
119
361
|
*/
|
|
120
362
|
setValue(value: CellValue | ICellData): FRange;
|
|
363
|
+
/**
|
|
364
|
+
* Set new value for current cell, first cell in this range.
|
|
365
|
+
* @param {CellValue | ICellData} value The value can be a number, string, boolean, or standard cell format. If it begins with `=`, it is interpreted as a formula. The value is tiled to all cells in the range.
|
|
366
|
+
* @returns {FRange} This range, for chaining
|
|
367
|
+
* ```ts
|
|
368
|
+
* univerAPI.getActiveWorkbook()
|
|
369
|
+
* .getActiveSheet()
|
|
370
|
+
* .getActiveRange()
|
|
371
|
+
* .setValueForCell(1);
|
|
372
|
+
* ```
|
|
373
|
+
*/
|
|
374
|
+
setValueForCell(value: CellValue | ICellData): FRange;
|
|
375
|
+
/**
|
|
376
|
+
* Set the rich text value for the cell at the start of this range.
|
|
377
|
+
* @param {RichTextValue | IDocumentData} value The rich text value
|
|
378
|
+
* @returns {FRange} The range
|
|
379
|
+
* @example
|
|
380
|
+
* ```
|
|
381
|
+
* univerAPI.getActiveWorkbook()
|
|
382
|
+
* .getActiveSheet()
|
|
383
|
+
* .getActiveRange()
|
|
384
|
+
* .setRichTextValueForCell(new RichTextValue().insertText('Hello'));
|
|
385
|
+
* ```
|
|
386
|
+
*/
|
|
387
|
+
setRichTextValueForCell(value: RichTextValue | IDocumentData): FRange;
|
|
388
|
+
/**
|
|
389
|
+
* Set the rich text value for the cells in the range.
|
|
390
|
+
* @param {RichTextValue[][]} values The rich text value
|
|
391
|
+
* @returns {FRange} The range
|
|
392
|
+
* @example
|
|
393
|
+
* ```ts
|
|
394
|
+
* univerAPI
|
|
395
|
+
* .getActiveWorkbook()
|
|
396
|
+
* .getActiveSheet()
|
|
397
|
+
* .getActiveRange()
|
|
398
|
+
* .setRichTextValues([[new RichTextValue().insertText('Hello')]]);
|
|
399
|
+
* ```
|
|
400
|
+
*/
|
|
401
|
+
setRichTextValues(values: (RichTextValue | IDocumentData)[][]): FRange;
|
|
121
402
|
/**
|
|
122
403
|
* Set the cell wrap of the given range.
|
|
123
404
|
* Cells with wrap enabled (the default) resize to display their full content. Cells with wrap disabled display as much as possible in the cell without resizing or running to multiple lines.
|
|
405
|
+
* @param {boolean} isWrapEnabled Whether to enable wrap
|
|
406
|
+
* @returns {FRange} this range, for chaining
|
|
407
|
+
* @example
|
|
408
|
+
* ```ts
|
|
409
|
+
* univerAPI.getActiveWorkbook()
|
|
410
|
+
* .getActiveSheet()
|
|
411
|
+
* .getActiveRange()
|
|
412
|
+
* .setWrap(true);
|
|
413
|
+
* ```
|
|
124
414
|
*/
|
|
125
415
|
setWrap(isWrapEnabled: boolean): FRange;
|
|
126
416
|
/**
|
|
127
417
|
* Sets the text wrapping strategy for the cells in the range.
|
|
418
|
+
* @param {WrapStrategy} strategy The text wrapping strategy
|
|
419
|
+
* @returns {FRange} this range, for chaining
|
|
420
|
+
* @example
|
|
421
|
+
* ```ts
|
|
422
|
+
* univerAPI.getActiveWorkbook()
|
|
423
|
+
* .getActiveSheet()
|
|
424
|
+
* .getActiveRange()
|
|
425
|
+
* .setWrapStrategy(WrapStrategy.WRAP);
|
|
426
|
+
* ```
|
|
128
427
|
*/
|
|
129
428
|
setWrapStrategy(strategy: WrapStrategy): FRange;
|
|
130
429
|
/**
|
|
131
430
|
* Set the vertical (top to bottom) alignment for the given range (top/middle/bottom).
|
|
431
|
+
* @param {"top" | "middle" | "bottom"} alignment The vertical alignment
|
|
432
|
+
* @returns {FRange} this range, for chaining
|
|
433
|
+
* @example
|
|
434
|
+
* ```ts
|
|
435
|
+
* univerAPI.getActiveWorkbook()
|
|
436
|
+
* .getActiveSheet()
|
|
437
|
+
* .getActiveRange()
|
|
438
|
+
* .setVerticalAlignment('top');
|
|
439
|
+
* ```
|
|
132
440
|
*/
|
|
133
441
|
setVerticalAlignment(alignment: FVerticalAlignment): FRange;
|
|
134
442
|
/**
|
|
135
443
|
* Set the horizontal (left to right) alignment for the given range (left/center/right).
|
|
444
|
+
* @param {"left" | "center" | "normal"} alignment The horizontal alignment
|
|
445
|
+
* @returns {FRange} this range, for chaining
|
|
446
|
+
* @example
|
|
447
|
+
* ```ts
|
|
448
|
+
* univerAPI.getActiveWorkbook()
|
|
449
|
+
* .getActiveSheet()
|
|
450
|
+
* .getActiveRange()
|
|
451
|
+
* .setHorizontalAlignment('left');
|
|
452
|
+
* ```
|
|
136
453
|
*/
|
|
137
454
|
setHorizontalAlignment(alignment: FHorizontalAlignment): FRange;
|
|
138
455
|
/**
|
|
139
456
|
* Sets a different value for each cell in the range. The value can be a two-dimensional array or a standard range matrix (must match the dimensions of this range), consisting of numbers, strings, Boolean values or Composed of standard cell formats. If a value begins with `=`, it is interpreted as a formula.
|
|
140
|
-
* @param value
|
|
457
|
+
* @param {CellValue[][] | IObjectMatrixPrimitiveType<CellValue> | ICellData[][] | IObjectMatrixPrimitiveType<ICellData>} value The value can be a two-dimensional array or a standard range matrix (must match the dimensions of this range), consisting of numbers, strings, Boolean values or Composed of standard cell formats.
|
|
458
|
+
* @returns {FRange} This range, for chaining
|
|
459
|
+
* @example
|
|
460
|
+
* ```ts
|
|
461
|
+
* univerAPI.getActiveWorkbook()
|
|
462
|
+
* .getActiveSheet()
|
|
463
|
+
* .getActiveRange()
|
|
464
|
+
* .setValues([[1, 2], [3, 4]]);
|
|
465
|
+
* ```
|
|
141
466
|
*/
|
|
142
467
|
setValues(value: CellValue[][] | IObjectMatrixPrimitiveType<CellValue> | ICellData[][] | IObjectMatrixPrimitiveType<ICellData>): FRange;
|
|
143
468
|
/**
|
|
144
469
|
* Sets the font weight for the given range (normal/bold),
|
|
145
|
-
* @param fontWeight The font weight, either 'normal' or 'bold'; a null value resets the font weight.
|
|
470
|
+
* @param {FontWeight|null} fontWeight The font weight, either 'normal' or 'bold'; a null value resets the font weight.
|
|
471
|
+
* @returns {FRange} This range, for chaining
|
|
472
|
+
* @example
|
|
473
|
+
* ```ts
|
|
474
|
+
* univerAPI.getActiveWorkbook()
|
|
475
|
+
* .getActiveSheet()
|
|
476
|
+
* .getActiveRange()
|
|
477
|
+
* .setFontWeight('bold');
|
|
478
|
+
* ```
|
|
146
479
|
*/
|
|
147
480
|
setFontWeight(fontWeight: FontWeight | null): this;
|
|
148
481
|
/**
|
|
149
482
|
* Sets the font style for the given range ('italic' or 'normal').
|
|
150
|
-
* @param fontStyle The font style, either 'italic' or 'normal'; a null value resets the font style.
|
|
483
|
+
* @param {FontStyle|null} fontStyle The font style, either 'italic' or 'normal'; a null value resets the font style.
|
|
484
|
+
* @returns {FRange} This range, for chaining
|
|
485
|
+
* @example
|
|
486
|
+
* ```ts
|
|
487
|
+
* univerAPI.getActiveWorkbook()
|
|
488
|
+
* .getActiveSheet()
|
|
489
|
+
* .getActiveRange()
|
|
490
|
+
* .setFontStyle('italic');
|
|
491
|
+
* ```
|
|
151
492
|
*/
|
|
152
493
|
setFontStyle(fontStyle: FontStyle | null): this;
|
|
153
494
|
/**
|
|
154
495
|
* Sets the font line style of the given range ('underline', 'line-through', or 'none').
|
|
155
|
-
* @param fontLine The font line style, either 'underline', 'line-through', or 'none'; a null value resets the font line style.
|
|
496
|
+
* @param {FontLine|null} fontLine The font line style, either 'underline', 'line-through', or 'none'; a null value resets the font line style.
|
|
497
|
+
* @returns {FRange} This range, for chaining
|
|
498
|
+
* @example
|
|
499
|
+
* ```ts
|
|
500
|
+
* univerAPI.getActiveWorkbook()
|
|
501
|
+
* .getActiveSheet()
|
|
502
|
+
* .getActiveRange()
|
|
503
|
+
* .setFontLine('underline');
|
|
504
|
+
* ```
|
|
156
505
|
*/
|
|
157
506
|
setFontLine(fontLine: FontLine | null): this;
|
|
158
507
|
/**
|
|
159
508
|
* Sets the font underline style of the given ITextDecoration
|
|
509
|
+
* @param {ITextDecoration|null} value The font underline style of the given ITextDecoration; a null value resets the font underline style
|
|
510
|
+
* @returns {void}
|
|
511
|
+
* @example
|
|
512
|
+
* ```ts
|
|
513
|
+
* univerAPI.getActiveWorkbook()
|
|
514
|
+
* .getActiveSheet()
|
|
515
|
+
* .getActiveRange()
|
|
516
|
+
* .setFontLine('underline');
|
|
517
|
+
* ```
|
|
160
518
|
*/
|
|
161
519
|
private _setFontUnderline;
|
|
162
520
|
/**
|
|
163
521
|
* Sets the font strikethrough style of the given ITextDecoration
|
|
522
|
+
* @param {ITextDecoration|null} value The font strikethrough style of the given ITextDecoration; a null value resets the font strikethrough style
|
|
523
|
+
* @returns {void}
|
|
164
524
|
*/
|
|
165
525
|
private _setFontStrikethrough;
|
|
166
526
|
/**
|
|
167
527
|
* Sets the font family, such as "Arial" or "Helvetica".
|
|
168
|
-
* @param fontFamily The font family to set; a null value resets the font family.
|
|
528
|
+
* @param {string|null} fontFamily The font family to set; a null value resets the font family.
|
|
529
|
+
* @returns {FRange} This range, for chaining
|
|
530
|
+
* @example
|
|
531
|
+
* ```ts
|
|
532
|
+
* univerAPI.getActiveWorkbook()
|
|
533
|
+
* .getActiveSheet()
|
|
534
|
+
* .getActiveRange()
|
|
535
|
+
* .setFontFamily('Arial');
|
|
536
|
+
* ```
|
|
169
537
|
*/
|
|
170
538
|
setFontFamily(fontFamily: string | null): this;
|
|
171
539
|
/**
|
|
172
540
|
* Sets the font size, with the size being the point size to use.
|
|
173
|
-
* @param size A font size in point size. A null value resets the font size.
|
|
541
|
+
* @param {number|null} size A font size in point size. A null value resets the font size.
|
|
542
|
+
* @returns {FRange} This range, for chaining
|
|
543
|
+
* @example
|
|
544
|
+
* ```ts
|
|
545
|
+
* univerAPI.getActiveWorkbook()
|
|
546
|
+
* .getActiveSheet()
|
|
547
|
+
* .getActiveRange()
|
|
548
|
+
* .setFontSize(12);
|
|
549
|
+
* ```
|
|
174
550
|
*/
|
|
175
551
|
setFontSize(size: number | null): this;
|
|
176
552
|
/**
|
|
177
553
|
* Sets the font color in CSS notation (such as '#ffffff' or 'white').
|
|
178
|
-
* @param color The font color in CSS notation (such as '#ffffff' or 'white'); a null value resets the color.
|
|
554
|
+
* @param {string|null} color The font color in CSS notation (such as '#ffffff' or 'white'); a null value resets the color.
|
|
555
|
+
* @returns {FRange} This range, for chaining
|
|
556
|
+
* @example
|
|
557
|
+
* ```ts
|
|
558
|
+
* univerAPI.getActiveWorkbook()
|
|
559
|
+
* .getActiveSheet()
|
|
560
|
+
* .getActiveRange()
|
|
561
|
+
* .setFontColor('#ff0000');
|
|
562
|
+
* ```
|
|
179
563
|
*/
|
|
180
564
|
setFontColor(color: string | null): this;
|
|
181
565
|
/**
|
|
182
566
|
* Merge cells in a range into one merged cell
|
|
183
|
-
*
|
|
184
|
-
* @
|
|
185
|
-
*
|
|
186
|
-
*
|
|
567
|
+
* @param {boolean} [defaultMerge] - If true, only the value in the upper left cell is retained.
|
|
568
|
+
* @returns {FRange} This range, for chaining
|
|
569
|
+
* @example
|
|
570
|
+
* ```ts
|
|
571
|
+
* const workbook = univerAPI.getActiveWorkbook();
|
|
572
|
+
* const worksheet = workbook.getActiveSheet();
|
|
573
|
+
* const range = worksheet.getRange(0, 0, 2, 2);
|
|
574
|
+
* const merge = range.merge();
|
|
575
|
+
* const isMerged = merge.isMerged();
|
|
576
|
+
* console.log('debugger', isMerged);
|
|
577
|
+
* ```
|
|
187
578
|
*/
|
|
188
579
|
merge(defaultMerge?: boolean): FRange;
|
|
189
580
|
/**
|
|
190
581
|
* Merges cells in a range horizontally.
|
|
191
|
-
*
|
|
192
|
-
* @
|
|
193
|
-
*
|
|
194
|
-
*
|
|
582
|
+
* @param {boolean} [defaultMerge] - If true, only the value in the upper left cell is retained.
|
|
583
|
+
* @returns {FRange} This range, for chaining
|
|
584
|
+
* @example
|
|
585
|
+
* ```ts
|
|
586
|
+
* const workbook = univerAPI.getActiveWorkbook();
|
|
587
|
+
* const worksheet = workbook.getActiveSheet();
|
|
588
|
+
* const range = worksheet.getRange(2, 2, 2, 2);
|
|
589
|
+
* const merge = range.mergeAcross();
|
|
590
|
+
* const allMerge = worksheet.getMergeData();
|
|
591
|
+
* console.log(allMerge.length); // There will be two merged cells.
|
|
592
|
+
* ```
|
|
195
593
|
*/
|
|
196
594
|
mergeAcross(defaultMerge?: boolean): FRange;
|
|
197
595
|
/**
|
|
198
596
|
* Merges cells in a range vertically.
|
|
199
|
-
*
|
|
200
|
-
* @
|
|
201
|
-
*
|
|
202
|
-
*
|
|
597
|
+
* @param {boolean} [defaultMerge] - If true, only the value in the upper left cell is retained.
|
|
598
|
+
* @returns {FRange} This range, for chaining
|
|
599
|
+
* @example
|
|
600
|
+
* ```ts
|
|
601
|
+
* const workbook = univerAPI.getActiveWorkbook();
|
|
602
|
+
* const worksheet = workbook.getActiveSheet();
|
|
603
|
+
* const range = worksheet.getRange(4, 4, 2, 2);
|
|
604
|
+
* const merge = range.mergeVertically();
|
|
605
|
+
* const allMerge = worksheet.getMergeData();
|
|
606
|
+
* console.log(allMerge.length); // There will be two merged cells.
|
|
607
|
+
* ```
|
|
203
608
|
*/
|
|
204
609
|
mergeVertically(defaultMerge?: boolean): FRange;
|
|
205
610
|
/**
|
|
206
611
|
* Returns true if cells in the current range overlap a merged cell.
|
|
207
612
|
* @returns {boolean} is overlap with a merged cell
|
|
613
|
+
* @example
|
|
614
|
+
* ```ts
|
|
615
|
+
* const workbook = univerAPI.getActiveWorkbook();
|
|
616
|
+
* const worksheet = workbook.getActiveSheet();
|
|
617
|
+
* const range = worksheet.getRange(0,0,2,2);
|
|
618
|
+
* const merge = range.merge();
|
|
619
|
+
* const anchor = worksheet.getRange(0,0);
|
|
620
|
+
* const isPartOfMerge = anchor.isPartOfMerge();
|
|
621
|
+
* console.log('debugger, isPartOfMerge) // true
|
|
622
|
+
* ```
|
|
208
623
|
*/
|
|
209
624
|
isPartOfMerge(): boolean;
|
|
210
625
|
/**
|
|
211
626
|
* Break all horizontally- or vertically-merged cells contained within the range list into individual cells again.
|
|
212
|
-
* @returns This range, for chaining
|
|
627
|
+
* @returns {FRange} This range, for chaining
|
|
628
|
+
* @example
|
|
629
|
+
* ```ts
|
|
630
|
+
* const workbook = univerAPI.getActiveWorkbook();
|
|
631
|
+
* const worksheet = workbook.getActiveSheet();
|
|
632
|
+
* const range = worksheet.getRange(0,0,2,2);
|
|
633
|
+
* const merge = range.merge();
|
|
634
|
+
* const anchor = worksheet.getRange(0,0);
|
|
635
|
+
* const isPartOfMergeFirst = anchor.isPartOfMerge();
|
|
636
|
+
* console.log('debugger' isPartOfMergeFirst) // true
|
|
637
|
+
* range.breakApart();
|
|
638
|
+
* const isPartOfMergeSecond = anchor.isPartOfMerge();
|
|
639
|
+
* console.log('debugger' isPartOfMergeSecond) // false
|
|
640
|
+
* ```
|
|
213
641
|
*/
|
|
214
642
|
breakApart(): FRange;
|
|
215
643
|
/**
|
|
216
644
|
* Iterate cells in this range. Merged cells will be respected.
|
|
217
|
-
* @param callback the callback function to be called for each cell in the range
|
|
645
|
+
* @param {Function} callback the callback function to be called for each cell in the range
|
|
218
646
|
* @param {number} callback.row the row number of the cell
|
|
219
647
|
* @param {number} callback.col the column number of the cell
|
|
220
648
|
* @param {ICellData} callback.cell the cell data
|
|
@@ -230,6 +658,7 @@ export declare class FRange extends FBaseInitialable {
|
|
|
230
658
|
forEach(callback: (row: number, col: number, cell: ICellData) => void): void;
|
|
231
659
|
/**
|
|
232
660
|
* Returns a string description of the range, in A1 notation.
|
|
661
|
+
* @param {boolean} [withSheet] - If true, the sheet name is included in the A1 notation.
|
|
233
662
|
* @returns {string} The A1 notation of the range.
|
|
234
663
|
* ```ts
|
|
235
664
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|