@rosperitus/excelerate 0.14.0 → 0.15.0

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.
@@ -0,0 +1,1345 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+
4
+ /**
5
+ * What `setDocumentProperties` takes: a named field is set, `null` clears it,
6
+ * a missing one stays. `custom` replaces the whole list; `type` is optional.
7
+ */
8
+ export type DocumentPropertiesPatch = Partial<
9
+ Record<Exclude<keyof DocumentProperties, "custom">, string | null>
10
+ > & {
11
+ custom?: { name: string; value: string | number | boolean; type?: CustomProperty["type"] }[];
12
+ };
13
+ /**
14
+ * A style to write, as `setCellStyle` takes it. Every field is optional and
15
+ * what is left out keeps the value the cell had, so `{ font: { bold: true } }`
16
+ * makes a cell bold without touching its number format.
17
+ */
18
+ export interface CellStylePatch {
19
+ numberFormat?: string;
20
+ font?: Partial<{
21
+ name: string;
22
+ size: number;
23
+ bold: boolean;
24
+ italic: boolean;
25
+ underline: string;
26
+ strike: boolean;
27
+ color: StyleColor;
28
+ }>;
29
+ fill?: Partial<{ pattern: string; foreground: StyleColor; background: StyleColor }>;
30
+ borders?: Partial<{
31
+ left: Partial<BorderSide>;
32
+ right: Partial<BorderSide>;
33
+ top: Partial<BorderSide>;
34
+ bottom: Partial<BorderSide>;
35
+ }>;
36
+ alignment?: Partial<{
37
+ horizontal: string | null;
38
+ vertical: string | null;
39
+ wrapText: boolean;
40
+ shrinkToFit: boolean;
41
+ indent: number;
42
+ textRotation: number;
43
+ }>;
44
+ }
45
+ /**
46
+ * Sort keys: a 1-based column number of the sheet (a row number when sorting
47
+ * columns) or a header's text; a minus in front sorts largest first.
48
+ */
49
+ export type SortKeys = (number | string)[];
50
+ /** How `sortRange` reads its range. */
51
+ export interface SortRangeOptions {
52
+ /** The first row (or column) is a header: it stays put and names keys. */
53
+ header?: boolean;
54
+ /** Reorder columns left to right instead of rows. */
55
+ byColumns?: boolean;
56
+ }
57
+ /**
58
+ * Styles to write over a rectangle, as `setRangeStyles` takes them: `grid`
59
+ * points into `styles`, and `null` or `-1` leaves its cell as it is. What
60
+ * `getRangeStyles` returns fits here unchanged.
61
+ */
62
+ export interface RangeStylesPatch {
63
+ styles: CellStylePatch[];
64
+ grid: (number | null)[][];
65
+ }
66
+ /**
67
+ * A colour to draw with: `#RRGGBB`, `#AARRGGBB` (the alpha is the opacity) or
68
+ * a theme colour by name - `accent1` to `accent6`, `tx1`, `tx2`, `bg1`,
69
+ * `bg2`, `hlink`, `folHlink` - which follows the workbook's theme.
70
+ */
71
+ export type DrawingColorInput = string;
72
+ /** A fill to write: the form `shapes` reads, without `other`. */
73
+ export type DrawingFillInput =
74
+ | { type: "none" }
75
+ | { type: "solid"; color: DrawingColorInput }
76
+ | {
77
+ type: "gradient";
78
+ stops: { position: number; color: DrawingColorInput }[];
79
+ angle?: number | null;
80
+ path?: "shape" | "circle" | "rect" | null;
81
+ }
82
+ | { type: "pattern"; preset?: string | null; foreground?: DrawingColorInput; background?: DrawingColorInput };
83
+ /**
84
+ * Fill and outline to lay over an object's own: a field left out stays,
85
+ * `null` gives it back to the style. `line.width` is in points.
86
+ */
87
+ export interface DrawingFormatPatch {
88
+ fill?: DrawingFillInput | null;
89
+ line?: { fill?: DrawingFillInput | null; width?: number | null } | null;
90
+ }
91
+ /** What `setShapeFormat` takes. `rotation` is in degrees clockwise. */
92
+ export interface ShapeFormatPatch extends DrawingFormatPatch {
93
+ font?: Pick<RunFont, "name" | "size" | "bold" | "italic" | "color">;
94
+ rotation?: number;
95
+ flipH?: boolean;
96
+ flipV?: boolean;
97
+ }
98
+ /**
99
+ * What a table column keeps, as `setTableFilter` takes it: the shown values,
100
+ * one or two comparisons, or the largest or smallest few.
101
+ */
102
+ export type TableFilter =
103
+ | { values: (string | number)[]; blank?: boolean }
104
+ | { custom: { op: "=" | "<>" | ">" | ">=" | "<" | "<="; value: string | number }[]; and?: boolean }
105
+ | { top: number; percent?: boolean }
106
+ | { bottom: number; percent?: boolean };
107
+ /** What `setChartFormat` takes: the chart area and the plot area. */
108
+ export interface ChartFormatPatch {
109
+ format?: DrawingFormatPatch | null;
110
+ plotFormat?: DrawingFormatPatch | null;
111
+ }
112
+
113
+
114
+
115
+ /** What a cell can hold on the JS side. An error cell reads as its code, `#DIV/0!`. */
116
+ export type CellValue = number | string | boolean | null;
117
+ /** A rectangle of cells, row by row, as `getRange` returns it. */
118
+ export type CellGrid = CellValue[][];
119
+ /**
120
+ * One row with its styling, as `getRowAt` returns it. `formatted` is `null`
121
+ * when the call asked for values alone. `bold` is one byte per cell, 0 or 1.
122
+ */
123
+ export interface SheetRow {
124
+ values: CellValue[];
125
+ formatted: string[] | null;
126
+ bold: Uint8Array;
127
+ indent: Uint32Array;
128
+ hidden: boolean;
129
+ }
130
+ /** Where a drawing object sits, in the 1-based numbers a user sees. */
131
+ export interface ObjectAnchor {
132
+ kind: "twoCell" | "oneCell" | "absolute";
133
+ row: number | null;
134
+ column: number | null;
135
+ }
136
+ /** How a sheet is frozen and shown, as `sheetView` returns it. */
137
+ export interface SheetViewInfo {
138
+ frozenRows: number;
139
+ frozenColumns: number;
140
+ zoom: number | null;
141
+ showGridLines: boolean;
142
+ showRowColHeaders: boolean;
143
+ rightToLeft: boolean;
144
+ topLeftCell: string | null;
145
+ }
146
+ /** One of the user's own document properties. */
147
+ export interface CustomProperty {
148
+ name: string;
149
+ type: "text" | "integer" | "number" | "boolean" | "date";
150
+ value: string | number | boolean;
151
+ }
152
+ /** Title, author, dates and the user's fields, as `documentProperties` returns them. Dates are ISO 8601. */
153
+ export interface DocumentProperties {
154
+ title: string | null;
155
+ subject: string | null;
156
+ creator: string | null;
157
+ keywords: string | null;
158
+ description: string | null;
159
+ lastModifiedBy: string | null;
160
+ category: string | null;
161
+ contentStatus: string | null;
162
+ language: string | null;
163
+ identifier: string | null;
164
+ revision: string | null;
165
+ version: string | null;
166
+ created: string | null;
167
+ modified: string | null;
168
+ lastPrinted: string | null;
169
+ company: string | null;
170
+ manager: string | null;
171
+ custom: CustomProperty[];
172
+ }
173
+ /** A name that stands for a formula, as `definedNames` returns it. */
174
+ export interface WorkbookName {
175
+ name: string;
176
+ formula: string;
177
+ sheet: number | null;
178
+ hidden: boolean;
179
+ }
180
+ /** A rule limiting what a cell accepts, as `dataValidations` returns it. */
181
+ export interface SheetValidation {
182
+ sqref: string[];
183
+ type: string;
184
+ operator: string;
185
+ formula1: string;
186
+ formula2: string;
187
+ allowBlank: boolean;
188
+ showDropDown: boolean;
189
+ }
190
+ /** One conditional formatting block, as `conditionalFormats` returns it. */
191
+ export interface SheetConditionalFormat {
192
+ sqref: string[];
193
+ rules: { type: string; priority: number; operator: string | null; formulas: string[]; text: string | null }[];
194
+ }
195
+ /** The autofilter over a range, as `autoFilter` returns it. */
196
+ export interface SheetAutoFilter {
197
+ range: string;
198
+ columns: { colId: number; kind: "values" | "custom" | "dynamic" | "top10" | "color" | "icon" | "none" }[];
199
+ }
200
+ /** A pivot report on the sheet, as `pivotTables` returns it. */
201
+ export interface SheetPivotTable {
202
+ name: string;
203
+ location: string | null;
204
+ cacheId: number;
205
+ rowFields: number;
206
+ columnFields: number;
207
+ valueFields: number;
208
+ }
209
+ /** How a sheet or the workbook is locked, as `sheetProtection` returns it. */
210
+ export interface ProtectionInfo { locked: boolean; hasPassword: boolean }
211
+ /** How `toCsv` writes, and how `Book.readCsv` reads. */
212
+ export interface CsvOptions {
213
+ delimiter?: string;
214
+ contiguous?: boolean;
215
+ preserveEmptyFields?: boolean;
216
+ }
217
+ /** A note on a cell, as `comments` returns it. */
218
+ export interface SheetComment { address: string; author: string; text: string }
219
+ /** A link over a cell or a block of them, as `hyperlinks` returns it. */
220
+ export interface SheetHyperlink {
221
+ range: string;
222
+ target: string;
223
+ external: boolean;
224
+ display: string | null;
225
+ tooltip: string | null;
226
+ }
227
+ /** A table over a block of cells, as `tables` returns it. */
228
+ export interface SheetTable {
229
+ name: string;
230
+ displayName: string;
231
+ range: string;
232
+ headerRowCount: number | null;
233
+ totalsRowCount: number | null;
234
+ columns: string[];
235
+ }
236
+ /** A chart on the sheet, as `charts` returns it. */
237
+ export interface SheetChart {
238
+ name: string;
239
+ title: string | null;
240
+ kinds: string[];
241
+ seriesCount: number;
242
+ anchor: ObjectAnchor;
243
+ /** The chart area's fill and outline; `null` leaves them to the chart style. */
244
+ format: DrawingFormat | null;
245
+ /** The plot area's, the same way. */
246
+ plotFormat: DrawingFormat | null;
247
+ }
248
+ /** A picture on the sheet, as `images` returns it. Bytes come from `imageData`. */
249
+ export interface SheetImage {
250
+ name: string;
251
+ description: string;
252
+ format: string;
253
+ byteLength: number;
254
+ anchor: ObjectAnchor;
255
+ }
256
+ /** A drawn shape, as `shapes` returns it. */
257
+ export interface SheetShape {
258
+ name: string;
259
+ description: string;
260
+ geometry: string | null;
261
+ text: string;
262
+ anchor: ObjectAnchor;
263
+ /** Degrees clockwise about the centre. */
264
+ rotation: number;
265
+ /** Mirrored left to right, before it is turned. */
266
+ flipH: boolean;
267
+ /** Mirrored top to bottom, before it is turned. */
268
+ flipV: boolean;
269
+ /** What Excel fills it with: its own, else its style's. */
270
+ fill: DrawingFill;
271
+ /** Its outline, the same way. */
272
+ line: DrawingLine;
273
+ /** The font of its text as the first run states it, the colour from the style if not. */
274
+ font: RunFont;
275
+ }
276
+ /**
277
+ * A colour of a drawing, resolved through the workbook theme to `#AARRGGBB` (`FF` for opaque);
278
+ * `null` for one no theme defines.
279
+ */
280
+ export type DrawingColor = string | null;
281
+ /** How a drawing object or chart area is filled. `position` is in percent, `angle` in degrees. */
282
+ export type DrawingFill =
283
+ | { type: "none" }
284
+ | { type: "solid"; color: DrawingColor }
285
+ | {
286
+ type: "gradient";
287
+ stops: { position: number; color: DrawingColor }[];
288
+ angle: number | null;
289
+ path: "shape" | "circle" | "rect" | null;
290
+ }
291
+ | { type: "pattern"; preset: string | null; foreground: DrawingColor; background: DrawingColor }
292
+ | { type: "other" };
293
+ /** An outline: `fill` is `null` and `width` (points) is `null` where the file is silent. */
294
+ export interface DrawingLine {
295
+ fill: DrawingFill | null;
296
+ width: number | null;
297
+ }
298
+ /** The fill and outline an element states; `null` in either leaves it to the style. */
299
+ export interface DrawingFormat {
300
+ fill: DrawingFill | null;
301
+ line: DrawingLine | null;
302
+ }
303
+ /**
304
+ * A colour as the file states it: `null` when the file leaves it to the
305
+ * reader, `#AARRGGBB` when it names one outright, and `indexed:N` or
306
+ * `theme:N` when it points into the legacy palette or the workbook theme -
307
+ * a theme colour carries its tint as `theme:4@-0.25`.
308
+ */
309
+ export type StyleColor = string | null;
310
+ /**
311
+ * What a run of formatted text changes about the cell's font; a field left
312
+ * out is the cell's own. `size` in points.
313
+ */
314
+ export interface RunFont {
315
+ name?: string;
316
+ size?: number;
317
+ bold?: boolean;
318
+ italic?: boolean;
319
+ underline?: string;
320
+ strike?: boolean;
321
+ color?: StyleColor;
322
+ script?: "superscript" | "subscript" | "baseline";
323
+ }
324
+ /** One run of formatted text, as `getRichText` returns it. */
325
+ export interface TextRun { text: string; font?: RunFont | null }
326
+ /** One side of a cell's border. */
327
+ export interface BorderSide { style: string; color: StyleColor }
328
+ /** How a cell is painted, as `cellStyle` returns it. */
329
+ export interface CellStyle {
330
+ numberFormat: string;
331
+ font: {
332
+ name: string;
333
+ size: number;
334
+ bold: boolean;
335
+ italic: boolean;
336
+ underline: string;
337
+ strike: boolean;
338
+ color: StyleColor;
339
+ };
340
+ fill: { pattern: string; foreground: StyleColor; background: StyleColor };
341
+ borders: {
342
+ left: BorderSide;
343
+ right: BorderSide;
344
+ top: BorderSide;
345
+ bottom: BorderSide;
346
+ };
347
+ alignment: {
348
+ horizontal: string | null;
349
+ vertical: string | null;
350
+ wrapText: boolean;
351
+ shrinkToFit: boolean;
352
+ indent: number;
353
+ textRotation: number;
354
+ };
355
+ }
356
+ /**
357
+ * The styles of a rectangle, as `getRangeStyles` returns them: each distinct
358
+ * style once in `styles`, and `grid` - row by row - pointing into it.
359
+ */
360
+ export interface RangeStyles {
361
+ styles: CellStyle[];
362
+ grid: number[][];
363
+ }
364
+
365
+
366
+
367
+ /**
368
+ * A workbook.
369
+ */
370
+ export class Book {
371
+ free(): void;
372
+ [Symbol.dispose](): void;
373
+ /**
374
+ * The tab a reader opens the workbook on.
375
+ */
376
+ activeSheet(): number;
377
+ /**
378
+ * Appends a sheet and returns its index.
379
+ */
380
+ addSheet(title: string): number;
381
+ /**
382
+ * Draws a table over a range, the thing `Sales[Amount]` names.
383
+ *
384
+ * The first row of the range is the header unless `headerRow` says
385
+ * otherwise, and the column names are read from it. The name must be
386
+ * unique in the workbook, as Excel requires.
387
+ */
388
+ addTable(sheet: number, name: string, range: string, header_row?: boolean | null): void;
389
+ /**
390
+ * The array formulas of a sheet, as the areas they cover: `["B2:B4"]`.
391
+ * The formula itself is on the top left cell of each.
392
+ */
393
+ arrayFormulas(sheet: number): string[];
394
+ /**
395
+ * The autofilter over a sheet, or `undefined` when it has none. What the
396
+ * filter hides is a property of each row - see `rowHidden`.
397
+ */
398
+ autoFilter(sheet: number): SheetAutoFilter | undefined;
399
+ /**
400
+ * Whether a cell is bold.
401
+ *
402
+ * The one flag, without building the rest of the style: a parser that
403
+ * looks for a header row asks this of every cell, and `cellStyle` would
404
+ * make it pay for the font, fill and four borders it never reads.
405
+ */
406
+ cellBold(sheet: number, address: string): boolean;
407
+ /**
408
+ * The same by 1-based row and column.
409
+ */
410
+ cellBoldAt(sheet: number, row: number, column: number): boolean;
411
+ /**
412
+ * How many non-empty cells the workbook holds, or one sheet of it.
413
+ */
414
+ cellCount(sheet?: number | null): number;
415
+ /**
416
+ * The indent of a cell, in Excel's indent steps (0 when it has none).
417
+ *
418
+ * Indent lives on the cell's style, and a spreadsheet only honours it for
419
+ * left, right and distributed alignment - but the number is returned as
420
+ * the file states it, whatever the alignment.
421
+ */
422
+ cellIndent(sheet: number, address: string): number;
423
+ /**
424
+ * The same by 1-based row and column.
425
+ */
426
+ cellIndentAt(sheet: number, row: number, column: number): number;
427
+ /**
428
+ * How a cell is painted: number format, font, fill, borders and text
429
+ * placement, as the file states them.
430
+ *
431
+ * A cell the file says nothing about answers with Excel's defaults, which
432
+ * is what Excel itself shows for it.
433
+ */
434
+ cellStyle(sheet: number, address: string): CellStyle;
435
+ /**
436
+ * The same by 1-based row and column.
437
+ */
438
+ cellStyleAt(sheet: number, row: number, column: number): CellStyle;
439
+ /**
440
+ * The charts on a sheet. `kinds` names the plots drawn in each -
441
+ * `barChart`, `lineChart` - and a combination chart has more than one.
442
+ */
443
+ charts(sheet: number): SheetChart[];
444
+ /**
445
+ * Empties a cell, style and all.
446
+ */
447
+ clear(sheet: number, address: string): void;
448
+ /**
449
+ * The same by 1-based row and column.
450
+ */
451
+ clearAt(sheet: number, row: number, column: number): void;
452
+ /**
453
+ * The same for a column, named by its letters: `columnLevel(0, "C")`.
454
+ */
455
+ columnLevel(sheet: number, column: string): number;
456
+ /**
457
+ * The width of a column in characters, or `undefined` when the sheet
458
+ * leaves it to the default. `column` is 1-based.
459
+ */
460
+ columnWidth(sheet: number, column: number): number | undefined;
461
+ /**
462
+ * The notes on a sheet, in address order.
463
+ */
464
+ comments(sheet: number): SheetComment[];
465
+ /**
466
+ * The conditional formatting of a sheet, block by block. The formatting
467
+ * each rule applies is not modelled here - it lives in the workbook's
468
+ * differential styles - but what the rule tests is.
469
+ */
470
+ conditionalFormats(sheet: number): SheetConditionalFormat[];
471
+ /**
472
+ * Copies a rectangle of cells so its top left corner lands on `to`,
473
+ * rewriting the formulas as Excel rewrites a copied formula: `=A1` one
474
+ * row down reads `=A2`, `$A$1` stays put.
475
+ *
476
+ * `toSheet` defaults to the sheet copied from. A cell the source leaves
477
+ * empty empties the target, the way pasting a block does.
478
+ */
479
+ copyRange(sheet: number, range: string, to: string, to_sheet?: number | null): void;
480
+ /**
481
+ * The rules limiting what cells accept: the dropdown lists, the ranges,
482
+ * the dates.
483
+ */
484
+ dataValidations(sheet: number): SheetValidation[];
485
+ /**
486
+ * The names the workbook defines: what `=Total` and `Print_Area` stand
487
+ * for. `sheet` is set on a name local to one sheet.
488
+ */
489
+ definedNames(): WorkbookName[];
490
+ /**
491
+ * What Excel shows under File > Info: every text field is a string or
492
+ * `null`, dates in ISO 8601. `custom` lists the user's own fields with
493
+ * their type: `text`, `integer`, `number`, `boolean` or `date`.
494
+ */
495
+ documentProperties(): DocumentProperties;
496
+ /**
497
+ * Evaluates a formula (with or without the leading `=`) as if it sat in
498
+ * `address` of `sheet`, and returns its result.
499
+ */
500
+ evaluate(sheet: number, address: string, formula: string): CellValue;
501
+ /**
502
+ * The other workbooks this one reads, in the order `[1]Sheet1!A1` counts
503
+ * them. A path is `undefined` where the file does not name one.
504
+ */
505
+ externalBooks(): any[];
506
+ /**
507
+ * Copies the first row of a range into the rows below it, as Ctrl+D.
508
+ */
509
+ fillDown(sheet: number, range: string): void;
510
+ /**
511
+ * Copies the first column of a range into the columns to its right, as
512
+ * Ctrl+R.
513
+ */
514
+ fillRight(sheet: number, range: string): void;
515
+ /**
516
+ * Continues what the first cells of a range start, as dragging the fill
517
+ * handle does: `1, 2` goes on `3, 4`, `Кв1` to `Кв2`, `Jan` to `Feb`, a
518
+ * date by a day; anything else repeats. `"down"` fills each column,
519
+ * `"right"` each row; `"up"` and `"left"` run the series back from the
520
+ * last cells.
521
+ */
522
+ fillSeries(sheet: number, range: string, direction: "down" | "right" | "up" | "left"): void;
523
+ /**
524
+ * Reads a workbook and hands sheet `sheet` over row by row, without
525
+ * building its grid: `callback(row, data)` gets the 1-based row number
526
+ * and what `getRowAt` would answer for it, and the row is dropped once
527
+ * the callback returns.
528
+ *
529
+ * The workbook comes back whole but for that sheet's cells. Only xlsx
530
+ * streams; any other format is read whole and then handed over the same
531
+ * way, so the callback sees the same rows but nothing is saved.
532
+ * A callback that throws is not called again, and what it threw comes
533
+ * out of `forEachRow` once the read is over.
534
+ */
535
+ static forEachRow(bytes: Uint8Array, name: string | null | undefined, sheet: number, callback: Function, formatted?: boolean | null): Book;
536
+ /**
537
+ * Freezes the first `rows` rows and `columns` columns, so they stay put
538
+ * while the rest scrolls. `freezePanes(0, 1, 0)` pins the header row;
539
+ * `freezePanes(0, 0, 0)` unfreezes.
540
+ */
541
+ freezePanes(sheet: number, rows: number, columns: number): void;
542
+ /**
543
+ * The value at `address` on sheet `sheet`, as a JS number, string, boolean
544
+ * or `null`. A formula cell gives its cached result, not its text.
545
+ */
546
+ get(sheet: number, address: string): CellValue;
547
+ /**
548
+ * The same by 1-based row and column.
549
+ */
550
+ getAt(sheet: number, row: number, column: number): CellValue;
551
+ /**
552
+ * The cell as a spreadsheet would display it: the value run through its
553
+ * number format, so `0.256` under `0.0%` reads `25.6%`.
554
+ */
555
+ getFormatted(sheet: number, address: string): string;
556
+ /**
557
+ * The same by 1-based row and column.
558
+ */
559
+ getFormattedAt(sheet: number, row: number, column: number): string;
560
+ /**
561
+ * The formula text of a cell without its leading `=`, or `undefined` when
562
+ * the cell holds a plain value.
563
+ */
564
+ getFormula(sheet: number, address: string): string | undefined;
565
+ /**
566
+ * The same by 1-based row and column.
567
+ */
568
+ getFormulaAt(sheet: number, row: number, column: number): string | undefined;
569
+ /**
570
+ * A rectangle of cells, row by row. One call across the boundary instead
571
+ * of one per cell, which is what makes reading a sheet worth doing.
572
+ */
573
+ getRange(sheet: number, range: string): CellGrid;
574
+ /**
575
+ * The same by numbers: the top-left cell, then how many rows and columns
576
+ * to take. `getRangeAt(0, 1, 1, 3, 2)` is `A1:B3`.
577
+ */
578
+ getRangeAt(sheet: number, row: number, column: number, rows: number, columns: number): CellGrid;
579
+ /**
580
+ * The styles of a rectangle in one call: each distinct style once, and a
581
+ * grid of indexes into them. `cellStyle` per cell costs a crossing and a
582
+ * whole style object per cell; a formatted table of ten thousand cells
583
+ * usually has a dozen styles.
584
+ */
585
+ getRangeStyles(sheet: number, range: string): RangeStyles;
586
+ /**
587
+ * The same by numbers, as `getRangeAt` takes them.
588
+ */
589
+ getRangeStylesAt(sheet: number, row: number, column: number, rows: number, columns: number): RangeStyles;
590
+ /**
591
+ * The runs of a cell's formatted text: `{ text, font }` each, `font`
592
+ * naming only what the run changes about the cell's font, or `null` for
593
+ * a run in the cell's own. `null` for a cell without formatted text.
594
+ */
595
+ getRichText(sheet: number, address: string): TextRun[] | null;
596
+ /**
597
+ * The same by 1-based row and column.
598
+ */
599
+ getRichTextAt(sheet: number, row: number, column: number): TextRun[] | null;
600
+ /**
601
+ * A whole row in one crossing of the boundary: values, displayed text,
602
+ * bold and indent, plus whether the row is hidden.
603
+ *
604
+ * The arrays run from column 1 to the last column this row has a cell in,
605
+ * so a row of ten cells costs one call rather than forty.
606
+ *
607
+ * `formatted` is what the number format makes of each value, and building
608
+ * it allocates a string per cell - which a caller reading values does not
609
+ * want to pay half a sheet over. Pass `false` and the field comes back
610
+ * `null`; `getFormattedAt` still answers for the cells that need it.
611
+ */
612
+ getRowAt(sheet: number, row: number, formatted?: boolean | null): SheetRow;
613
+ /**
614
+ * The hyperlinks of a sheet. `external` tells a URL from a jump inside
615
+ * the workbook.
616
+ */
617
+ hyperlinks(sheet: number): SheetHyperlink[];
618
+ /**
619
+ * The bytes of one picture, by its position in `images`.
620
+ */
621
+ imageData(sheet: number, index: number): Uint8Array;
622
+ /**
623
+ * The pictures on a sheet, without their bytes: `imageData` fetches those
624
+ * for the one that is wanted.
625
+ */
626
+ images(sheet: number): SheetImage[];
627
+ /**
628
+ * Inserts blank cells over a range, pushing what was there `"down"` or
629
+ * `"right"` - Excel's "Insert Cells", which moves part of a row rather
630
+ * than the whole of it. `copyOrigin` works as in `insertRows`.
631
+ */
632
+ insertCells(sheet: number, range: string, shift: "down" | "right", copyOrigin?: "before" | "after" | "none"): void;
633
+ /**
634
+ * Inserts `count` columns to the left of column `at`, 1-based.
635
+ * `copyOrigin` works as in `insertRows`, with left and right.
636
+ */
637
+ insertColumns(sheet: number, at: number, count: number, copyOrigin?: "before" | "after" | "none"): void;
638
+ /**
639
+ * `insertRowsMany` for columns.
640
+ */
641
+ insertColumnsMany(sheet: number, places: [number, number][], copyOrigin?: "before" | "after" | "none"): void;
642
+ /**
643
+ * Inserts `count` rows above row `at`, moving everything below down.
644
+ * `copyOrigin` - `"before"` (the row above), `"after"` (the row below)
645
+ * or `"none"` - says whose formatting the new rows take. Left out, it is
646
+ * `"before"`, as in Excel.
647
+ *
648
+ * Formulas across the whole workbook follow the cells they read, and so
649
+ * do merges, links, validations, tables and drawings. `at` is the number
650
+ * a user sees.
651
+ */
652
+ insertRows(sheet: number, at: number, count: number, copyOrigin?: "before" | "after" | "none"): void;
653
+ /**
654
+ * Inserts rows at many places in one pass: `places` is `[at, count]`
655
+ * pairs, numbered as the sheet is before the call, in any order.
656
+ * `book.insertRowsMany(0, [[5, 1], [9, 1]])` puts a row above each of
657
+ * rows 5 and 9 - the old row 9, now row 10. Each new block takes its
658
+ * formatting from its own neighbour, as `copyOrigin` says.
659
+ *
660
+ * The result is that of the single inserts made from the bottom up, but
661
+ * the workbook is walked once rather than once per place: four thousand
662
+ * subtotal rows into forty thousand take milliseconds, not a minute.
663
+ */
664
+ insertRowsMany(sheet: number, places: [number, number][], copyOrigin?: "before" | "after" | "none"): void;
665
+ /**
666
+ * Merges a block of cells: `merge(0, "A1:C1")`.
667
+ */
668
+ merge(sheet: number, range: string): void;
669
+ /**
670
+ * The merged areas of a sheet, as `"A1:C1"` strings in the order the file
671
+ * lists them.
672
+ */
673
+ mergedRanges(sheet: number): string[];
674
+ /**
675
+ * The merged areas of a sheet as numbers: four per area, `[r1, c1, r2,
676
+ * c2]`, rows and columns 1-based.
677
+ *
678
+ * One typed array instead of a JS string per area, which is what a sheet
679
+ * carrying three hundred thousand of them needs.
680
+ */
681
+ mergedRangesAt(sheet: number): Uint32Array;
682
+ /**
683
+ * Moves a rectangle of cells, leaving the source empty.
684
+ *
685
+ * A moved formula keeps reading the cells it read; the formulas elsewhere
686
+ * that read *these* cells follow them instead, as they do when Excel cuts
687
+ * and pastes.
688
+ */
689
+ moveRange(sheet: number, range: string, to: string, to_sheet?: number | null): void;
690
+ /**
691
+ * Moves a sheet along the tab bar. Formulas are untouched - a sheet is
692
+ * named, not numbered - but every index moves, this one included, so read
693
+ * `sheetIndex` again afterwards.
694
+ */
695
+ moveSheet(from: number, to: number): void;
696
+ /**
697
+ * A new workbook with one empty sheet.
698
+ */
699
+ constructor();
700
+ /**
701
+ * The pivot reports laid out on a sheet. The numbers they show are cells
702
+ * like any others; this says where a report sits and how wide its axes
703
+ * are.
704
+ */
705
+ pivotTables(sheet: number): SheetPivotTable[];
706
+ /**
707
+ * Locks a sheet against editing, optionally behind a password.
708
+ *
709
+ * This is the lock Excel offers under "Protect Sheet": it stops a user
710
+ * editing, it does not encrypt anything. The password is stored as Excel
711
+ * stores it - SHA-512 over a random salt, 100,000 spins - and
712
+ * `verifySheetPassword` checks it back.
713
+ */
714
+ protectSheet(sheet: number, password?: string | null): void;
715
+ /**
716
+ * Locks the structure of the workbook: which sheets there are, and their
717
+ * order. `windows` locks the window layout as well.
718
+ */
719
+ protectWorkbook(password?: string | null, windows?: boolean | null): void;
720
+ /**
721
+ * Reads a workbook of any format this crate supports, working the format
722
+ * out from the bytes themselves.
723
+ *
724
+ * `name` is the file name they came from, if the caller has one: it
725
+ * settles what the bytes cannot say (a `.csv` against a `.html`) and names
726
+ * the sheet of a SYLK file. `password` opens a workbook saved with a
727
+ * password to open; without it only one encrypted to be opened
728
+ * read-only reads.
729
+ */
730
+ static read(bytes: Uint8Array, name?: string | null, max_expanded?: number | null, on_progress?: Function | null, password?: string | null): Book;
731
+ /**
732
+ * Reads CSV with the guesses overridden: the delimiter, whether a row
733
+ * that produced no cell is skipped, whether an empty field becomes an
734
+ * empty string rather than no cell at all.
735
+ *
736
+ * `Book.read` guesses all of this from the bytes, which is right for a
737
+ * file of unknown origin; this is for one whose shape you already know.
738
+ */
739
+ static readCsv(bytes: Uint8Array, options: CsvOptions): Book;
740
+ /**
741
+ * Recomputes every formula and stores the results beside them, so that
742
+ * `get` and `toCsv` show this engine's answers rather than the cache the
743
+ * file was saved with. Returns how many formulas were computed.
744
+ *
745
+ * With no argument the whole workbook is recomputed; with a sheet index,
746
+ * only that sheet's formulas are - though they still read the whole
747
+ * workbook, as a cross-sheet reference must.
748
+ */
749
+ recalculate(sheet?: number | null, on_progress?: Function | null): number;
750
+ /**
751
+ * Recomputes the formula in one cell and stores its result. Returns
752
+ * whether there was a formula there.
753
+ *
754
+ * Not the same as `recalculateFrom`, which recomputes the formulas
755
+ * *reading* this cell and leaves the cell itself alone.
756
+ */
757
+ recalculateCell(sheet: number, address: string): boolean;
758
+ /**
759
+ * The same by 1-based row and column.
760
+ */
761
+ recalculateCellAt(sheet: number, row: number, column: number): boolean;
762
+ /**
763
+ * Recomputes only what depends on one cell that changed - the formulas
764
+ * reading it, the formulas reading those, and so on. Returns how many were
765
+ * computed. This is the pass to run after `set`.
766
+ *
767
+ * For a batch of edits use `recalculateFromMany`, which answers them all
768
+ * in one pass.
769
+ */
770
+ recalculateFrom(sheet: number, address: string): number;
771
+ /**
772
+ * The same by 1-based row and column.
773
+ */
774
+ recalculateFromAt(sheet: number, row: number, column: number): number;
775
+ /**
776
+ * The same for a batch of cells, all on sheet `sheet`, answered in one
777
+ * pass: editing a hundred cells costs one walk of the workbook, not a
778
+ * hundred.
779
+ *
780
+ * The index of what reads what is built on the first call and kept, so a
781
+ * run of edits parses the formulas only once. `set` keeps it in step.
782
+ */
783
+ recalculateFromMany(sheet: number, addresses: string[]): number;
784
+ /**
785
+ * Registers a function of your own, callable from any formula in the
786
+ * workbook by that name.
787
+ *
788
+ * The function is handed the arguments already computed - a range arrives
789
+ * as an array of arrays - and whatever it returns becomes the value. A
790
+ * name a built-in claims stays the built-in's: a workbook where `SUM`
791
+ * means something else is a workbook nobody else can read.
792
+ *
793
+ * ```js
794
+ * book.registerFunction("MYRATE", (base) => base * 1.5 + 0.5);
795
+ * book.evaluate(0, "A1", "=MYRATE(10)"); // 15.5
796
+ * ```
797
+ */
798
+ registerFunction(name: string, _function: Function): void;
799
+ /**
800
+ * The names registered, in no particular order.
801
+ */
802
+ registeredFunctions(): string[];
803
+ /**
804
+ * Removes the cells of a range, pulling the rest back over the hole from
805
+ * below (`"up"`) or from the right (`"left"`).
806
+ */
807
+ removeCells(sheet: number, range: string, shift: "up" | "left"): void;
808
+ /**
809
+ * Removes `count` columns from column `at`, 1-based.
810
+ */
811
+ removeColumns(sheet: number, at: number, count: number): void;
812
+ /**
813
+ * `removeRowsMany` for columns.
814
+ */
815
+ removeColumnsMany(sheet: number, places: [number, number][]): void;
816
+ /**
817
+ * Takes a note off a cell. Answers whether there was one.
818
+ */
819
+ removeComment(sheet: number, address: string): boolean;
820
+ /**
821
+ * Removes a defined name. Answers whether there was one.
822
+ */
823
+ removeDefinedName(name: string, sheet?: number | null): boolean;
824
+ /**
825
+ * Takes the link off a range. Answers whether there was one.
826
+ */
827
+ removeHyperlink(sheet: number, range: string): boolean;
828
+ /**
829
+ * Removes `count` rows from row `at` down. A formula that read a removed
830
+ * cell reads `#REF!` afterwards.
831
+ */
832
+ removeRows(sheet: number, at: number, count: number): void;
833
+ /**
834
+ * Removes rows at many places in one pass: `[at, count]` pairs, numbered
835
+ * as the sheet is before the call. Blocks that overlap are merged.
836
+ */
837
+ removeRowsMany(sheet: number, places: [number, number][]): void;
838
+ /**
839
+ * Removes a sheet. References to it from anywhere in the workbook become
840
+ * `#REF!`, the way Excel writes them, and the sheets after it shift down
841
+ * by one index.
842
+ */
843
+ removeSheet(sheet: number): void;
844
+ /**
845
+ * Removes a table by name. Answers whether there was one.
846
+ */
847
+ removeTable(sheet: number, name: string): boolean;
848
+ /**
849
+ * Renames a sheet.
850
+ */
851
+ renameSheet(sheet: number, title: string): void;
852
+ /**
853
+ * The height of a row in points, or `undefined` when the sheet leaves it
854
+ * to the default. `row` is the number a user sees.
855
+ */
856
+ rowHeight(sheet: number, row: number): number | undefined;
857
+ /**
858
+ * Whether a row is hidden. `row` is the number a user sees.
859
+ */
860
+ rowHidden(sheet: number, row: number): boolean;
861
+ /**
862
+ * How deeply a row is grouped: 0 when it is not, 1 for the outermost
863
+ * group, and so on. `row` is the number a user sees.
864
+ */
865
+ rowLevel(sheet: number, row: number): number;
866
+ /**
867
+ * Writes a value: a number, boolean, or string. A string starting with `=`
868
+ * becomes a formula.
869
+ */
870
+ set(sheet: number, address: string, value: CellValue): void;
871
+ /**
872
+ * Sets that tab.
873
+ */
874
+ setActiveSheet(sheet: number): void;
875
+ /**
876
+ * The same by 1-based row and column.
877
+ */
878
+ setAt(sheet: number, row: number, column: number, value: CellValue): void;
879
+ /**
880
+ * Paints a cell: a number format, a font, a fill, borders, alignment, or
881
+ * any part of those.
882
+ *
883
+ * The patch is laid over the style the cell has, so a field left out
884
+ * keeps what was there - `{ font: { bold: true } }` does not reset the
885
+ * number format. Equal styles share one entry in the workbook's table,
886
+ * so painting a column costs one style, not one per cell.
887
+ *
888
+ * ```js
889
+ * book.setCellStyle(0, "B2", {
890
+ * numberFormat: "#,##0.00",
891
+ * font: { bold: true, color: "#FF1F4E79" },
892
+ * fill: { pattern: "solid", foreground: "#FFFFE699" },
893
+ * alignment: { horizontal: "right" },
894
+ * });
895
+ * ```
896
+ */
897
+ setCellStyle(sheet: number, address: string, patch: CellStylePatch): void;
898
+ /**
899
+ * The same by 1-based row and column.
900
+ */
901
+ setCellStyleAt(sheet: number, row: number, column: number, patch: CellStylePatch): void;
902
+ /**
903
+ * Changes the fill and outline of a chart's chart area (`format`) and
904
+ * plot area (`plotFormat`), by its position in `charts`; each takes
905
+ * `{ fill, line }` as `setShapeFormat` does, or `null` to leave the area
906
+ * to the chart style.
907
+ */
908
+ setChartFormat(sheet: number, index: number, patch: ChartFormatPatch): void;
909
+ /**
910
+ * Hides a column, or shows it again. `column` is 1-based.
911
+ */
912
+ setColumnHidden(sheet: number, column: number, hidden: boolean): void;
913
+ /**
914
+ * Sets the width of a column in characters of the default font, or gives
915
+ * it back to the sheet default with `undefined`. `column` is 1-based.
916
+ *
917
+ * A run of columns that covered this one is split around it, so the
918
+ * neighbours keep the width they had.
919
+ */
920
+ setColumnWidth(sheet: number, column: number, width?: number | null): void;
921
+ /**
922
+ * Puts a note on a cell, replacing any note already there.
923
+ */
924
+ setComment(sheet: number, address: string, author: string, text: string): void;
925
+ /**
926
+ * Defines a name, replacing one of the same name. `formula` is what it
927
+ * stands for - `Sheet1!$A$1:$A$9` or a constant - and `sheet` makes the
928
+ * name local to that sheet instead of the workbook.
929
+ */
930
+ setDefinedName(name: string, formula: string, sheet?: number | null): void;
931
+ /**
932
+ * Changes the fields the patch names and leaves the rest: a string sets
933
+ * one, `null` clears it. `custom`, when given, replaces the list; a
934
+ * field's type is taken from `type` or else from the value (a whole
935
+ * number is an integer).
936
+ */
937
+ setDocumentProperties(patch: DocumentPropertiesPatch): void;
938
+ /**
939
+ * Puts a link over a cell or a block of them.
940
+ *
941
+ * `target` is a URL or a file path unless `inside` is true, and then it
942
+ * is a place in this workbook: `'Sheet 2'!A1`.
943
+ */
944
+ setHyperlink(sheet: number, range: string, target: string, inside?: boolean | null, display?: string | null, tooltip?: string | null): void;
945
+ /**
946
+ * Writes a rectangle of values with `at` as its top-left corner. Rows may
947
+ * differ in length; a `null` leaves its cell empty.
948
+ */
949
+ setRange(sheet: number, at: string, values: CellGrid): void;
950
+ /**
951
+ * The same with the corner given as 1-based row and column.
952
+ */
953
+ setRangeAt(sheet: number, row: number, column: number, values: CellGrid): void;
954
+ /**
955
+ * The same over a rectangle: `setRangeStyle(0, "A1:D1", { font: { bold:
956
+ * true } })`. Cells the range covers but the sheet has no value for are
957
+ * created empty, which is what carries the style.
958
+ */
959
+ setRangeStyle(sheet: number, range: string, patch: CellStylePatch): void;
960
+ /**
961
+ * Paints a rectangle cell by cell in one call, `at` its top-left corner:
962
+ * `grid` points into `styles`, each a patch as `setCellStyle` takes it,
963
+ * and `null` or `-1` leaves its cell alone. The output of
964
+ * `getRangeStyles` goes back in unchanged, so a block's formatting can be
965
+ * read, edited in JS and written back - or copied somewhere else.
966
+ */
967
+ setRangeStyles(sheet: number, at: string, styles: RangeStylesPatch): void;
968
+ /**
969
+ * The same with the corner given as 1-based row and column.
970
+ */
971
+ setRangeStylesAt(sheet: number, row: number, column: number, styles: RangeStylesPatch): void;
972
+ /**
973
+ * Writes formatted text: runs as `getRichText` returns them, each with
974
+ * its own text and the part of the font it changes (`font` may be left
975
+ * out or `null` for the cell's own).
976
+ */
977
+ setRichText(sheet: number, address: string, runs: TextRun[]): void;
978
+ /**
979
+ * The same by 1-based row and column.
980
+ */
981
+ setRichTextAt(sheet: number, row: number, column: number, runs: TextRun[]): void;
982
+ /**
983
+ * Sets the height of a row in points, or gives it back to the sheet
984
+ * default with `undefined`. `row` is the number a user sees.
985
+ */
986
+ setRowHeight(sheet: number, row: number, height?: number | null): void;
987
+ /**
988
+ * Hides a row, or shows it again.
989
+ */
990
+ setRowHidden(sheet: number, row: number, hidden: boolean): void;
991
+ /**
992
+ * Changes how a shape looks, by its position in `shapes`:
993
+ *
994
+ * ```js
995
+ * book.setShapeFormat(0, 2, {
996
+ * fill: { type: "solid", color: "accent2" },
997
+ * line: { width: 2 },
998
+ * font: { bold: true, color: "#FFFFFFFF" },
999
+ * rotation: 15,
1000
+ * });
1001
+ * ```
1002
+ *
1003
+ * `fill`, `line`, `font`, `rotation` (degrees clockwise), `flipH` and
1004
+ * `flipV`; a field left out stays as it was, `null` for `fill` or `line`
1005
+ * gives it back to the shape's style. A colour is `#RRGGBB`,
1006
+ * `#AARRGGBB` or a theme colour by name (`accent1`, `tx1`, `bg2`), which
1007
+ * follows the theme. The rest of the shape - effects, other runs, the
1008
+ * outline's dashes - stays in the file as it was.
1009
+ */
1010
+ setShapeFormat(sheet: number, index: number, patch: ShapeFormatPatch): void;
1011
+ /**
1012
+ * Gives a sheet a tab or takes it away: `"visible"`, `"hidden"` or
1013
+ * `"veryHidden"`.
1014
+ *
1015
+ * A very hidden sheet is not in the dialog Excel offers for unhiding one.
1016
+ * Either way the sheet keeps its index, which is what every other call
1017
+ * counts.
1018
+ */
1019
+ setSheetVisibility(sheet: number, state: string): void;
1020
+ /**
1021
+ * Shows or hides the grid lines, and the row and column headings with
1022
+ * `headers`.
1023
+ */
1024
+ setShowGridLines(sheet: number, show: boolean, headers?: boolean | null): void;
1025
+ /**
1026
+ * Filters a table by one of its columns, named by its header or
1027
+ * numbered from 1, and hides the data rows the table's criteria reject,
1028
+ * as Excel does. `null` takes the column's criterion off.
1029
+ *
1030
+ * ```js
1031
+ * book.setTableFilter("Sales", "Region", { values: ["South", "West"] });
1032
+ * book.setTableFilter("Sales", "Amount", { custom: [{ op: ">", value: 100 }] });
1033
+ * book.setTableFilter("Sales", 3, { top: 5 }); // or { bottom: 10, percent: true }
1034
+ * ```
1035
+ *
1036
+ * `values` keeps a row whose cell shows one of them, `blank: true` the
1037
+ * empty ones too; `custom` takes one or two comparisons (`=`, `<>`, `>`,
1038
+ * `>=`, `<`, `<=`; `*` and `?` in `=` and `<>`), joined by `or` unless
1039
+ * `and` is set. Criteria on several columns all have to hold.
1040
+ */
1041
+ setTableFilter(name: string, column: string | number, criteria: TableFilter | null): void;
1042
+ /**
1043
+ * The zoom a reader opens the sheet at, in percent; `undefined` gives it
1044
+ * back to 100.
1045
+ */
1046
+ setZoom(sheet: number, percent?: number | null): void;
1047
+ /**
1048
+ * The drawn shapes of a sheet, text and all, with the look Excel shows:
1049
+ * fill, outline and font are the shape's own with its style filling in
1050
+ * the rest, colours resolved through the workbook theme.
1051
+ */
1052
+ shapes(sheet: number): SheetShape[];
1053
+ /**
1054
+ * The tab index of a sheet by name, or `undefined` when there is none.
1055
+ * Names are compared the way Excel does, ignoring case.
1056
+ */
1057
+ sheetIndex(name: string): number | undefined;
1058
+ /**
1059
+ * Sheet titles, in tab order.
1060
+ */
1061
+ sheetNames(): string[];
1062
+ /**
1063
+ * Whether a sheet is locked, and whether the lock has a password.
1064
+ */
1065
+ sheetProtection(sheet: number): ProtectionInfo;
1066
+ /**
1067
+ * How the sheet is frozen and shown.
1068
+ */
1069
+ sheetView(sheet: number): SheetViewInfo;
1070
+ /**
1071
+ * Whether a sheet has a tab: `"visible"`, `"hidden"` or `"veryHidden"`.
1072
+ *
1073
+ * `sheetNames` lists every sheet, hidden ones included, because that is
1074
+ * what the index of every other call counts.
1075
+ */
1076
+ sheetVisibility(sheet: number): string;
1077
+ /**
1078
+ * Sorts the rows of a range, or its columns. A key is a column number of
1079
+ * the sheet, 1-based (a row number when sorting columns), or the text of
1080
+ * a header when `options.header` says the first line is one; a minus
1081
+ * sorts it largest first: `[2, -4]`, `["Region", "-Amount"]`. The first
1082
+ * key decides first.
1083
+ *
1084
+ * ```js
1085
+ * book.sortRange(0, "A1:D100", ["Region", "-Amount"], { header: true });
1086
+ * ```
1087
+ */
1088
+ sortRange(sheet: number, range: string, keys: SortKeys, options?: SortRangeOptions): void;
1089
+ /**
1090
+ * Sorts the data rows of a table, found by name anywhere in the book;
1091
+ * its header and totals rows stay put. Keys name its columns, as in
1092
+ * `sortRange`: `book.sortTable("Sales", ["-Amount"])`.
1093
+ */
1094
+ sortTable(name: string, keys: SortKeys): void;
1095
+ /**
1096
+ * The tables of a sheet: what a structured reference like `Sales[Amount]`
1097
+ * names.
1098
+ */
1099
+ tables(sheet: number): SheetTable[];
1100
+ /**
1101
+ * One sheet as CSV, comma-separated unless `options.delimiter` says
1102
+ * otherwise - a semicolon for a locale where the comma is the decimal
1103
+ * mark.
1104
+ */
1105
+ toCsv(sheet: number, options?: CsvOptions): string;
1106
+ /**
1107
+ * The workbook as an HTML page, or one sheet of it. `fragment` leaves out
1108
+ * the `<html>` wrapper, for embedding in a page that already has one.
1109
+ */
1110
+ toHtml(sheet?: number | null, fragment?: boolean | null): string;
1111
+ /**
1112
+ * The workbook as an `OpenDocument` spreadsheet.
1113
+ */
1114
+ toOds(): Uint8Array;
1115
+ /**
1116
+ * The workbook as a BIFF8 `.xls` file.
1117
+ *
1118
+ * Formulas are written as tokens with their cached result; what BIFF8
1119
+ * cannot hold - a structured reference, a row past 65536 - is written as
1120
+ * the value, so call `recalculate` first if the cache is stale.
1121
+ */
1122
+ toXls(): Uint8Array;
1123
+ /**
1124
+ * The workbook as an xlsx package.
1125
+ */
1126
+ toXlsx(on_progress?: Function | null): Uint8Array;
1127
+ /**
1128
+ * Takes a merge back out. Answers whether there was one.
1129
+ */
1130
+ unmerge(sheet: number, range: string): boolean;
1131
+ /**
1132
+ * Unlocks a sheet, password and all.
1133
+ */
1134
+ unprotectSheet(sheet: number): void;
1135
+ /**
1136
+ * Unlocks the workbook.
1137
+ */
1138
+ unprotectWorkbook(): void;
1139
+ /**
1140
+ * Forgets a function registered earlier; answers whether there was one.
1141
+ */
1142
+ unregisterFunction(name: string): boolean;
1143
+ /**
1144
+ * The used range of a sheet as `A1:D9`, or `undefined` if it holds
1145
+ * nothing. This is the rectangle to walk; the sheet itself is sparse.
1146
+ */
1147
+ usedRange(sheet: number): string | undefined;
1148
+ /**
1149
+ * The used range of a sheet as `"A1:D20"` without walking the rows;
1150
+ * `undefined` for an empty sheet.
1151
+ *
1152
+ * Rows are exact, columns an upper bound: removing a cell never narrows
1153
+ * them. `usedRange` answers the same until a cell in an edge column is
1154
+ * removed, and walks the rows after that to give the exact rectangle.
1155
+ */
1156
+ usedRangeHint(sheet: number): string | undefined;
1157
+ /**
1158
+ * Whether that password unlocks the sheet. `false` for a sheet with no
1159
+ * password on it, and for a hash this crate cannot check.
1160
+ */
1161
+ verifySheetPassword(sheet: number, password: string): boolean;
1162
+ /**
1163
+ * Whether the workbook's structure is locked, and whether behind a
1164
+ * password.
1165
+ */
1166
+ workbookProtection(): ProtectionInfo;
1167
+ }
1168
+
1169
+ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
1170
+
1171
+ export interface InitOutput {
1172
+ readonly memory: WebAssembly.Memory;
1173
+ readonly __wbg_book_free: (a: number, b: number) => void;
1174
+ readonly book_activeSheet: (a: number) => number;
1175
+ readonly book_addSheet: (a: number, b: number, c: number) => [number, number, number];
1176
+ readonly book_addTable: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
1177
+ readonly book_arrayFormulas: (a: number, b: number) => [number, number, number, number];
1178
+ readonly book_autoFilter: (a: number, b: number) => [number, number, number];
1179
+ readonly book_cellBold: (a: number, b: number, c: number, d: number) => [number, number, number];
1180
+ readonly book_cellBoldAt: (a: number, b: number, c: number, d: number) => [number, number, number];
1181
+ readonly book_cellCount: (a: number, b: number) => number;
1182
+ readonly book_cellIndent: (a: number, b: number, c: number, d: number) => [number, number, number];
1183
+ readonly book_cellIndentAt: (a: number, b: number, c: number, d: number) => [number, number, number];
1184
+ readonly book_cellStyle: (a: number, b: number, c: number, d: number) => [number, number, number];
1185
+ readonly book_cellStyleAt: (a: number, b: number, c: number, d: number) => [number, number, number];
1186
+ readonly book_charts: (a: number, b: number) => [number, number, number];
1187
+ readonly book_clear: (a: number, b: number, c: number, d: number) => [number, number];
1188
+ readonly book_clearAt: (a: number, b: number, c: number, d: number) => [number, number];
1189
+ readonly book_columnLevel: (a: number, b: number, c: number, d: number) => [number, number, number];
1190
+ readonly book_columnWidth: (a: number, b: number, c: number) => [number, number, number, number];
1191
+ readonly book_comments: (a: number, b: number) => [number, number, number];
1192
+ readonly book_conditionalFormats: (a: number, b: number) => [number, number, number];
1193
+ readonly book_copyRange: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
1194
+ readonly book_dataValidations: (a: number, b: number) => [number, number, number];
1195
+ readonly book_definedNames: (a: number) => any;
1196
+ readonly book_documentProperties: (a: number) => any;
1197
+ readonly book_evaluate: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
1198
+ readonly book_externalBooks: (a: number) => [number, number];
1199
+ readonly book_fillDown: (a: number, b: number, c: number, d: number) => [number, number];
1200
+ readonly book_fillRight: (a: number, b: number, c: number, d: number) => [number, number];
1201
+ readonly book_fillSeries: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
1202
+ readonly book_forEachRow: (a: number, b: number, c: number, d: number, e: number, f: any, g: number) => [number, number, number];
1203
+ readonly book_freezePanes: (a: number, b: number, c: number, d: number) => [number, number];
1204
+ readonly book_get: (a: number, b: number, c: number, d: number) => [number, number, number];
1205
+ readonly book_getAt: (a: number, b: number, c: number, d: number) => [number, number, number];
1206
+ readonly book_getFormatted: (a: number, b: number, c: number, d: number) => [number, number, number, number];
1207
+ readonly book_getFormattedAt: (a: number, b: number, c: number, d: number) => [number, number, number, number];
1208
+ readonly book_getFormula: (a: number, b: number, c: number, d: number) => [number, number];
1209
+ readonly book_getFormulaAt: (a: number, b: number, c: number, d: number) => [number, number];
1210
+ readonly book_getRange: (a: number, b: number, c: number, d: number) => [number, number, number];
1211
+ readonly book_getRangeAt: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
1212
+ readonly book_getRangeStyles: (a: number, b: number, c: number, d: number) => [number, number, number];
1213
+ readonly book_getRangeStylesAt: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
1214
+ readonly book_getRichText: (a: number, b: number, c: number, d: number) => [number, number, number];
1215
+ readonly book_getRichTextAt: (a: number, b: number, c: number, d: number) => [number, number, number];
1216
+ readonly book_getRowAt: (a: number, b: number, c: number, d: number) => [number, number, number];
1217
+ readonly book_hyperlinks: (a: number, b: number) => [number, number, number];
1218
+ readonly book_imageData: (a: number, b: number, c: number) => [number, number, number, number];
1219
+ readonly book_images: (a: number, b: number) => [number, number, number];
1220
+ readonly book_insertCells: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number];
1221
+ readonly book_insertColumns: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
1222
+ readonly book_insertColumnsMany: (a: number, b: number, c: any, d: number, e: number) => [number, number];
1223
+ readonly book_insertRows: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
1224
+ readonly book_insertRowsMany: (a: number, b: number, c: any, d: number, e: number) => [number, number];
1225
+ readonly book_merge: (a: number, b: number, c: number, d: number) => [number, number];
1226
+ readonly book_mergedRanges: (a: number, b: number) => [number, number, number, number];
1227
+ readonly book_mergedRangesAt: (a: number, b: number) => [number, number, number];
1228
+ readonly book_moveRange: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
1229
+ readonly book_moveSheet: (a: number, b: number, c: number) => [number, number];
1230
+ readonly book_new: () => number;
1231
+ readonly book_pivotTables: (a: number, b: number) => [number, number, number];
1232
+ readonly book_protectSheet: (a: number, b: number, c: number, d: number) => [number, number];
1233
+ readonly book_protectWorkbook: (a: number, b: number, c: number, d: number) => [number, number];
1234
+ readonly book_read: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number, number];
1235
+ readonly book_readCsv: (a: number, b: number, c: any) => [number, number, number];
1236
+ readonly book_recalculate: (a: number, b: number, c: number) => number;
1237
+ readonly book_recalculateCell: (a: number, b: number, c: number, d: number) => [number, number, number];
1238
+ readonly book_recalculateCellAt: (a: number, b: number, c: number, d: number) => [number, number, number];
1239
+ readonly book_recalculateFrom: (a: number, b: number, c: number, d: number) => [number, number, number];
1240
+ readonly book_recalculateFromAt: (a: number, b: number, c: number, d: number) => [number, number, number];
1241
+ readonly book_recalculateFromMany: (a: number, b: number, c: number, d: number) => [number, number, number];
1242
+ readonly book_registerFunction: (a: number, b: number, c: number, d: any) => void;
1243
+ readonly book_registeredFunctions: (a: number) => [number, number];
1244
+ readonly book_removeCells: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
1245
+ readonly book_removeColumns: (a: number, b: number, c: number, d: number) => [number, number];
1246
+ readonly book_removeColumnsMany: (a: number, b: number, c: any) => [number, number];
1247
+ readonly book_removeComment: (a: number, b: number, c: number, d: number) => [number, number, number];
1248
+ readonly book_removeDefinedName: (a: number, b: number, c: number, d: number) => number;
1249
+ readonly book_removeHyperlink: (a: number, b: number, c: number, d: number) => [number, number, number];
1250
+ readonly book_removeRows: (a: number, b: number, c: number, d: number) => [number, number];
1251
+ readonly book_removeRowsMany: (a: number, b: number, c: any) => [number, number];
1252
+ readonly book_removeSheet: (a: number, b: number) => [number, number];
1253
+ readonly book_removeTable: (a: number, b: number, c: number, d: number) => [number, number, number];
1254
+ readonly book_renameSheet: (a: number, b: number, c: number, d: number) => [number, number];
1255
+ readonly book_rowHeight: (a: number, b: number, c: number) => [number, number, number, number];
1256
+ readonly book_rowHidden: (a: number, b: number, c: number) => [number, number, number];
1257
+ readonly book_rowLevel: (a: number, b: number, c: number) => [number, number, number];
1258
+ readonly book_set: (a: number, b: number, c: number, d: number, e: any) => [number, number];
1259
+ readonly book_setActiveSheet: (a: number, b: number) => [number, number];
1260
+ readonly book_setAt: (a: number, b: number, c: number, d: number, e: any) => [number, number];
1261
+ readonly book_setCellStyle: (a: number, b: number, c: number, d: number, e: any) => [number, number];
1262
+ readonly book_setCellStyleAt: (a: number, b: number, c: number, d: number, e: any) => [number, number];
1263
+ readonly book_setChartFormat: (a: number, b: number, c: number, d: any) => [number, number];
1264
+ readonly book_setColumnHidden: (a: number, b: number, c: number, d: number) => [number, number];
1265
+ readonly book_setColumnWidth: (a: number, b: number, c: number, d: number, e: number) => [number, number];
1266
+ readonly book_setComment: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number];
1267
+ readonly book_setDefinedName: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
1268
+ readonly book_setDocumentProperties: (a: number, b: any) => [number, number];
1269
+ readonly book_setHyperlink: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number) => [number, number];
1270
+ readonly book_setRange: (a: number, b: number, c: number, d: number, e: any) => [number, number];
1271
+ readonly book_setRangeAt: (a: number, b: number, c: number, d: number, e: any) => [number, number];
1272
+ readonly book_setRangeStyle: (a: number, b: number, c: number, d: number, e: any) => [number, number];
1273
+ readonly book_setRangeStyles: (a: number, b: number, c: number, d: number, e: any) => [number, number];
1274
+ readonly book_setRangeStylesAt: (a: number, b: number, c: number, d: number, e: any) => [number, number];
1275
+ readonly book_setRichText: (a: number, b: number, c: number, d: number, e: any) => [number, number];
1276
+ readonly book_setRichTextAt: (a: number, b: number, c: number, d: number, e: any) => [number, number];
1277
+ readonly book_setRowHeight: (a: number, b: number, c: number, d: number, e: number) => [number, number];
1278
+ readonly book_setRowHidden: (a: number, b: number, c: number, d: number) => [number, number];
1279
+ readonly book_setShapeFormat: (a: number, b: number, c: number, d: any) => [number, number];
1280
+ readonly book_setSheetVisibility: (a: number, b: number, c: number, d: number) => [number, number];
1281
+ readonly book_setShowGridLines: (a: number, b: number, c: number, d: number) => [number, number];
1282
+ readonly book_setTableFilter: (a: number, b: number, c: number, d: any, e: any) => [number, number];
1283
+ readonly book_setZoom: (a: number, b: number, c: number) => [number, number];
1284
+ readonly book_shapes: (a: number, b: number) => [number, number, number];
1285
+ readonly book_sheetIndex: (a: number, b: number, c: number) => number;
1286
+ readonly book_sheetNames: (a: number) => [number, number];
1287
+ readonly book_sheetProtection: (a: number, b: number) => [number, number, number];
1288
+ readonly book_sheetView: (a: number, b: number) => [number, number, number];
1289
+ readonly book_sheetVisibility: (a: number, b: number) => [number, number, number, number];
1290
+ readonly book_sortRange: (a: number, b: number, c: number, d: number, e: any, f: any) => [number, number];
1291
+ readonly book_sortTable: (a: number, b: number, c: number, d: any) => [number, number];
1292
+ readonly book_tables: (a: number, b: number) => [number, number, number];
1293
+ readonly book_toCsv: (a: number, b: number, c: any) => [number, number, number, number];
1294
+ readonly book_toHtml: (a: number, b: number, c: number) => [number, number, number, number];
1295
+ readonly book_toOds: (a: number) => [number, number, number, number];
1296
+ readonly book_toXls: (a: number) => [number, number, number, number];
1297
+ readonly book_toXlsx: (a: number, b: number) => [number, number, number, number];
1298
+ readonly book_unmerge: (a: number, b: number, c: number, d: number) => [number, number, number];
1299
+ readonly book_unprotectSheet: (a: number, b: number) => [number, number];
1300
+ readonly book_unprotectWorkbook: (a: number) => void;
1301
+ readonly book_unregisterFunction: (a: number, b: number, c: number) => number;
1302
+ readonly book_usedRange: (a: number, b: number) => [number, number];
1303
+ readonly book_usedRangeHint: (a: number, b: number) => [number, number, number, number];
1304
+ readonly book_verifySheetPassword: (a: number, b: number, c: number, d: number) => [number, number, number];
1305
+ readonly book_workbookProtection: (a: number) => any;
1306
+ readonly rust_zstd_wasm_shim_calloc: (a: number, b: number) => number;
1307
+ readonly rust_zstd_wasm_shim_free: (a: number) => void;
1308
+ readonly rust_zstd_wasm_shim_malloc: (a: number) => number;
1309
+ readonly rust_zstd_wasm_shim_memcmp: (a: number, b: number, c: number) => number;
1310
+ readonly rust_zstd_wasm_shim_memcpy: (a: number, b: number, c: number) => number;
1311
+ readonly rust_zstd_wasm_shim_memmove: (a: number, b: number, c: number) => number;
1312
+ readonly rust_zstd_wasm_shim_memset: (a: number, b: number, c: number) => number;
1313
+ readonly rust_zstd_wasm_shim_qsort: (a: number, b: number, c: number, d: number) => void;
1314
+ readonly __wbindgen_malloc: (a: number, b: number) => number;
1315
+ readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
1316
+ readonly __wbindgen_exn_store: (a: number) => void;
1317
+ readonly __externref_table_alloc: () => number;
1318
+ readonly __wbindgen_externrefs: WebAssembly.Table;
1319
+ readonly __externref_table_dealloc: (a: number) => void;
1320
+ readonly __externref_drop_slice: (a: number, b: number) => void;
1321
+ readonly __wbindgen_free: (a: number, b: number, c: number) => void;
1322
+ readonly __wbindgen_start: () => void;
1323
+ }
1324
+
1325
+ export type SyncInitInput = BufferSource | WebAssembly.Module;
1326
+
1327
+ /**
1328
+ * Instantiates the given `module`, which can either be bytes or
1329
+ * a precompiled `WebAssembly.Module`.
1330
+ *
1331
+ * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
1332
+ *
1333
+ * @returns {InitOutput}
1334
+ */
1335
+ export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
1336
+
1337
+ /**
1338
+ * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
1339
+ * for everything else, calls `WebAssembly.instantiate` directly.
1340
+ *
1341
+ * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
1342
+ *
1343
+ * @returns {Promise<InitOutput>}
1344
+ */
1345
+ export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;