@rosperitus/excelerate-reader 0.14.0 → 0.16.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.
- package/README.md +38 -0
- package/excelerate.d.ts +88 -3
- package/excelerate.js +48 -4
- package/excelerate_bg.wasm +0 -0
- package/package.json +21 -3
- package/web/excelerate.d.ts +749 -0
- package/web/excelerate.js +1381 -0
- package/web/excelerate_bg.wasm +0 -0
- package/web/excelerate_bg.wasm.d.ts +86 -0
- package/web/package.json +4 -0
|
@@ -0,0 +1,749 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
/** What a cell can hold on the JS side. An error cell reads as its code, `#DIV/0!`. */
|
|
5
|
+
export type CellValue = number | string | boolean | null;
|
|
6
|
+
/** A rectangle of cells, row by row, as `getRange` returns it. */
|
|
7
|
+
export type CellGrid = CellValue[][];
|
|
8
|
+
/**
|
|
9
|
+
* One row with its styling, as `getRowAt` returns it. `formatted` is `null`
|
|
10
|
+
* when the call asked for values alone. `bold` is one byte per cell, 0 or 1.
|
|
11
|
+
*/
|
|
12
|
+
export interface SheetRow {
|
|
13
|
+
values: CellValue[];
|
|
14
|
+
formatted: string[] | null;
|
|
15
|
+
bold: Uint8Array;
|
|
16
|
+
indent: Uint32Array;
|
|
17
|
+
hidden: boolean;
|
|
18
|
+
}
|
|
19
|
+
/** Where a drawing object sits, in the 1-based numbers a user sees. */
|
|
20
|
+
export interface ObjectAnchor {
|
|
21
|
+
kind: "twoCell" | "oneCell" | "absolute";
|
|
22
|
+
row: number | null;
|
|
23
|
+
column: number | null;
|
|
24
|
+
}
|
|
25
|
+
/** How a sheet is frozen and shown, as `sheetView` returns it. */
|
|
26
|
+
export interface SheetViewInfo {
|
|
27
|
+
frozenRows: number;
|
|
28
|
+
frozenColumns: number;
|
|
29
|
+
zoom: number | null;
|
|
30
|
+
showGridLines: boolean;
|
|
31
|
+
showRowColHeaders: boolean;
|
|
32
|
+
rightToLeft: boolean;
|
|
33
|
+
topLeftCell: string | null;
|
|
34
|
+
}
|
|
35
|
+
/** One of the user's own document properties. */
|
|
36
|
+
export interface CustomProperty {
|
|
37
|
+
name: string;
|
|
38
|
+
type: "text" | "integer" | "number" | "boolean" | "date";
|
|
39
|
+
value: string | number | boolean;
|
|
40
|
+
}
|
|
41
|
+
/** Title, author, dates and the user's fields, as `documentProperties` returns them. Dates are ISO 8601. */
|
|
42
|
+
export interface DocumentProperties {
|
|
43
|
+
title: string | null;
|
|
44
|
+
subject: string | null;
|
|
45
|
+
creator: string | null;
|
|
46
|
+
keywords: string | null;
|
|
47
|
+
description: string | null;
|
|
48
|
+
lastModifiedBy: string | null;
|
|
49
|
+
category: string | null;
|
|
50
|
+
contentStatus: string | null;
|
|
51
|
+
language: string | null;
|
|
52
|
+
identifier: string | null;
|
|
53
|
+
revision: string | null;
|
|
54
|
+
version: string | null;
|
|
55
|
+
created: string | null;
|
|
56
|
+
modified: string | null;
|
|
57
|
+
lastPrinted: string | null;
|
|
58
|
+
company: string | null;
|
|
59
|
+
manager: string | null;
|
|
60
|
+
custom: CustomProperty[];
|
|
61
|
+
}
|
|
62
|
+
/** A name that stands for a formula, as `definedNames` returns it. */
|
|
63
|
+
export interface WorkbookName {
|
|
64
|
+
name: string;
|
|
65
|
+
formula: string;
|
|
66
|
+
sheet: number | null;
|
|
67
|
+
hidden: boolean;
|
|
68
|
+
}
|
|
69
|
+
/** A rule limiting what a cell accepts, as `dataValidations` returns it. */
|
|
70
|
+
export interface SheetValidation {
|
|
71
|
+
sqref: string[];
|
|
72
|
+
type: string;
|
|
73
|
+
operator: string;
|
|
74
|
+
formula1: string;
|
|
75
|
+
formula2: string;
|
|
76
|
+
allowBlank: boolean;
|
|
77
|
+
showDropDown: boolean;
|
|
78
|
+
}
|
|
79
|
+
/** One conditional formatting block, as `conditionalFormats` returns it. */
|
|
80
|
+
export interface SheetConditionalFormat {
|
|
81
|
+
sqref: string[];
|
|
82
|
+
rules: { type: string; priority: number; operator: string | null; formulas: string[]; text: string | null }[];
|
|
83
|
+
}
|
|
84
|
+
/** The autofilter over a range, as `autoFilter` returns it. */
|
|
85
|
+
export interface SheetAutoFilter {
|
|
86
|
+
range: string;
|
|
87
|
+
columns: { colId: number; kind: "values" | "custom" | "dynamic" | "top10" | "color" | "icon" | "none" }[];
|
|
88
|
+
}
|
|
89
|
+
/** A pivot report on the sheet, as `pivotTables` returns it. */
|
|
90
|
+
export interface SheetPivotTable {
|
|
91
|
+
name: string;
|
|
92
|
+
location: string | null;
|
|
93
|
+
cacheId: number;
|
|
94
|
+
rowFields: number;
|
|
95
|
+
columnFields: number;
|
|
96
|
+
valueFields: number;
|
|
97
|
+
}
|
|
98
|
+
/** How a sheet or the workbook is locked, as `sheetProtection` returns it. */
|
|
99
|
+
export interface ProtectionInfo { locked: boolean; hasPassword: boolean }
|
|
100
|
+
/** How `toCsv` writes, and how `Book.readCsv` reads. */
|
|
101
|
+
export interface CsvOptions {
|
|
102
|
+
delimiter?: string;
|
|
103
|
+
contiguous?: boolean;
|
|
104
|
+
preserveEmptyFields?: boolean;
|
|
105
|
+
}
|
|
106
|
+
/** A note on a cell, as `comments` returns it. */
|
|
107
|
+
export interface SheetComment { address: string; author: string; text: string }
|
|
108
|
+
/** A link over a cell or a block of them, as `hyperlinks` returns it. */
|
|
109
|
+
export interface SheetHyperlink {
|
|
110
|
+
range: string;
|
|
111
|
+
target: string;
|
|
112
|
+
external: boolean;
|
|
113
|
+
display: string | null;
|
|
114
|
+
tooltip: string | null;
|
|
115
|
+
}
|
|
116
|
+
/** A table over a block of cells, as `tables` returns it. */
|
|
117
|
+
export interface SheetTable {
|
|
118
|
+
name: string;
|
|
119
|
+
displayName: string;
|
|
120
|
+
range: string;
|
|
121
|
+
headerRowCount: number | null;
|
|
122
|
+
totalsRowCount: number | null;
|
|
123
|
+
columns: string[];
|
|
124
|
+
}
|
|
125
|
+
/** A chart on the sheet, as `charts` returns it. */
|
|
126
|
+
export interface SheetChart {
|
|
127
|
+
name: string;
|
|
128
|
+
title: string | null;
|
|
129
|
+
kinds: string[];
|
|
130
|
+
seriesCount: number;
|
|
131
|
+
anchor: ObjectAnchor;
|
|
132
|
+
/** The chart area's fill and outline; `null` leaves them to the chart style. */
|
|
133
|
+
format: DrawingFormat | null;
|
|
134
|
+
/** The plot area's, the same way. */
|
|
135
|
+
plotFormat: DrawingFormat | null;
|
|
136
|
+
}
|
|
137
|
+
/** A picture on the sheet, as `images` returns it. Bytes come from `imageData`. */
|
|
138
|
+
export interface SheetImage {
|
|
139
|
+
name: string;
|
|
140
|
+
description: string;
|
|
141
|
+
format: string;
|
|
142
|
+
byteLength: number;
|
|
143
|
+
anchor: ObjectAnchor;
|
|
144
|
+
}
|
|
145
|
+
/** A drawn shape, as `shapes` returns it. */
|
|
146
|
+
export interface SheetShape {
|
|
147
|
+
name: string;
|
|
148
|
+
description: string;
|
|
149
|
+
geometry: string | null;
|
|
150
|
+
text: string;
|
|
151
|
+
anchor: ObjectAnchor;
|
|
152
|
+
/** Degrees clockwise about the centre. */
|
|
153
|
+
rotation: number;
|
|
154
|
+
/** Mirrored left to right, before it is turned. */
|
|
155
|
+
flipH: boolean;
|
|
156
|
+
/** Mirrored top to bottom, before it is turned. */
|
|
157
|
+
flipV: boolean;
|
|
158
|
+
/** What Excel fills it with: its own, else its style's. */
|
|
159
|
+
fill: DrawingFill;
|
|
160
|
+
/** Its outline, the same way. */
|
|
161
|
+
line: DrawingLine;
|
|
162
|
+
/** The font of its text as the first run states it, the colour from the style if not. */
|
|
163
|
+
font: RunFont;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* A colour of a drawing, resolved through the workbook theme to `#AARRGGBB` (`FF` for opaque);
|
|
167
|
+
* `null` for one no theme defines.
|
|
168
|
+
*/
|
|
169
|
+
export type DrawingColor = string | null;
|
|
170
|
+
/** How a drawing object or chart area is filled. `position` is in percent, `angle` in degrees. */
|
|
171
|
+
export type DrawingFill =
|
|
172
|
+
| { type: "none" }
|
|
173
|
+
| { type: "solid"; color: DrawingColor }
|
|
174
|
+
| {
|
|
175
|
+
type: "gradient";
|
|
176
|
+
stops: { position: number; color: DrawingColor }[];
|
|
177
|
+
angle: number | null;
|
|
178
|
+
path: "shape" | "circle" | "rect" | null;
|
|
179
|
+
}
|
|
180
|
+
| { type: "pattern"; preset: string | null; foreground: DrawingColor; background: DrawingColor }
|
|
181
|
+
| { type: "other" };
|
|
182
|
+
/** An outline: `fill` is `null` and `width` (points) is `null` where the file is silent. */
|
|
183
|
+
export interface DrawingLine {
|
|
184
|
+
fill: DrawingFill | null;
|
|
185
|
+
width: number | null;
|
|
186
|
+
}
|
|
187
|
+
/** The fill and outline an element states; `null` in either leaves it to the style. */
|
|
188
|
+
export interface DrawingFormat {
|
|
189
|
+
fill: DrawingFill | null;
|
|
190
|
+
line: DrawingLine | null;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* A colour as the file states it: `null` when the file leaves it to the
|
|
194
|
+
* reader, `#AARRGGBB` when it names one outright, and `indexed:N` or
|
|
195
|
+
* `theme:N` when it points into the legacy palette or the workbook theme -
|
|
196
|
+
* a theme colour carries its tint as `theme:4@-0.25`.
|
|
197
|
+
*/
|
|
198
|
+
export type StyleColor = string | null;
|
|
199
|
+
/**
|
|
200
|
+
* What a run of formatted text changes about the cell's font; a field left
|
|
201
|
+
* out is the cell's own. `size` in points.
|
|
202
|
+
*/
|
|
203
|
+
export interface RunFont {
|
|
204
|
+
name?: string;
|
|
205
|
+
size?: number;
|
|
206
|
+
bold?: boolean;
|
|
207
|
+
italic?: boolean;
|
|
208
|
+
underline?: string;
|
|
209
|
+
strike?: boolean;
|
|
210
|
+
color?: StyleColor;
|
|
211
|
+
script?: "superscript" | "subscript" | "baseline";
|
|
212
|
+
}
|
|
213
|
+
/** One run of formatted text, as `getRichText` returns it. */
|
|
214
|
+
export interface TextRun { text: string; font?: RunFont | null }
|
|
215
|
+
/** One side of a cell's border. */
|
|
216
|
+
export interface BorderSide { style: string; color: StyleColor }
|
|
217
|
+
/** How a cell is painted, as `cellStyle` returns it. */
|
|
218
|
+
export interface CellStyle {
|
|
219
|
+
numberFormat: string;
|
|
220
|
+
font: {
|
|
221
|
+
name: string;
|
|
222
|
+
size: number;
|
|
223
|
+
bold: boolean;
|
|
224
|
+
italic: boolean;
|
|
225
|
+
underline: string;
|
|
226
|
+
strike: boolean;
|
|
227
|
+
color: StyleColor;
|
|
228
|
+
};
|
|
229
|
+
fill: { pattern: string; foreground: StyleColor; background: StyleColor };
|
|
230
|
+
borders: {
|
|
231
|
+
left: BorderSide;
|
|
232
|
+
right: BorderSide;
|
|
233
|
+
top: BorderSide;
|
|
234
|
+
bottom: BorderSide;
|
|
235
|
+
};
|
|
236
|
+
alignment: {
|
|
237
|
+
horizontal: string | null;
|
|
238
|
+
vertical: string | null;
|
|
239
|
+
wrapText: boolean;
|
|
240
|
+
shrinkToFit: boolean;
|
|
241
|
+
indent: number;
|
|
242
|
+
textRotation: number;
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* The styles of a rectangle, as `getRangeStyles` returns them: each distinct
|
|
247
|
+
* style once in `styles`, and `grid` - row by row - pointing into it.
|
|
248
|
+
*/
|
|
249
|
+
export interface RangeStyles {
|
|
250
|
+
styles: CellStyle[];
|
|
251
|
+
grid: number[][];
|
|
252
|
+
}
|
|
253
|
+
/** Limits for `goalSeek`; the workbook's iteration settings when left out. */
|
|
254
|
+
export interface GoalSeekOptions {
|
|
255
|
+
maxIterations?: number;
|
|
256
|
+
tolerance?: number;
|
|
257
|
+
}
|
|
258
|
+
/** How `goalSeek` ended. */
|
|
259
|
+
export interface GoalSeekResult {
|
|
260
|
+
/** The value left in the changing cell: the best one tried. */
|
|
261
|
+
value: number;
|
|
262
|
+
/** What the set cell computes with it; `null` when that is not a number. */
|
|
263
|
+
result: number | null;
|
|
264
|
+
/** How many times the set cell was computed. */
|
|
265
|
+
iterations: number;
|
|
266
|
+
/** Whether `result` is within the tolerance of the target. */
|
|
267
|
+
converged: boolean;
|
|
268
|
+
}
|
|
269
|
+
/** The rule a value breaks, as `checkValidation` reports it. */
|
|
270
|
+
export interface ValidationProblem {
|
|
271
|
+
/** How Excel reports it: `stop` refuses the entry, the others only warn. */
|
|
272
|
+
style: "stop" | "warning" | "information";
|
|
273
|
+
title: string;
|
|
274
|
+
/** The rule's own message; empty when it has none. */
|
|
275
|
+
message: string;
|
|
276
|
+
sqref: string[];
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* A workbook.
|
|
283
|
+
*/
|
|
284
|
+
export class Book {
|
|
285
|
+
free(): void;
|
|
286
|
+
[Symbol.dispose](): void;
|
|
287
|
+
/**
|
|
288
|
+
* The tab a reader opens the workbook on.
|
|
289
|
+
*/
|
|
290
|
+
activeSheet(): number;
|
|
291
|
+
/**
|
|
292
|
+
* Appends a sheet and returns its index.
|
|
293
|
+
*/
|
|
294
|
+
addSheet(title: string): number;
|
|
295
|
+
/**
|
|
296
|
+
* The array formulas of a sheet, as the areas they cover: `["B2:B4"]`.
|
|
297
|
+
* The formula itself is on the top left cell of each.
|
|
298
|
+
*/
|
|
299
|
+
arrayFormulas(sheet: number): string[];
|
|
300
|
+
/**
|
|
301
|
+
* The autofilter over a sheet, or `undefined` when it has none. What the
|
|
302
|
+
* filter hides is a property of each row - see `rowHidden`.
|
|
303
|
+
*/
|
|
304
|
+
autoFilter(sheet: number): SheetAutoFilter | undefined;
|
|
305
|
+
/**
|
|
306
|
+
* Whether a cell is bold.
|
|
307
|
+
*
|
|
308
|
+
* The one flag, without building the rest of the style: a parser that
|
|
309
|
+
* looks for a header row asks this of every cell, and `cellStyle` would
|
|
310
|
+
* make it pay for the font, fill and four borders it never reads.
|
|
311
|
+
*/
|
|
312
|
+
cellBold(sheet: number, address: string): boolean;
|
|
313
|
+
/**
|
|
314
|
+
* The same by 1-based row and column.
|
|
315
|
+
*/
|
|
316
|
+
cellBoldAt(sheet: number, row: number, column: number): boolean;
|
|
317
|
+
/**
|
|
318
|
+
* How many non-empty cells the workbook holds, or one sheet of it.
|
|
319
|
+
*/
|
|
320
|
+
cellCount(sheet?: number | null): number;
|
|
321
|
+
/**
|
|
322
|
+
* The indent of a cell, in Excel's indent steps (0 when it has none).
|
|
323
|
+
*
|
|
324
|
+
* Indent lives on the cell's style, and a spreadsheet only honours it for
|
|
325
|
+
* left, right and distributed alignment - but the number is returned as
|
|
326
|
+
* the file states it, whatever the alignment.
|
|
327
|
+
*/
|
|
328
|
+
cellIndent(sheet: number, address: string): number;
|
|
329
|
+
/**
|
|
330
|
+
* The same by 1-based row and column.
|
|
331
|
+
*/
|
|
332
|
+
cellIndentAt(sheet: number, row: number, column: number): number;
|
|
333
|
+
/**
|
|
334
|
+
* How a cell is painted: number format, font, fill, borders and text
|
|
335
|
+
* placement, as the file states them.
|
|
336
|
+
*
|
|
337
|
+
* A cell the file says nothing about answers with Excel's defaults, which
|
|
338
|
+
* is what Excel itself shows for it.
|
|
339
|
+
*/
|
|
340
|
+
cellStyle(sheet: number, address: string): CellStyle;
|
|
341
|
+
/**
|
|
342
|
+
* The same by 1-based row and column.
|
|
343
|
+
*/
|
|
344
|
+
cellStyleAt(sheet: number, row: number, column: number): CellStyle;
|
|
345
|
+
/**
|
|
346
|
+
* The charts on a sheet. `kinds` names the plots drawn in each -
|
|
347
|
+
* `barChart`, `lineChart` - and a combination chart has more than one.
|
|
348
|
+
*/
|
|
349
|
+
charts(sheet: number): SheetChart[];
|
|
350
|
+
/**
|
|
351
|
+
* Empties a cell, style and all.
|
|
352
|
+
*/
|
|
353
|
+
clear(sheet: number, address: string): void;
|
|
354
|
+
/**
|
|
355
|
+
* The same by 1-based row and column.
|
|
356
|
+
*/
|
|
357
|
+
clearAt(sheet: number, row: number, column: number): void;
|
|
358
|
+
/**
|
|
359
|
+
* The same for a column, named by its letters: `columnLevel(0, "C")`.
|
|
360
|
+
*/
|
|
361
|
+
columnLevel(sheet: number, column: string): number;
|
|
362
|
+
/**
|
|
363
|
+
* The width of a column in characters, or `undefined` when the sheet
|
|
364
|
+
* leaves it to the default. `column` is 1-based.
|
|
365
|
+
*/
|
|
366
|
+
columnWidth(sheet: number, column: number): number | undefined;
|
|
367
|
+
/**
|
|
368
|
+
* The notes on a sheet, in address order.
|
|
369
|
+
*/
|
|
370
|
+
comments(sheet: number): SheetComment[];
|
|
371
|
+
/**
|
|
372
|
+
* The conditional formatting of a sheet, block by block. The formatting
|
|
373
|
+
* each rule applies is not modelled here - it lives in the workbook's
|
|
374
|
+
* differential styles - but what the rule tests is.
|
|
375
|
+
*/
|
|
376
|
+
conditionalFormats(sheet: number): SheetConditionalFormat[];
|
|
377
|
+
/**
|
|
378
|
+
* The rules limiting what cells accept: the dropdown lists, the ranges,
|
|
379
|
+
* the dates.
|
|
380
|
+
*/
|
|
381
|
+
dataValidations(sheet: number): SheetValidation[];
|
|
382
|
+
/**
|
|
383
|
+
* The names the workbook defines: what `=Total` and `Print_Area` stand
|
|
384
|
+
* for. `sheet` is set on a name local to one sheet.
|
|
385
|
+
*/
|
|
386
|
+
definedNames(): WorkbookName[];
|
|
387
|
+
/**
|
|
388
|
+
* What Excel shows under File > Info: every text field is a string or
|
|
389
|
+
* `null`, dates in ISO 8601. `custom` lists the user's own fields with
|
|
390
|
+
* their type: `text`, `integer`, `number`, `boolean` or `date`.
|
|
391
|
+
*/
|
|
392
|
+
documentProperties(): DocumentProperties;
|
|
393
|
+
/**
|
|
394
|
+
* The other workbooks this one reads, in the order `[1]Sheet1!A1` counts
|
|
395
|
+
* them. A path is `undefined` where the file does not name one.
|
|
396
|
+
*/
|
|
397
|
+
externalBooks(): any[];
|
|
398
|
+
/**
|
|
399
|
+
* Reads a workbook and hands sheet `sheet` over row by row, without
|
|
400
|
+
* building its grid: `callback(row, data)` gets the 1-based row number
|
|
401
|
+
* and what `getRowAt` would answer for it, and the row is dropped once
|
|
402
|
+
* the callback returns.
|
|
403
|
+
*
|
|
404
|
+
* The workbook comes back whole but for that sheet's cells. Only xlsx
|
|
405
|
+
* streams; any other format is read whole and then handed over the same
|
|
406
|
+
* way, so the callback sees the same rows but nothing is saved.
|
|
407
|
+
* A callback that throws is not called again, and what it threw comes
|
|
408
|
+
* out of `forEachRow` once the read is over.
|
|
409
|
+
*/
|
|
410
|
+
static forEachRow(bytes: Uint8Array, name: string | null | undefined, sheet: number, callback: Function, formatted?: boolean | null): Book;
|
|
411
|
+
/**
|
|
412
|
+
* The value at `address` on sheet `sheet`, as a JS number, string, boolean
|
|
413
|
+
* or `null`. A formula cell gives its cached result, not its text.
|
|
414
|
+
*/
|
|
415
|
+
get(sheet: number, address: string): CellValue;
|
|
416
|
+
/**
|
|
417
|
+
* The same by 1-based row and column.
|
|
418
|
+
*/
|
|
419
|
+
getAt(sheet: number, row: number, column: number): CellValue;
|
|
420
|
+
/**
|
|
421
|
+
* The cell as a spreadsheet would display it: the value run through its
|
|
422
|
+
* number format, so `0.256` under `0.0%` reads `25.6%`.
|
|
423
|
+
*/
|
|
424
|
+
getFormatted(sheet: number, address: string): string;
|
|
425
|
+
/**
|
|
426
|
+
* The same by 1-based row and column.
|
|
427
|
+
*/
|
|
428
|
+
getFormattedAt(sheet: number, row: number, column: number): string;
|
|
429
|
+
/**
|
|
430
|
+
* The formula text of a cell without its leading `=`, or `undefined` when
|
|
431
|
+
* the cell holds a plain value.
|
|
432
|
+
*/
|
|
433
|
+
getFormula(sheet: number, address: string): string | undefined;
|
|
434
|
+
/**
|
|
435
|
+
* The same by 1-based row and column.
|
|
436
|
+
*/
|
|
437
|
+
getFormulaAt(sheet: number, row: number, column: number): string | undefined;
|
|
438
|
+
/**
|
|
439
|
+
* A rectangle of cells, row by row. One call across the boundary instead
|
|
440
|
+
* of one per cell, which is what makes reading a sheet worth doing.
|
|
441
|
+
*/
|
|
442
|
+
getRange(sheet: number, range: string): CellGrid;
|
|
443
|
+
/**
|
|
444
|
+
* The same by numbers: the top-left cell, then how many rows and columns
|
|
445
|
+
* to take. `getRangeAt(0, 1, 1, 3, 2)` is `A1:B3`.
|
|
446
|
+
*/
|
|
447
|
+
getRangeAt(sheet: number, row: number, column: number, rows: number, columns: number): CellGrid;
|
|
448
|
+
/**
|
|
449
|
+
* The styles of a rectangle in one call: each distinct style once, and a
|
|
450
|
+
* grid of indexes into them. `cellStyle` per cell costs a crossing and a
|
|
451
|
+
* whole style object per cell; a formatted table of ten thousand cells
|
|
452
|
+
* usually has a dozen styles.
|
|
453
|
+
*/
|
|
454
|
+
getRangeStyles(sheet: number, range: string): RangeStyles;
|
|
455
|
+
/**
|
|
456
|
+
* The same by numbers, as `getRangeAt` takes them.
|
|
457
|
+
*/
|
|
458
|
+
getRangeStylesAt(sheet: number, row: number, column: number, rows: number, columns: number): RangeStyles;
|
|
459
|
+
/**
|
|
460
|
+
* The runs of a cell's formatted text: `{ text, font }` each, `font`
|
|
461
|
+
* naming only what the run changes about the cell's font, or `null` for
|
|
462
|
+
* a run in the cell's own. `null` for a cell without formatted text.
|
|
463
|
+
*/
|
|
464
|
+
getRichText(sheet: number, address: string): TextRun[] | null;
|
|
465
|
+
/**
|
|
466
|
+
* The same by 1-based row and column.
|
|
467
|
+
*/
|
|
468
|
+
getRichTextAt(sheet: number, row: number, column: number): TextRun[] | null;
|
|
469
|
+
/**
|
|
470
|
+
* A whole row in one crossing of the boundary: values, displayed text,
|
|
471
|
+
* bold and indent, plus whether the row is hidden.
|
|
472
|
+
*
|
|
473
|
+
* The arrays run from column 1 to the last column this row has a cell in,
|
|
474
|
+
* so a row of ten cells costs one call rather than forty.
|
|
475
|
+
*
|
|
476
|
+
* `formatted` is what the number format makes of each value, and building
|
|
477
|
+
* it allocates a string per cell - which a caller reading values does not
|
|
478
|
+
* want to pay half a sheet over. Pass `false` and the field comes back
|
|
479
|
+
* `null`; `getFormattedAt` still answers for the cells that need it.
|
|
480
|
+
*/
|
|
481
|
+
getRowAt(sheet: number, row: number, formatted?: boolean | null): SheetRow;
|
|
482
|
+
/**
|
|
483
|
+
* The hyperlinks of a sheet. `external` tells a URL from a jump inside
|
|
484
|
+
* the workbook.
|
|
485
|
+
*/
|
|
486
|
+
hyperlinks(sheet: number): SheetHyperlink[];
|
|
487
|
+
/**
|
|
488
|
+
* The bytes of one picture, by its position in `images`.
|
|
489
|
+
*/
|
|
490
|
+
imageData(sheet: number, index: number): Uint8Array;
|
|
491
|
+
/**
|
|
492
|
+
* The pictures on a sheet, without their bytes: `imageData` fetches those
|
|
493
|
+
* for the one that is wanted.
|
|
494
|
+
*/
|
|
495
|
+
images(sheet: number): SheetImage[];
|
|
496
|
+
/**
|
|
497
|
+
* The merged areas of a sheet, as `"A1:C1"` strings in the order the file
|
|
498
|
+
* lists them.
|
|
499
|
+
*/
|
|
500
|
+
mergedRanges(sheet: number): string[];
|
|
501
|
+
/**
|
|
502
|
+
* The merged areas of a sheet as numbers: four per area, `[r1, c1, r2,
|
|
503
|
+
* c2]`, rows and columns 1-based.
|
|
504
|
+
*
|
|
505
|
+
* One typed array instead of a JS string per area, which is what a sheet
|
|
506
|
+
* carrying three hundred thousand of them needs.
|
|
507
|
+
*/
|
|
508
|
+
mergedRangesAt(sheet: number): Uint32Array;
|
|
509
|
+
/**
|
|
510
|
+
* A new workbook with one empty sheet.
|
|
511
|
+
*/
|
|
512
|
+
constructor();
|
|
513
|
+
/**
|
|
514
|
+
* The pivot reports laid out on a sheet. The numbers they show are cells
|
|
515
|
+
* like any others; this says where a report sits and how wide its axes
|
|
516
|
+
* are.
|
|
517
|
+
*/
|
|
518
|
+
pivotTables(sheet: number): SheetPivotTable[];
|
|
519
|
+
/**
|
|
520
|
+
* Reads a workbook of any format this crate supports, working the format
|
|
521
|
+
* out from the bytes themselves.
|
|
522
|
+
*
|
|
523
|
+
* `name` is the file name they came from, if the caller has one: it
|
|
524
|
+
* settles what the bytes cannot say (a `.csv` against a `.html`) and names
|
|
525
|
+
* the sheet of a SYLK file. `password` opens a workbook saved with a
|
|
526
|
+
* password to open; without it only one encrypted to be opened
|
|
527
|
+
* read-only reads.
|
|
528
|
+
*/
|
|
529
|
+
static read(bytes: Uint8Array, name?: string | null, max_expanded?: number | null, on_progress?: Function | null, password?: string | null): Book;
|
|
530
|
+
/**
|
|
531
|
+
* Reads CSV with the guesses overridden: the delimiter, whether a row
|
|
532
|
+
* that produced no cell is skipped, whether an empty field becomes an
|
|
533
|
+
* empty string rather than no cell at all.
|
|
534
|
+
*
|
|
535
|
+
* `Book.read` guesses all of this from the bytes, which is right for a
|
|
536
|
+
* file of unknown origin; this is for one whose shape you already know.
|
|
537
|
+
*/
|
|
538
|
+
static readCsv(bytes: Uint8Array, options: CsvOptions): Book;
|
|
539
|
+
/**
|
|
540
|
+
* Renames a sheet.
|
|
541
|
+
*/
|
|
542
|
+
renameSheet(sheet: number, title: string): void;
|
|
543
|
+
/**
|
|
544
|
+
* The height of a row in points, or `undefined` when the sheet leaves it
|
|
545
|
+
* to the default. `row` is the number a user sees.
|
|
546
|
+
*/
|
|
547
|
+
rowHeight(sheet: number, row: number): number | undefined;
|
|
548
|
+
/**
|
|
549
|
+
* Whether a row is hidden. `row` is the number a user sees.
|
|
550
|
+
*/
|
|
551
|
+
rowHidden(sheet: number, row: number): boolean;
|
|
552
|
+
/**
|
|
553
|
+
* How deeply a row is grouped: 0 when it is not, 1 for the outermost
|
|
554
|
+
* group, and so on. `row` is the number a user sees.
|
|
555
|
+
*/
|
|
556
|
+
rowLevel(sheet: number, row: number): number;
|
|
557
|
+
/**
|
|
558
|
+
* Writes a value: a number, boolean, or string. A string starting with `=`
|
|
559
|
+
* becomes a formula.
|
|
560
|
+
*/
|
|
561
|
+
set(sheet: number, address: string, value: CellValue): void;
|
|
562
|
+
/**
|
|
563
|
+
* Sets that tab.
|
|
564
|
+
*/
|
|
565
|
+
setActiveSheet(sheet: number): void;
|
|
566
|
+
/**
|
|
567
|
+
* The same by 1-based row and column.
|
|
568
|
+
*/
|
|
569
|
+
setAt(sheet: number, row: number, column: number, value: CellValue): void;
|
|
570
|
+
/**
|
|
571
|
+
* Writes a rectangle of values with `at` as its top-left corner. Rows may
|
|
572
|
+
* differ in length; a `null` leaves its cell empty.
|
|
573
|
+
*/
|
|
574
|
+
setRange(sheet: number, at: string, values: CellGrid): void;
|
|
575
|
+
/**
|
|
576
|
+
* The same with the corner given as 1-based row and column.
|
|
577
|
+
*/
|
|
578
|
+
setRangeAt(sheet: number, row: number, column: number, values: CellGrid): void;
|
|
579
|
+
/**
|
|
580
|
+
* The drawn shapes of a sheet, text and all, with the look Excel shows:
|
|
581
|
+
* fill, outline and font are the shape's own with its style filling in
|
|
582
|
+
* the rest, colours resolved through the workbook theme.
|
|
583
|
+
*/
|
|
584
|
+
shapes(sheet: number): SheetShape[];
|
|
585
|
+
/**
|
|
586
|
+
* The tab index of a sheet by name, or `undefined` when there is none.
|
|
587
|
+
* Names are compared the way Excel does, ignoring case.
|
|
588
|
+
*/
|
|
589
|
+
sheetIndex(name: string): number | undefined;
|
|
590
|
+
/**
|
|
591
|
+
* Sheet titles, in tab order.
|
|
592
|
+
*/
|
|
593
|
+
sheetNames(): string[];
|
|
594
|
+
/**
|
|
595
|
+
* Whether a sheet is locked, and whether the lock has a password.
|
|
596
|
+
*/
|
|
597
|
+
sheetProtection(sheet: number): ProtectionInfo;
|
|
598
|
+
/**
|
|
599
|
+
* How the sheet is frozen and shown.
|
|
600
|
+
*/
|
|
601
|
+
sheetView(sheet: number): SheetViewInfo;
|
|
602
|
+
/**
|
|
603
|
+
* Whether a sheet has a tab: `"visible"`, `"hidden"` or `"veryHidden"`.
|
|
604
|
+
*
|
|
605
|
+
* `sheetNames` lists every sheet, hidden ones included, because that is
|
|
606
|
+
* what the index of every other call counts.
|
|
607
|
+
*/
|
|
608
|
+
sheetVisibility(sheet: number): string;
|
|
609
|
+
/**
|
|
610
|
+
* The tables of a sheet: what a structured reference like `Sales[Amount]`
|
|
611
|
+
* names.
|
|
612
|
+
*/
|
|
613
|
+
tables(sheet: number): SheetTable[];
|
|
614
|
+
/**
|
|
615
|
+
* The used range of a sheet as `A1:D9`, or `undefined` if it holds
|
|
616
|
+
* nothing. This is the rectangle to walk; the sheet itself is sparse.
|
|
617
|
+
*/
|
|
618
|
+
usedRange(sheet: number): string | undefined;
|
|
619
|
+
/**
|
|
620
|
+
* The used range of a sheet as `"A1:D20"` without walking the rows;
|
|
621
|
+
* `undefined` for an empty sheet.
|
|
622
|
+
*
|
|
623
|
+
* Rows are exact, columns an upper bound: removing a cell never narrows
|
|
624
|
+
* them. `usedRange` answers the same until a cell in an edge column is
|
|
625
|
+
* removed, and walks the rows after that to give the exact rectangle.
|
|
626
|
+
*/
|
|
627
|
+
usedRangeHint(sheet: number): string | undefined;
|
|
628
|
+
/**
|
|
629
|
+
* Whether that password unlocks the sheet. `false` for a sheet with no
|
|
630
|
+
* password on it, and for a hash this crate cannot check.
|
|
631
|
+
*/
|
|
632
|
+
verifySheetPassword(sheet: number, password: string): boolean;
|
|
633
|
+
/**
|
|
634
|
+
* Whether the workbook's structure is locked, and whether behind a
|
|
635
|
+
* password.
|
|
636
|
+
*/
|
|
637
|
+
workbookProtection(): ProtectionInfo;
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
641
|
+
|
|
642
|
+
export interface InitOutput {
|
|
643
|
+
readonly memory: WebAssembly.Memory;
|
|
644
|
+
readonly __wbg_book_free: (a: number, b: number) => void;
|
|
645
|
+
readonly book_activeSheet: (a: number) => number;
|
|
646
|
+
readonly book_addSheet: (a: number, b: number, c: number) => [number, number, number];
|
|
647
|
+
readonly book_arrayFormulas: (a: number, b: number) => [number, number, number, number];
|
|
648
|
+
readonly book_autoFilter: (a: number, b: number) => [number, number, number];
|
|
649
|
+
readonly book_cellBold: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
650
|
+
readonly book_cellBoldAt: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
651
|
+
readonly book_cellCount: (a: number, b: number) => number;
|
|
652
|
+
readonly book_cellIndent: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
653
|
+
readonly book_cellIndentAt: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
654
|
+
readonly book_cellStyle: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
655
|
+
readonly book_cellStyleAt: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
656
|
+
readonly book_charts: (a: number, b: number) => [number, number, number];
|
|
657
|
+
readonly book_clear: (a: number, b: number, c: number, d: number) => [number, number];
|
|
658
|
+
readonly book_clearAt: (a: number, b: number, c: number, d: number) => [number, number];
|
|
659
|
+
readonly book_columnLevel: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
660
|
+
readonly book_columnWidth: (a: number, b: number, c: number) => [number, number, number, number];
|
|
661
|
+
readonly book_comments: (a: number, b: number) => [number, number, number];
|
|
662
|
+
readonly book_conditionalFormats: (a: number, b: number) => [number, number, number];
|
|
663
|
+
readonly book_dataValidations: (a: number, b: number) => [number, number, number];
|
|
664
|
+
readonly book_definedNames: (a: number) => any;
|
|
665
|
+
readonly book_documentProperties: (a: number) => any;
|
|
666
|
+
readonly book_externalBooks: (a: number) => [number, number];
|
|
667
|
+
readonly book_forEachRow: (a: number, b: number, c: number, d: number, e: number, f: any, g: number) => [number, number, number];
|
|
668
|
+
readonly book_get: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
669
|
+
readonly book_getAt: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
670
|
+
readonly book_getFormatted: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
671
|
+
readonly book_getFormattedAt: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
672
|
+
readonly book_getFormula: (a: number, b: number, c: number, d: number) => [number, number];
|
|
673
|
+
readonly book_getFormulaAt: (a: number, b: number, c: number, d: number) => [number, number];
|
|
674
|
+
readonly book_getRange: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
675
|
+
readonly book_getRangeAt: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
|
|
676
|
+
readonly book_getRangeStyles: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
677
|
+
readonly book_getRangeStylesAt: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
|
|
678
|
+
readonly book_getRichText: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
679
|
+
readonly book_getRichTextAt: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
680
|
+
readonly book_getRowAt: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
681
|
+
readonly book_hyperlinks: (a: number, b: number) => [number, number, number];
|
|
682
|
+
readonly book_imageData: (a: number, b: number, c: number) => [number, number, number, number];
|
|
683
|
+
readonly book_images: (a: number, b: number) => [number, number, number];
|
|
684
|
+
readonly book_mergedRanges: (a: number, b: number) => [number, number, number, number];
|
|
685
|
+
readonly book_mergedRangesAt: (a: number, b: number) => [number, number, number];
|
|
686
|
+
readonly book_new: () => number;
|
|
687
|
+
readonly book_pivotTables: (a: number, b: number) => [number, number, number];
|
|
688
|
+
readonly book_read: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number, number];
|
|
689
|
+
readonly book_readCsv: (a: number, b: number, c: any) => [number, number, number];
|
|
690
|
+
readonly book_renameSheet: (a: number, b: number, c: number, d: number) => [number, number];
|
|
691
|
+
readonly book_rowHeight: (a: number, b: number, c: number) => [number, number, number, number];
|
|
692
|
+
readonly book_rowHidden: (a: number, b: number, c: number) => [number, number, number];
|
|
693
|
+
readonly book_rowLevel: (a: number, b: number, c: number) => [number, number, number];
|
|
694
|
+
readonly book_set: (a: number, b: number, c: number, d: number, e: any) => [number, number];
|
|
695
|
+
readonly book_setActiveSheet: (a: number, b: number) => [number, number];
|
|
696
|
+
readonly book_setAt: (a: number, b: number, c: number, d: number, e: any) => [number, number];
|
|
697
|
+
readonly book_setRange: (a: number, b: number, c: number, d: number, e: any) => [number, number];
|
|
698
|
+
readonly book_setRangeAt: (a: number, b: number, c: number, d: number, e: any) => [number, number];
|
|
699
|
+
readonly book_shapes: (a: number, b: number) => [number, number, number];
|
|
700
|
+
readonly book_sheetIndex: (a: number, b: number, c: number) => number;
|
|
701
|
+
readonly book_sheetNames: (a: number) => [number, number];
|
|
702
|
+
readonly book_sheetProtection: (a: number, b: number) => [number, number, number];
|
|
703
|
+
readonly book_sheetView: (a: number, b: number) => [number, number, number];
|
|
704
|
+
readonly book_sheetVisibility: (a: number, b: number) => [number, number, number, number];
|
|
705
|
+
readonly book_tables: (a: number, b: number) => [number, number, number];
|
|
706
|
+
readonly book_usedRange: (a: number, b: number) => [number, number];
|
|
707
|
+
readonly book_usedRangeHint: (a: number, b: number) => [number, number, number, number];
|
|
708
|
+
readonly book_verifySheetPassword: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
709
|
+
readonly book_workbookProtection: (a: number) => any;
|
|
710
|
+
readonly rust_zstd_wasm_shim_calloc: (a: number, b: number) => number;
|
|
711
|
+
readonly rust_zstd_wasm_shim_free: (a: number) => void;
|
|
712
|
+
readonly rust_zstd_wasm_shim_malloc: (a: number) => number;
|
|
713
|
+
readonly rust_zstd_wasm_shim_memcmp: (a: number, b: number, c: number) => number;
|
|
714
|
+
readonly rust_zstd_wasm_shim_memcpy: (a: number, b: number, c: number) => number;
|
|
715
|
+
readonly rust_zstd_wasm_shim_memmove: (a: number, b: number, c: number) => number;
|
|
716
|
+
readonly rust_zstd_wasm_shim_memset: (a: number, b: number, c: number) => number;
|
|
717
|
+
readonly rust_zstd_wasm_shim_qsort: (a: number, b: number, c: number, d: number) => void;
|
|
718
|
+
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
719
|
+
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
720
|
+
readonly __wbindgen_exn_store: (a: number) => void;
|
|
721
|
+
readonly __externref_table_alloc: () => number;
|
|
722
|
+
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
723
|
+
readonly __externref_table_dealloc: (a: number) => void;
|
|
724
|
+
readonly __externref_drop_slice: (a: number, b: number) => void;
|
|
725
|
+
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
726
|
+
readonly __wbindgen_start: () => void;
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
730
|
+
|
|
731
|
+
/**
|
|
732
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
733
|
+
* a precompiled `WebAssembly.Module`.
|
|
734
|
+
*
|
|
735
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
736
|
+
*
|
|
737
|
+
* @returns {InitOutput}
|
|
738
|
+
*/
|
|
739
|
+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
740
|
+
|
|
741
|
+
/**
|
|
742
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
743
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
744
|
+
*
|
|
745
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
746
|
+
*
|
|
747
|
+
* @returns {Promise<InitOutput>}
|
|
748
|
+
*/
|
|
749
|
+
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|