@ex-grid/data-xlsx 0.0.0-stage → 0.2.0-beta.3
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/LICENSE +21 -0
- package/README.md +26 -2
- package/dist/index.d.ts +810 -0
- package/dist/index.js +4222 -0
- package/dist/index.js.map +7 -0
- package/package.json +23 -4
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,810 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `argb` lightened or darkened by `tint`, as ECMA-376 Part 1, §18.8.19 says: the colour taken to hue, luminance and
|
|
3
|
+
* saturation, its luminance scaled toward black (`L × (1 + tint)`) or toward white (`L × (1 − tint) + tint`), and taken
|
|
4
|
+
* back, each channel rounded to the nearest of 0 to 255. Alpha is kept.
|
|
5
|
+
* @param tint - From -1 (black) to 1 (white).
|
|
6
|
+
*/
|
|
7
|
+
export declare function applyTint(argb: number, tint: number): number;
|
|
8
|
+
|
|
9
|
+
/** The automatic colour. */
|
|
10
|
+
export declare const automaticColor: XlsxColor;
|
|
11
|
+
|
|
12
|
+
/** The cells a batch holds at most. */
|
|
13
|
+
export declare const batchSize = 4096;
|
|
14
|
+
|
|
15
|
+
/** The name of the column `column`, from zero: 0 is `A`, 26 is `AA`. */
|
|
16
|
+
export declare function columnName(column: number): string;
|
|
17
|
+
|
|
18
|
+
/** A writer of an `.xlsx` workbook (`XlsxWriter`).
|
|
19
|
+
* @param options - What the workbook says of itself; the defaults when left out. */
|
|
20
|
+
export declare function createXlsxWriter(options?: XlsxWriteOptions): XlsxWriter;
|
|
21
|
+
|
|
22
|
+
/** The alignment of a cell that writes none. */
|
|
23
|
+
export declare const defaultAlignment: XlsxAlignment;
|
|
24
|
+
|
|
25
|
+
/** The default indexed palette's 64 colours (ECMA-376 Part 1, §18.8.27), as ARGB values. */
|
|
26
|
+
export declare const defaultIndexedColors: readonly number[];
|
|
27
|
+
|
|
28
|
+
/** The cells a read allows when the options name none. */
|
|
29
|
+
export declare const defaultMaxCells = 10000000;
|
|
30
|
+
|
|
31
|
+
/** The uncompressed bytes a read allows when the options name none: 1 GiB. */
|
|
32
|
+
export declare const defaultMaxUncompressedBytes: number;
|
|
33
|
+
|
|
34
|
+
/** The styles of a workbook that styles nothing: Calibri 11, no fill (and the reserved grey), no border, and one cell
|
|
35
|
+
* format of all four. */
|
|
36
|
+
export declare const defaultStyles: XlsxStyles;
|
|
37
|
+
|
|
38
|
+
/** The children an `XlsxElement` keeps of each element, in the file's order. */
|
|
39
|
+
export declare const elementMaxChildren = 16;
|
|
40
|
+
|
|
41
|
+
/** The levels of children an `XlsxElement` keeps below a worksheet's element. */
|
|
42
|
+
export declare const elementMaxDepth = 3;
|
|
43
|
+
|
|
44
|
+
/** The characters of an element's own text that an `XlsxElement` keeps. */
|
|
45
|
+
export declare const elementMaxText = 1024;
|
|
46
|
+
|
|
47
|
+
/** The first Number Format id a styles part defines for itself; the ones below it are built in. */
|
|
48
|
+
export declare const firstCustomNumberFormat = 164;
|
|
49
|
+
|
|
50
|
+
/** The cell at `row` and `column`, both from zero, as `B7`. */
|
|
51
|
+
export declare function formatCell(row: number, column: number): string;
|
|
52
|
+
|
|
53
|
+
/** The 12.5% grey pattern Excel reserves as every styles part's second fill. */
|
|
54
|
+
export declare const gray125Fill: XlsxFill;
|
|
55
|
+
|
|
56
|
+
/** An entry of the indexed palette, 0 to 65. */
|
|
57
|
+
export declare function indexedColor(index: number, tint?: number): XlsxColor;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Whether `name` is a name Excel gives a Table: a letter, `_` or `\`, then letters, digits, `_` and `.`; at most 255
|
|
61
|
+
* characters; not a cell's address (`A1`, `A01`), not an R1C1 one, `R` or `C`, and not `TRUE` or `FALSE`. Whether another
|
|
62
|
+
* table or a defined name has it is the workbook's to say.
|
|
63
|
+
*/
|
|
64
|
+
export declare function isValidTableName(name: string): boolean;
|
|
65
|
+
|
|
66
|
+
/** The columns a worksheet has: 16,384 (A to XFD). */
|
|
67
|
+
export declare const maxColumns = 16384;
|
|
68
|
+
|
|
69
|
+
/** The rows a worksheet has: 1,048,576. */
|
|
70
|
+
export declare const maxRows = 1048576;
|
|
71
|
+
|
|
72
|
+
/** No border: the first border of every styles part. */
|
|
73
|
+
export declare const noBorder: XlsxBorder;
|
|
74
|
+
|
|
75
|
+
/** No line. */
|
|
76
|
+
export declare const noBorderEdge: XlsxBorderEdge;
|
|
77
|
+
|
|
78
|
+
/** No fill: the first fill of every styles part. */
|
|
79
|
+
export declare const noFill: XlsxFill;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Opens the workbook in `file`, reading its workbook part, shared strings, styles and theme, or refuses it by name
|
|
83
|
+
* (`XlsxError`). A Blob — a File — is read where its bytes are asked for, through `slice`, and never whole.
|
|
84
|
+
* @param file - The file's bytes, or a Blob.
|
|
85
|
+
* @param options - The limits, progress and pacing; the defaults when left out.
|
|
86
|
+
*/
|
|
87
|
+
export declare function openXlsx(file: Uint8Array | ArrayBuffer | Blob, options?: XlsxReadOptions): Promise<XlsxReader>;
|
|
88
|
+
|
|
89
|
+
/** Reads `B7` into its row and column, from zero; `undefined` for text that is not a cell inside the grid. `$` marks are
|
|
90
|
+
* allowed. */
|
|
91
|
+
export declare function parseCell(text: string): XlsxPlaceOfCell | undefined;
|
|
92
|
+
|
|
93
|
+
/** The cell's place as `B7`. */
|
|
94
|
+
export declare function referenceOf(cell: {
|
|
95
|
+
readonly row: number;
|
|
96
|
+
readonly column: number;
|
|
97
|
+
}): string;
|
|
98
|
+
|
|
99
|
+
/** An ARGB value, as `0xFF4472C4`. */
|
|
100
|
+
export declare function rgbColor(argb: number, tint?: number): XlsxColor;
|
|
101
|
+
|
|
102
|
+
/** A solid fill of `color`. */
|
|
103
|
+
export declare function solidFill(color: XlsxColor): XlsxFill;
|
|
104
|
+
|
|
105
|
+
/** The cells the table covers, its header's included, as `A1:C4`. */
|
|
106
|
+
export declare function tableReference(table: XlsxTable): string;
|
|
107
|
+
|
|
108
|
+
/** A theme slot, with a tint: 0 Background 1, 1 Text 1, 2 Background 2, 3 Text 2, 4 to 9 Accents 1 to 6, 10 Hyperlink,
|
|
109
|
+
* 11 Followed Hyperlink. */
|
|
110
|
+
export declare function themeColor(slot: number, tint?: number): XlsxColor;
|
|
111
|
+
|
|
112
|
+
/** A cell's alignment, as an `<alignment>` writes it. */
|
|
113
|
+
export declare interface XlsxAlignment {
|
|
114
|
+
/** Where the text lies across the cell. */
|
|
115
|
+
readonly horizontal: XlsxHorizontalAlignment;
|
|
116
|
+
/** Where the text lies up and down the cell. */
|
|
117
|
+
readonly vertical: XlsxVerticalAlignment;
|
|
118
|
+
/** Whether the text wraps onto more lines. */
|
|
119
|
+
readonly wrapText: boolean;
|
|
120
|
+
/** The indent, in steps. */
|
|
121
|
+
readonly indent: number;
|
|
122
|
+
/** The rotation, as the file writes it: 0 to 180, or 255 for stacked text. */
|
|
123
|
+
readonly textRotation: number;
|
|
124
|
+
/** Whether the text shrinks to fit the cell's width. */
|
|
125
|
+
readonly shrinkToFit: boolean;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/** A border of the styles part: four edges and a diagonal. */
|
|
129
|
+
export declare interface XlsxBorder {
|
|
130
|
+
/** The left edge. */
|
|
131
|
+
readonly left: XlsxBorderEdge;
|
|
132
|
+
/** The right edge. */
|
|
133
|
+
readonly right: XlsxBorderEdge;
|
|
134
|
+
/** The top edge. */
|
|
135
|
+
readonly top: XlsxBorderEdge;
|
|
136
|
+
/** The bottom edge. */
|
|
137
|
+
readonly bottom: XlsxBorderEdge;
|
|
138
|
+
/** The diagonal line, drawn where `diagonalUp` or `diagonalDown` says. */
|
|
139
|
+
readonly diagonal: XlsxBorderEdge;
|
|
140
|
+
/** Whether the diagonal rises from bottom left to top right. */
|
|
141
|
+
readonly diagonalUp: boolean;
|
|
142
|
+
/** Whether the diagonal falls from top left to bottom right. */
|
|
143
|
+
readonly diagonalDown: boolean;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/** One edge of a border: its line style and colour. */
|
|
147
|
+
export declare interface XlsxBorderEdge {
|
|
148
|
+
/** The line's style; `none` for no line. */
|
|
149
|
+
readonly style: XlsxBorderStyle;
|
|
150
|
+
/** The line's colour, or null for none written. */
|
|
151
|
+
readonly color: XlsxColor | null;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/** A border line's style: none, or one of Excel's thirteen (ECMA-376 `ST_BorderStyle`). */
|
|
155
|
+
export declare type XlsxBorderStyle = 'none' | 'thin' | 'medium' | 'dashed' | 'dotted' | 'thick' | 'double' | 'hair' | 'mediumDashed' | 'dashDot' | 'mediumDashDot' | 'dashDotDot' | 'mediumDashDotDot' | 'slantDashDot';
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* One cell as a worksheet writes it (ADR-0330 §9): its place, its type, its value as written, its Formula and its
|
|
159
|
+
* style. Nothing is interpreted: a number is its text, a Formula its stored text, a style its index into the styles'
|
|
160
|
+
* cell formats.
|
|
161
|
+
*/
|
|
162
|
+
export declare interface XlsxCell {
|
|
163
|
+
/** The cell's row, from zero (row 1 is 0). */
|
|
164
|
+
readonly row: number;
|
|
165
|
+
/** The cell's column, from zero (column A is 0). */
|
|
166
|
+
readonly column: number;
|
|
167
|
+
/** What the value is. */
|
|
168
|
+
readonly type: XlsxCellType;
|
|
169
|
+
/** The value as written (`<v>`), or null for a cell with none: a cell that carries only a style, or an inline string. */
|
|
170
|
+
readonly value: string | null;
|
|
171
|
+
/** The text of a shared or inline string; otherwise null. */
|
|
172
|
+
readonly text: string | null;
|
|
173
|
+
/** The Formula, or null. */
|
|
174
|
+
readonly formula: XlsxFormula | null;
|
|
175
|
+
/** The index into the styles' cell formats (`s`); 0 when the cell names none. */
|
|
176
|
+
readonly styleIndex: number;
|
|
177
|
+
/** Whether the text came in runs of their own formatting, which are not carried; the text is. */
|
|
178
|
+
readonly isRichText: boolean;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/** A cell format (`<xf>` of `cellXfs`): what a cell's style index points at. */
|
|
182
|
+
export declare interface XlsxCellFormat {
|
|
183
|
+
/** The Number Format's id: a built-in one below 164, or one of the styles' own. */
|
|
184
|
+
readonly numberFormatId: number;
|
|
185
|
+
/** The index of its font in the styles' fonts. */
|
|
186
|
+
readonly fontId: number;
|
|
187
|
+
/** The index of its fill in the styles' fills. */
|
|
188
|
+
readonly fillId: number;
|
|
189
|
+
/** The index of its border in the styles' borders. */
|
|
190
|
+
readonly borderId: number;
|
|
191
|
+
/** The alignment, or null when the format writes none. */
|
|
192
|
+
readonly alignment: XlsxAlignment | null;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/** A cell to write. A shared string is written from its `text`, whatever its `value` says. */
|
|
196
|
+
export declare interface XlsxCellInput {
|
|
197
|
+
/** The cell's row, from zero. */
|
|
198
|
+
readonly row: number;
|
|
199
|
+
/** The cell's column, from zero. */
|
|
200
|
+
readonly column: number;
|
|
201
|
+
/** What the value is. */
|
|
202
|
+
readonly type: XlsxCellType;
|
|
203
|
+
/** The value as written; none when left out. */
|
|
204
|
+
readonly value?: string | null;
|
|
205
|
+
/** The text of a shared or inline string. */
|
|
206
|
+
readonly text?: string | null;
|
|
207
|
+
/** The Formula. */
|
|
208
|
+
readonly formula?: XlsxFormulaInput | null;
|
|
209
|
+
/** The index into the styles' cell formats; 0 when left out. */
|
|
210
|
+
readonly styleIndex?: number;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/** What a cell's value is, as its `t` attribute writes it (ECMA-376 `ST_CellType`). */
|
|
214
|
+
export declare type XlsxCellType =
|
|
215
|
+
/** A number (`t="n"`, or no `t`): the value is its decimal text, invariant. A cell with no value is a number with none. */
|
|
216
|
+
'number'
|
|
217
|
+
/** Text held in the shared strings (`t="s"`): the value is its index, and the cell's `text` the text. */
|
|
218
|
+
| 'sharedString'
|
|
219
|
+
/** Text written in the cell itself (`t="inlineStr"`): the cell's `text` is the text. */
|
|
220
|
+
| 'inlineString'
|
|
221
|
+
/** A Formula's text result (`t="str"`): the value is the text. */
|
|
222
|
+
| 'formulaString'
|
|
223
|
+
/** A boolean (`t="b"`): the value is `0` or `1`. */
|
|
224
|
+
| 'boolean'
|
|
225
|
+
/** An Error Value (`t="e"`): the value is its text, as `#DIV/0!`. */
|
|
226
|
+
| 'error'
|
|
227
|
+
/** A date in ISO 8601 (`t="d"`), which Excel itself never writes. */
|
|
228
|
+
| 'date';
|
|
229
|
+
|
|
230
|
+
/** A colour as the file writes it: an ARGB value, a theme slot, an indexed entry or the automatic colour, each with a
|
|
231
|
+
* tint. `XlsxTheme.resolve` turns it into the RGB Excel paints (ADR-0330 §8). */
|
|
232
|
+
export declare interface XlsxColor {
|
|
233
|
+
/** What the colour names. */
|
|
234
|
+
readonly kind: XlsxColorKind;
|
|
235
|
+
/** The ARGB value for `rgb` (alpha in the high byte, unsigned), the theme slot for `theme`, the palette index for
|
|
236
|
+
* `indexed`; 0 for `automatic`. */
|
|
237
|
+
readonly value: number;
|
|
238
|
+
/** How far the colour is lightened (positive, up to 1) or darkened (negative, down to -1); 0 for none. */
|
|
239
|
+
readonly tint: number;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/** What a colour names (ECMA-376 `CT_Color`). */
|
|
243
|
+
export declare type XlsxColorKind =
|
|
244
|
+
/** The automatic colour (`auto="1"`): the window's text or background, as the place it colours decides. */
|
|
245
|
+
'automatic'
|
|
246
|
+
/** An ARGB value (`rgb`). */
|
|
247
|
+
| 'rgb'
|
|
248
|
+
/** A slot of the workbook's theme (`theme`), resolved through `XlsxTheme`. */
|
|
249
|
+
| 'theme'
|
|
250
|
+
/** An entry of the legacy indexed palette (`indexed`). */
|
|
251
|
+
| 'indexed';
|
|
252
|
+
|
|
253
|
+
/** A column range's width, as `<col>` writes it. */
|
|
254
|
+
export declare interface XlsxColumn {
|
|
255
|
+
/** The first column of the range, from zero. */
|
|
256
|
+
readonly first: number;
|
|
257
|
+
/** The last column of the range, from zero. */
|
|
258
|
+
readonly last: number;
|
|
259
|
+
/** The width in Excel's own unit (characters of the default font's widest digit, with padding), or null when the range
|
|
260
|
+
* sets none. */
|
|
261
|
+
readonly width: number | null;
|
|
262
|
+
/** Whether the columns are hidden. */
|
|
263
|
+
readonly hidden: boolean;
|
|
264
|
+
/** The style the columns' empty cells take, or 0. */
|
|
265
|
+
readonly styleIndex: number;
|
|
266
|
+
/** Whether the width is marked as fitted to what the columns hold (`bestFit`): where a typed entry widened the column,
|
|
267
|
+
* or where it was fitted on purpose; the file does not say which. */
|
|
268
|
+
readonly bestFit: boolean;
|
|
269
|
+
/** Whether the width is one set for the columns (`customWidth`), rather than the default width written only so that a
|
|
270
|
+
* range that records a style has a width. */
|
|
271
|
+
readonly customWidth: boolean;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/** A column range to write; a key left out is the record's default. */
|
|
275
|
+
export declare interface XlsxColumnInput {
|
|
276
|
+
/** The first column of the range, from zero. */
|
|
277
|
+
readonly first: number;
|
|
278
|
+
/** The last column of the range, from zero. */
|
|
279
|
+
readonly last: number;
|
|
280
|
+
/** The width in Excel's own unit; none when left out. */
|
|
281
|
+
readonly width?: number | null;
|
|
282
|
+
/** Whether the columns are hidden; false when left out. */
|
|
283
|
+
readonly hidden?: boolean;
|
|
284
|
+
/** The style the columns' empty cells take; 0 when left out. */
|
|
285
|
+
readonly styleIndex?: number;
|
|
286
|
+
/** Whether the width is marked as fitted; false when left out. */
|
|
287
|
+
readonly bestFit?: boolean;
|
|
288
|
+
/** Whether the width is one set for the columns; true when left out. */
|
|
289
|
+
readonly customWidth?: boolean;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/** A defined name, as the workbook part writes it. */
|
|
293
|
+
export declare interface XlsxDefinedName {
|
|
294
|
+
/** The name, as `Rate`, or a built-in one such as `_xlnm.Print_Area`. */
|
|
295
|
+
readonly name: string;
|
|
296
|
+
/** What it refers to, as a Formula's text. */
|
|
297
|
+
readonly text: string;
|
|
298
|
+
/** The index of the sheet it is local to, or null for a name of the whole workbook. */
|
|
299
|
+
readonly localSheet: number | null;
|
|
300
|
+
/** Whether it is hidden. */
|
|
301
|
+
readonly hidden: boolean;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
/** A defined name to write. */
|
|
305
|
+
export declare interface XlsxDefinedNameInput {
|
|
306
|
+
/** The name, as `Rate`, or a built-in one such as `_xlnm.Print_Area`. */
|
|
307
|
+
readonly name: string;
|
|
308
|
+
/** What it refers to, as a Formula's text. */
|
|
309
|
+
readonly text: string;
|
|
310
|
+
/** The index of the sheet it is local to; none, for a name of the whole workbook, when left out. */
|
|
311
|
+
readonly localSheet?: number | null;
|
|
312
|
+
/** Whether it is hidden; false when left out. */
|
|
313
|
+
readonly hidden?: boolean;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* An element of a worksheet that the reader does not read, kept as far as a reader of the file needs to judge what it
|
|
318
|
+
* holds: its name, its attributes, its text, and its children to `elementMaxDepth` levels, the first `elementMaxChildren`
|
|
319
|
+
* of each. It is never the whole element, and is not written back.
|
|
320
|
+
*/
|
|
321
|
+
export declare interface XlsxElement {
|
|
322
|
+
/** The element's local name, as `pageMargins`; an extension's without its prefix, as `conditionalFormattings`. */
|
|
323
|
+
readonly name: string;
|
|
324
|
+
/** Its attributes by local name (`r:id` is `id`), namespace declarations left out, in the file's order. */
|
|
325
|
+
readonly attributes: ReadonlyMap<string, string>;
|
|
326
|
+
/** Its child elements, the first `elementMaxChildren`, to `elementMaxDepth` levels below the worksheet's element. */
|
|
327
|
+
readonly children: readonly XlsxElement[];
|
|
328
|
+
/** Its own text, its first `elementMaxText` characters; null when it holds none. */
|
|
329
|
+
readonly text: string | null;
|
|
330
|
+
/** Whether it held children that `children` leaves out, past the limits. */
|
|
331
|
+
readonly childrenCut: boolean;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* A file refused by name (ADR-0330 §4, §9): the reason, and the part, the Sheet and the cell it met, as far as the
|
|
336
|
+
* refusal is about one. Nothing is read from a refused file: `Sheet 'Trades', cell B7: …`.
|
|
337
|
+
*/
|
|
338
|
+
export declare class XlsxError extends Error {
|
|
339
|
+
/** Why the file was refused. */
|
|
340
|
+
readonly reason: XlsxRefusal;
|
|
341
|
+
/** The package part the refusal met, as `xl/worksheets/sheet1.xml`; `undefined` when it is about the file as a whole. */
|
|
342
|
+
readonly part: string | undefined;
|
|
343
|
+
/** The name of the Sheet the refusal met; `undefined` when it is not about one Sheet. */
|
|
344
|
+
readonly sheet: string | undefined;
|
|
345
|
+
/** The cell the refusal met, as `B7`; `undefined` when it is not about one cell. */
|
|
346
|
+
readonly cell: string | undefined;
|
|
347
|
+
/**
|
|
348
|
+
* A refusal naming what it met.
|
|
349
|
+
* @param reason - Why the file is refused.
|
|
350
|
+
* @param message - What was wrong, as a sentence that follows the Sheet and the cell.
|
|
351
|
+
* @param where - The part, the Sheet and the cell it met, as far as it is about one.
|
|
352
|
+
* @param options - What caused it, when it was another error.
|
|
353
|
+
*/
|
|
354
|
+
constructor(reason: XlsxRefusal, message: string, where?: XlsxPlace, options?: ErrorOptions);
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
/** A fill of the styles part. */
|
|
358
|
+
export declare interface XlsxFill {
|
|
359
|
+
/** The pattern, as ECMA-376 `ST_PatternType` names it: `none`, `solid`, `gray125`, …; null for a gradient fill. */
|
|
360
|
+
readonly pattern: string | null;
|
|
361
|
+
/** The pattern's foreground colour — a solid fill's colour — or null. */
|
|
362
|
+
readonly foreground: XlsxColor | null;
|
|
363
|
+
/** The pattern's background colour, or null. */
|
|
364
|
+
readonly background: XlsxColor | null;
|
|
365
|
+
/** Whether it is a gradient fill, which carries no pattern. */
|
|
366
|
+
readonly isGradient: boolean;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
/** A font of the styles part. */
|
|
370
|
+
export declare interface XlsxFont {
|
|
371
|
+
/** The typeface, as `Calibri`, or null. */
|
|
372
|
+
readonly name: string | null;
|
|
373
|
+
/** The size in points, or null. */
|
|
374
|
+
readonly size: number | null;
|
|
375
|
+
/** Whether it is bold. */
|
|
376
|
+
readonly bold: boolean;
|
|
377
|
+
/** Whether it is italic. */
|
|
378
|
+
readonly italic: boolean;
|
|
379
|
+
/** How it is underlined. */
|
|
380
|
+
readonly underline: XlsxUnderline;
|
|
381
|
+
/** Whether it is struck through. */
|
|
382
|
+
readonly strike: boolean;
|
|
383
|
+
/** Its colour, or null for none written. */
|
|
384
|
+
readonly color: XlsxColor | null;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
/** A cell's Formula as the file writes it: its text, without the leading `=`, and how it is shared. */
|
|
388
|
+
export declare interface XlsxFormula {
|
|
389
|
+
/** The Formula's text as stored, Excel's `_xlfn.` and `_xlws.` prefixes included; empty for a cell that takes a shared
|
|
390
|
+
* formula from its master. */
|
|
391
|
+
readonly text: string;
|
|
392
|
+
/** How it is written. */
|
|
393
|
+
readonly kind: XlsxFormulaKind;
|
|
394
|
+
/** The range a shared formula's master or an array formula covers, as `A1:A10`; otherwise null. */
|
|
395
|
+
readonly reference: string | null;
|
|
396
|
+
/** A shared formula's group (`si`); otherwise null. */
|
|
397
|
+
readonly sharedIndex: number | null;
|
|
398
|
+
/** Whether an array formula is a dynamic array that spills (Excel 365), as the workbook's cell metadata marks one. */
|
|
399
|
+
readonly isDynamicArray: boolean;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
/** A Formula to write: its text, and how it is shared where it is not a cell's own. */
|
|
403
|
+
export declare interface XlsxFormulaInput {
|
|
404
|
+
/** The Formula's text, without the leading `=`, Excel's prefixes included; empty for a cell that takes a shared formula. */
|
|
405
|
+
readonly text: string;
|
|
406
|
+
/** How it is written; `normal` when left out. */
|
|
407
|
+
readonly kind?: XlsxFormulaKind;
|
|
408
|
+
/** The range a shared formula's master or an array formula covers; an array formula left without one covers its cell. */
|
|
409
|
+
readonly reference?: string | null;
|
|
410
|
+
/** A shared formula's group. */
|
|
411
|
+
readonly sharedIndex?: number | null;
|
|
412
|
+
/** Whether an array formula is a dynamic array that spills. */
|
|
413
|
+
readonly isDynamicArray?: boolean;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
/** How a Formula is written (ECMA-376 `ST_CellFormulaType`). */
|
|
417
|
+
export declare type XlsxFormulaKind =
|
|
418
|
+
/** A Formula of the cell's own. */
|
|
419
|
+
'normal'
|
|
420
|
+
/** A shared formula: the master carries the text, the range it covers and its index; every other cell of the group
|
|
421
|
+
* carries only the index, and its Formula is the master's moved to it. */
|
|
422
|
+
| 'shared'
|
|
423
|
+
/** An array formula over its range: a dynamic array that spills when it says so, and a legacy multi-cell array formula
|
|
424
|
+
* otherwise. */
|
|
425
|
+
| 'array'
|
|
426
|
+
/** A What-If data table. */
|
|
427
|
+
| 'dataTable';
|
|
428
|
+
|
|
429
|
+
/** A cell's horizontal alignment (ECMA-376 `ST_HorizontalAlignment`). */
|
|
430
|
+
export declare type XlsxHorizontalAlignment = 'general' | 'left' | 'center' | 'right' | 'fill' | 'justify' | 'centerContinuous' | 'distributed';
|
|
431
|
+
|
|
432
|
+
/** Where a refusal met what it refuses: the part, the Sheet and the cell, as far as it is about one. */
|
|
433
|
+
export declare interface XlsxPlace {
|
|
434
|
+
/** The package part, as `xl/worksheets/sheet1.xml`. */
|
|
435
|
+
readonly part?: string | undefined;
|
|
436
|
+
/** The Sheet's name. */
|
|
437
|
+
readonly sheet?: string | undefined;
|
|
438
|
+
/** The cell, as `B7`. */
|
|
439
|
+
readonly cell?: string | undefined;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
/** A cell's place, both from zero. */
|
|
443
|
+
export declare interface XlsxPlaceOfCell {
|
|
444
|
+
/** The row, from zero (row 1 is 0). */
|
|
445
|
+
readonly row: number;
|
|
446
|
+
/** The column, from zero (column A is 0). */
|
|
447
|
+
readonly column: number;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
/** How far a read has come. */
|
|
451
|
+
export declare interface XlsxProgress {
|
|
452
|
+
/** The index of the worksheet being read, or -1 while the shared strings are. */
|
|
453
|
+
readonly sheet: number;
|
|
454
|
+
/** The sheets the workbook lists. */
|
|
455
|
+
readonly sheets: number;
|
|
456
|
+
/** The cells read so far, every worksheet counted. */
|
|
457
|
+
readonly cells: number;
|
|
458
|
+
/** The worksheets' bytes inflated so far; while the shared strings are read, theirs. */
|
|
459
|
+
readonly bytes: number;
|
|
460
|
+
/** The worksheets' uncompressed bytes, as the zip declares them; while the shared strings are read, theirs. */
|
|
461
|
+
readonly totalBytes: number;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
/**
|
|
465
|
+
* An `.xlsx` workbook opened for reading (ADR-0330 §1, §9): its sheets, defined names, shared strings, styles and theme,
|
|
466
|
+
* read when it is opened; each worksheet's cells read as a stream through `openSheet`. The model is the file's own: a
|
|
467
|
+
* number is its text, a Formula its stored text with its prefixes, a style an index. Made by `openXlsx`.
|
|
468
|
+
*/
|
|
469
|
+
export declare interface XlsxReader {
|
|
470
|
+
/** The workbook part's name, as `xl/workbook.xml`. */
|
|
471
|
+
readonly workbookPart: string;
|
|
472
|
+
/** The workbook's sheets, in its order: the order of its tabs. */
|
|
473
|
+
readonly sheets: readonly XlsxSheetInfo[];
|
|
474
|
+
/** The index into `sheets` of the sheet the workbook shows (`activeTab`), 0 when it names none. */
|
|
475
|
+
readonly activeSheet: number;
|
|
476
|
+
/** Whether the workbook counts dates from 1904 (`date1904`), whose serials are 1,462 less than 1900's for the same day. */
|
|
477
|
+
readonly date1904: boolean;
|
|
478
|
+
/** The workbook's defined names. */
|
|
479
|
+
readonly definedNames: readonly XlsxDefinedName[];
|
|
480
|
+
/** The shared strings, held whole. */
|
|
481
|
+
readonly sharedStrings: XlsxSharedStrings;
|
|
482
|
+
/** The styles, as far as ADR-0330 §4 carries them; `defaultStyles` when the package has no styles part. */
|
|
483
|
+
readonly styles: XlsxStyles;
|
|
484
|
+
/** The theme's colours; `XlsxTheme.office` when the package has no theme part (`hasTheme`). */
|
|
485
|
+
readonly theme: XlsxTheme;
|
|
486
|
+
/** Whether the package has a theme part of its own. */
|
|
487
|
+
readonly hasTheme: boolean;
|
|
488
|
+
/** Every part the package holds, by name, as `xl/comments1.xml`: what else it holds than what is read. */
|
|
489
|
+
readonly parts: readonly string[];
|
|
490
|
+
/** The cells read so far, every worksheet counted. */
|
|
491
|
+
readonly cellsRead: number;
|
|
492
|
+
/** The worksheets' uncompressed bytes, as the zip declares them. */
|
|
493
|
+
readonly sheetBytes: number;
|
|
494
|
+
/** Opens the worksheet at `index` for reading its cells as a stream. One worksheet is read at a time: close the reader
|
|
495
|
+
* before opening the next. */
|
|
496
|
+
openSheet(index: number): Promise<XlsxSheetReader>;
|
|
497
|
+
/** Reads the worksheet at `index` whole: its columns, its cells and what else it holds. For a sheet that is small, or a
|
|
498
|
+
* test; a large one is read a batch at a time through `openSheet`. */
|
|
499
|
+
readSheet(index: number): Promise<XlsxWorksheet>;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
/** The limits, progress and pacing of a read. A key left out takes the default its comment names. */
|
|
503
|
+
export declare interface XlsxReadOptions {
|
|
504
|
+
/**
|
|
505
|
+
* The uncompressed bytes the package may hold, every part counted, as the zip declares them, and that a part may
|
|
506
|
+
* inflate to: past it the file is refused as `tooLarge`. 1 GiB when left out.
|
|
507
|
+
*/
|
|
508
|
+
readonly maxUncompressedBytes?: number;
|
|
509
|
+
/** The cells a read may hold, every worksheet counted: past it the file is refused as `tooManyCells`. 10,000,000
|
|
510
|
+
* when left out. */
|
|
511
|
+
readonly maxCells?: number;
|
|
512
|
+
/** Told how far the read has come after every slice, and once more at the end of the shared strings and of each
|
|
513
|
+
* worksheet. */
|
|
514
|
+
readonly onProgress?: (progress: XlsxProgress) => void;
|
|
515
|
+
/** How long one slice works, in milliseconds, before the read yields; 30 when left out. A slice always does some work,
|
|
516
|
+
* so 0 yields after every batch. */
|
|
517
|
+
readonly sliceBudgetMs?: number;
|
|
518
|
+
/** What the read awaits between slices; a macrotask (`setTimeout(…, 0)`) when left out, which gives a browser a turn
|
|
519
|
+
* of its event loop to paint in. */
|
|
520
|
+
readonly yield?: () => Promise<void>;
|
|
521
|
+
/** Cancels the read: it rejects with the signal's reason, looked at between slices. */
|
|
522
|
+
readonly signal?: AbortSignal;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
/** Why a file was refused (ADR-0330 §4, §9). A refused file is never read in part. */
|
|
526
|
+
export declare type XlsxRefusal =
|
|
527
|
+
/** The bytes are not a zip package, or the zip is damaged. */
|
|
528
|
+
'notAZip'
|
|
529
|
+
/** A zip package, but not a spreadsheet: it has no workbook part (a `.docx`, a `.pptx`, any other zip). */
|
|
530
|
+
| 'notAWorkbook'
|
|
531
|
+
/** A workbook with macros (`.xlsm`, `.xltm`, `.xlam`): its content types name a macro-enabled workbook or a VBA project. */
|
|
532
|
+
| 'macroEnabled'
|
|
533
|
+
/** A binary workbook (`.xlsb`). */
|
|
534
|
+
| 'binary'
|
|
535
|
+
/** A legacy Excel 97–2003 workbook (`.xls`): an OLE compound file that holds no encrypted package. */
|
|
536
|
+
| 'legacy'
|
|
537
|
+
/** An encrypted (password-protected) workbook: an OLE compound file holding an `EncryptedPackage`. */
|
|
538
|
+
| 'encrypted'
|
|
539
|
+
/** A workbook written as Strict Open XML, whose parts use other namespaces than the transitional ones Excel saves by default. */
|
|
540
|
+
| 'strictOpenXml'
|
|
541
|
+
/** A part declares a document type (`<!DOCTYPE`), which a workbook never needs and an attack uses. */
|
|
542
|
+
| 'dtd'
|
|
543
|
+
/** A part is not well-formed XML, or does not hold what its place in the package says it does. */
|
|
544
|
+
| 'malformed'
|
|
545
|
+
/** The file holds more uncompressed bytes than a read allows; or a workbook written would hold more than a write allows. */
|
|
546
|
+
| 'tooLarge'
|
|
547
|
+
/** The workbook holds more cells than a read allows. */
|
|
548
|
+
| 'tooManyCells';
|
|
549
|
+
|
|
550
|
+
/** A row that records a cell format of its own (`<row s="…" customFormat="1">`): the format its cells take where the row
|
|
551
|
+
* holds no cell, in place of their columns'. */
|
|
552
|
+
export declare interface XlsxRow {
|
|
553
|
+
/** The row, from zero (row 1 is 0). */
|
|
554
|
+
readonly row: number;
|
|
555
|
+
/** The index into the styles' cell formats its empty cells take; 0 is the default format, which still stands in place
|
|
556
|
+
* of the columns'. */
|
|
557
|
+
readonly styleIndex: number;
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
/** The workbook's shared strings, held whole, in the part's order, and which of them came in runs of their own
|
|
561
|
+
* formatting. */
|
|
562
|
+
export declare class XlsxSharedStrings {
|
|
563
|
+
#private;
|
|
564
|
+
/** A workbook with no shared strings. */
|
|
565
|
+
static readonly empty: XlsxSharedStrings;
|
|
566
|
+
/** The strings `texts`, those at the indexes in `rich` marked as having come in runs. */
|
|
567
|
+
constructor(texts: readonly string[], rich: ReadonlySet<number>);
|
|
568
|
+
/** The strings, in the part's order: a cell's `<v>` is an index into them. */
|
|
569
|
+
get texts(): readonly string[];
|
|
570
|
+
/** How many there are. */
|
|
571
|
+
get count(): number;
|
|
572
|
+
/** Whether the string at `index` came in runs of their own formatting, which are not carried; its text is. */
|
|
573
|
+
isRich(index: number): boolean;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
/** A worksheet as the workbook part lists it. */
|
|
577
|
+
export declare interface XlsxSheetInfo {
|
|
578
|
+
/** Its name, as its tab shows it. */
|
|
579
|
+
readonly name: string;
|
|
580
|
+
/** Its `sheetId`. */
|
|
581
|
+
readonly sheetId: number;
|
|
582
|
+
/** Whether it is shown. */
|
|
583
|
+
readonly visibility: XlsxSheetVisibility;
|
|
584
|
+
/** The package part that holds it, as `xl/worksheets/sheet1.xml`, or null for a sheet that is not a worksheet. */
|
|
585
|
+
readonly part: string | null;
|
|
586
|
+
/** What kind of sheet it is. */
|
|
587
|
+
readonly kind: XlsxSheetKind;
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
/** What kind of sheet a workbook lists. */
|
|
591
|
+
export declare type XlsxSheetKind =
|
|
592
|
+
/** A worksheet of cells. */
|
|
593
|
+
'worksheet'
|
|
594
|
+
/** A chart sheet, or any other sheet that holds no cells. */
|
|
595
|
+
| 'other';
|
|
596
|
+
|
|
597
|
+
/**
|
|
598
|
+
* One worksheet's cells read as a stream (ADR-0330 §9): `read` reads the next batch into `cells`, row by row as the file
|
|
599
|
+
* holds them, and between batches the read reports its progress and yields once a slice has spent its budget. Made by
|
|
600
|
+
* `XlsxReader.openSheet`; close it before opening the next.
|
|
601
|
+
*/
|
|
602
|
+
export declare interface XlsxSheetReader {
|
|
603
|
+
/** The sheet as the workbook lists it. */
|
|
604
|
+
readonly sheet: XlsxSheetInfo;
|
|
605
|
+
/** The cells of the batch the last `read` read, in the file's order. */
|
|
606
|
+
readonly cells: readonly XlsxCell[];
|
|
607
|
+
/** The rows the last `read` began that record a cell format of their own (`customFormat`), in the file's order. A row
|
|
608
|
+
* comes in the batch that holds its first cell, or in an earlier one. */
|
|
609
|
+
readonly rows: readonly XlsxRow[];
|
|
610
|
+
/** The worksheet's column widths, complete once the first `read` has returned: they come before the cells. */
|
|
611
|
+
readonly columns: readonly XlsxColumn[];
|
|
612
|
+
/**
|
|
613
|
+
* Every element of the worksheet the reader does not read, beside its cells and columns, in the file's order, complete
|
|
614
|
+
* once `read` has returned false: `dimension`, `sheetViews` (of which only `frozenPanes` is read), `sheetFormatPr`,
|
|
615
|
+
* `mergeCells`, `conditionalFormatting`, `dataValidations`, `hyperlinks`, `drawing`, `legacyDrawing` (notes),
|
|
616
|
+
* `tableParts`, `sheetProtection`, `pageMargins`, `pageSetup`, `extLst` and the rest, each as far as `XlsxElement`
|
|
617
|
+
* keeps it. None of it is judged here: whether an element holds anything that matters is for the reader of the file to
|
|
618
|
+
* say.
|
|
619
|
+
*/
|
|
620
|
+
readonly otherElements: readonly XlsxElement[];
|
|
621
|
+
/** Whether a row read so far sets a height of its own. */
|
|
622
|
+
readonly customRowHeights: boolean;
|
|
623
|
+
/** Whether a row read so far is hidden. */
|
|
624
|
+
readonly hiddenRows: boolean;
|
|
625
|
+
/** Whether the sheet's view freezes panes; known once the first `read` has returned. */
|
|
626
|
+
readonly frozenPanes: boolean;
|
|
627
|
+
/** Reads the next batch of cells into `cells`; false when the worksheet has no more. Refuses the file by name
|
|
628
|
+
* (`XlsxError`) on a cell it cannot read, or past the read's cells. */
|
|
629
|
+
read(): Promise<boolean>;
|
|
630
|
+
/** Closes the worksheet's part. */
|
|
631
|
+
close(): Promise<void>;
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
/** Whether a sheet is shown. */
|
|
635
|
+
export declare type XlsxSheetVisibility =
|
|
636
|
+
/** Shown. */
|
|
637
|
+
'visible'
|
|
638
|
+
/** Hidden, and listed in Excel's Unhide. */
|
|
639
|
+
| 'hidden'
|
|
640
|
+
/** Hidden, and not listed in Excel's Unhide. */
|
|
641
|
+
| 'veryHidden';
|
|
642
|
+
|
|
643
|
+
/**
|
|
644
|
+
* One worksheet being written (`XlsxWriter.addSheet`): its cells, row by row and left to right. A cell out of that order,
|
|
645
|
+
* or one written twice, is refused.
|
|
646
|
+
*/
|
|
647
|
+
export declare interface XlsxSheetWriter {
|
|
648
|
+
/** The sheet's name. */
|
|
649
|
+
readonly name: string;
|
|
650
|
+
/**
|
|
651
|
+
* Adds an Excel Table over cells of this sheet (`tableParts`, and a table part of its own), before the first cell of its
|
|
652
|
+
* header's row is written. Each cell of its header must then be written, as text equal to its column's name (a shared
|
|
653
|
+
* or inline string, no Formula), or the cell, or the sheet's end, is refused; its rows of data hold whatever is written
|
|
654
|
+
* there. A table whose name is another table's or a defined name's in the workbook, in any case, or that overlaps
|
|
655
|
+
* another table of the sheet, is refused.
|
|
656
|
+
*/
|
|
657
|
+
addTable(table: XlsxTable): void;
|
|
658
|
+
/** Begins `row` with the cell format of its own that its empty cells take (`customFormat`), after every row written
|
|
659
|
+
* before it; the row's cells, if any, are then written as any others. A row written before, or one that already holds
|
|
660
|
+
* a cell, is refused. */
|
|
661
|
+
writeRow(row: XlsxRow): void;
|
|
662
|
+
/** Writes `cell`, after every cell written before it in the sheet's order. A shared string is written from its `text`
|
|
663
|
+
* into the workbook's shared strings, whatever its `value` says. */
|
|
664
|
+
write(cell: XlsxCellInput): void;
|
|
665
|
+
/** Writes every cell of `cells` in turn, flushing between batches. */
|
|
666
|
+
writeAll(cells: Iterable<XlsxCellInput>): Promise<void>;
|
|
667
|
+
/** Awaits the deflating of what is written so far, so that memory holds it compressed: call it between batches of a
|
|
668
|
+
* large sheet. */
|
|
669
|
+
flush(): Promise<void>;
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
/**
|
|
673
|
+
* The styles part as far as ADR-0330 §4 carries it: the custom Number Formats, the fonts, fills and borders, and the cell
|
|
674
|
+
* formats that cells point at. What else the part holds (named cell styles, differential formats, table styles) is not
|
|
675
|
+
* read.
|
|
676
|
+
*/
|
|
677
|
+
export declare interface XlsxStyles {
|
|
678
|
+
/** The custom Number Formats by id (164 and above, or a built-in id written over), each its format code. */
|
|
679
|
+
readonly numberFormats: ReadonlyMap<number, string>;
|
|
680
|
+
/** The fonts, which a cell format names by index. */
|
|
681
|
+
readonly fonts: readonly XlsxFont[];
|
|
682
|
+
/** The fills, the first two of which Excel reserves: `none` and `gray125`. */
|
|
683
|
+
readonly fills: readonly XlsxFill[];
|
|
684
|
+
/** The borders, which a cell format names by index. */
|
|
685
|
+
readonly borders: readonly XlsxBorder[];
|
|
686
|
+
/** The cell formats, which a cell's style index names; the first is the one a cell of no style takes. */
|
|
687
|
+
readonly cellFormats: readonly XlsxCellFormat[];
|
|
688
|
+
/** The indexed palette written over (`<colors><indexedColors>`), as ARGB values, or null when the file keeps the default one. */
|
|
689
|
+
readonly indexedColors: readonly number[] | null;
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
/**
|
|
693
|
+
* An Excel Table on a worksheet (ECMA-376 Part 1, §18.5), as a sheet writer's `addTable` writes it: a header row holding
|
|
694
|
+
* each column's name, its rows of data below, an AutoFilter over them and Excel's default table style.
|
|
695
|
+
*/
|
|
696
|
+
export declare interface XlsxTable {
|
|
697
|
+
/** The name a Formula reads it by (`Positions[PV]`), as Excel names a Table (`isValidTableName`), and no other table's or
|
|
698
|
+
* defined name's in the workbook, in any case. */
|
|
699
|
+
readonly name: string;
|
|
700
|
+
/** The header's row, from zero. */
|
|
701
|
+
readonly headerRow: number;
|
|
702
|
+
/** The first column, from zero. */
|
|
703
|
+
readonly firstColumn: number;
|
|
704
|
+
/** The columns' names, in order: at least one, none empty, no two the same in any case. */
|
|
705
|
+
readonly columns: readonly string[];
|
|
706
|
+
/** The rows of data below the header: at least one, as Excel holds a table of none as one empty row. */
|
|
707
|
+
readonly dataRows: number;
|
|
708
|
+
/** Whether the header's cells carry an AutoFilter's buttons, as a table Excel makes does; true when left out. */
|
|
709
|
+
readonly autoFilter?: boolean;
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
/**
|
|
713
|
+
* The colours of a workbook's theme (`<a:clrScheme>`), and the resolution of any colour a style writes into the RGB
|
|
714
|
+
* Excel paints (ADR-0330 §8): a theme slot through these colours, an indexed entry through the palette, and the tint
|
|
715
|
+
* applied to the result as ECMA-376 Part 1, §18.8.19 says.
|
|
716
|
+
*/
|
|
717
|
+
export declare class XlsxTheme {
|
|
718
|
+
/**
|
|
719
|
+
* The theme of Office 2013–2022, which a workbook with no theme part takes: dark 1 `000000`, light 1 `FFFFFF`,
|
|
720
|
+
* `44546A`, `E7E6E6`, the accents `4472C4`, `ED7D31`, `A5A5A5`, `FFC000`, `5B9BD5`, `70AD47`, and the hyperlinks
|
|
721
|
+
* `0563C1` and `954F72`.
|
|
722
|
+
*/
|
|
723
|
+
static readonly office: XlsxTheme;
|
|
724
|
+
/** The scheme's twelve colours as ARGB values, in the scheme's order: dark 1, light 1, dark 2, light 2, accents 1 to 6,
|
|
725
|
+
* hyperlink, followed hyperlink. */
|
|
726
|
+
readonly schemeColors: readonly number[];
|
|
727
|
+
/** A theme of the twelve colours its scheme lists, as ARGB values in the scheme's own order. */
|
|
728
|
+
constructor(schemeColors: readonly number[]);
|
|
729
|
+
/**
|
|
730
|
+
* The colour a style's theme slot names. A style numbers the first four slots in another order than the scheme lists
|
|
731
|
+
* them — 0 is light 1 (Background 1), 1 dark 1 (Text 1), 2 light 2, 3 dark 2 — and the rest as listed.
|
|
732
|
+
*/
|
|
733
|
+
slotColor(slot: number): number;
|
|
734
|
+
/**
|
|
735
|
+
* The RGB value, as `0xFFRRGGBB`, that `color` paints, or `undefined` for the automatic colour (and the indexed entries
|
|
736
|
+
* 64 and 65, which name the window's text and background), whose meaning the place it colours decides.
|
|
737
|
+
* @param indexedColors - The styles part's own indexed palette, or none for the default one.
|
|
738
|
+
*/
|
|
739
|
+
resolve(color: XlsxColor, indexedColors?: readonly number[] | null): number | undefined;
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
/** How a font underlines (ECMA-376 `ST_UnderlineValues`). */
|
|
743
|
+
export declare type XlsxUnderline = 'none' | 'single' | 'double' | 'singleAccounting' | 'doubleAccounting';
|
|
744
|
+
|
|
745
|
+
/** A cell's vertical alignment (ECMA-376 `ST_VerticalAlignment`). */
|
|
746
|
+
export declare type XlsxVerticalAlignment = 'bottom' | 'top' | 'center' | 'justify' | 'distributed';
|
|
747
|
+
|
|
748
|
+
/** A worksheet read whole (`XlsxReader.readSheet`). */
|
|
749
|
+
export declare interface XlsxWorksheet {
|
|
750
|
+
/** The sheet as the workbook lists it. */
|
|
751
|
+
readonly sheet: XlsxSheetInfo;
|
|
752
|
+
/** Its column widths. */
|
|
753
|
+
readonly columns: readonly XlsxColumn[];
|
|
754
|
+
/** Its cells, in the file's order: row by row, left to right. */
|
|
755
|
+
readonly cells: readonly XlsxCell[];
|
|
756
|
+
/** What else it holds, as `XlsxSheetReader.otherElements` lists it. */
|
|
757
|
+
readonly otherElements: readonly XlsxElement[];
|
|
758
|
+
/** The rows that record a cell format of their own, in order; empty for none. */
|
|
759
|
+
readonly rows: readonly XlsxRow[];
|
|
760
|
+
/** Whether a row sets a height of its own. */
|
|
761
|
+
readonly customRowHeights: boolean;
|
|
762
|
+
/** Whether a row is hidden. */
|
|
763
|
+
readonly hiddenRows: boolean;
|
|
764
|
+
/** Whether the sheet's view freezes panes. */
|
|
765
|
+
readonly frozenPanes: boolean;
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
/** What a written workbook says of itself, beside its sheets. A key left out takes the default its comment names. */
|
|
769
|
+
export declare interface XlsxWriteOptions {
|
|
770
|
+
/** The styles the cells' style indexes point into; `defaultStyles` when left out. */
|
|
771
|
+
readonly styles?: XlsxStyles;
|
|
772
|
+
/** The index of the sheet the workbook shows when it opens; 0 when left out. */
|
|
773
|
+
readonly activeSheet?: number;
|
|
774
|
+
/** Whether the workbook counts dates from 1904; the serials written are the caller's. False when left out. */
|
|
775
|
+
readonly date1904?: boolean;
|
|
776
|
+
/** Whether the workbook asks to be calculated in full when Excel opens it (`fullCalcOnLoad`): every Formula is written
|
|
777
|
+
* with its Value, and Excel computes them again (ADR-0330 §6). False when left out. */
|
|
778
|
+
readonly fullCalculationOnLoad?: boolean;
|
|
779
|
+
/** The defined names the workbook part writes; none when left out. */
|
|
780
|
+
readonly definedNames?: readonly XlsxDefinedNameInput[];
|
|
781
|
+
/**
|
|
782
|
+
* The uncompressed bytes the package's parts may hold together, 1 to 1 GiB; 1 GiB, the most a file is read with by
|
|
783
|
+
* default, when left out, so that what is written opens again. A write that would go past it is refused by name
|
|
784
|
+
* (`XlsxError`, `tooLarge`), naming the part, and the sheet, it met; the workbook is then abandoned.
|
|
785
|
+
*/
|
|
786
|
+
readonly maxUncompressedBytes?: number;
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
/**
|
|
790
|
+
* Writes an `.xlsx` workbook as a stream (ADR-0330 §1): each worksheet's cells go into the package as they are written,
|
|
791
|
+
* and the parts that need every sheet at `complete`. Made by `createXlsxWriter`.
|
|
792
|
+
*/
|
|
793
|
+
export declare interface XlsxWriter {
|
|
794
|
+
/**
|
|
795
|
+
* Begins the next worksheet, after the ones before it, ending the one being written. Its cells are then written in the
|
|
796
|
+
* order of the sheet: row by row, left to right.
|
|
797
|
+
* @param name - The sheet's name: 1 to 31 characters, none of `[ ] : * ? / \` and no control character or half of a
|
|
798
|
+
* surrogate pair, not beginning or ending with `'`, and no other sheet's in any case.
|
|
799
|
+
* @param columns - The column widths: ranges that do not overlap, each naming a cell format the styles hold.
|
|
800
|
+
* @param visibility - Whether the sheet is shown; `visible` when left out.
|
|
801
|
+
*/
|
|
802
|
+
addSheet(name: string, columns?: readonly XlsxColumnInput[], visibility?: XlsxSheetVisibility): XlsxSheetWriter;
|
|
803
|
+
/** Ends the last worksheet, writes the parts that need every sheet, and returns the package. The workbook needs a sheet,
|
|
804
|
+
* and the options' active sheet must name one of them. */
|
|
805
|
+
complete(): Promise<Blob>;
|
|
806
|
+
/** Abandons a workbook not completed, writing nothing more. */
|
|
807
|
+
abandon(): Promise<void>;
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
export { }
|