@progress/kendo-spreadsheet-common 1.0.0-develop.1 → 1.0.0-develop.11
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/README.md +28 -3
- package/dist/index-esm.js +174 -162
- package/dist/index.js +182 -165
- package/package.json +6 -8
- package/src/index.d.ts +756 -1
package/src/index.d.ts
CHANGED
|
@@ -1 +1,756 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
/* eslint-disable max-len */
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Represents the default cell styles that will be applied to the sheet cells.
|
|
6
|
+
*/
|
|
7
|
+
export interface CellDefaultStyle {
|
|
8
|
+
/**
|
|
9
|
+
* The background [CSS color](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the cell.
|
|
10
|
+
*/
|
|
11
|
+
background?: string;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* The text [CSS color](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the cell.
|
|
15
|
+
*/
|
|
16
|
+
color?: string;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* The font family of the cell.
|
|
20
|
+
*/
|
|
21
|
+
fontFamily?: string;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The font size of the cell in pixels.
|
|
25
|
+
*/
|
|
26
|
+
fontSize?: number;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* If set to `true`, sets the cell font to bold.
|
|
30
|
+
*/
|
|
31
|
+
bold?: boolean;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* If set to `true`, sets the cell font to italic.
|
|
35
|
+
*/
|
|
36
|
+
italic?: boolean;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* If set to `true`, sets the cell font to underline.
|
|
40
|
+
*/
|
|
41
|
+
underline?: boolean;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* If set to `true`, sets the cell wrap.
|
|
45
|
+
*/
|
|
46
|
+
wrap?: boolean;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Configures the Excel export settings of the Spreadsheet.
|
|
51
|
+
*/
|
|
52
|
+
export interface ExcelExportSettings {
|
|
53
|
+
/**
|
|
54
|
+
* Specifies the file name of the exported Excel file.
|
|
55
|
+
*
|
|
56
|
+
* @default 'Workbook.xslx'
|
|
57
|
+
*/
|
|
58
|
+
fileName?: string;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* If set to `true`, the content will be forwarded to proxyURL even if the browser supports the saving of files locally.
|
|
62
|
+
*
|
|
63
|
+
* @default false
|
|
64
|
+
*/
|
|
65
|
+
forceProxy?: boolean;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* The URL of the server side proxy which will stream the file to the end user. A proxy will be used when the browser is not capable of saving files locally. Such browsers are IE version 9 and lower and Safari. The developer is responsible for implementing the server-side proxy. The proxy will return the decoded file with the `Content-Disposition` header set to `attachment; filename="<fileName.xslx>"`.
|
|
69
|
+
* The proxy will receive a POST request with the following parameters in the request body:
|
|
70
|
+
* - contentType - The MIME type of the file.
|
|
71
|
+
* - base64 - The base-64 encoded file content.
|
|
72
|
+
* - fileName - The file name as requested by the caller.
|
|
73
|
+
*
|
|
74
|
+
* @default null
|
|
75
|
+
*/
|
|
76
|
+
proxyURL?: string | null;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* The SheetColumn object.
|
|
81
|
+
*/
|
|
82
|
+
export interface SheetColumn {
|
|
83
|
+
/**
|
|
84
|
+
* The zero-based index of the column. Required to ensure correct positioning.
|
|
85
|
+
*/
|
|
86
|
+
index?: number;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* The width of the column in pixels. Defaults to columnWidth.
|
|
90
|
+
*/
|
|
91
|
+
width?: number;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* The CellBorder object.
|
|
96
|
+
*/
|
|
97
|
+
export interface CellBorder {
|
|
98
|
+
/**
|
|
99
|
+
* The border color of the cell. Many standard CSS formats are supported. However, the canonical form is #ccff00.
|
|
100
|
+
*/
|
|
101
|
+
color?: string;
|
|
102
|
+
/**
|
|
103
|
+
* The width of the border in pixels.
|
|
104
|
+
*/
|
|
105
|
+
size?: number;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Represents the interface of a Spreadsheet cell.
|
|
110
|
+
*/
|
|
111
|
+
export interface Cell extends CellDefaultStyle {
|
|
112
|
+
/**
|
|
113
|
+
* The style information for the bottom border of the cell.
|
|
114
|
+
*/
|
|
115
|
+
borderBottom?: CellBorder;
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* The style information for the left border of the cell.
|
|
119
|
+
*/
|
|
120
|
+
borderLeft?: CellBorder;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* The style information for the right border of the cell.
|
|
124
|
+
*/
|
|
125
|
+
borderRight?: CellBorder;
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* The style information for the top border of the cell.
|
|
129
|
+
*/
|
|
130
|
+
borderTop?: CellBorder;
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* If set to `false`, disables the cell.
|
|
134
|
+
*/
|
|
135
|
+
enable?: boolean;
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* The format of the cell text. For more information, refer to the article on
|
|
139
|
+
* [creating or deleting a custom number format on MS Office](https://support.office.com/en-au/article/Create-or-delete-a-custom-number-format-78f2a361-936b-4c03-8772-09fab54be7f4).
|
|
140
|
+
*/
|
|
141
|
+
format?: string;
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* The cell formula without the leading equals sign, for example, `A1 * 10`.
|
|
145
|
+
*/
|
|
146
|
+
formula?: string;
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* If set to `true`, renders the cell value as HTML.
|
|
150
|
+
* It is important to sanitize the value of the cell on the server for passing safe html because there is no client-side sanitizing.
|
|
151
|
+
* When editing a cell the new value can be checked and prevented in the client `changing` event.
|
|
152
|
+
*/
|
|
153
|
+
html?: boolean;
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* The zero-based index of the cell. Required to ensure correct positioning.
|
|
157
|
+
*/
|
|
158
|
+
index?: number;
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* The hyperlink (URL) of the cell.
|
|
162
|
+
*/
|
|
163
|
+
link?: string;
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* The text-align setting for the cell content.
|
|
167
|
+
*
|
|
168
|
+
* The available options are: `left`, `center`, `right` or `justify`.
|
|
169
|
+
*/
|
|
170
|
+
textAlign?: string;
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* The cell value.
|
|
174
|
+
*/
|
|
175
|
+
value?: number | string | boolean | Date;
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* The vertical align setting for the cell content.
|
|
179
|
+
*
|
|
180
|
+
* The available options are: `top`, `center` or `bottom`.
|
|
181
|
+
*/
|
|
182
|
+
verticalAlign?: string;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* The SheetRow object.
|
|
187
|
+
*/
|
|
188
|
+
export interface SheetRow {
|
|
189
|
+
/**
|
|
190
|
+
* The cells in the row.
|
|
191
|
+
*/
|
|
192
|
+
cells?: Cell[];
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* The row height in pixels. Defaults to rowHeight.
|
|
196
|
+
*/
|
|
197
|
+
height?: number;
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* The absolute row index. Required to ensure correct positioning.
|
|
201
|
+
*/
|
|
202
|
+
index?: number;
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* The table row element role in the context of the Grid table structure.
|
|
206
|
+
*/
|
|
207
|
+
type?: string;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Represents the interface of a Spreadsheet document sheet and its content.
|
|
212
|
+
*/
|
|
213
|
+
export interface SheetDescriptor {
|
|
214
|
+
/**
|
|
215
|
+
* The active cell in the sheet, for example, `A1`.
|
|
216
|
+
*/
|
|
217
|
+
activeCell?: string;
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* The name of the sheet.
|
|
221
|
+
*/
|
|
222
|
+
name?: string;
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* An array which defines the columns in this sheet and their content.
|
|
226
|
+
*/
|
|
227
|
+
columns?: SheetColumn[];
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* The number of frozen columns in this sheet.
|
|
231
|
+
*/
|
|
232
|
+
frozenColumns?: number;
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* The number of frozen rows in this sheet.
|
|
236
|
+
*/
|
|
237
|
+
frozenRows?: number;
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* An array of merged cell ranges, for example, `B1:D2`.
|
|
241
|
+
*/
|
|
242
|
+
mergedCells?: string[];
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* The row data for this sheet.
|
|
246
|
+
*/
|
|
247
|
+
rows?: SheetRow[];
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* The selected range in the sheet, for example, `A1:B10`.
|
|
251
|
+
*/
|
|
252
|
+
selection?: string;
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* A Boolean value which indicates if the grid lines of the sheet will be displayed.
|
|
256
|
+
*
|
|
257
|
+
* @default true
|
|
258
|
+
*/
|
|
259
|
+
showGridLines?: boolean;
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* @hidden
|
|
263
|
+
*/
|
|
264
|
+
gridLinesColor?: string | null;
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* An array which contains the hyperlinks of the cells.
|
|
268
|
+
*/
|
|
269
|
+
hyperlinks?: { ref: string; target: string }[];
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* The default cell styles that will be applied to the sheet cells.
|
|
273
|
+
*/
|
|
274
|
+
defaultCellStyle?: CellDefaultStyle;
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* An array which contains the drawings used in this sheet.
|
|
278
|
+
*/
|
|
279
|
+
drawings?: { topLeftCell: any; offsetX: number; offsetY: number; width: number; height: number; image: string; opacity: any }[];
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* Represents the configuration of a Spreadsheet document.
|
|
284
|
+
*/
|
|
285
|
+
export interface DocumentDescriptor {
|
|
286
|
+
/**
|
|
287
|
+
* The name of the currently active sheet. Must exactly match one of the sheet names.
|
|
288
|
+
*/
|
|
289
|
+
activeSheet?: string;
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* An array which defines the document sheets and their content.
|
|
293
|
+
*/
|
|
294
|
+
sheets?: SheetDescriptor[];
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* An array which holds the names of the sheets.
|
|
298
|
+
*/
|
|
299
|
+
names?: { value: string; name: string; sheet: string; localName: string }[];
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* An object containing any images used in the Spreadsheet. The keys should be image ID-s
|
|
303
|
+
* (they are referenced by this ID in `sheets.drawings`) and the values should be image URLs.
|
|
304
|
+
* The image URLs can be either [data URLs](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URLs), in which case the images are fully contained by the JSON,
|
|
305
|
+
* or can be external URLs.
|
|
306
|
+
* Note that when external URLs are used, they should reside on the same domain, or the server must
|
|
307
|
+
* be configured with the proper [CORS headers](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS),
|
|
308
|
+
* for the Spreadsheet to be able to fetch binary image data using a XMLHttpRequest. If it cannot fetch
|
|
309
|
+
* the image, export to Excel or PDF might not work.
|
|
310
|
+
*/
|
|
311
|
+
images?: { [name: string]: string };
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* The default column width in pixels.
|
|
315
|
+
*
|
|
316
|
+
* @default 64
|
|
317
|
+
*/
|
|
318
|
+
columnWidth?: number;
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* The number of columns in the document.
|
|
322
|
+
*
|
|
323
|
+
* @default 50
|
|
324
|
+
*/
|
|
325
|
+
columns?: number;
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* The default cell styles that will be applied to the sheet cells.
|
|
329
|
+
*/
|
|
330
|
+
defaultCellStyle?: CellDefaultStyle;
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* The height of the header row in pixels.
|
|
334
|
+
*
|
|
335
|
+
* @default 20
|
|
336
|
+
*/
|
|
337
|
+
headerHeight?: number;
|
|
338
|
+
|
|
339
|
+
/**
|
|
340
|
+
* The width of the header column in pixels.
|
|
341
|
+
*
|
|
342
|
+
* @default 32
|
|
343
|
+
*/
|
|
344
|
+
headerWidth?: number;
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* The default row height in pixels.
|
|
348
|
+
*
|
|
349
|
+
* @default 20
|
|
350
|
+
*/
|
|
351
|
+
rowHeight?: number;
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* The number of rows in the document.
|
|
355
|
+
*
|
|
356
|
+
* @default 200
|
|
357
|
+
*/
|
|
358
|
+
rows?: number;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
/**
|
|
362
|
+
* The View object.
|
|
363
|
+
*/
|
|
364
|
+
export class View {
|
|
365
|
+
constructor(element: HTMLElement, options: any);
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* A function which enables and disables the clipboard.
|
|
369
|
+
*/
|
|
370
|
+
enableClipboard(enable: boolean): void;
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* Returns the workbook object of the View.
|
|
374
|
+
*/
|
|
375
|
+
workbook(workbook?: Workbook): void | Workbook;
|
|
376
|
+
/**
|
|
377
|
+
* @hidden
|
|
378
|
+
*/
|
|
379
|
+
sheet(sheet: Sheet): void;
|
|
380
|
+
|
|
381
|
+
/**
|
|
382
|
+
* Re-renders all data in the View.
|
|
383
|
+
*/
|
|
384
|
+
refresh(reason: any): void;
|
|
385
|
+
/**
|
|
386
|
+
* @hidden
|
|
387
|
+
*/
|
|
388
|
+
nameEditor: any;
|
|
389
|
+
/**
|
|
390
|
+
* @hidden
|
|
391
|
+
*/
|
|
392
|
+
bind(eventName: string, handler: any, one?: boolean): void;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
/**
|
|
396
|
+
* The props of the Workbook component.
|
|
397
|
+
*/
|
|
398
|
+
export class Workbook {
|
|
399
|
+
constructor(options: any, view: View);
|
|
400
|
+
|
|
401
|
+
/**
|
|
402
|
+
* Executes a command with the passed options.
|
|
403
|
+
*
|
|
404
|
+
* @param options The object from where data will be loaded. This has to be the deserialized object, not the JSON string.
|
|
405
|
+
*/
|
|
406
|
+
execute(options: any): any;
|
|
407
|
+
|
|
408
|
+
/**
|
|
409
|
+
* Re-renders all data in the Workbook.
|
|
410
|
+
*/
|
|
411
|
+
refresh(reason: any): void;
|
|
412
|
+
|
|
413
|
+
/**
|
|
414
|
+
* A collection holding the commands available for undo and redo.
|
|
415
|
+
*/
|
|
416
|
+
undoRedoStack: any;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
/**
|
|
420
|
+
* Represents one or more rectangular regions of cells in a given Sheet.
|
|
421
|
+
*/
|
|
422
|
+
export class Range {
|
|
423
|
+
/**
|
|
424
|
+
* Gets or sets the background color of the cells in the range.
|
|
425
|
+
*
|
|
426
|
+
* @param value Any valid [CSS color](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value).
|
|
427
|
+
* @returns the current background color of the top-left cell of the range.
|
|
428
|
+
*/
|
|
429
|
+
background(value?: string): string;
|
|
430
|
+
/**
|
|
431
|
+
* Gets or sets the bold state of the cells in the range.
|
|
432
|
+
*
|
|
433
|
+
* @param value True to make the text bold; false otherwise.
|
|
434
|
+
* @returns the current bold state of the top-left cell of the range.
|
|
435
|
+
*/
|
|
436
|
+
bold(value?: boolean): boolean;
|
|
437
|
+
/**
|
|
438
|
+
* Gets or sets the state of the bottom border of the cells. If the range includes more than a single cell, the setting is applied to all cells.
|
|
439
|
+
*
|
|
440
|
+
* @param value The border configuration object. It may contain size and color keys.
|
|
441
|
+
* @returns the current value of the top-left cell of the range.
|
|
442
|
+
*/
|
|
443
|
+
borderBottom(value?: CellBorder): CellBorder;
|
|
444
|
+
/**
|
|
445
|
+
* Gets or sets the state of the left border of the cells. If the range includes more than a single cell, the setting is applied to all cells.
|
|
446
|
+
*
|
|
447
|
+
* @param value The border configuration object. It may contain size and color keys.
|
|
448
|
+
* @returns the current value of the top-left cell of the range.
|
|
449
|
+
*/
|
|
450
|
+
borderLeft(value?: CellBorder): CellBorder;
|
|
451
|
+
/**
|
|
452
|
+
* Gets or sets the state of the right border of the cells. If the range includes more than a single cell, the setting is applied to all cells.
|
|
453
|
+
*
|
|
454
|
+
* @param value The border configuration object. It may contain size and color keys.
|
|
455
|
+
* @returns the current value of the top-left cell of the range.
|
|
456
|
+
*/
|
|
457
|
+
borderRight(value?: CellBorder): CellBorder;
|
|
458
|
+
/**
|
|
459
|
+
* Gets or sets the state of the top border of the cells. If the range includes more than a single cell, the setting is applied to all cells.
|
|
460
|
+
*
|
|
461
|
+
* @param value The border configuration object. It may contain size and color keys.
|
|
462
|
+
* @returns the current value of the top-left cell of the range.
|
|
463
|
+
*/
|
|
464
|
+
borderTop(value?: CellBorder): CellBorder;
|
|
465
|
+
/**
|
|
466
|
+
* Gets or sets the text color of the cells in the range.
|
|
467
|
+
*
|
|
468
|
+
* @param value - Any valid [CSS color](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value).
|
|
469
|
+
* @returns the current text color of the top-left cell of the range.
|
|
470
|
+
*/
|
|
471
|
+
color(value?: string): string;
|
|
472
|
+
/**
|
|
473
|
+
* Clears the contents of the range cells.
|
|
474
|
+
*
|
|
475
|
+
* @param value An object which may contain `contentsOnly: true` or `formatOnly: true` key values. Clearing the format will remove the cell formatting and visual styles.
|
|
476
|
+
* If a parameter is not passed, the method will clear both the cells values and the formatting.
|
|
477
|
+
*/
|
|
478
|
+
clear(value?: { contentsOnly?: boolean; formatOnly: boolean }): void;
|
|
479
|
+
/**
|
|
480
|
+
* Gets or sets the disabled state of the cells in the range.
|
|
481
|
+
*
|
|
482
|
+
* @param value True to make the cell enabled; false to disable it.
|
|
483
|
+
* @returns the current disabled state of the top-left cell of the range.
|
|
484
|
+
*/
|
|
485
|
+
enable(value?: boolean): boolean;
|
|
486
|
+
/**
|
|
487
|
+
* Gets or sets the font family of the cells in the range.
|
|
488
|
+
*
|
|
489
|
+
* @param value The font family that should be set.
|
|
490
|
+
* @returns the font family of the top-left cell of the range.
|
|
491
|
+
*/
|
|
492
|
+
fontFamily(value?: string): string;
|
|
493
|
+
/**
|
|
494
|
+
* Gets or sets the font size of the cells in the range.
|
|
495
|
+
*
|
|
496
|
+
* @param value The font size (in pixels) that should be set.
|
|
497
|
+
* @returns the font size of the top-left cell of the range.
|
|
498
|
+
*/
|
|
499
|
+
fontSize(value?: number): number;
|
|
500
|
+
/**
|
|
501
|
+
* Executes a function for each cell in the range.
|
|
502
|
+
*
|
|
503
|
+
* @param value The function that will be executed against every cell. The function receives the following parameters:
|
|
504
|
+
* `rowIndex` - the row index of the cell,
|
|
505
|
+
* `columnIndex` - the column index of the cell,
|
|
506
|
+
* `cellProperties` - the cell properties
|
|
507
|
+
*/
|
|
508
|
+
forEachCell(value: (rowIndex: number, columnIndex: number, cellProperties: Cell) => void): void;
|
|
509
|
+
/**
|
|
510
|
+
* Gets or sets the format of the cells.
|
|
511
|
+
*
|
|
512
|
+
* @param value The new format for the cells.
|
|
513
|
+
* @returns the format of the top-left cell of the range. When used as a setter, format returns the Range object to allow chained calls.
|
|
514
|
+
*/
|
|
515
|
+
format(value?: string): string;
|
|
516
|
+
/**
|
|
517
|
+
* Gets or sets the formula of the cells.
|
|
518
|
+
*
|
|
519
|
+
* @param value The new formula of the cell. The string may optionally start with `=`.
|
|
520
|
+
* @returns the formula of the top-left cell of the range.
|
|
521
|
+
*/
|
|
522
|
+
formula(value?: string): string;
|
|
523
|
+
/**
|
|
524
|
+
* Gets or sets the value of the cells. This is similar to `value`, but it parses the argument as if it was entered through the text box:
|
|
525
|
+
* - if it starts with `=` (equal sign), a formula is set. This may throw an error if the formula is syntactically invalid. Example: `range("C1").input("=A1+B1")`.
|
|
526
|
+
* - if it looks like a number, a numeric value (not string) is set.
|
|
527
|
+
* - if it's `true` or `false` (case-insensitive) the respective boolean value is set.
|
|
528
|
+
* - if it's a `Date` object, or a string that can be parsed as a date, it is converted to the numerical representation of the date.
|
|
529
|
+
* - if it starts with `'` (single quote), a string containing the rest of the characters is set. Example: `range("A1").input("'TRUE")` — sets the text "TRUE", not the boolean.
|
|
530
|
+
*
|
|
531
|
+
* @param value The value to be set to the cells.
|
|
532
|
+
* @returns the current value of the top-left cell of the range.
|
|
533
|
+
*/
|
|
534
|
+
input(value?: string | number | Date): any;
|
|
535
|
+
/**
|
|
536
|
+
* Gets or sets the italic state of the cells in the range.
|
|
537
|
+
*
|
|
538
|
+
* @param value True will make the text of the cells italic; false otherwise.
|
|
539
|
+
* @returns the current italic state of the top-left cell of the range.
|
|
540
|
+
*/
|
|
541
|
+
italic(value?: boolean): boolean;
|
|
542
|
+
/**
|
|
543
|
+
* Gets or sets the hyperlink of the cells in the range.
|
|
544
|
+
*
|
|
545
|
+
* @param value Pass a string (the URL) to create a hyperlink. Pass `null` to remove the link. Omit argument to get the existing URL, if any.
|
|
546
|
+
* @returns the current hyperlink attribute of the top-left cell of the range.
|
|
547
|
+
*/
|
|
548
|
+
link(value?: string): any;
|
|
549
|
+
/**
|
|
550
|
+
* Sets the sheet selection to the range cells.
|
|
551
|
+
*/
|
|
552
|
+
select(): void;
|
|
553
|
+
/**
|
|
554
|
+
* Gets or sets the text alignment of the cells in the range.
|
|
555
|
+
*
|
|
556
|
+
* @param value One of the following values: "left", "center", "right" and "justify".
|
|
557
|
+
* @returns the current text alignment of the top-left cell of the range.
|
|
558
|
+
*/
|
|
559
|
+
textAlign(value?: string): string;
|
|
560
|
+
/**
|
|
561
|
+
* Gets or sets the value of the cells. If the cell has formula set, the value setting will clear it.
|
|
562
|
+
*
|
|
563
|
+
* @param value The value to be set to the cells.
|
|
564
|
+
* @returns the current value of the top-left cell of the range.
|
|
565
|
+
*/
|
|
566
|
+
value(value?: string | number | Date): any;
|
|
567
|
+
/**
|
|
568
|
+
* Gets or sets the vertical alignment of the cells in the range.
|
|
569
|
+
*
|
|
570
|
+
* @param value One of the following values: "top", "center" and "bottom".
|
|
571
|
+
* @returns the current text alignment of the top-left cell of the range.
|
|
572
|
+
*/
|
|
573
|
+
verticalAlign(value?: string): string;
|
|
574
|
+
/**
|
|
575
|
+
* Gets or sets the wrap of the range cells.
|
|
576
|
+
*
|
|
577
|
+
* @param value `true` if to enable wrapping, `false` otherwise.
|
|
578
|
+
* @returns the current wrap state of the top-left cell of the range.
|
|
579
|
+
*/
|
|
580
|
+
wrap(value?: boolean): boolean;
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
/**
|
|
584
|
+
* The Sheet object.
|
|
585
|
+
*/
|
|
586
|
+
export class Sheet {
|
|
587
|
+
/**
|
|
588
|
+
* Changes the size of the rows and columns of the current sheet.
|
|
589
|
+
*
|
|
590
|
+
* @param newRows The rows of the sheet after the resizing.
|
|
591
|
+
*
|
|
592
|
+
* @param newCols The columns of the sheet after the resizing.
|
|
593
|
+
*/
|
|
594
|
+
resize(newRows: number, newCols: number): void;
|
|
595
|
+
|
|
596
|
+
/**
|
|
597
|
+
* Returns the name of the sheet.
|
|
598
|
+
*/
|
|
599
|
+
name(): string;
|
|
600
|
+
|
|
601
|
+
/**
|
|
602
|
+
* Returns a Range object based on the passed cells.
|
|
603
|
+
*/
|
|
604
|
+
range(cell: string): Range;
|
|
605
|
+
|
|
606
|
+
/**
|
|
607
|
+
* Returns the active cell in the sheet, for example, A1.
|
|
608
|
+
*/
|
|
609
|
+
activeCell(): any;
|
|
610
|
+
|
|
611
|
+
/**
|
|
612
|
+
* A Boolean value which indicates if the grid lines of the sheet will be displayed.
|
|
613
|
+
*
|
|
614
|
+
* @default true
|
|
615
|
+
*/
|
|
616
|
+
showGridLines(value?: any): any;
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
/**
|
|
620
|
+
* @hidden
|
|
621
|
+
*/
|
|
622
|
+
export interface ExternalRef<T> {
|
|
623
|
+
get current(): T | null;
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
/**
|
|
627
|
+
* Represents the options that will be applied the Spreadsheet.
|
|
628
|
+
*/
|
|
629
|
+
export interface SpreadsheetOptions extends DocumentDescriptor {
|
|
630
|
+
/**
|
|
631
|
+
* The name of the sheet.
|
|
632
|
+
*/
|
|
633
|
+
name?: string;
|
|
634
|
+
|
|
635
|
+
/**
|
|
636
|
+
* @hidden
|
|
637
|
+
*/
|
|
638
|
+
sheetsbar?: boolean;
|
|
639
|
+
|
|
640
|
+
/**
|
|
641
|
+
* Configures the Excel export settings of the Spreadsheet.
|
|
642
|
+
*/
|
|
643
|
+
excel?: ExcelExportSettings;
|
|
644
|
+
|
|
645
|
+
/**
|
|
646
|
+
* Sets the component messages.
|
|
647
|
+
*/
|
|
648
|
+
messages?: any;
|
|
649
|
+
|
|
650
|
+
/**
|
|
651
|
+
* Sets the component locale.
|
|
652
|
+
*/
|
|
653
|
+
locale?: string;
|
|
654
|
+
|
|
655
|
+
/**
|
|
656
|
+
* @hidden
|
|
657
|
+
*/
|
|
658
|
+
formulaBarInputRef?: ExternalRef<any>;
|
|
659
|
+
/**
|
|
660
|
+
* @hidden
|
|
661
|
+
*/
|
|
662
|
+
formulaCellInputRef?: ExternalRef<any>;
|
|
663
|
+
/**
|
|
664
|
+
* @hidden
|
|
665
|
+
*/
|
|
666
|
+
nameBoxRef?: ExternalRef<any>;
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
/**
|
|
670
|
+
* Represents the SpreadsheetWidget, holding the core functionality of the Spreadsheet.
|
|
671
|
+
*/
|
|
672
|
+
export class SpreadsheetWidget {
|
|
673
|
+
constructor(element: HTMLElement, options: SpreadsheetOptions);
|
|
674
|
+
|
|
675
|
+
/**
|
|
676
|
+
* Returns the `View` object of the Spreadsheet.
|
|
677
|
+
*/
|
|
678
|
+
get view(): View;
|
|
679
|
+
|
|
680
|
+
/**
|
|
681
|
+
* Returns the `Workbook` object of the Spreadsheet.
|
|
682
|
+
*/
|
|
683
|
+
get workbook(): Workbook;
|
|
684
|
+
|
|
685
|
+
/**
|
|
686
|
+
* @hidden
|
|
687
|
+
*/
|
|
688
|
+
get options(): SpreadsheetOptions;
|
|
689
|
+
|
|
690
|
+
/**
|
|
691
|
+
* Executes the passed command against the selected cell/range.
|
|
692
|
+
*
|
|
693
|
+
* @param options An object containing the command name and the required by it options.
|
|
694
|
+
*/
|
|
695
|
+
executeCommand(options: any): void;
|
|
696
|
+
|
|
697
|
+
/**
|
|
698
|
+
* Loads the workbook data from an object with the format that is defined in the configuration.
|
|
699
|
+
*
|
|
700
|
+
* Note: All existing sheets and their data will be lost.
|
|
701
|
+
*
|
|
702
|
+
* @param json The object from where data will be loaded. This has to be the deserialized object, not the JSON string.
|
|
703
|
+
*/
|
|
704
|
+
fromJSON(json: DocumentDescriptor): void;
|
|
705
|
+
|
|
706
|
+
/**
|
|
707
|
+
* Serializes the workbook.
|
|
708
|
+
*/
|
|
709
|
+
toJSON(): DocumentDescriptor;
|
|
710
|
+
|
|
711
|
+
/**
|
|
712
|
+
* Serializes the workbook. This method does not return the JSON, but a Promise object which will yield the JSON data when it is available.
|
|
713
|
+
* The method is functionally similar to `toJSON`, but it is also able to save the embedded images (this is the reason why it must be asynchronous).
|
|
714
|
+
*/
|
|
715
|
+
saveJSON(): Promise<DocumentDescriptor>;
|
|
716
|
+
|
|
717
|
+
/**
|
|
718
|
+
* Clears the Spreadsheet and populates it with data from the specified Excel (.xlsx) file.
|
|
719
|
+
*
|
|
720
|
+
* @param blob The file or blob that is usually obtained through a file input.
|
|
721
|
+
*/
|
|
722
|
+
fromFile(file: File | Blob): void;
|
|
723
|
+
|
|
724
|
+
/**
|
|
725
|
+
* Initiates the Excel export. Also fires the excelExport event.
|
|
726
|
+
*
|
|
727
|
+
* Note: Calling this method may trigger the built-in popup blocker of the browser.
|
|
728
|
+
* To avoid that, always call it as a response to an end-user action, for example, a button click.
|
|
729
|
+
*/
|
|
730
|
+
saveAsExcel(options: any): void;
|
|
731
|
+
|
|
732
|
+
/**
|
|
733
|
+
* Gets or sets the active sheet.
|
|
734
|
+
*/
|
|
735
|
+
activeSheet(sheet?: Sheet): Sheet | void;
|
|
736
|
+
|
|
737
|
+
/**
|
|
738
|
+
* Returns an array with the sheets in the workbook.
|
|
739
|
+
*/
|
|
740
|
+
sheets(): Sheet[];
|
|
741
|
+
|
|
742
|
+
/**
|
|
743
|
+
* Re-renders all data in the Spreadsheet.
|
|
744
|
+
*/
|
|
745
|
+
refresh(): void;
|
|
746
|
+
|
|
747
|
+
/**
|
|
748
|
+
* @hidden
|
|
749
|
+
*/
|
|
750
|
+
bind(eventName: string, handler: any, one?: boolean): void;
|
|
751
|
+
|
|
752
|
+
/**
|
|
753
|
+
* @hidden
|
|
754
|
+
*/
|
|
755
|
+
destroy(): void;
|
|
756
|
+
}
|