@univerjs/sheets 0.6.0 → 0.6.1
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 +1184 -997
- package/lib/es/index.js +1017 -1012
- package/lib/types/commands/commands/set-border-command.d.ts +3 -1
- package/lib/types/commands/operations/scroll-to-cell.operation.d.ts +5 -1
- package/lib/types/controllers/permission/sheet-permission-init.controller.d.ts +1 -0
- package/lib/types/facade/f-defined-name.d.ts +67 -43
- package/lib/types/facade/f-enum.d.ts +6 -1
- package/lib/types/facade/f-event.d.ts +106 -37
- package/lib/types/facade/f-permission.d.ts +8 -7
- package/lib/types/facade/f-range.d.ts +349 -246
- package/lib/types/facade/f-selection.d.ts +37 -12
- package/lib/types/facade/f-univer.d.ts +31 -12
- package/lib/types/facade/f-workbook.d.ts +154 -84
- package/lib/types/facade/f-worksheet.d.ts +298 -262
- package/lib/types/index.d.ts +2 -3
- package/lib/types/model/range-themes/default.d.ts +1 -0
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +3 -3
- package/package.json +8 -8
|
@@ -29,8 +29,9 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
29
29
|
* @example
|
|
30
30
|
* ```ts
|
|
31
31
|
* // The code below gets the Workbook instance
|
|
32
|
-
* const
|
|
33
|
-
* const workbook =
|
|
32
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
33
|
+
* const workbook = fWorkbook.getWorkbook();
|
|
34
|
+
* console.log(workbook);
|
|
34
35
|
* ```
|
|
35
36
|
*/
|
|
36
37
|
getWorkbook(): Workbook;
|
|
@@ -40,8 +41,9 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
40
41
|
* @example
|
|
41
42
|
* ```ts
|
|
42
43
|
* // The code below gets the id of the workbook
|
|
43
|
-
* const
|
|
44
|
-
* const
|
|
44
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
45
|
+
* const unitId = fWorkbook.getId();
|
|
46
|
+
* console.log(unitId);
|
|
45
47
|
* ```
|
|
46
48
|
*/
|
|
47
49
|
getId(): string;
|
|
@@ -51,20 +53,20 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
51
53
|
* @example
|
|
52
54
|
* ```ts
|
|
53
55
|
* // The code below gets the name of the workbook
|
|
54
|
-
* const
|
|
55
|
-
* const name =
|
|
56
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
57
|
+
* const name = fWorkbook.getName();
|
|
58
|
+
* console.log(name);
|
|
56
59
|
* ```
|
|
57
60
|
*/
|
|
58
61
|
getName(): string;
|
|
59
62
|
/**
|
|
60
63
|
* Set the name of the workbook.
|
|
61
64
|
* @param {string} name The new name of the workbook.
|
|
62
|
-
* @returns {void}
|
|
63
65
|
* @example
|
|
64
66
|
* ```ts
|
|
65
67
|
* // The code below sets the name of the workbook
|
|
66
|
-
* const
|
|
67
|
-
*
|
|
68
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
69
|
+
* fWorkbook.setName('MyWorkbook');
|
|
68
70
|
* ```
|
|
69
71
|
*/
|
|
70
72
|
setName(name: string): void;
|
|
@@ -74,8 +76,9 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
74
76
|
* @example
|
|
75
77
|
* ```ts
|
|
76
78
|
* // The code below saves the workbook snapshot data
|
|
77
|
-
* const
|
|
78
|
-
* const snapshot =
|
|
79
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
80
|
+
* const snapshot = fWorkbook.save();
|
|
81
|
+
* console.log(snapshot);
|
|
79
82
|
* ```
|
|
80
83
|
*/
|
|
81
84
|
save(): IWorkbookData;
|
|
@@ -97,8 +100,9 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
97
100
|
* @example
|
|
98
101
|
* ```ts
|
|
99
102
|
* // The code below gets the active sheet of the workbook
|
|
100
|
-
* const
|
|
101
|
-
* const
|
|
103
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
104
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
105
|
+
* console.log(fWorksheet);
|
|
102
106
|
* ```
|
|
103
107
|
*/
|
|
104
108
|
getActiveSheet(): FWorksheet;
|
|
@@ -108,8 +112,9 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
108
112
|
* @example
|
|
109
113
|
* ```ts
|
|
110
114
|
* // The code below gets all the worksheets in the workbook
|
|
111
|
-
* const
|
|
112
|
-
* const sheets =
|
|
115
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
116
|
+
* const sheets = fWorkbook.getSheets();
|
|
117
|
+
* console.log(sheets);
|
|
113
118
|
* ```
|
|
114
119
|
*/
|
|
115
120
|
getSheets(): FWorksheet[];
|
|
@@ -122,8 +127,9 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
122
127
|
* @example
|
|
123
128
|
* ```ts
|
|
124
129
|
* // The code below creates a new sheet
|
|
125
|
-
* const
|
|
126
|
-
* const newSheet =
|
|
130
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
131
|
+
* const newSheet = fWorkbook.create('MyNewSheet', 10, 10);
|
|
132
|
+
* console.log(newSheet);
|
|
127
133
|
* ```
|
|
128
134
|
*/
|
|
129
135
|
create(name: string, rows: number, column: number): FWorksheet;
|
|
@@ -134,8 +140,9 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
134
140
|
* @example
|
|
135
141
|
* ```ts
|
|
136
142
|
* // The code below gets a worksheet by sheet id
|
|
137
|
-
* const
|
|
138
|
-
* const sheet =
|
|
143
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
144
|
+
* const sheet = fWorkbook.getSheetBySheetId('sheetId');
|
|
145
|
+
* console.log(sheet);
|
|
139
146
|
* ```
|
|
140
147
|
*/
|
|
141
148
|
getSheetBySheetId(sheetId: string): FWorksheet | null;
|
|
@@ -146,8 +153,9 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
146
153
|
* @example
|
|
147
154
|
* ```ts
|
|
148
155
|
* // The code below gets a worksheet by sheet name
|
|
149
|
-
* const
|
|
150
|
-
* const sheet =
|
|
156
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
157
|
+
* const sheet = fWorkbook.getSheetByName('Sheet1');
|
|
158
|
+
* console.log(sheet);
|
|
151
159
|
* ```
|
|
152
160
|
*/
|
|
153
161
|
getSheetByName(name: string): FWorksheet | null;
|
|
@@ -158,9 +166,9 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
158
166
|
* @example
|
|
159
167
|
* ```ts
|
|
160
168
|
* // The code below sets the given worksheet to be the active worksheet
|
|
161
|
-
* const
|
|
162
|
-
* const sheet =
|
|
163
|
-
*
|
|
169
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
170
|
+
* const sheet = fWorkbook.getSheets()[1];
|
|
171
|
+
* fWorkbook.setActiveSheet(sheet);
|
|
164
172
|
* ```
|
|
165
173
|
*/
|
|
166
174
|
setActiveSheet(sheet: FWorksheet | string): FWorksheet;
|
|
@@ -172,12 +180,12 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
172
180
|
* @example
|
|
173
181
|
* ```ts
|
|
174
182
|
* // The code below inserts a new sheet into the workbook
|
|
175
|
-
* const
|
|
176
|
-
*
|
|
183
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
184
|
+
* fWorkbook.insertSheet();
|
|
177
185
|
*
|
|
178
186
|
* // The code below inserts a new sheet into the workbook, using a custom name
|
|
179
|
-
* const
|
|
180
|
-
*
|
|
187
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
188
|
+
* fWorkbook.insertSheet('MyNewSheet');
|
|
181
189
|
* ```
|
|
182
190
|
*/
|
|
183
191
|
insertSheet(sheetName?: string): FWorksheet;
|
|
@@ -188,9 +196,9 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
188
196
|
* @example
|
|
189
197
|
* ```ts
|
|
190
198
|
* // The code below deletes the specified worksheet
|
|
191
|
-
* const
|
|
192
|
-
* const sheet =
|
|
193
|
-
*
|
|
199
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
200
|
+
* const sheet = fWorkbook.getSheets()[1];
|
|
201
|
+
* fWorkbook.deleteSheet(sheet);
|
|
194
202
|
* ```
|
|
195
203
|
*/
|
|
196
204
|
deleteSheet(sheet: FWorksheet | string): boolean;
|
|
@@ -200,8 +208,8 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
200
208
|
* @example
|
|
201
209
|
* ```ts
|
|
202
210
|
* // The code below undoes the last action
|
|
203
|
-
* const
|
|
204
|
-
*
|
|
211
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
212
|
+
* fWorkbook.undo();
|
|
205
213
|
* ```
|
|
206
214
|
*/
|
|
207
215
|
undo(): FWorkbook;
|
|
@@ -211,8 +219,8 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
211
219
|
* @example
|
|
212
220
|
* ```ts
|
|
213
221
|
* // The code below redoes the last undone action
|
|
214
|
-
* const
|
|
215
|
-
*
|
|
222
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
223
|
+
* fWorkbook.redo();
|
|
216
224
|
* ```
|
|
217
225
|
*/
|
|
218
226
|
redo(): FWorkbook;
|
|
@@ -228,9 +236,9 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
228
236
|
* @example
|
|
229
237
|
* ```ts
|
|
230
238
|
* // The code below registers a callback that will be triggered before invoking a command targeting the Univer sheet
|
|
231
|
-
* const
|
|
232
|
-
*
|
|
233
|
-
* console.log('
|
|
239
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
240
|
+
* fWorkbook.onBeforeCommandExecute((command) => {
|
|
241
|
+
* console.log('Before command execute:', command);
|
|
234
242
|
* });
|
|
235
243
|
* ```
|
|
236
244
|
*/
|
|
@@ -247,8 +255,8 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
247
255
|
* @example
|
|
248
256
|
* ```ts
|
|
249
257
|
* // The code below registers a callback that will be triggered when a command is invoked targeting the Univer sheet
|
|
250
|
-
* const
|
|
251
|
-
*
|
|
258
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
259
|
+
* fWorkbook.onCommandExecuted((command) => {
|
|
252
260
|
* console.log('Command executed:', command);
|
|
253
261
|
* });
|
|
254
262
|
* ```
|
|
@@ -263,23 +271,49 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
263
271
|
* Register a callback that will be triggered when the selection changes.
|
|
264
272
|
* @param {onSelectionChangeCallback} callback The callback.
|
|
265
273
|
* @returns {IDisposable} A function to dispose the listening
|
|
274
|
+
* @example
|
|
275
|
+
* ```ts
|
|
276
|
+
* // The code below registers a callback that will be triggered when the selection changes
|
|
277
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
278
|
+
* fWorkbook.onSelectionChange((selections) => {
|
|
279
|
+
* console.log('Selection changed:', selections);
|
|
280
|
+
* });
|
|
281
|
+
* ```
|
|
266
282
|
*/
|
|
267
283
|
onSelectionChange(callback: (selections: IRange[]) => void): IDisposable;
|
|
268
284
|
/**
|
|
269
285
|
* Used to modify the editing permissions of the workbook. When the value is false, editing is not allowed.
|
|
270
286
|
* @param {boolean} value editable value want to set
|
|
271
287
|
* @returns {FWorkbook} FWorkbook instance
|
|
288
|
+
* @example
|
|
289
|
+
* ```ts
|
|
290
|
+
* // The code below sets the editing permissions of the workbook
|
|
291
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
292
|
+
* fWorkbook.setEditable(false);
|
|
293
|
+
* ```
|
|
272
294
|
*/
|
|
273
295
|
setEditable(value: boolean): FWorkbook;
|
|
274
296
|
/**
|
|
275
297
|
* Sets the selection region for active sheet.
|
|
276
298
|
* @param {FRange} range The range to set as the active selection.
|
|
277
299
|
* @returns {FWorkbook} FWorkbook instance
|
|
300
|
+
* @example
|
|
301
|
+
* ```ts
|
|
302
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
303
|
+
* const range = fWorkbook.getActiveSheet().getRange('A10:B10');
|
|
304
|
+
* fWorkbook.setActiveRange(range);
|
|
305
|
+
* ```
|
|
278
306
|
*/
|
|
279
307
|
setActiveRange(range: FRange): FWorkbook;
|
|
280
308
|
/**
|
|
281
309
|
* Returns the selected range in the active sheet, or null if there is no active range.
|
|
282
310
|
* @returns {FRange | null} The active range
|
|
311
|
+
* @example
|
|
312
|
+
* ```ts
|
|
313
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
314
|
+
* const activeRange = fWorkbook.getActiveRange();
|
|
315
|
+
* console.log(activeRange);
|
|
316
|
+
* ```
|
|
283
317
|
*/
|
|
284
318
|
getActiveRange(): FRange | null;
|
|
285
319
|
/**
|
|
@@ -287,9 +321,8 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
287
321
|
* @returns {boolean} true if the sheet was deleted, false otherwise
|
|
288
322
|
* @example
|
|
289
323
|
* ```ts
|
|
290
|
-
*
|
|
291
|
-
*
|
|
292
|
-
* const sheet = univerAPI.getActiveWorkbook().deleteActiveSheet();
|
|
324
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
325
|
+
* fWorkbook.deleteActiveSheet();
|
|
293
326
|
* ```
|
|
294
327
|
*/
|
|
295
328
|
deleteActiveSheet(): boolean;
|
|
@@ -300,9 +333,10 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
300
333
|
* @example
|
|
301
334
|
* ```ts
|
|
302
335
|
* // The code below duplicates the given worksheet
|
|
303
|
-
* const
|
|
304
|
-
* const activeSheet =
|
|
305
|
-
*
|
|
336
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
337
|
+
* const activeSheet = fWorkbook.getActiveSheet();
|
|
338
|
+
* const duplicatedSheet = fWorkbook.duplicateSheet(activeSheet);
|
|
339
|
+
* console.log(duplicatedSheet);
|
|
306
340
|
* ```
|
|
307
341
|
*/
|
|
308
342
|
duplicateSheet(sheet: FWorksheet): FWorksheet;
|
|
@@ -311,8 +345,9 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
311
345
|
* @returns {FWorksheet} The duplicated worksheet
|
|
312
346
|
* @example
|
|
313
347
|
* ```ts
|
|
314
|
-
*
|
|
315
|
-
*
|
|
348
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
349
|
+
* const duplicatedSheet = fWorkbook.duplicateActiveSheet();
|
|
350
|
+
* console.log(duplicatedSheet);
|
|
316
351
|
* ```
|
|
317
352
|
*/
|
|
318
353
|
duplicateActiveSheet(): FWorksheet;
|
|
@@ -322,8 +357,8 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
322
357
|
* @example
|
|
323
358
|
* ```ts
|
|
324
359
|
* // The code below gets the number of sheets in the workbook
|
|
325
|
-
* const
|
|
326
|
-
*
|
|
360
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
361
|
+
* console.log(fWorkbook.getNumSheets());
|
|
327
362
|
* ```
|
|
328
363
|
*/
|
|
329
364
|
getNumSheets(): number;
|
|
@@ -333,13 +368,13 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
333
368
|
* @example
|
|
334
369
|
* ```ts
|
|
335
370
|
* // The code below gets the locale of the workbook
|
|
336
|
-
* const
|
|
337
|
-
*
|
|
371
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
372
|
+
* console.log(fWorkbook.getLocale());
|
|
338
373
|
* ```
|
|
339
374
|
*/
|
|
340
375
|
getLocale(): LocaleType;
|
|
341
376
|
/**
|
|
342
|
-
* @deprecated use setSpreadsheetLocale instead.
|
|
377
|
+
* @deprecated use `setSpreadsheetLocale` instead.
|
|
343
378
|
* @param {LocaleType} locale - The locale to set
|
|
344
379
|
*/
|
|
345
380
|
setLocale(locale: LocaleType): void;
|
|
@@ -350,8 +385,9 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
350
385
|
* @example
|
|
351
386
|
* ```ts
|
|
352
387
|
* // The code below sets the locale of the workbook
|
|
353
|
-
* const
|
|
354
|
-
*
|
|
388
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
389
|
+
* fWorkbook.setSpreadsheetLocale(univerAPI.Enum.LocaleType.EN_US);
|
|
390
|
+
* console.log(fWorkbook.getLocale());
|
|
355
391
|
* ```
|
|
356
392
|
*/
|
|
357
393
|
setSpreadsheetLocale(locale: LocaleType): FWorkbook;
|
|
@@ -361,8 +397,9 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
361
397
|
* @example
|
|
362
398
|
* ```ts
|
|
363
399
|
* // The code below gets the URL of the workbook
|
|
364
|
-
* const
|
|
365
|
-
* const url =
|
|
400
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
401
|
+
* const url = fWorkbook.getUrl();
|
|
402
|
+
* console.log(url);
|
|
366
403
|
* ```
|
|
367
404
|
*/
|
|
368
405
|
getUrl(): string;
|
|
@@ -374,9 +411,9 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
374
411
|
* @example
|
|
375
412
|
* ```ts
|
|
376
413
|
* // The code below moves the sheet to the specified index
|
|
377
|
-
* const
|
|
378
|
-
* const sheet =
|
|
379
|
-
*
|
|
414
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
415
|
+
* const sheet = fWorkbook.getActiveSheet();
|
|
416
|
+
* fWorkbook.moveSheet(sheet, 1);
|
|
380
417
|
* ```
|
|
381
418
|
*/
|
|
382
419
|
moveSheet(sheet: FWorksheet, index: number): FWorkbook;
|
|
@@ -387,14 +424,20 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
387
424
|
* @example
|
|
388
425
|
* ```ts
|
|
389
426
|
* // The code below moves the active sheet to the specified index
|
|
390
|
-
* const
|
|
391
|
-
*
|
|
427
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
428
|
+
* fWorkbook.moveActiveSheet(1);
|
|
392
429
|
* ```
|
|
393
430
|
*/
|
|
394
431
|
moveActiveSheet(index: number): FWorkbook;
|
|
395
432
|
/**
|
|
396
433
|
* Get the PermissionInstance.
|
|
397
434
|
* @returns {FPermission} - The PermissionInstance.
|
|
435
|
+
* @example
|
|
436
|
+
* ```ts
|
|
437
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
438
|
+
* const permission = fWorkbook.getPermission();
|
|
439
|
+
* console.log(permission);
|
|
440
|
+
* ```
|
|
398
441
|
*/
|
|
399
442
|
getPermission(): FPermission;
|
|
400
443
|
/**
|
|
@@ -404,8 +447,9 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
404
447
|
* @example
|
|
405
448
|
* ```ts
|
|
406
449
|
* // The code below gets the defined name by name
|
|
407
|
-
* const
|
|
408
|
-
* const definedName =
|
|
450
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
451
|
+
* const definedName = fWorkbook.getDefinedName('MyDefinedName');
|
|
452
|
+
* console.log(definedName);
|
|
409
453
|
* ```
|
|
410
454
|
*/
|
|
411
455
|
getDefinedName(name: string): FDefinedName | null;
|
|
@@ -415,8 +459,9 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
415
459
|
* @example
|
|
416
460
|
* ```ts
|
|
417
461
|
* // The code below gets all the defined names in the workbook
|
|
418
|
-
* const
|
|
419
|
-
* const definedNames =
|
|
462
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
463
|
+
* const definedNames = fWorkbook.getDefinedNames();
|
|
464
|
+
* console.log(definedNames);
|
|
420
465
|
* ```
|
|
421
466
|
*/
|
|
422
467
|
getDefinedNames(): FDefinedName[];
|
|
@@ -428,8 +473,8 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
428
473
|
* @example
|
|
429
474
|
* ```ts
|
|
430
475
|
* // The code below inserts a defined name
|
|
431
|
-
* const
|
|
432
|
-
*
|
|
476
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
477
|
+
* fWorkbook.insertDefinedName('MyDefinedName', 'Sheet1!A1');
|
|
433
478
|
* ```
|
|
434
479
|
*/
|
|
435
480
|
insertDefinedName(name: string, formulaOrRefString: string): FWorkbook;
|
|
@@ -440,8 +485,8 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
440
485
|
* @example
|
|
441
486
|
* ```ts
|
|
442
487
|
* // The code below deletes the defined name with the given name
|
|
443
|
-
* const
|
|
444
|
-
*
|
|
488
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
489
|
+
* fWorkbook.deleteDefinedName('MyDefinedName');
|
|
445
490
|
* ```
|
|
446
491
|
*/
|
|
447
492
|
deleteDefinedName(name: string): boolean;
|
|
@@ -452,10 +497,13 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
452
497
|
* @example
|
|
453
498
|
* ```ts
|
|
454
499
|
* // The code below inserts a defined name by builder param
|
|
455
|
-
* const
|
|
456
|
-
* const
|
|
457
|
-
*
|
|
458
|
-
*
|
|
500
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
501
|
+
* const definedNameBuilder = univerAPI.newDefinedName()
|
|
502
|
+
* .setRef('Sheet1!$A$1')
|
|
503
|
+
* .setName('MyDefinedName')
|
|
504
|
+
* .setComment('This is a comment')
|
|
505
|
+
* .build();
|
|
506
|
+
* fWorkbook.insertDefinedNameBuilder(definedNameBuilder);
|
|
459
507
|
* ```
|
|
460
508
|
*/
|
|
461
509
|
insertDefinedNameBuilder(param: ISetDefinedNameMutationParam): void;
|
|
@@ -466,10 +514,12 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
466
514
|
* @example
|
|
467
515
|
* ```ts
|
|
468
516
|
* // The code below updates the defined name with the given name
|
|
469
|
-
* const
|
|
470
|
-
* const
|
|
471
|
-
*
|
|
472
|
-
*
|
|
517
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
518
|
+
* const definedNameBuilder = fWorkbook.getDefinedName('MyDefinedName').toBuilder();
|
|
519
|
+
* const param = definedNameBuilder.setRef('Sheet1!A2')
|
|
520
|
+
* .setName('NewDefinedName')
|
|
521
|
+
* .build();
|
|
522
|
+
* fWorkbook.updateDefinedNameBuilder(param);
|
|
473
523
|
* ```
|
|
474
524
|
*/
|
|
475
525
|
updateDefinedNameBuilder(param: ISetDefinedNameMutationParam): void;
|
|
@@ -479,8 +529,8 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
479
529
|
* @example
|
|
480
530
|
* ```ts
|
|
481
531
|
* // The code below gets the registered range themes
|
|
482
|
-
* const
|
|
483
|
-
* const themes =
|
|
532
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
533
|
+
* const themes = fWorkbook.getRegisteredRangeThemes();
|
|
484
534
|
* console.log(themes);
|
|
485
535
|
* ```
|
|
486
536
|
*/
|
|
@@ -493,10 +543,11 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
493
543
|
* ```ts
|
|
494
544
|
* // import {RangeThemeStyle} from '@univerjs/sheets';
|
|
495
545
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
496
|
-
* const rangeThemeStyle =
|
|
497
|
-
*
|
|
498
|
-
*
|
|
499
|
-
*
|
|
546
|
+
* const rangeThemeStyle = fWorkbook.createRangeThemeStyle('MyTheme', {
|
|
547
|
+
* secondRowStyle: {
|
|
548
|
+
* bg: {
|
|
549
|
+
* rgb: 'rgb(214,231,241)',
|
|
550
|
+
* },
|
|
500
551
|
* },
|
|
501
552
|
* });
|
|
502
553
|
* fWorkbook.registerRangeTheme(rangeThemeStyle);
|
|
@@ -514,6 +565,24 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
514
565
|
* ```
|
|
515
566
|
*/
|
|
516
567
|
unregisterRangeTheme(themeName: string): void;
|
|
568
|
+
/**
|
|
569
|
+
* Create a range theme style.
|
|
570
|
+
* @param {string} themeName - The name of the theme to register
|
|
571
|
+
* @param {Omit<IRangeThemeStyleJSON, 'name'>} themeStyleJson - The theme style json to register
|
|
572
|
+
* @returns {RangeThemeStyle} - The created range theme style
|
|
573
|
+
* @example
|
|
574
|
+
* ```ts
|
|
575
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
576
|
+
* const rangeThemeStyle = fWorkbook.createRangeThemeStyle('MyTheme', {
|
|
577
|
+
* secondRowStyle: {
|
|
578
|
+
* bg: {
|
|
579
|
+
* rgb: 'rgb(214,231,241)',
|
|
580
|
+
* },
|
|
581
|
+
* },
|
|
582
|
+
* });
|
|
583
|
+
* console.log(rangeThemeStyle);
|
|
584
|
+
* ```
|
|
585
|
+
*/
|
|
517
586
|
createRangeThemeStyle(themeName: string, themeStyleJson?: Omit<IRangeThemeStyleJSON, 'name'>): RangeThemeStyle;
|
|
518
587
|
/**
|
|
519
588
|
* Set custom metadata of workbook
|
|
@@ -533,6 +602,7 @@ export declare class FWorkbook extends FBaseInitialable {
|
|
|
533
602
|
* ```ts
|
|
534
603
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
535
604
|
* const custom = fWorkbook.getCustomMetadata();
|
|
605
|
+
* console.log(custom);
|
|
536
606
|
* ```
|
|
537
607
|
*/
|
|
538
608
|
getCustomMetadata(): CustomData | undefined;
|