@xlvane/compat 0.0.0-stage → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +46 -0
- package/README.md +74 -2
- package/dist/index.d.ts +3661 -0
- package/dist/index.js +6972 -0
- package/dist/no-node.d.ts +1 -0
- package/dist/no-node.js +2 -0
- package/dist/node-fs.d.ts +2 -0
- package/dist/node-fs.js +1 -0
- package/package.json +79 -4
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,3661 @@
|
|
|
1
|
+
import { StreamSheetSpec, Workbook as Workbook$1, WorkbookProperties as WorkbookProperties$1 } from "xlvane";
|
|
2
|
+
/**
|
|
3
|
+
* A cell location of a defined name, as exceljs keeps it.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* import ExcelJS, { type NameCell } from '@xlvane/compat';
|
|
8
|
+
*
|
|
9
|
+
* const workbook = new ExcelJS.Workbook();
|
|
10
|
+
* workbook.definedNames.add('Data!$B$2', 'total');
|
|
11
|
+
* workbook.definedNames.forEach((name: string, cell: NameCell) => console.log(name, cell.sheetName, cell.address)); // total Data B2
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
interface NameCell {
|
|
15
|
+
sheetName: string | undefined;
|
|
16
|
+
address: string;
|
|
17
|
+
row: number;
|
|
18
|
+
col: number;
|
|
19
|
+
/** @internal Used while grouping cells into ranges. */
|
|
20
|
+
mark?: boolean;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* A location parsed by exceljs `colCache.decodeEx`: one cell, a range, or an error reference.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* import ExcelJS, { type DecodedLocation } from '@xlvane/compat';
|
|
28
|
+
*
|
|
29
|
+
* const workbook = new ExcelJS.Workbook();
|
|
30
|
+
* const location: DecodedLocation = { sheetName: 'Data', row: 2, col: 2 };
|
|
31
|
+
* workbook.definedNames.addEx(location, 'total');
|
|
32
|
+
* console.log(workbook.definedNames.getNamesEx(location)); // ['total']
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
interface DecodedLocation {
|
|
36
|
+
sheetName?: string | undefined;
|
|
37
|
+
row?: number | undefined;
|
|
38
|
+
col?: number | undefined;
|
|
39
|
+
top?: number;
|
|
40
|
+
left?: number;
|
|
41
|
+
bottom?: number;
|
|
42
|
+
right?: number;
|
|
43
|
+
error?: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* The cells of one defined name, as exceljs `CellMatrix`: sheet → row → column.
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```ts
|
|
50
|
+
* import ExcelJS from '@xlvane/compat';
|
|
51
|
+
*
|
|
52
|
+
* const workbook = new ExcelJS.Workbook();
|
|
53
|
+
* workbook.definedNames.add('Data!$A$1:$A$3', 'items');
|
|
54
|
+
* workbook.definedNames.getMatrix('items').forEach((cell) => console.log(cell.address)); // A1 A2 A3
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
export declare class CellMatrix {
|
|
58
|
+
/** @internal */
|
|
59
|
+
readonly sheets: Map<string | undefined, (NameCell | undefined)[][]>;
|
|
60
|
+
addCell(addressStr: string): void;
|
|
61
|
+
getCell(addressStr: string): NameCell | undefined;
|
|
62
|
+
findCell(addressStr: string): NameCell | undefined;
|
|
63
|
+
findCellAt(sheetName: string | undefined, rowNumber: number, colNumber: number): NameCell | undefined;
|
|
64
|
+
addCellEx(address: DecodedLocation): void;
|
|
65
|
+
getCellEx(address: DecodedLocation): NameCell | undefined;
|
|
66
|
+
findCellEx(address: DecodedLocation, create: boolean): NameCell | undefined;
|
|
67
|
+
getCellAt(sheetName: string | undefined, rowNumber: number, colNumber: number): NameCell;
|
|
68
|
+
removeCellEx(address: DecodedLocation): void;
|
|
69
|
+
forEachInSheet(sheetName: string | undefined, callback: (cell: NameCell, row: number, col: number) => void): void;
|
|
70
|
+
forEach(callback: (cell: NameCell) => void): void;
|
|
71
|
+
/**
|
|
72
|
+
* @internal The keys of `sheets` that name `sheetName`, ignoring case as spreadsheet
|
|
73
|
+
* applications compare sheet names (xlvane addition; exceljs compares exactly).
|
|
74
|
+
*/
|
|
75
|
+
sheetKeys(sheetName: string | undefined): (string | undefined)[];
|
|
76
|
+
/** Removes `numDelete` rows at `start` and inserts `numInsert` empty ones (cell-matrix.js L138). */
|
|
77
|
+
spliceRows(sheetName: string | undefined, start: number, numDelete: number, numInsert: number): void;
|
|
78
|
+
/** Removes `numDelete` columns at `start` and inserts `numInsert` empty ones (cell-matrix.js L150). */
|
|
79
|
+
spliceColumns(sheetName: string | undefined, start: number, numDelete: number, numInsert: number): void;
|
|
80
|
+
map<T>(callback: (cell: NameCell) => T): T[];
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Defined names of a workbook, as exceljs `workbook.definedNames`. A name is a set of cells; when
|
|
84
|
+
* the workbook is written, the cells are grouped into rectangles with absolute references
|
|
85
|
+
* (`Sheet!$A$1:$B$2`), and names that hold no cells are left out, as in exceljs.
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* ```ts
|
|
89
|
+
* import ExcelJS from '@xlvane/compat';
|
|
90
|
+
*
|
|
91
|
+
* const workbook = new ExcelJS.Workbook();
|
|
92
|
+
* workbook.addWorksheet('Data');
|
|
93
|
+
* workbook.definedNames.add('Data!$A$1:$B$2', 'block');
|
|
94
|
+
* console.log(workbook.definedNames.getRanges('block')); // { name: 'block', ranges: ['Data!$A$1:$B$2'] }
|
|
95
|
+
* console.log(workbook.definedNames.getNames('Data!B2')); // ['block']
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
export declare class DefinedNames {
|
|
99
|
+
/** @internal */
|
|
100
|
+
matrixMap: Map<string, CellMatrix>;
|
|
101
|
+
getMatrix(name: string): CellMatrix;
|
|
102
|
+
/** Adds the cells of `locStr` (`Sheet!$A$1` or `Sheet!$A$1:$B$2`) to the name. */
|
|
103
|
+
add(locStr: string, name: string): void;
|
|
104
|
+
addEx(location: DecodedLocation, name: string): void;
|
|
105
|
+
remove(locStr: string, name: string): void;
|
|
106
|
+
removeEx(location: DecodedLocation, name: string): void;
|
|
107
|
+
removeAllNames(location: DecodedLocation): void;
|
|
108
|
+
forEach(callback: (name: string, cell: NameCell) => void): void;
|
|
109
|
+
/** The names that include the cell `addressStr` (`Sheet!A1`). */
|
|
110
|
+
getNames(addressStr: string): string[];
|
|
111
|
+
getNamesEx(address: DecodedLocation): string[];
|
|
112
|
+
private explore;
|
|
113
|
+
/** Gives moved cells their new row and column (lib/doc/defined-names.js L147). */
|
|
114
|
+
normaliseMatrix(matrix: CellMatrix, sheetName: string | undefined): void;
|
|
115
|
+
spliceRows(sheetName: string | undefined, start: number, numDelete: number, numInsert: number): void;
|
|
116
|
+
spliceColumns(sheetName: string | undefined, start: number, numDelete: number, numInsert: number): void;
|
|
117
|
+
/**
|
|
118
|
+
* xlvane addition: after `numInsert` rows (or columns) were inserted at `start`, adds the
|
|
119
|
+
* inserted cells to every name that has cells on both sides of them in the same column (or row),
|
|
120
|
+
* so a named range grows as in a spreadsheet application. exceljs leaves a gap (X4-15).
|
|
121
|
+
*/
|
|
122
|
+
fillInserted(sheetName: string | undefined, axis: "row" | "col", start: number, numInsert: number): void;
|
|
123
|
+
/** The cells of a name grouped into ranges, as exceljs `getRanges` (lib/doc/defined-names.js L125). */
|
|
124
|
+
getRanges(name: string, matrix?: CellMatrix): {
|
|
125
|
+
name: string;
|
|
126
|
+
ranges: string[];
|
|
127
|
+
};
|
|
128
|
+
/** Every name with at least one cell, as `{ name, ranges }`. */
|
|
129
|
+
get model(): {
|
|
130
|
+
name: string;
|
|
131
|
+
ranges: string[];
|
|
132
|
+
}[];
|
|
133
|
+
set model(value: {
|
|
134
|
+
name: string;
|
|
135
|
+
ranges: string[];
|
|
136
|
+
}[]);
|
|
137
|
+
}
|
|
138
|
+
/** Workbook-level data written with the sheets: document properties and defined names. */
|
|
139
|
+
interface WorkbookMeta {
|
|
140
|
+
readonly properties?: WorkbookProperties$1;
|
|
141
|
+
readonly definedNames?: readonly {
|
|
142
|
+
name: string;
|
|
143
|
+
ranges: string[];
|
|
144
|
+
}[];
|
|
145
|
+
/** The workbook's images, by exceljs image id (`workbook.addImage`). */
|
|
146
|
+
readonly media?: readonly ImageData[];
|
|
147
|
+
/** `false` writes no cell or column styles, as exceljs `xlsx.write(…, { useStyles: false })` (dates keep format 14). */
|
|
148
|
+
readonly useStyles?: boolean;
|
|
149
|
+
/** `workbook.views` (workbook windows). */
|
|
150
|
+
readonly views?: readonly Record<string, unknown>[];
|
|
151
|
+
/** `workbook.calcProperties`. */
|
|
152
|
+
readonly calcProperties?: Record<string, unknown>;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Options of `xlsx.load`, `read` and `readFile`, as exceljs `XlsxReadOptions` (index.d.ts L1460;
|
|
156
|
+
* lib/xlsx/xlsx.js L257, lib/xlsx/xform/sheet/worksheet-xform.js L95, L372; X4-25).
|
|
157
|
+
*
|
|
158
|
+
* @example
|
|
159
|
+
* ```ts
|
|
160
|
+
* import type { XlsxReadOptions } from '@xlvane/compat';
|
|
161
|
+
*
|
|
162
|
+
* const options: XlsxReadOptions = { ignoreNodes: ['dataValidations'], maxRows: 100_000 };
|
|
163
|
+
* ```
|
|
164
|
+
*/
|
|
165
|
+
interface XlsxReadOptions {
|
|
166
|
+
/** Worksheet elements to skip, by element name (`sheetData`, `mergeCells`, `hyperlinks`, `dataValidations`, …). */
|
|
167
|
+
ignoreNodes?: string[];
|
|
168
|
+
/** Refuse a worksheet with more rows than this (`XLV_E_LIMIT_EXCEEDED`). */
|
|
169
|
+
maxRows?: number;
|
|
170
|
+
/** Refuse a row with more cells than this (`XLV_E_LIMIT_EXCEEDED`). */
|
|
171
|
+
maxCols?: number;
|
|
172
|
+
/** `load` only: the data is a base64 string. */
|
|
173
|
+
base64?: boolean;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Options of `xlsx.writeBuffer`, `write` and `writeFile`, as exceljs `XlsxWriteOptions`
|
|
177
|
+
* (index.d.ts L1447–1472; lib/xlsx/xlsx.js L602–603). `useSharedStrings: false` writes inline
|
|
178
|
+
* strings; `zip: { compression: 'STORE' }` or `zip: { compressionOptions: { level } }` sets the
|
|
179
|
+
* Deflate level (0–9).
|
|
180
|
+
*
|
|
181
|
+
* @example
|
|
182
|
+
* ```ts
|
|
183
|
+
* import type { XlsxWriteOptions } from '@xlvane/compat';
|
|
184
|
+
*
|
|
185
|
+
* const options: XlsxWriteOptions = { useStyles: false };
|
|
186
|
+
* ```
|
|
187
|
+
*/
|
|
188
|
+
interface XlsxWriteOptions {
|
|
189
|
+
/** `false` writes no cell or column styles; dates keep format 14, as in exceljs. */
|
|
190
|
+
useStyles?: boolean;
|
|
191
|
+
useSharedStrings?: boolean;
|
|
192
|
+
zip?: Record<string, unknown>;
|
|
193
|
+
}
|
|
194
|
+
/** A writable Node.js stream, as accepted by `xlsx.write()`. */
|
|
195
|
+
interface WritableLike$1 {
|
|
196
|
+
write(chunk: Uint8Array): unknown;
|
|
197
|
+
end(callback?: () => void): unknown;
|
|
198
|
+
once?(event: string, listener: (error?: unknown) => void): unknown;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* The `xlsx` property of a {@link Workbook}: reading and writing XLSX files.
|
|
202
|
+
*
|
|
203
|
+
* @example
|
|
204
|
+
* ```ts
|
|
205
|
+
* import ExcelJS from '@xlvane/compat';
|
|
206
|
+
*
|
|
207
|
+
* const workbook = new ExcelJS.Workbook();
|
|
208
|
+
* workbook.addWorksheet('Data').getCell('A1').value = 'Hello';
|
|
209
|
+
* const buffer = await workbook.xlsx.writeBuffer();
|
|
210
|
+
* const copy = await new ExcelJS.Workbook().xlsx.load(buffer);
|
|
211
|
+
* console.log(copy.getWorksheet('Data')?.getCell('A1').value); // Hello
|
|
212
|
+
* ```
|
|
213
|
+
*/
|
|
214
|
+
export declare class XlsxIO {
|
|
215
|
+
private readonly workbook;
|
|
216
|
+
/** @internal */
|
|
217
|
+
constructor(workbook: Workbook);
|
|
218
|
+
/** Reads XLSX bytes into the workbook (its sheets are replaced) and returns the workbook. */
|
|
219
|
+
load(data: Uint8Array | ArrayBuffer | string, options?: XlsxReadOptions): Promise<Workbook>;
|
|
220
|
+
/** Reads an XLSX file (Node.js). */
|
|
221
|
+
readFile(path: string, options?: XlsxReadOptions): Promise<Workbook>;
|
|
222
|
+
/** Reads XLSX data from a readable stream (Node.js stream or any async iterable of bytes). */
|
|
223
|
+
read(stream: AsyncIterable<Uint8Array>, options?: XlsxReadOptions): Promise<Workbook>;
|
|
224
|
+
/** Writes the workbook and returns the file contents (a Buffer in Node.js). */
|
|
225
|
+
writeBuffer(options?: XlsxWriteOptions): Promise<Uint8Array>;
|
|
226
|
+
/** Writes the workbook to a file, replacing an existing file as exceljs does (Node.js). */
|
|
227
|
+
writeFile(path: string, options?: XlsxWriteOptions): Promise<void>;
|
|
228
|
+
/** Writes the workbook to a writable stream and ends it. */
|
|
229
|
+
write(stream: WritableLike$1, options?: XlsxWriteOptions): Promise<void>;
|
|
230
|
+
/** Removed in exceljs 4 (it throws there too); use `read`. */
|
|
231
|
+
createInputStream(): never;
|
|
232
|
+
/** Reads image files given by `filename`, as exceljs does when it writes (xlsx.js L426–429). */
|
|
233
|
+
private loadFiles;
|
|
234
|
+
private book;
|
|
235
|
+
private bytes;
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* A workbook, as exceljs `Workbook`. Use `xlsx` to read and write files.
|
|
239
|
+
*
|
|
240
|
+
* @example
|
|
241
|
+
* ```ts
|
|
242
|
+
* import ExcelJS from '@xlvane/compat';
|
|
243
|
+
*
|
|
244
|
+
* const workbook = new ExcelJS.Workbook();
|
|
245
|
+
* workbook.creator = 'Me';
|
|
246
|
+
* const sheet = workbook.addWorksheet('My Sheet');
|
|
247
|
+
* sheet.addRow(['Name', 'Total']);
|
|
248
|
+
* sheet.addRow(['Tea', 3.5]);
|
|
249
|
+
* await workbook.xlsx.writeFile('report.xlsx');
|
|
250
|
+
* ```
|
|
251
|
+
*/
|
|
252
|
+
export declare class Workbook {
|
|
253
|
+
/** Written to `docProps/core.xml`; `"Unknown"` when not set, as exceljs (lib/doc/workbook.js L155). */
|
|
254
|
+
creator: string | undefined;
|
|
255
|
+
lastModifiedBy: string | undefined;
|
|
256
|
+
created: Date | undefined;
|
|
257
|
+
modified: Date | undefined;
|
|
258
|
+
lastPrinted: Date | undefined;
|
|
259
|
+
title: string | undefined;
|
|
260
|
+
subject: string | undefined;
|
|
261
|
+
keywords: string | undefined;
|
|
262
|
+
category: string | undefined;
|
|
263
|
+
description: string | undefined;
|
|
264
|
+
language: string | undefined;
|
|
265
|
+
revision: string | number | undefined;
|
|
266
|
+
contentStatus: string | undefined;
|
|
267
|
+
/** Written to `docProps/app.xml`, always (`company || ''`), as exceljs (X4-13). */
|
|
268
|
+
company: string | undefined;
|
|
269
|
+
/** Written to `docProps/app.xml` when defined, as exceljs (X4-13). */
|
|
270
|
+
manager: string | undefined;
|
|
271
|
+
/** Workbook properties; `date1904: true` selects the 1904 date system. */
|
|
272
|
+
properties: {
|
|
273
|
+
date1904?: boolean;
|
|
274
|
+
[key: string]: unknown;
|
|
275
|
+
};
|
|
276
|
+
calcProperties: Record<string, unknown>;
|
|
277
|
+
views: Record<string, unknown>[];
|
|
278
|
+
/** @internal */
|
|
279
|
+
_sheets: (Worksheet | undefined)[];
|
|
280
|
+
private _xlsx;
|
|
281
|
+
private _csv;
|
|
282
|
+
get xlsx(): XlsxIO;
|
|
283
|
+
/** CSV reading and writing, as exceljs `workbook.csv` (X4-23, X4-24). */
|
|
284
|
+
get csv(): CsvIO;
|
|
285
|
+
private readonly _definedNames;
|
|
286
|
+
/** Defined names, as exceljs `workbook.definedNames`. */
|
|
287
|
+
get definedNames(): DefinedNames;
|
|
288
|
+
/** @internal The document properties and defined names to write, as exceljs `workbook.model`. */
|
|
289
|
+
_meta(): WorkbookMeta;
|
|
290
|
+
/** @internal */
|
|
291
|
+
get _date1904(): boolean;
|
|
292
|
+
/** @internal Names of the other sheets, for the duplicate check of Worksheet.name. */
|
|
293
|
+
readonly _names: (exclude: Worksheet) => string[];
|
|
294
|
+
/** The id the next worksheet gets (lib/doc/workbook.js `nextId`). */
|
|
295
|
+
get nextId(): number;
|
|
296
|
+
/** Adds a worksheet. Names follow exceljs rules (31 characters at most; longer names are cut). */
|
|
297
|
+
addWorksheet(name?: string, options?: WorksheetOptions): Worksheet;
|
|
298
|
+
removeWorksheet(id: number | string): void;
|
|
299
|
+
/** Removes a worksheet by id or name, as `removeWorksheet` (lib/doc/workbook.js L77). */
|
|
300
|
+
removeWorksheetEx(worksheet: Worksheet): void;
|
|
301
|
+
/**
|
|
302
|
+
* exceljs keeps the theme of a loaded file and `clearThemes()` drops it (lib/doc/workbook.js
|
|
303
|
+
* L137). xlvane never keeps or writes a theme part, so there is nothing to clear.
|
|
304
|
+
*/
|
|
305
|
+
clearThemes(): void;
|
|
306
|
+
/**
|
|
307
|
+
* A plain-data snapshot of the workbook, as exceljs `workbook.model` (lib/doc/workbook.js L153):
|
|
308
|
+
* the document properties, `views`, `calcProperties`, the defined names, the media and the
|
|
309
|
+
* worksheets' `model`. The setter rebuilds the workbook from such a snapshot (X4-30).
|
|
310
|
+
*/
|
|
311
|
+
get model(): Record<string, unknown>;
|
|
312
|
+
set model(value: Record<string, unknown>);
|
|
313
|
+
/** A worksheet by id or name; the first worksheet without an argument; `undefined` if none. */
|
|
314
|
+
getWorksheet(id?: number | string): Worksheet | undefined;
|
|
315
|
+
/** Worksheets in workbook order. */
|
|
316
|
+
get worksheets(): Worksheet[];
|
|
317
|
+
eachSheet(iteratee: (sheet: Worksheet, id: number) => void): void;
|
|
318
|
+
/** @internal Images of the workbook, as exceljs `workbook.media`. */
|
|
319
|
+
_media: ImageData[];
|
|
320
|
+
/**
|
|
321
|
+
* Adds an image (PNG, JPEG or GIF, or EMF or WMF as Excel stores them; recognised from its bytes) and returns its id for
|
|
322
|
+
* `worksheet.addImage` and `addBackgroundImage`, as exceljs `workbook.addImage`. Give `buffer`,
|
|
323
|
+
* `base64` or `filename`; a file is read when the workbook is written (Node.js, Bun, Deno), as
|
|
324
|
+
* in exceljs.
|
|
325
|
+
*/
|
|
326
|
+
addImage(image: ImageData): number;
|
|
327
|
+
/**
|
|
328
|
+
* The image with this id, as exceljs `workbook.getImage`. Typed `Image` as in exceljs
|
|
329
|
+
* (index.d.ts L1780); at run time an unknown id gives `undefined`, as in exceljs
|
|
330
|
+
* (lib/doc/workbook.js L149-151).
|
|
331
|
+
*/
|
|
332
|
+
getImage(id: number): Image;
|
|
333
|
+
/**
|
|
334
|
+
* @internal Replaces the sheets with those of a workbook read by xlvane. `options.ignoreNodes`
|
|
335
|
+
* skips what exceljs skips for those worksheet elements, and `maxRows`/`maxCols` refuse
|
|
336
|
+
* bigger worksheets (worksheet-xform.js L95, L372; list-xform.js L75; row-xform.js L119; X4-25).
|
|
337
|
+
*/
|
|
338
|
+
_fill(read: Workbook$1, options?: XlsxReadOptions): void;
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* Options of `workbook.csv.read` and `readFile`, as exceljs `CsvReadOptions`.
|
|
342
|
+
*
|
|
343
|
+
* @example
|
|
344
|
+
* ```ts
|
|
345
|
+
* import type { CsvReadOptions } from '@xlvane/compat';
|
|
346
|
+
*
|
|
347
|
+
* const options: CsvReadOptions = { sheetName: 'Data', parserOptions: { delimiter: ';' } };
|
|
348
|
+
* ```
|
|
349
|
+
*/
|
|
350
|
+
interface CsvReadOptions {
|
|
351
|
+
/** Formats tried, in order, for text that is not a number (dayjs tokens, strict, local time). */
|
|
352
|
+
dateFormats?: string[];
|
|
353
|
+
/** Turns each field into a cell value; replaces the default conversion. */
|
|
354
|
+
map?(value: string, index: number): unknown;
|
|
355
|
+
/** Name of the worksheet that is added; exceljs's default name `sheetN` otherwise. */
|
|
356
|
+
sheetName?: string;
|
|
357
|
+
/** fast-csv parser options: `delimiter`, `quote`, `escape`, `trim`, `ltrim`, `rtrim`, `ignoreEmpty`, `comment`, `skipLines`, `skipRows`, `maxRows`, `headers`, `renameHeaders`, `encoding`. */
|
|
358
|
+
parserOptions?: Record<string, unknown>;
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* Options of `workbook.csv.write`, `writeFile` and `writeBuffer`, as exceljs `CsvWriteOptions`,
|
|
362
|
+
* plus `formulaInjection`.
|
|
363
|
+
*
|
|
364
|
+
* @example
|
|
365
|
+
* ```ts
|
|
366
|
+
* import type { CsvWriteOptions } from '@xlvane/compat';
|
|
367
|
+
*
|
|
368
|
+
* const options: CsvWriteOptions = { sheetName: 'Data', dateFormat: 'DD/MM/YYYY', formatterOptions: { delimiter: ';' } };
|
|
369
|
+
* ```
|
|
370
|
+
*/
|
|
371
|
+
interface CsvWriteOptions {
|
|
372
|
+
/** dayjs format for dates; ISO 8601 with offset otherwise. */
|
|
373
|
+
dateFormat?: string;
|
|
374
|
+
/** Format dates in UTC instead of local time. */
|
|
375
|
+
dateUTC?: boolean;
|
|
376
|
+
sheetName?: string;
|
|
377
|
+
sheetId?: number;
|
|
378
|
+
/** Character set of `writeFile`: `utf8` (default), `utf16le` or `latin1`. */
|
|
379
|
+
encoding?: string;
|
|
380
|
+
/** Turns each cell value into a field; replaces the default conversion. */
|
|
381
|
+
map?(value: unknown, index: number): unknown;
|
|
382
|
+
/** Blank lines for missing rows (default `true`). */
|
|
383
|
+
includeEmptyRows?: boolean;
|
|
384
|
+
/** fast-csv formatter options: `delimiter`, `rowDelimiter`, `quote`, `escape`, `quoteColumns`, `headers`, `writeHeaders`, `includeEndRowDelimiter`, `writeBOM`. */
|
|
385
|
+
formatterOptions?: Record<string, unknown>;
|
|
386
|
+
/**
|
|
387
|
+
* `"escape"` (default): text that starts with `=`, `+`, `-`, `@`, tab, CR or LF (or their
|
|
388
|
+
* full-width forms) is written with a leading `'`, so spreadsheet applications show it as text
|
|
389
|
+
* (OWASP CSV Injection). `"off"`: written unchanged, as exceljs does. An xlvane option.
|
|
390
|
+
*/
|
|
391
|
+
formulaInjection?: "escape" | "off";
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* The `csv` property of a {@link Workbook}: CSV reading and writing as exceljs `workbook.csv`.
|
|
395
|
+
* Reading adds a worksheet; writing takes one worksheet. Formula-like text is escaped on writing
|
|
396
|
+
* unless `formulaInjection: "off"` is given.
|
|
397
|
+
*
|
|
398
|
+
* @example
|
|
399
|
+
* ```ts
|
|
400
|
+
* import ExcelJS from '@xlvane/compat';
|
|
401
|
+
*
|
|
402
|
+
* const workbook = new ExcelJS.Workbook();
|
|
403
|
+
* workbook.addWorksheet('Data').addRow(['Tea', 3.5]);
|
|
404
|
+
* const buffer = await workbook.csv.writeBuffer();
|
|
405
|
+
* console.log(new TextDecoder().decode(buffer)); // Tea,3.5
|
|
406
|
+
* ```
|
|
407
|
+
*/
|
|
408
|
+
export declare class CsvIO {
|
|
409
|
+
private readonly workbook;
|
|
410
|
+
/** @internal */
|
|
411
|
+
constructor(workbook: Workbook);
|
|
412
|
+
/** Reads CSV from a stream into a new worksheet and returns it. */
|
|
413
|
+
read(stream: unknown, options?: CsvReadOptions): Promise<Worksheet>;
|
|
414
|
+
/** Reads a CSV file (Node.js, Bun, Deno) into a new worksheet. */
|
|
415
|
+
readFile(path: string, options?: CsvReadOptions): Promise<Worksheet>;
|
|
416
|
+
/** Writes a worksheet as CSV to a stream and ends it. */
|
|
417
|
+
write(stream: unknown, options?: CsvWriteOptions): Promise<void>;
|
|
418
|
+
/** Writes a worksheet to a CSV file (Node.js, Bun, Deno), replacing it. */
|
|
419
|
+
writeFile(path: string, options?: CsvWriteOptions): Promise<void>;
|
|
420
|
+
/** The CSV of a worksheet as bytes (a Buffer in Node.js), UTF-8 encoded. */
|
|
421
|
+
writeBuffer(options?: CsvWriteOptions): Promise<Uint8Array>;
|
|
422
|
+
/** Removed in exceljs 4 (it throws there too); use `read`. */
|
|
423
|
+
createInputStream(): never;
|
|
424
|
+
private text;
|
|
425
|
+
}
|
|
426
|
+
/**
|
|
427
|
+
* The bytes exceljs returns from `writeBuffer()` (a Node.js Buffer in Node.js, a `Uint8Array` elsewhere); exceljs `Buffer` (index.d.ts L1).
|
|
428
|
+
*
|
|
429
|
+
* @example
|
|
430
|
+
* ```ts
|
|
431
|
+
* import type { Buffer } from '@xlvane/compat';
|
|
432
|
+
* const value: Buffer | undefined = new Uint8Array(0);
|
|
433
|
+
* console.log(value);
|
|
434
|
+
* ```
|
|
435
|
+
*/
|
|
436
|
+
type Buffer = Uint8Array;
|
|
437
|
+
/**
|
|
438
|
+
* Paper sizes of `pageSetup.paperSize`, as exceljs `PaperSize` (index.d.ts L18).
|
|
439
|
+
*
|
|
440
|
+
* @example
|
|
441
|
+
* ```ts
|
|
442
|
+
* import { PaperSize } from '@xlvane/compat';
|
|
443
|
+
*
|
|
444
|
+
* const size: PaperSize = PaperSize.A4;
|
|
445
|
+
* console.log(size); // 9
|
|
446
|
+
* ```
|
|
447
|
+
*/
|
|
448
|
+
export declare const PaperSize: {
|
|
449
|
+
readonly Legal: 5;
|
|
450
|
+
readonly Executive: 7;
|
|
451
|
+
readonly A4: 9;
|
|
452
|
+
readonly A5: 11;
|
|
453
|
+
readonly B5: 13;
|
|
454
|
+
readonly Envelope_10: 20;
|
|
455
|
+
readonly Envelope_DL: 27;
|
|
456
|
+
readonly Envelope_C5: 28;
|
|
457
|
+
readonly Envelope_B5: 34;
|
|
458
|
+
readonly Envelope_Monarch: 37;
|
|
459
|
+
readonly Double_Japan_Postcard_Rotated: 82;
|
|
460
|
+
readonly K16_197x273_mm: 119;
|
|
461
|
+
};
|
|
462
|
+
/** A value of {@link PaperSize}. */
|
|
463
|
+
export type PaperSize = (typeof PaperSize)[keyof typeof PaperSize];
|
|
464
|
+
/**
|
|
465
|
+
* One colour stop of a gradient fill (exceljs `GradientStop`, index.d.ts L174).
|
|
466
|
+
*
|
|
467
|
+
* @example
|
|
468
|
+
* ```ts
|
|
469
|
+
* import type { GradientStop } from '@xlvane/compat';
|
|
470
|
+
* const value: GradientStop | undefined = { position: 0, color: { argb: 'FFFFFFFF' } };
|
|
471
|
+
* console.log(value);
|
|
472
|
+
* ```
|
|
473
|
+
*/
|
|
474
|
+
interface GradientStop {
|
|
475
|
+
position: number;
|
|
476
|
+
color: Partial<Color>;
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* A linear gradient fill (exceljs `FillGradientAngle`, index.d.ts L179).
|
|
480
|
+
*
|
|
481
|
+
* @example
|
|
482
|
+
* ```ts
|
|
483
|
+
* import type { FillGradientAngle } from '@xlvane/compat';
|
|
484
|
+
* const value: FillGradientAngle | undefined = { type: 'gradient', gradient: 'angle', degree: 90, stops: [{ position: 0, color: { argb: 'FFFFFFFF' } }, { position: 1, color: { argb: 'FF0070C0' } }] };
|
|
485
|
+
* console.log(value);
|
|
486
|
+
* ```
|
|
487
|
+
*/
|
|
488
|
+
interface FillGradientAngle {
|
|
489
|
+
type: "gradient";
|
|
490
|
+
gradient: "angle";
|
|
491
|
+
degree: number;
|
|
492
|
+
stops: GradientStop[];
|
|
493
|
+
}
|
|
494
|
+
/**
|
|
495
|
+
* A path gradient fill (exceljs `FillGradientPath`, index.d.ts L197).
|
|
496
|
+
*
|
|
497
|
+
* @example
|
|
498
|
+
* ```ts
|
|
499
|
+
* import type { FillGradientPath } from '@xlvane/compat';
|
|
500
|
+
* const value: FillGradientPath | undefined = { type: 'gradient', gradient: 'path', center: { left: 0.5, top: 0.5 }, stops: [] };
|
|
501
|
+
* console.log(value);
|
|
502
|
+
* ```
|
|
503
|
+
*/
|
|
504
|
+
interface FillGradientPath {
|
|
505
|
+
type: "gradient";
|
|
506
|
+
gradient: "path";
|
|
507
|
+
center: {
|
|
508
|
+
left: number;
|
|
509
|
+
top: number;
|
|
510
|
+
};
|
|
511
|
+
stops: GradientStop[];
|
|
512
|
+
}
|
|
513
|
+
/**
|
|
514
|
+
* A diagonal border (exceljs `BorderDiagonal`, index.d.ts L253).
|
|
515
|
+
*
|
|
516
|
+
* @example
|
|
517
|
+
* ```ts
|
|
518
|
+
* import type { BorderDiagonal } from '@xlvane/compat';
|
|
519
|
+
* const value: BorderDiagonal | undefined = { style: 'thin', color: { argb: 'FF000000' }, up: true, down: false };
|
|
520
|
+
* console.log(value);
|
|
521
|
+
* ```
|
|
522
|
+
*/
|
|
523
|
+
interface BorderDiagonal extends Border {
|
|
524
|
+
up: boolean;
|
|
525
|
+
down: boolean;
|
|
526
|
+
}
|
|
527
|
+
/**
|
|
528
|
+
* Page margins in inches (exceljs `Margins`, index.d.ts L266).
|
|
529
|
+
*
|
|
530
|
+
* @example
|
|
531
|
+
* ```ts
|
|
532
|
+
* import type { Margins } from '@xlvane/compat';
|
|
533
|
+
* const value: Margins | undefined = { top: 0.75, left: 0.7, bottom: 0.75, right: 0.7, header: 0.3, footer: 0.3 };
|
|
534
|
+
* console.log(value);
|
|
535
|
+
* ```
|
|
536
|
+
*/
|
|
537
|
+
interface Margins {
|
|
538
|
+
top: number;
|
|
539
|
+
left: number;
|
|
540
|
+
bottom: number;
|
|
541
|
+
right: number;
|
|
542
|
+
header: number;
|
|
543
|
+
footer: number;
|
|
544
|
+
}
|
|
545
|
+
/**
|
|
546
|
+
* Operators of a data validation (exceljs `DataValidationOperator`, index.d.ts L304).
|
|
547
|
+
*
|
|
548
|
+
* @example
|
|
549
|
+
* ```ts
|
|
550
|
+
* import type { DataValidationOperator } from '@xlvane/compat';
|
|
551
|
+
* const value: DataValidationOperator | undefined = 'between';
|
|
552
|
+
* console.log(value);
|
|
553
|
+
* ```
|
|
554
|
+
*/
|
|
555
|
+
type DataValidationOperator = "between" | "notBetween" | "equal" | "notEqual" | "greaterThan" | "lessThan" | "greaterThanOrEqual" | "lessThanOrEqual";
|
|
556
|
+
/**
|
|
557
|
+
* One run of rich text (exceljs `RichText`, index.d.ts L336).
|
|
558
|
+
*
|
|
559
|
+
* @example
|
|
560
|
+
* ```ts
|
|
561
|
+
* import type { RichText } from '@xlvane/compat';
|
|
562
|
+
* const value: RichText | undefined = { text: 'Bold', font: { bold: true } };
|
|
563
|
+
* console.log(value);
|
|
564
|
+
* ```
|
|
565
|
+
*/
|
|
566
|
+
interface RichText {
|
|
567
|
+
text: string;
|
|
568
|
+
font?: Partial<Font>;
|
|
569
|
+
}
|
|
570
|
+
/**
|
|
571
|
+
* A rich-text cell value (exceljs `CellRichTextValue`, index.d.ts L341).
|
|
572
|
+
*
|
|
573
|
+
* @example
|
|
574
|
+
* ```ts
|
|
575
|
+
* import type { CellRichTextValue } from '@xlvane/compat';
|
|
576
|
+
* const value: CellRichTextValue | undefined = { richText: [{ text: 'a' }, { text: 'b', font: { italic: true } }] };
|
|
577
|
+
* console.log(value);
|
|
578
|
+
* ```
|
|
579
|
+
*/
|
|
580
|
+
interface CellRichTextValue {
|
|
581
|
+
richText: RichText[];
|
|
582
|
+
}
|
|
583
|
+
/**
|
|
584
|
+
* A hyperlink cell value (exceljs `CellHyperlinkValue`, index.d.ts L345).
|
|
585
|
+
*
|
|
586
|
+
* @example
|
|
587
|
+
* ```ts
|
|
588
|
+
* import type { CellHyperlinkValue } from '@xlvane/compat';
|
|
589
|
+
* const value: CellHyperlinkValue | undefined = { text: 'Site', hyperlink: 'https://example.com' };
|
|
590
|
+
* console.log(value);
|
|
591
|
+
* ```
|
|
592
|
+
*/
|
|
593
|
+
interface CellHyperlinkValue {
|
|
594
|
+
text: string;
|
|
595
|
+
hyperlink: string;
|
|
596
|
+
tooltip?: string;
|
|
597
|
+
}
|
|
598
|
+
/**
|
|
599
|
+
* A decoded cell address (exceljs `Address`, index.d.ts L1622).
|
|
600
|
+
*
|
|
601
|
+
* @example
|
|
602
|
+
* ```ts
|
|
603
|
+
* import type { Address } from '@xlvane/compat';
|
|
604
|
+
* const value: Address | undefined = undefined;
|
|
605
|
+
* console.log(value);
|
|
606
|
+
* ```
|
|
607
|
+
*/
|
|
608
|
+
interface Address {
|
|
609
|
+
sheetName?: string;
|
|
610
|
+
address: string;
|
|
611
|
+
col: string;
|
|
612
|
+
row: string;
|
|
613
|
+
$col$row: string;
|
|
614
|
+
}
|
|
615
|
+
/**
|
|
616
|
+
* The data of one cell as exceljs `CellModel` (index.d.ts L410). `cell.model` returns xlvane's own snapshot with these fields where they apply.
|
|
617
|
+
*
|
|
618
|
+
* @example
|
|
619
|
+
* ```ts
|
|
620
|
+
* import type { CellModel } from '@xlvane/compat';
|
|
621
|
+
* const value: CellModel | undefined = undefined;
|
|
622
|
+
* console.log(value);
|
|
623
|
+
* ```
|
|
624
|
+
*/
|
|
625
|
+
interface CellModel {
|
|
626
|
+
address: string;
|
|
627
|
+
style: Partial<Style>;
|
|
628
|
+
type: ValueType;
|
|
629
|
+
text?: string;
|
|
630
|
+
hyperlink?: string;
|
|
631
|
+
value?: CellValue;
|
|
632
|
+
master?: string;
|
|
633
|
+
formula?: string;
|
|
634
|
+
sharedFormula?: string;
|
|
635
|
+
result?: unknown;
|
|
636
|
+
comment?: unknown;
|
|
637
|
+
}
|
|
638
|
+
/**
|
|
639
|
+
* The data of one row (exceljs `RowModel`, index.d.ts L511).
|
|
640
|
+
*
|
|
641
|
+
* @example
|
|
642
|
+
* ```ts
|
|
643
|
+
* import type { RowModel } from '@xlvane/compat';
|
|
644
|
+
* const value: RowModel | undefined = undefined;
|
|
645
|
+
* console.log(value);
|
|
646
|
+
* ```
|
|
647
|
+
*/
|
|
648
|
+
interface RowModel {
|
|
649
|
+
cells: CellModel[];
|
|
650
|
+
number: number;
|
|
651
|
+
min: number;
|
|
652
|
+
max: number;
|
|
653
|
+
height: number;
|
|
654
|
+
style: Partial<Style>;
|
|
655
|
+
hidden: boolean;
|
|
656
|
+
outlineLevel: number;
|
|
657
|
+
collapsed: boolean;
|
|
658
|
+
}
|
|
659
|
+
/**
|
|
660
|
+
* The autofilter of a worksheet (exceljs `AutoFilter`, index.d.ts L864).
|
|
661
|
+
*
|
|
662
|
+
* @example
|
|
663
|
+
* ```ts
|
|
664
|
+
* import type { AutoFilter } from '@xlvane/compat';
|
|
665
|
+
* const value: AutoFilter | undefined = 'A1:C1';
|
|
666
|
+
* console.log(value);
|
|
667
|
+
* ```
|
|
668
|
+
*/
|
|
669
|
+
type AutoFilter = string | {
|
|
670
|
+
from: string | {
|
|
671
|
+
row: number;
|
|
672
|
+
column: number;
|
|
673
|
+
};
|
|
674
|
+
to: string | {
|
|
675
|
+
row: number;
|
|
676
|
+
column: number;
|
|
677
|
+
};
|
|
678
|
+
};
|
|
679
|
+
/**
|
|
680
|
+
* An image for `workbook.addImage()` (exceljs `Image`, index.d.ts L887). `filename` works only in Node.js, Bun and Deno.
|
|
681
|
+
*
|
|
682
|
+
* @example
|
|
683
|
+
* ```ts
|
|
684
|
+
* import type { Image } from '@xlvane/compat';
|
|
685
|
+
* const value: Image | undefined = { extension: 'png', base64: 'iVBORw0KGgo=' };
|
|
686
|
+
* console.log(value);
|
|
687
|
+
* ```
|
|
688
|
+
*/
|
|
689
|
+
interface Image {
|
|
690
|
+
extension: "jpeg" | "png" | "gif";
|
|
691
|
+
base64?: string;
|
|
692
|
+
filename?: string;
|
|
693
|
+
buffer?: Uint8Array;
|
|
694
|
+
}
|
|
695
|
+
/**
|
|
696
|
+
* Two corners of a picture (exceljs `ImageRange`, index.d.ts L915).
|
|
697
|
+
*
|
|
698
|
+
* @example
|
|
699
|
+
* ```ts
|
|
700
|
+
* import type { ImageRange } from '@xlvane/compat';
|
|
701
|
+
* const value: ImageRange | undefined = { tl: { col: 0, row: 0 }, br: { col: 2, row: 3 } };
|
|
702
|
+
* console.log(value);
|
|
703
|
+
* ```
|
|
704
|
+
*/
|
|
705
|
+
interface ImageRange {
|
|
706
|
+
tl: IAnchorPosition;
|
|
707
|
+
br: IAnchorPosition;
|
|
708
|
+
}
|
|
709
|
+
/**
|
|
710
|
+
* A picture corner given by column and row, counted from 0 (the `tl`/`br` positions of exceljs `ImageRange`).
|
|
711
|
+
*
|
|
712
|
+
* @example
|
|
713
|
+
* ```ts
|
|
714
|
+
* import type { IAnchorPosition } from '@xlvane/compat';
|
|
715
|
+
* const value: IAnchorPosition | undefined = { col: 1, row: 2 };
|
|
716
|
+
* console.log(value);
|
|
717
|
+
* ```
|
|
718
|
+
*/
|
|
719
|
+
interface IAnchorPosition {
|
|
720
|
+
col: number;
|
|
721
|
+
row: number;
|
|
722
|
+
}
|
|
723
|
+
/**
|
|
724
|
+
* A picture corner plus a size in pixels (exceljs `ImagePosition`, index.d.ts L920).
|
|
725
|
+
*
|
|
726
|
+
* @example
|
|
727
|
+
* ```ts
|
|
728
|
+
* import type { ImagePosition } from '@xlvane/compat';
|
|
729
|
+
* const value: ImagePosition | undefined = { tl: { col: 0, row: 0 }, ext: { width: 120, height: 60 } };
|
|
730
|
+
* console.log(value);
|
|
731
|
+
* ```
|
|
732
|
+
*/
|
|
733
|
+
interface ImagePosition {
|
|
734
|
+
tl: {
|
|
735
|
+
col: number;
|
|
736
|
+
row: number;
|
|
737
|
+
};
|
|
738
|
+
ext: {
|
|
739
|
+
width: number;
|
|
740
|
+
height: number;
|
|
741
|
+
};
|
|
742
|
+
}
|
|
743
|
+
/**
|
|
744
|
+
* The link of a picture (exceljs `ImageHyperlinkValue`, index.d.ts L925).
|
|
745
|
+
*
|
|
746
|
+
* @example
|
|
747
|
+
* ```ts
|
|
748
|
+
* import type { ImageHyperlinkValue } from '@xlvane/compat';
|
|
749
|
+
* const value: ImageHyperlinkValue | undefined = { hyperlink: 'https://example.com' };
|
|
750
|
+
* console.log(value);
|
|
751
|
+
* ```
|
|
752
|
+
*/
|
|
753
|
+
interface ImageHyperlinkValue {
|
|
754
|
+
hyperlink: string;
|
|
755
|
+
tooltip?: string;
|
|
756
|
+
}
|
|
757
|
+
/**
|
|
758
|
+
* A rectangle of cells, 1-based (exceljs `Location`, index.d.ts L1630).
|
|
759
|
+
*
|
|
760
|
+
* @example
|
|
761
|
+
* ```ts
|
|
762
|
+
* import type { Location } from '@xlvane/compat';
|
|
763
|
+
* const value: Location | undefined = { top: 1, left: 1, bottom: 3, right: 2 };
|
|
764
|
+
* console.log(value);
|
|
765
|
+
* ```
|
|
766
|
+
*/
|
|
767
|
+
interface Location {
|
|
768
|
+
top: number;
|
|
769
|
+
left: number;
|
|
770
|
+
bottom: number;
|
|
771
|
+
right: number;
|
|
772
|
+
}
|
|
773
|
+
/**
|
|
774
|
+
* A range of cells as exceljs `Range` (index.d.ts L930), the type of `worksheet.dimensions`.
|
|
775
|
+
*
|
|
776
|
+
* @example
|
|
777
|
+
* ```ts
|
|
778
|
+
* import type { Range } from '@xlvane/compat';
|
|
779
|
+
* const value: Range | undefined = undefined;
|
|
780
|
+
* console.log(value);
|
|
781
|
+
* ```
|
|
782
|
+
*/
|
|
783
|
+
interface Range extends Location {
|
|
784
|
+
readonly tl: string;
|
|
785
|
+
readonly br: string;
|
|
786
|
+
readonly range: string;
|
|
787
|
+
readonly shortRange: string;
|
|
788
|
+
readonly $range: string;
|
|
789
|
+
readonly count: number;
|
|
790
|
+
readonly model: Location & {
|
|
791
|
+
sheetName?: string;
|
|
792
|
+
};
|
|
793
|
+
toString(): string;
|
|
794
|
+
}
|
|
795
|
+
/**
|
|
796
|
+
* A picture of a workbook (exceljs `Media`, index.d.ts L1615).
|
|
797
|
+
*
|
|
798
|
+
* @example
|
|
799
|
+
* ```ts
|
|
800
|
+
* import type { Media } from '@xlvane/compat';
|
|
801
|
+
* const value: Media | undefined = undefined;
|
|
802
|
+
* console.log(value);
|
|
803
|
+
* ```
|
|
804
|
+
*/
|
|
805
|
+
interface Media {
|
|
806
|
+
type: string;
|
|
807
|
+
name: string;
|
|
808
|
+
extension: string;
|
|
809
|
+
buffer: Uint8Array;
|
|
810
|
+
}
|
|
811
|
+
/**
|
|
812
|
+
* Visibility of a worksheet (exceljs `WorksheetState`, index.d.ts L997).
|
|
813
|
+
*
|
|
814
|
+
* @example
|
|
815
|
+
* ```ts
|
|
816
|
+
* import type { WorksheetState } from '@xlvane/compat';
|
|
817
|
+
* const value: WorksheetState | undefined = 'hidden';
|
|
818
|
+
* console.log(value);
|
|
819
|
+
* ```
|
|
820
|
+
*/
|
|
821
|
+
type WorksheetState = "visible" | "hidden" | "veryHidden";
|
|
822
|
+
/**
|
|
823
|
+
* Operators of a `cellIs` conditional formatting rule (exceljs index.d.ts L999).
|
|
824
|
+
*
|
|
825
|
+
* @example
|
|
826
|
+
* ```ts
|
|
827
|
+
* import type { CellIsOperators } from '@xlvane/compat';
|
|
828
|
+
* const value: CellIsOperators | undefined = 'between';
|
|
829
|
+
* console.log(value);
|
|
830
|
+
* ```
|
|
831
|
+
*/
|
|
832
|
+
type CellIsOperators = "equal" | "greaterThan" | "lessThan" | "between";
|
|
833
|
+
/**
|
|
834
|
+
* Operators of a `containsText` rule (exceljs index.d.ts L1001).
|
|
835
|
+
*
|
|
836
|
+
* @example
|
|
837
|
+
* ```ts
|
|
838
|
+
* import type { ContainsTextOperators } from '@xlvane/compat';
|
|
839
|
+
* const value: ContainsTextOperators | undefined = 'containsText';
|
|
840
|
+
* console.log(value);
|
|
841
|
+
* ```
|
|
842
|
+
*/
|
|
843
|
+
type ContainsTextOperators = "containsText" | "containsBlanks" | "notContainsBlanks" | "containsErrors" | "notContainsErrors";
|
|
844
|
+
/**
|
|
845
|
+
* Periods of a `timePeriod` rule (exceljs index.d.ts L1003).
|
|
846
|
+
*
|
|
847
|
+
* @example
|
|
848
|
+
* ```ts
|
|
849
|
+
* import type { TimePeriodTypes } from '@xlvane/compat';
|
|
850
|
+
* const value: TimePeriodTypes | undefined = 'today';
|
|
851
|
+
* console.log(value);
|
|
852
|
+
* ```
|
|
853
|
+
*/
|
|
854
|
+
type TimePeriodTypes = "lastWeek" | "thisWeek" | "nextWeek" | "yesterday" | "today" | "tomorrow" | "last7Days" | "lastMonth" | "thisMonth" | "nextMonth";
|
|
855
|
+
/**
|
|
856
|
+
* Icon sets of an `iconSet` rule (exceljs index.d.ts L1006).
|
|
857
|
+
*
|
|
858
|
+
* @example
|
|
859
|
+
* ```ts
|
|
860
|
+
* import type { IconSetTypes } from '@xlvane/compat';
|
|
861
|
+
* const value: IconSetTypes | undefined = '3Arrows';
|
|
862
|
+
* console.log(value);
|
|
863
|
+
* ```
|
|
864
|
+
*/
|
|
865
|
+
type IconSetTypes = "5Arrows" | "5ArrowsGray" | "5Boxes" | "5Quarters" | "5Rating" | "4Arrows" | "4ArrowsGray" | "4Rating" | "4RedToBlack" | "4TrafficLights" | "NoIcons" | "3Arrows" | "3ArrowsGray" | "3Flags" | "3Signs" | "3Stars" | "3Symbols" | "3Symbols2" | "3TrafficLights1" | "3TrafficLights2" | "3Triangles";
|
|
866
|
+
/**
|
|
867
|
+
* Value types of a conditional formatting value object (exceljs index.d.ts L1010).
|
|
868
|
+
*
|
|
869
|
+
* @example
|
|
870
|
+
* ```ts
|
|
871
|
+
* import type { CfvoTypes } from '@xlvane/compat';
|
|
872
|
+
* const value: CfvoTypes | undefined = 'min';
|
|
873
|
+
* console.log(value);
|
|
874
|
+
* ```
|
|
875
|
+
*/
|
|
876
|
+
type CfvoTypes = "percentile" | "percent" | "num" | "min" | "max" | "formula" | "autoMin" | "autoMax";
|
|
877
|
+
/**
|
|
878
|
+
* A conditional formatting value object (exceljs `Cvfo`, index.d.ts L1012).
|
|
879
|
+
*
|
|
880
|
+
* @example
|
|
881
|
+
* ```ts
|
|
882
|
+
* import type { Cvfo } from '@xlvane/compat';
|
|
883
|
+
* const value: Cvfo | undefined = { type: 'percentile', value: 50 };
|
|
884
|
+
* console.log(value);
|
|
885
|
+
* ```
|
|
886
|
+
*/
|
|
887
|
+
interface Cvfo {
|
|
888
|
+
type: CfvoTypes;
|
|
889
|
+
value?: number;
|
|
890
|
+
}
|
|
891
|
+
/**
|
|
892
|
+
* A `expression` conditional formatting rule (exceljs `ExpressionRuleType`, index.d.ts L1020).
|
|
893
|
+
*
|
|
894
|
+
* @example
|
|
895
|
+
* ```ts
|
|
896
|
+
* import type { ExpressionRuleType } from '@xlvane/compat';
|
|
897
|
+
* const value: ExpressionRuleType | undefined = { type: 'expression' } as ExpressionRuleType;
|
|
898
|
+
* console.log(value);
|
|
899
|
+
* ```
|
|
900
|
+
*/
|
|
901
|
+
interface ExpressionRuleType {
|
|
902
|
+
type: "expression";
|
|
903
|
+
priority?: number;
|
|
904
|
+
style?: Partial<Style>;
|
|
905
|
+
formulae?: unknown[];
|
|
906
|
+
}
|
|
907
|
+
/**
|
|
908
|
+
* A `cellIs` conditional formatting rule (exceljs `CellIsRuleType`, index.d.ts L1025).
|
|
909
|
+
*
|
|
910
|
+
* @example
|
|
911
|
+
* ```ts
|
|
912
|
+
* import type { CellIsRuleType } from '@xlvane/compat';
|
|
913
|
+
* const value: CellIsRuleType | undefined = { type: 'cellIs' } as CellIsRuleType;
|
|
914
|
+
* console.log(value);
|
|
915
|
+
* ```
|
|
916
|
+
*/
|
|
917
|
+
interface CellIsRuleType {
|
|
918
|
+
type: "cellIs";
|
|
919
|
+
priority?: number;
|
|
920
|
+
style?: Partial<Style>;
|
|
921
|
+
formulae?: unknown[];
|
|
922
|
+
operator?: CellIsOperators;
|
|
923
|
+
}
|
|
924
|
+
/**
|
|
925
|
+
* A `aboveAverage` conditional formatting rule (exceljs `AboveAverageRuleType`, index.d.ts L1038).
|
|
926
|
+
*
|
|
927
|
+
* @example
|
|
928
|
+
* ```ts
|
|
929
|
+
* import type { AboveAverageRuleType } from '@xlvane/compat';
|
|
930
|
+
* const value: AboveAverageRuleType | undefined = { type: 'aboveAverage' } as AboveAverageRuleType;
|
|
931
|
+
* console.log(value);
|
|
932
|
+
* ```
|
|
933
|
+
*/
|
|
934
|
+
interface AboveAverageRuleType {
|
|
935
|
+
type: "aboveAverage";
|
|
936
|
+
priority?: number;
|
|
937
|
+
style?: Partial<Style>;
|
|
938
|
+
aboveAverage: boolean;
|
|
939
|
+
}
|
|
940
|
+
/**
|
|
941
|
+
* A `colorScale` conditional formatting rule (exceljs `ColorScaleRuleType`, index.d.ts L1043).
|
|
942
|
+
*
|
|
943
|
+
* @example
|
|
944
|
+
* ```ts
|
|
945
|
+
* import type { ColorScaleRuleType } from '@xlvane/compat';
|
|
946
|
+
* const value: ColorScaleRuleType | undefined = { type: 'colorScale' } as ColorScaleRuleType;
|
|
947
|
+
* console.log(value);
|
|
948
|
+
* ```
|
|
949
|
+
*/
|
|
950
|
+
interface ColorScaleRuleType {
|
|
951
|
+
type: "colorScale";
|
|
952
|
+
priority?: number;
|
|
953
|
+
style?: Partial<Style>;
|
|
954
|
+
cfvo?: Cvfo[];
|
|
955
|
+
color?: Partial<Color>[];
|
|
956
|
+
}
|
|
957
|
+
/**
|
|
958
|
+
* A `iconSet` conditional formatting rule (exceljs `IconSetRuleType`, index.d.ts L1049).
|
|
959
|
+
*
|
|
960
|
+
* @example
|
|
961
|
+
* ```ts
|
|
962
|
+
* import type { IconSetRuleType } from '@xlvane/compat';
|
|
963
|
+
* const value: IconSetRuleType | undefined = { type: 'iconSet' } as IconSetRuleType;
|
|
964
|
+
* console.log(value);
|
|
965
|
+
* ```
|
|
966
|
+
*/
|
|
967
|
+
interface IconSetRuleType {
|
|
968
|
+
type: "iconSet";
|
|
969
|
+
priority?: number;
|
|
970
|
+
style?: Partial<Style>;
|
|
971
|
+
showValue?: boolean;
|
|
972
|
+
reverse?: boolean;
|
|
973
|
+
custom?: boolean;
|
|
974
|
+
iconSet?: IconSetTypes;
|
|
975
|
+
cfvo?: Cvfo[];
|
|
976
|
+
}
|
|
977
|
+
/**
|
|
978
|
+
* A `containsText` conditional formatting rule (exceljs `ContainsTextRuleType`, index.d.ts L1058).
|
|
979
|
+
*
|
|
980
|
+
* @example
|
|
981
|
+
* ```ts
|
|
982
|
+
* import type { ContainsTextRuleType } from '@xlvane/compat';
|
|
983
|
+
* const value: ContainsTextRuleType | undefined = { type: 'containsText' } as ContainsTextRuleType;
|
|
984
|
+
* console.log(value);
|
|
985
|
+
* ```
|
|
986
|
+
*/
|
|
987
|
+
interface ContainsTextRuleType {
|
|
988
|
+
type: "containsText";
|
|
989
|
+
priority?: number;
|
|
990
|
+
style?: Partial<Style>;
|
|
991
|
+
operator?: ContainsTextOperators;
|
|
992
|
+
text?: string;
|
|
993
|
+
}
|
|
994
|
+
/**
|
|
995
|
+
* A `timePeriod` conditional formatting rule (exceljs `TimePeriodRuleType`, index.d.ts L1064).
|
|
996
|
+
*
|
|
997
|
+
* @example
|
|
998
|
+
* ```ts
|
|
999
|
+
* import type { TimePeriodRuleType } from '@xlvane/compat';
|
|
1000
|
+
* const value: TimePeriodRuleType | undefined = { type: 'timePeriod' } as TimePeriodRuleType;
|
|
1001
|
+
* console.log(value);
|
|
1002
|
+
* ```
|
|
1003
|
+
*/
|
|
1004
|
+
interface TimePeriodRuleType {
|
|
1005
|
+
type: "timePeriod";
|
|
1006
|
+
priority?: number;
|
|
1007
|
+
style?: Partial<Style>;
|
|
1008
|
+
timePeriod?: TimePeriodTypes;
|
|
1009
|
+
}
|
|
1010
|
+
/**
|
|
1011
|
+
* A `dataBar` conditional formatting rule (exceljs `DataBarRuleType`, index.d.ts L1069).
|
|
1012
|
+
*
|
|
1013
|
+
* @example
|
|
1014
|
+
* ```ts
|
|
1015
|
+
* import type { DataBarRuleType } from '@xlvane/compat';
|
|
1016
|
+
* const value: DataBarRuleType | undefined = { type: 'dataBar' } as DataBarRuleType;
|
|
1017
|
+
* console.log(value);
|
|
1018
|
+
* ```
|
|
1019
|
+
*/
|
|
1020
|
+
interface DataBarRuleType {
|
|
1021
|
+
type: "dataBar";
|
|
1022
|
+
priority?: number;
|
|
1023
|
+
style?: Partial<Style>;
|
|
1024
|
+
gradient?: boolean;
|
|
1025
|
+
minLength?: number;
|
|
1026
|
+
maxLength?: number;
|
|
1027
|
+
showValue?: boolean;
|
|
1028
|
+
border?: boolean;
|
|
1029
|
+
negativeBarColorSameAsPositive?: boolean;
|
|
1030
|
+
negativeBarBorderColorSameAsPositive?: boolean;
|
|
1031
|
+
axisPosition?: "auto" | "middle" | "none";
|
|
1032
|
+
direction?: "context" | "leftToRight" | "rightToLeft";
|
|
1033
|
+
cfvo?: Cvfo[];
|
|
1034
|
+
}
|
|
1035
|
+
/**
|
|
1036
|
+
* The values of a row given to `addRow()` (exceljs `RowValues`, index.d.ts L1087).
|
|
1037
|
+
*
|
|
1038
|
+
* @example
|
|
1039
|
+
* ```ts
|
|
1040
|
+
* import type { RowValues } from '@xlvane/compat';
|
|
1041
|
+
* const value: RowValues | undefined = [1, 'two', new Date(0)];
|
|
1042
|
+
* console.log(value);
|
|
1043
|
+
* ```
|
|
1044
|
+
*/
|
|
1045
|
+
type RowValues = CellValue[] | {
|
|
1046
|
+
[key: string]: CellValue;
|
|
1047
|
+
} | undefined | null;
|
|
1048
|
+
/**
|
|
1049
|
+
* `workbook.calcProperties` (exceljs `CalculationProperties`, index.d.ts L1385).
|
|
1050
|
+
*
|
|
1051
|
+
* @example
|
|
1052
|
+
* ```ts
|
|
1053
|
+
* import type { CalculationProperties } from '@xlvane/compat';
|
|
1054
|
+
* const value: CalculationProperties | undefined = { fullCalcOnLoad: true };
|
|
1055
|
+
* console.log(value);
|
|
1056
|
+
* ```
|
|
1057
|
+
*/
|
|
1058
|
+
interface CalculationProperties {
|
|
1059
|
+
fullCalcOnLoad: boolean;
|
|
1060
|
+
}
|
|
1061
|
+
/**
|
|
1062
|
+
* `workbook.properties` (exceljs `WorkbookProperties`, index.d.ts L1440).
|
|
1063
|
+
*
|
|
1064
|
+
* @example
|
|
1065
|
+
* ```ts
|
|
1066
|
+
* import type { WorkbookProperties } from '@xlvane/compat';
|
|
1067
|
+
* const value: WorkbookProperties | undefined = { date1904: false };
|
|
1068
|
+
* console.log(value);
|
|
1069
|
+
* ```
|
|
1070
|
+
*/
|
|
1071
|
+
interface WorkbookProperties {
|
|
1072
|
+
date1904: boolean;
|
|
1073
|
+
}
|
|
1074
|
+
/**
|
|
1075
|
+
* The `zip` option of `writeBuffer()` (exceljs `JSZipGeneratorOptions`, index.d.ts L1447); xlvane uses `compressionOptions.level`.
|
|
1076
|
+
*
|
|
1077
|
+
* @example
|
|
1078
|
+
* ```ts
|
|
1079
|
+
* import type { JSZipGeneratorOptions } from '@xlvane/compat';
|
|
1080
|
+
* const value: JSZipGeneratorOptions | undefined = { compression: 'DEFLATE', compressionOptions: { level: 9 } };
|
|
1081
|
+
* console.log(value);
|
|
1082
|
+
* ```
|
|
1083
|
+
*/
|
|
1084
|
+
interface JSZipGeneratorOptions {
|
|
1085
|
+
compression: "STORE" | "DEFLATE";
|
|
1086
|
+
compressionOptions: null | {
|
|
1087
|
+
level: number;
|
|
1088
|
+
};
|
|
1089
|
+
}
|
|
1090
|
+
/**
|
|
1091
|
+
* `workbook.xlsx` (exceljs `Xlsx`, index.d.ts L1474).
|
|
1092
|
+
*
|
|
1093
|
+
* @example
|
|
1094
|
+
* ```ts
|
|
1095
|
+
* import type { Xlsx } from '@xlvane/compat';
|
|
1096
|
+
* const value: Xlsx | undefined = undefined;
|
|
1097
|
+
* console.log(value);
|
|
1098
|
+
* ```
|
|
1099
|
+
*/
|
|
1100
|
+
type Xlsx = XlsxIO;
|
|
1101
|
+
/**
|
|
1102
|
+
* `workbook.csv` (exceljs `Csv`, index.d.ts L1583).
|
|
1103
|
+
*
|
|
1104
|
+
* @example
|
|
1105
|
+
* ```ts
|
|
1106
|
+
* import type { Csv } from '@xlvane/compat';
|
|
1107
|
+
* const value: Csv | undefined = undefined;
|
|
1108
|
+
* console.log(value);
|
|
1109
|
+
* ```
|
|
1110
|
+
*/
|
|
1111
|
+
type Csv = CsvIO;
|
|
1112
|
+
/**
|
|
1113
|
+
* fast-csv parser options accepted by `csv.read()` (exceljs index.d.ts L1512).
|
|
1114
|
+
*
|
|
1115
|
+
* @example
|
|
1116
|
+
* ```ts
|
|
1117
|
+
* import type { FastCsvParserOptionsArgs } from '@xlvane/compat';
|
|
1118
|
+
* const value: FastCsvParserOptionsArgs | undefined = { delimiter: ';' } as FastCsvParserOptionsArgs;
|
|
1119
|
+
* console.log(value);
|
|
1120
|
+
* ```
|
|
1121
|
+
*/
|
|
1122
|
+
interface FastCsvParserOptionsArgs {
|
|
1123
|
+
objectMode: boolean;
|
|
1124
|
+
delimiter: string;
|
|
1125
|
+
quote: string | null;
|
|
1126
|
+
escape: string;
|
|
1127
|
+
headers: boolean | ((headers: (string | undefined | null)[]) => (string | undefined | null)[]) | (string | undefined | null)[];
|
|
1128
|
+
renameHeaders: boolean;
|
|
1129
|
+
ignoreEmpty: boolean;
|
|
1130
|
+
comment: string;
|
|
1131
|
+
strictColumnHandling: boolean;
|
|
1132
|
+
discardUnmappedColumns: boolean;
|
|
1133
|
+
trim: boolean;
|
|
1134
|
+
ltrim: boolean;
|
|
1135
|
+
rtrim: boolean;
|
|
1136
|
+
encoding: string;
|
|
1137
|
+
maxRows: number;
|
|
1138
|
+
skipLines: number;
|
|
1139
|
+
skipRows: number;
|
|
1140
|
+
}
|
|
1141
|
+
/**
|
|
1142
|
+
* fast-csv formatter options accepted by `csv.write()` (exceljs index.d.ts L1550).
|
|
1143
|
+
*
|
|
1144
|
+
* @example
|
|
1145
|
+
* ```ts
|
|
1146
|
+
* import type { FastCsvFormatterOptionsArgs } from '@xlvane/compat';
|
|
1147
|
+
* const value: FastCsvFormatterOptionsArgs | undefined = { delimiter: ';' } as FastCsvFormatterOptionsArgs;
|
|
1148
|
+
* console.log(value);
|
|
1149
|
+
* ```
|
|
1150
|
+
*/
|
|
1151
|
+
interface FastCsvFormatterOptionsArgs {
|
|
1152
|
+
objectMode: boolean;
|
|
1153
|
+
delimiter: string;
|
|
1154
|
+
rowDelimiter: string;
|
|
1155
|
+
quote: string | boolean;
|
|
1156
|
+
escape: string;
|
|
1157
|
+
quoteColumns: boolean | boolean[] | {
|
|
1158
|
+
[column: string]: boolean;
|
|
1159
|
+
};
|
|
1160
|
+
quoteHeaders: boolean | boolean[] | {
|
|
1161
|
+
[column: string]: boolean;
|
|
1162
|
+
};
|
|
1163
|
+
headers: null | boolean | string[];
|
|
1164
|
+
includeEndRowDelimiter: boolean;
|
|
1165
|
+
writeBOM: boolean;
|
|
1166
|
+
transform: (row: unknown) => unknown;
|
|
1167
|
+
alwaysWriteHeaders: boolean;
|
|
1168
|
+
}
|
|
1169
|
+
/**
|
|
1170
|
+
* The data of a worksheet as exceljs `WorksheetModel` (index.d.ts L984). `worksheet.model` returns xlvane's own snapshot.
|
|
1171
|
+
*
|
|
1172
|
+
* @example
|
|
1173
|
+
* ```ts
|
|
1174
|
+
* import type { WorksheetModel } from '@xlvane/compat';
|
|
1175
|
+
* const value: WorksheetModel | undefined = undefined;
|
|
1176
|
+
* console.log(value);
|
|
1177
|
+
* ```
|
|
1178
|
+
*/
|
|
1179
|
+
interface WorksheetModel {
|
|
1180
|
+
id: number;
|
|
1181
|
+
name: string;
|
|
1182
|
+
properties: Partial<WorksheetProperties>;
|
|
1183
|
+
pageSetup: Partial<PageSetup>;
|
|
1184
|
+
headerFooter: Partial<HeaderFooter>;
|
|
1185
|
+
rowBreaks: RowBreak[];
|
|
1186
|
+
views: Partial<WorksheetView>[];
|
|
1187
|
+
autoFilter: AutoFilter;
|
|
1188
|
+
media: Media[];
|
|
1189
|
+
merges: string[];
|
|
1190
|
+
}
|
|
1191
|
+
/**
|
|
1192
|
+
* The data of a workbook as exceljs `WorkbookModel` (index.d.ts L1682). `workbook.model` returns xlvane's own snapshot.
|
|
1193
|
+
*
|
|
1194
|
+
* @example
|
|
1195
|
+
* ```ts
|
|
1196
|
+
* import type { WorkbookModel } from '@xlvane/compat';
|
|
1197
|
+
* const value: WorkbookModel | undefined = undefined;
|
|
1198
|
+
* console.log(value);
|
|
1199
|
+
* ```
|
|
1200
|
+
*/
|
|
1201
|
+
interface WorkbookModel {
|
|
1202
|
+
creator: string;
|
|
1203
|
+
lastModifiedBy: string;
|
|
1204
|
+
lastPrinted: Date;
|
|
1205
|
+
created: Date;
|
|
1206
|
+
modified: Date;
|
|
1207
|
+
properties: WorkbookProperties;
|
|
1208
|
+
worksheets: Worksheet[];
|
|
1209
|
+
sheets: WorksheetModel[];
|
|
1210
|
+
definedNames: {
|
|
1211
|
+
name: string;
|
|
1212
|
+
ranges: string[];
|
|
1213
|
+
}[];
|
|
1214
|
+
views: Record<string, unknown>[];
|
|
1215
|
+
company: string;
|
|
1216
|
+
manager: string;
|
|
1217
|
+
title: string;
|
|
1218
|
+
subject: string;
|
|
1219
|
+
keywords: string;
|
|
1220
|
+
category: string;
|
|
1221
|
+
description: string;
|
|
1222
|
+
language: string;
|
|
1223
|
+
revision: Date;
|
|
1224
|
+
contentStatus: string;
|
|
1225
|
+
themes: string[];
|
|
1226
|
+
media: Media[];
|
|
1227
|
+
}
|
|
1228
|
+
/**
|
|
1229
|
+
* Settings shared by every worksheet view (exceljs `WorksheetViewCommon`, index.d.ts L33).
|
|
1230
|
+
*
|
|
1231
|
+
* @example
|
|
1232
|
+
* ```ts
|
|
1233
|
+
* import type { WorksheetViewCommon } from '@xlvane/compat';
|
|
1234
|
+
*
|
|
1235
|
+
* const value: WorksheetViewCommon | undefined = undefined;
|
|
1236
|
+
* console.log(value);
|
|
1237
|
+
* ```
|
|
1238
|
+
*/
|
|
1239
|
+
interface WorksheetViewCommon {
|
|
1240
|
+
rightToLeft: boolean;
|
|
1241
|
+
activeCell: string;
|
|
1242
|
+
showRuler: boolean;
|
|
1243
|
+
showRowColHeaders: boolean;
|
|
1244
|
+
showGridLines: boolean;
|
|
1245
|
+
zoomScale: number;
|
|
1246
|
+
zoomScaleNormal: number;
|
|
1247
|
+
}
|
|
1248
|
+
/**
|
|
1249
|
+
* A normal worksheet view (exceljs `WorksheetViewNormal`, index.d.ts L72).
|
|
1250
|
+
*
|
|
1251
|
+
* @example
|
|
1252
|
+
* ```ts
|
|
1253
|
+
* import type { WorksheetViewNormal } from '@xlvane/compat';
|
|
1254
|
+
*
|
|
1255
|
+
* const value: WorksheetViewNormal | undefined = { state: 'normal', style: 'pageLayout' };
|
|
1256
|
+
* console.log(value);
|
|
1257
|
+
* ```
|
|
1258
|
+
*/
|
|
1259
|
+
interface WorksheetViewNormal {
|
|
1260
|
+
state: "normal";
|
|
1261
|
+
style: "pageBreakPreview" | "pageLayout";
|
|
1262
|
+
}
|
|
1263
|
+
/**
|
|
1264
|
+
* A view with frozen rows and columns (exceljs `WorksheetViewFrozen`, index.d.ts L84).
|
|
1265
|
+
*
|
|
1266
|
+
* @example
|
|
1267
|
+
* ```ts
|
|
1268
|
+
* import type { WorksheetViewFrozen } from '@xlvane/compat';
|
|
1269
|
+
*
|
|
1270
|
+
* const value: WorksheetViewFrozen | undefined = { state: 'frozen', ySplit: 1 };
|
|
1271
|
+
* console.log(value);
|
|
1272
|
+
* ```
|
|
1273
|
+
*/
|
|
1274
|
+
interface WorksheetViewFrozen {
|
|
1275
|
+
state: "frozen";
|
|
1276
|
+
style?: "pageBreakPreview";
|
|
1277
|
+
xSplit?: number;
|
|
1278
|
+
ySplit?: number;
|
|
1279
|
+
topLeftCell?: string;
|
|
1280
|
+
}
|
|
1281
|
+
/**
|
|
1282
|
+
* A view split into panes (exceljs `WorksheetViewSplit`, index.d.ts L113).
|
|
1283
|
+
*
|
|
1284
|
+
* @example
|
|
1285
|
+
* ```ts
|
|
1286
|
+
* import type { WorksheetViewSplit } from '@xlvane/compat';
|
|
1287
|
+
*
|
|
1288
|
+
* const value: WorksheetViewSplit | undefined = { state: 'split', xSplit: 2000, ySplit: 3000 };
|
|
1289
|
+
* console.log(value);
|
|
1290
|
+
* ```
|
|
1291
|
+
*/
|
|
1292
|
+
interface WorksheetViewSplit {
|
|
1293
|
+
state: "split";
|
|
1294
|
+
style?: "pageBreakPreview" | "pageLayout";
|
|
1295
|
+
xSplit?: number;
|
|
1296
|
+
ySplit?: number;
|
|
1297
|
+
topLeftCell?: string;
|
|
1298
|
+
activePane?: "topLeft" | "topRight" | "bottomLeft" | "bottomRight";
|
|
1299
|
+
}
|
|
1300
|
+
/**
|
|
1301
|
+
* A window of the workbook (exceljs `WorkbookView`, index.d.ts L151).
|
|
1302
|
+
*
|
|
1303
|
+
* @example
|
|
1304
|
+
* ```ts
|
|
1305
|
+
* import type { WorkbookView } from '@xlvane/compat';
|
|
1306
|
+
*
|
|
1307
|
+
* const value: WorkbookView | undefined = { x: 0, y: 0, width: 10000, height: 20000, firstSheet: 0, activeTab: 0, visibility: 'visible' };
|
|
1308
|
+
* console.log(value);
|
|
1309
|
+
* ```
|
|
1310
|
+
*/
|
|
1311
|
+
interface WorkbookView {
|
|
1312
|
+
x: number;
|
|
1313
|
+
y: number;
|
|
1314
|
+
width: number;
|
|
1315
|
+
height: number;
|
|
1316
|
+
firstSheet: number;
|
|
1317
|
+
activeTab: number;
|
|
1318
|
+
visibility: string;
|
|
1319
|
+
}
|
|
1320
|
+
/**
|
|
1321
|
+
* A pattern fill (exceljs `FillPattern`, index.d.ts L167).
|
|
1322
|
+
*
|
|
1323
|
+
* @example
|
|
1324
|
+
* ```ts
|
|
1325
|
+
* import type { FillPattern } from '@xlvane/compat';
|
|
1326
|
+
*
|
|
1327
|
+
* const value: FillPattern | undefined = { type: 'pattern', pattern: 'solid', fgColor: { argb: 'FFFFFF00' } };
|
|
1328
|
+
* console.log(value);
|
|
1329
|
+
* ```
|
|
1330
|
+
*/
|
|
1331
|
+
interface FillPattern {
|
|
1332
|
+
type: "pattern";
|
|
1333
|
+
pattern: FillPatterns;
|
|
1334
|
+
fgColor?: Partial<Color>;
|
|
1335
|
+
bgColor?: Partial<Color>;
|
|
1336
|
+
}
|
|
1337
|
+
/**
|
|
1338
|
+
* A cell that shares the formula of a master cell (exceljs `CellSharedFormulaValue`, index.d.ts L357).
|
|
1339
|
+
*
|
|
1340
|
+
* @example
|
|
1341
|
+
* ```ts
|
|
1342
|
+
* import type { CellSharedFormulaValue } from '@xlvane/compat';
|
|
1343
|
+
*
|
|
1344
|
+
* const value: CellSharedFormulaValue | undefined = { sharedFormula: 'A1', result: 2 };
|
|
1345
|
+
* console.log(value);
|
|
1346
|
+
* ```
|
|
1347
|
+
*/
|
|
1348
|
+
interface CellSharedFormulaValue {
|
|
1349
|
+
sharedFormula: string;
|
|
1350
|
+
readonly formula?: string;
|
|
1351
|
+
result?: number | string | boolean | Date | CellErrorValue;
|
|
1352
|
+
date1904?: boolean;
|
|
1353
|
+
}
|
|
1354
|
+
/**
|
|
1355
|
+
* A picture anchor (exceljs `IAnchor`, index.d.ts L893).
|
|
1356
|
+
*
|
|
1357
|
+
* @example
|
|
1358
|
+
* ```ts
|
|
1359
|
+
* import type { IAnchor } from '@xlvane/compat';
|
|
1360
|
+
*
|
|
1361
|
+
* const value: IAnchor | undefined = undefined;
|
|
1362
|
+
* console.log(value);
|
|
1363
|
+
* ```
|
|
1364
|
+
*/
|
|
1365
|
+
interface IAnchor {
|
|
1366
|
+
col: number;
|
|
1367
|
+
row: number;
|
|
1368
|
+
nativeCol: number;
|
|
1369
|
+
nativeRow: number;
|
|
1370
|
+
nativeColOff: number;
|
|
1371
|
+
nativeRowOff: number;
|
|
1372
|
+
}
|
|
1373
|
+
/**
|
|
1374
|
+
* Fields shared by conditional formatting rules (exceljs `ConditionalFormattingBaseRule`, index.d.ts L1015).
|
|
1375
|
+
*
|
|
1376
|
+
* @example
|
|
1377
|
+
* ```ts
|
|
1378
|
+
* import type { ConditionalFormattingBaseRule } from '@xlvane/compat';
|
|
1379
|
+
*
|
|
1380
|
+
* const value: ConditionalFormattingBaseRule | undefined = { priority: 1 };
|
|
1381
|
+
* console.log(value);
|
|
1382
|
+
* ```
|
|
1383
|
+
*/
|
|
1384
|
+
interface ConditionalFormattingBaseRule {
|
|
1385
|
+
priority: number;
|
|
1386
|
+
style?: Partial<Style>;
|
|
1387
|
+
}
|
|
1388
|
+
/**
|
|
1389
|
+
* A `top10` conditional formatting rule (exceljs `Top10RuleType`, index.d.ts L1031).
|
|
1390
|
+
*
|
|
1391
|
+
* @example
|
|
1392
|
+
* ```ts
|
|
1393
|
+
* import type { Top10RuleType } from '@xlvane/compat';
|
|
1394
|
+
*
|
|
1395
|
+
* const value: Top10RuleType | undefined = { type: 'top10', rank: 5, percent: false, bottom: false };
|
|
1396
|
+
* console.log(value);
|
|
1397
|
+
* ```
|
|
1398
|
+
*/
|
|
1399
|
+
interface Top10RuleType {
|
|
1400
|
+
type: "top10";
|
|
1401
|
+
priority?: number;
|
|
1402
|
+
style?: Partial<Style>;
|
|
1403
|
+
rank: number;
|
|
1404
|
+
percent: boolean;
|
|
1405
|
+
bottom: boolean;
|
|
1406
|
+
}
|
|
1407
|
+
/**
|
|
1408
|
+
* `worksheet.properties` (exceljs `WorksheetProperties`, index.d.ts L1392).
|
|
1409
|
+
*
|
|
1410
|
+
* @example
|
|
1411
|
+
* ```ts
|
|
1412
|
+
* import type { WorksheetProperties } from '@xlvane/compat';
|
|
1413
|
+
*
|
|
1414
|
+
* const value: WorksheetProperties | undefined = { tabColor: { argb: 'FFFF0000' } } as WorksheetProperties;
|
|
1415
|
+
* console.log(value);
|
|
1416
|
+
* ```
|
|
1417
|
+
*/
|
|
1418
|
+
interface WorksheetProperties {
|
|
1419
|
+
tabColor: Partial<Color>;
|
|
1420
|
+
outlineLevelCol: number;
|
|
1421
|
+
outlineLevelRow: number;
|
|
1422
|
+
outlineProperties: {
|
|
1423
|
+
summaryBelow: boolean;
|
|
1424
|
+
summaryRight: boolean;
|
|
1425
|
+
};
|
|
1426
|
+
defaultRowHeight: number;
|
|
1427
|
+
defaultColWidth?: number;
|
|
1428
|
+
dyDescent: number;
|
|
1429
|
+
showGridLines: boolean;
|
|
1430
|
+
}
|
|
1431
|
+
/**
|
|
1432
|
+
* Options of `addWorksheet()` (exceljs `AddWorksheetOptions`, index.d.ts L1431).
|
|
1433
|
+
*
|
|
1434
|
+
* @example
|
|
1435
|
+
* ```ts
|
|
1436
|
+
* import type { AddWorksheetOptions } from '@xlvane/compat';
|
|
1437
|
+
*
|
|
1438
|
+
* const value: AddWorksheetOptions | undefined = { state: 'hidden' } as Partial<AddWorksheetOptions> as AddWorksheetOptions;
|
|
1439
|
+
* console.log(value);
|
|
1440
|
+
* ```
|
|
1441
|
+
*/
|
|
1442
|
+
interface AddWorksheetOptions {
|
|
1443
|
+
properties: Partial<WorksheetProperties>;
|
|
1444
|
+
pageSetup: Partial<PageSetup>;
|
|
1445
|
+
headerFooter: Partial<HeaderFooter>;
|
|
1446
|
+
views: Array<Partial<WorksheetView>>;
|
|
1447
|
+
state: WorksheetState;
|
|
1448
|
+
}
|
|
1449
|
+
/**
|
|
1450
|
+
* One defined name and its ranges (exceljs `DefinedNamesRanges`, index.d.ts L1654).
|
|
1451
|
+
*
|
|
1452
|
+
* @example
|
|
1453
|
+
* ```ts
|
|
1454
|
+
* import type { DefinedNamesRanges } from '@xlvane/compat';
|
|
1455
|
+
*
|
|
1456
|
+
* const value: DefinedNamesRanges | undefined = { name: 'Totals', ranges: ['Sheet1!$A$1'] };
|
|
1457
|
+
* console.log(value);
|
|
1458
|
+
* ```
|
|
1459
|
+
*/
|
|
1460
|
+
interface DefinedNamesRanges {
|
|
1461
|
+
name: string;
|
|
1462
|
+
ranges: string[];
|
|
1463
|
+
}
|
|
1464
|
+
/**
|
|
1465
|
+
* `workbook.definedNames.model` (exceljs `DefinedNamesModel`, index.d.ts L1659).
|
|
1466
|
+
*
|
|
1467
|
+
* @example
|
|
1468
|
+
* ```ts
|
|
1469
|
+
* import type { DefinedNamesModel } from '@xlvane/compat';
|
|
1470
|
+
*
|
|
1471
|
+
* const value: DefinedNamesModel | undefined = [];
|
|
1472
|
+
* console.log(value);
|
|
1473
|
+
* ```
|
|
1474
|
+
*/
|
|
1475
|
+
type DefinedNamesModel = DefinedNamesRanges[];
|
|
1476
|
+
/**
|
|
1477
|
+
* The style of a table (exceljs `TableStyleProperties`, index.d.ts L1783). `theme` is any table style name, such as `TableStyleMedium2`.
|
|
1478
|
+
*
|
|
1479
|
+
* @example
|
|
1480
|
+
* ```ts
|
|
1481
|
+
* import type { TableStyleProperties } from '@xlvane/compat';
|
|
1482
|
+
*
|
|
1483
|
+
* const value: TableStyleProperties | undefined = { theme: 'TableStyleMedium2', showRowStripes: true };
|
|
1484
|
+
* console.log(value);
|
|
1485
|
+
* ```
|
|
1486
|
+
*/
|
|
1487
|
+
interface TableStyleProperties {
|
|
1488
|
+
theme?: string;
|
|
1489
|
+
showFirstColumn?: boolean;
|
|
1490
|
+
showLastColumn?: boolean;
|
|
1491
|
+
showRowStripes?: boolean;
|
|
1492
|
+
showColumnStripes?: boolean;
|
|
1493
|
+
}
|
|
1494
|
+
/**
|
|
1495
|
+
* exceljs `config` (index.d.ts L1906): declared by exceljs for a custom Promise library; exceljs does
|
|
1496
|
+
* not export it at run time either.
|
|
1497
|
+
*
|
|
1498
|
+
* @example
|
|
1499
|
+
* ```ts
|
|
1500
|
+
* import type { config } from '@xlvane/compat';
|
|
1501
|
+
*
|
|
1502
|
+
* type SetValue = typeof config.setValue;
|
|
1503
|
+
* const kind: SetValue | undefined = undefined;
|
|
1504
|
+
* console.log(kind);
|
|
1505
|
+
* ```
|
|
1506
|
+
*/
|
|
1507
|
+
declare namespace config {
|
|
1508
|
+
function setValue(key: "promise", promise: unknown): void;
|
|
1509
|
+
}
|
|
1510
|
+
/**
|
|
1511
|
+
* A colour: `argb` such as `"FFFF0000"`, or a theme index (with optional tint), or an indexed colour.
|
|
1512
|
+
*
|
|
1513
|
+
* @example
|
|
1514
|
+
* ```ts
|
|
1515
|
+
* import type { Color } from '@xlvane/compat';
|
|
1516
|
+
*
|
|
1517
|
+
* const red: Partial<Color> = { argb: 'FFFF0000' };
|
|
1518
|
+
* ```
|
|
1519
|
+
*/
|
|
1520
|
+
interface Color {
|
|
1521
|
+
argb: string;
|
|
1522
|
+
theme: number;
|
|
1523
|
+
tint: number;
|
|
1524
|
+
indexed: number;
|
|
1525
|
+
}
|
|
1526
|
+
/**
|
|
1527
|
+
* Font of a cell (exceljs `Font`); every property is written and read back.
|
|
1528
|
+
*
|
|
1529
|
+
* @example
|
|
1530
|
+
* ```ts
|
|
1531
|
+
* import type { Font } from '@xlvane/compat';
|
|
1532
|
+
*
|
|
1533
|
+
* const font: Partial<Font> = { name: 'Arial', size: 12, bold: true, color: { argb: 'FF1F4E79' } };
|
|
1534
|
+
* ```
|
|
1535
|
+
*/
|
|
1536
|
+
interface Font {
|
|
1537
|
+
name: string;
|
|
1538
|
+
size: number;
|
|
1539
|
+
family: number;
|
|
1540
|
+
scheme: "minor" | "major" | "none";
|
|
1541
|
+
charset: number;
|
|
1542
|
+
color: Partial<Color>;
|
|
1543
|
+
bold: boolean;
|
|
1544
|
+
italic: boolean;
|
|
1545
|
+
underline: boolean | "none" | "single" | "double" | "singleAccounting" | "doubleAccounting";
|
|
1546
|
+
vertAlign: "superscript" | "subscript";
|
|
1547
|
+
strike: boolean;
|
|
1548
|
+
outline: boolean;
|
|
1549
|
+
}
|
|
1550
|
+
/**
|
|
1551
|
+
* Fill patterns.
|
|
1552
|
+
*
|
|
1553
|
+
* @example
|
|
1554
|
+
* ```ts
|
|
1555
|
+
* import type { FillPatterns } from '@xlvane/compat';
|
|
1556
|
+
*
|
|
1557
|
+
* const pattern: FillPatterns = 'solid';
|
|
1558
|
+
* ```
|
|
1559
|
+
*/
|
|
1560
|
+
type FillPatterns = "none" | "solid" | "darkVertical" | "darkHorizontal" | "darkGrid" | "darkTrellis" | "darkDown" | "darkUp" | "lightVertical" | "lightHorizontal" | "lightGrid" | "lightTrellis" | "lightDown" | "lightUp" | "darkGray" | "mediumGray" | "lightGray" | "gray125" | "gray0625";
|
|
1561
|
+
/**
|
|
1562
|
+
* A pattern fill (`pattern`, `fgColor`, `bgColor`) or a gradient fill, as in exceljs: `gradient:
|
|
1563
|
+
* 'angle'` with `degree`, or `gradient: 'path'` with `center: { left, top }`, and `stops: [{
|
|
1564
|
+
* position, color }]` (X4-27).
|
|
1565
|
+
*
|
|
1566
|
+
* @example
|
|
1567
|
+
* ```ts
|
|
1568
|
+
* import type { Fill } from '@xlvane/compat';
|
|
1569
|
+
*
|
|
1570
|
+
* const fill: Fill = { type: 'pattern', pattern: 'solid', fgColor: { argb: 'FFFFFF00' } };
|
|
1571
|
+
* const gradient: Fill = { type: 'gradient', gradient: 'angle', degree: 90, stops: [{ position: 0, color: { argb: 'FFFFFFFF' } }, { position: 1, color: { argb: 'FF4472C4' } }] };
|
|
1572
|
+
* ```
|
|
1573
|
+
*/
|
|
1574
|
+
interface Fill {
|
|
1575
|
+
type: "pattern" | "gradient";
|
|
1576
|
+
pattern?: FillPatterns;
|
|
1577
|
+
fgColor?: Partial<Color>;
|
|
1578
|
+
bgColor?: Partial<Color>;
|
|
1579
|
+
gradient?: "angle" | "path";
|
|
1580
|
+
degree?: number;
|
|
1581
|
+
center?: {
|
|
1582
|
+
left: number;
|
|
1583
|
+
top: number;
|
|
1584
|
+
};
|
|
1585
|
+
stops?: GradientStop[];
|
|
1586
|
+
}
|
|
1587
|
+
/**
|
|
1588
|
+
* Border line styles.
|
|
1589
|
+
*
|
|
1590
|
+
* @example
|
|
1591
|
+
* ```ts
|
|
1592
|
+
* import type { BorderStyle } from '@xlvane/compat';
|
|
1593
|
+
*
|
|
1594
|
+
* const style: BorderStyle = 'thin';
|
|
1595
|
+
* ```
|
|
1596
|
+
*/
|
|
1597
|
+
type BorderStyle = "thin" | "dotted" | "hair" | "medium" | "double" | "thick" | "dashed" | "dashDot" | "dashDotDot" | "slantDashDot" | "mediumDashed" | "mediumDashDotDot" | "mediumDashDot";
|
|
1598
|
+
/**
|
|
1599
|
+
* One edge of a border.
|
|
1600
|
+
*
|
|
1601
|
+
* @example
|
|
1602
|
+
* ```ts
|
|
1603
|
+
* import type { Border } from '@xlvane/compat';
|
|
1604
|
+
*
|
|
1605
|
+
* const edge: Partial<Border> = { style: 'thin', color: { argb: 'FF000000' } };
|
|
1606
|
+
* ```
|
|
1607
|
+
*/
|
|
1608
|
+
interface Border {
|
|
1609
|
+
style: BorderStyle;
|
|
1610
|
+
color: Partial<Color>;
|
|
1611
|
+
}
|
|
1612
|
+
/**
|
|
1613
|
+
* Borders of a cell; `diagonal` has `up` and `down` flags, written only with a style (X4-27).
|
|
1614
|
+
*
|
|
1615
|
+
* @example
|
|
1616
|
+
* ```ts
|
|
1617
|
+
* import type { Borders } from '@xlvane/compat';
|
|
1618
|
+
*
|
|
1619
|
+
* const border: Partial<Borders> = { top: { style: 'thin' }, bottom: { style: 'double' } };
|
|
1620
|
+
* ```
|
|
1621
|
+
*/
|
|
1622
|
+
interface Borders {
|
|
1623
|
+
top: Partial<Border>;
|
|
1624
|
+
left: Partial<Border>;
|
|
1625
|
+
bottom: Partial<Border>;
|
|
1626
|
+
right: Partial<Border>;
|
|
1627
|
+
diagonal: Partial<Border> & {
|
|
1628
|
+
up?: boolean;
|
|
1629
|
+
down?: boolean;
|
|
1630
|
+
};
|
|
1631
|
+
}
|
|
1632
|
+
/**
|
|
1633
|
+
* Alignment of a cell. `textRotation` is −90…90 or `'vertical'`; `readingOrder` is `'ltr'` or `'rtl'` (X4-27).
|
|
1634
|
+
*
|
|
1635
|
+
* @example
|
|
1636
|
+
* ```ts
|
|
1637
|
+
* import type { Alignment } from '@xlvane/compat';
|
|
1638
|
+
*
|
|
1639
|
+
* const alignment: Partial<Alignment> = { horizontal: 'center', vertical: 'middle', wrapText: true };
|
|
1640
|
+
* ```
|
|
1641
|
+
*/
|
|
1642
|
+
interface Alignment {
|
|
1643
|
+
horizontal: "left" | "center" | "right" | "fill" | "justify" | "centerContinuous" | "distributed";
|
|
1644
|
+
vertical: "top" | "middle" | "bottom" | "distributed" | "justify";
|
|
1645
|
+
wrapText: boolean;
|
|
1646
|
+
shrinkToFit: boolean;
|
|
1647
|
+
indent: number;
|
|
1648
|
+
readingOrder: "rtl" | "ltr";
|
|
1649
|
+
textRotation: number | "vertical";
|
|
1650
|
+
}
|
|
1651
|
+
/**
|
|
1652
|
+
* The style of a cell, row or column.
|
|
1653
|
+
*
|
|
1654
|
+
* @example
|
|
1655
|
+
* ```ts
|
|
1656
|
+
* import type { Style } from '@xlvane/compat';
|
|
1657
|
+
*
|
|
1658
|
+
* const style: Partial<Style> = { numFmt: '#,##0.00', font: { bold: true } };
|
|
1659
|
+
* ```
|
|
1660
|
+
*/
|
|
1661
|
+
interface Style {
|
|
1662
|
+
numFmt?: string | undefined;
|
|
1663
|
+
font?: Partial<Font> | undefined;
|
|
1664
|
+
fill?: Fill | undefined;
|
|
1665
|
+
border?: Partial<Borders> | undefined;
|
|
1666
|
+
alignment?: Partial<Alignment> | undefined;
|
|
1667
|
+
protection?: Partial<Protection> | undefined;
|
|
1668
|
+
}
|
|
1669
|
+
/**
|
|
1670
|
+
* Cell protection; it takes effect when the sheet is protected (X4-27).
|
|
1671
|
+
*
|
|
1672
|
+
* @example
|
|
1673
|
+
* ```ts
|
|
1674
|
+
* import type { Protection } from '@xlvane/compat';
|
|
1675
|
+
*
|
|
1676
|
+
* const unlocked: Partial<Protection> = { locked: false };
|
|
1677
|
+
* ```
|
|
1678
|
+
*/
|
|
1679
|
+
interface Protection {
|
|
1680
|
+
locked: boolean;
|
|
1681
|
+
hidden: boolean;
|
|
1682
|
+
}
|
|
1683
|
+
/**
|
|
1684
|
+
* An error value of a cell.
|
|
1685
|
+
*
|
|
1686
|
+
* @example
|
|
1687
|
+
* ```ts
|
|
1688
|
+
* import type { CellErrorValue } from '@xlvane/compat';
|
|
1689
|
+
*
|
|
1690
|
+
* const na: CellErrorValue = { error: '#N/A' };
|
|
1691
|
+
* ```
|
|
1692
|
+
*/
|
|
1693
|
+
interface CellErrorValue {
|
|
1694
|
+
error: "#N/A" | "#REF!" | "#NAME?" | "#DIV/0!" | "#NULL!" | "#VALUE!" | "#NUM!";
|
|
1695
|
+
}
|
|
1696
|
+
/**
|
|
1697
|
+
* A formula with an optional cached result. xlvane does not calculate formulas.
|
|
1698
|
+
*
|
|
1699
|
+
* @example
|
|
1700
|
+
* ```ts
|
|
1701
|
+
* import type { CellFormulaValue } from '@xlvane/compat';
|
|
1702
|
+
*
|
|
1703
|
+
* const total: CellFormulaValue = { formula: 'SUM(B2:B10)', result: 120 };
|
|
1704
|
+
* ```
|
|
1705
|
+
*/
|
|
1706
|
+
interface CellFormulaValue {
|
|
1707
|
+
formula: string;
|
|
1708
|
+
result?: number | string | boolean | Date | CellErrorValue;
|
|
1709
|
+
date1904?: boolean;
|
|
1710
|
+
}
|
|
1711
|
+
/**
|
|
1712
|
+
* A cell value, including rich text (`{ richText: [{ text, font? }] }`) and hyperlinks
|
|
1713
|
+
* (`{ text, hyperlink, tooltip? }`; a `hyperlink` starting with `#` is a place in the workbook).
|
|
1714
|
+
* Shared-string values are not supported (`XLV_E_NOT_SUPPORTED` when set); shared formulas are
|
|
1715
|
+
* written as ordinary formulas.
|
|
1716
|
+
*
|
|
1717
|
+
* @example
|
|
1718
|
+
* ```ts
|
|
1719
|
+
* import type { CellValue } from '@xlvane/compat';
|
|
1720
|
+
*
|
|
1721
|
+
* const values: CellValue[] = [
|
|
1722
|
+
* 1, 'text', true, new Date(), null, { formula: 'A1*2' }, { error: '#N/A' },
|
|
1723
|
+
* { richText: [{ font: { bold: true }, text: 'Bold' }, { text: ' plain' }] },
|
|
1724
|
+
* { text: 'Docs', hyperlink: 'https://example.com', tooltip: 'Open the docs' },
|
|
1725
|
+
* { text: 'Totals', hyperlink: "#'Sheet 2'!A1" },
|
|
1726
|
+
* ];
|
|
1727
|
+
* ```
|
|
1728
|
+
*/
|
|
1729
|
+
type CellValue = null | undefined | number | string | boolean | Date | CellErrorValue | CellFormulaValue | CellRichTextValue | CellHyperlinkValue | CellSharedFormulaValue | Record<string, unknown>;
|
|
1730
|
+
/**
|
|
1731
|
+
* A column definition for `worksheet.columns`.
|
|
1732
|
+
*
|
|
1733
|
+
* @example
|
|
1734
|
+
* ```ts
|
|
1735
|
+
* import type { ColumnDefn } from '@xlvane/compat';
|
|
1736
|
+
*
|
|
1737
|
+
* const column: Partial<ColumnDefn> = { header: 'Total', key: 'total', width: 12, style: { numFmt: '#,##0.00' } };
|
|
1738
|
+
* ```
|
|
1739
|
+
*/
|
|
1740
|
+
interface ColumnDefn {
|
|
1741
|
+
header?: string | string[] | undefined;
|
|
1742
|
+
key?: string | undefined;
|
|
1743
|
+
width?: number | undefined;
|
|
1744
|
+
style?: Style | undefined;
|
|
1745
|
+
hidden?: boolean | undefined;
|
|
1746
|
+
outlineLevel?: number | undefined;
|
|
1747
|
+
}
|
|
1748
|
+
/**
|
|
1749
|
+
* A worksheet view. The first view of a worksheet is written: frozen panes (`xSplit`/`ySplit`
|
|
1750
|
+
* in columns and rows) or a split window (`state: "split"`, `xSplit`/`ySplit` in 1/20 point),
|
|
1751
|
+
* `zoomScale`, `zoomScaleNormal`, `showGridLines`, `showRowColHeaders`, `showRuler`,
|
|
1752
|
+
* `rightToLeft`, `style`, `topLeftCell` (not for frozen panes, whose top-left cell follows the
|
|
1753
|
+
* split) and `activeCell`. `activePane` follows from the panes; further views are not written.
|
|
1754
|
+
*
|
|
1755
|
+
* @example
|
|
1756
|
+
* ```ts
|
|
1757
|
+
* import type { WorksheetView } from '@xlvane/compat';
|
|
1758
|
+
*
|
|
1759
|
+
* const view: WorksheetView = { state: 'frozen', xSplit: 1, ySplit: 1 };
|
|
1760
|
+
* ```
|
|
1761
|
+
*/
|
|
1762
|
+
interface WorksheetView {
|
|
1763
|
+
state?: "normal" | "frozen" | "split";
|
|
1764
|
+
xSplit?: number;
|
|
1765
|
+
ySplit?: number;
|
|
1766
|
+
topLeftCell?: string | undefined;
|
|
1767
|
+
activeCell?: string;
|
|
1768
|
+
showGridLines?: boolean;
|
|
1769
|
+
zoomScale?: number;
|
|
1770
|
+
[key: string]: unknown;
|
|
1771
|
+
}
|
|
1772
|
+
/**
|
|
1773
|
+
* Options for `workbook.addWorksheet()`, as in exceljs (index.d.ts `AddWorksheetOptions`).
|
|
1774
|
+
*
|
|
1775
|
+
* @example
|
|
1776
|
+
* ```ts
|
|
1777
|
+
* import type { WorksheetOptions } from '@xlvane/compat';
|
|
1778
|
+
*
|
|
1779
|
+
* const options: WorksheetOptions = { state: 'hidden', views: [{ state: 'frozen', ySplit: 1 }] };
|
|
1780
|
+
* ```
|
|
1781
|
+
*/
|
|
1782
|
+
interface WorksheetOptions {
|
|
1783
|
+
state?: "visible" | "hidden" | "veryHidden";
|
|
1784
|
+
views?: WorksheetView[];
|
|
1785
|
+
properties?: Record<string, unknown>;
|
|
1786
|
+
pageSetup?: Partial<PageSetup>;
|
|
1787
|
+
headerFooter?: Partial<HeaderFooter>;
|
|
1788
|
+
}
|
|
1789
|
+
/**
|
|
1790
|
+
* A cell note (`cell.note = string | Comment`), as in exceljs (index.d.ts `Comment`, lib/doc/note.js).
|
|
1791
|
+
* `texts` are rich text runs. `margins` (`inset` in centimetres: left, top, right, bottom),
|
|
1792
|
+
* `protection` and `editAs` set the box that shows the note, as in exceljs (D-E07).
|
|
1793
|
+
*
|
|
1794
|
+
* @example
|
|
1795
|
+
* ```ts
|
|
1796
|
+
* import type { Comment } from '@xlvane/compat';
|
|
1797
|
+
*
|
|
1798
|
+
* const note: Comment = { texts: [{ font: { bold: true }, text: 'Check: ' }, { text: 'estimate only' }] };
|
|
1799
|
+
* ```
|
|
1800
|
+
*/
|
|
1801
|
+
interface Comment {
|
|
1802
|
+
texts?: {
|
|
1803
|
+
text: string;
|
|
1804
|
+
font?: Partial<Font>;
|
|
1805
|
+
}[];
|
|
1806
|
+
margins?: {
|
|
1807
|
+
insetmode?: "auto" | "custom";
|
|
1808
|
+
inset?: number[];
|
|
1809
|
+
};
|
|
1810
|
+
protection?: {
|
|
1811
|
+
locked?: "True" | "False";
|
|
1812
|
+
lockText?: "True" | "False";
|
|
1813
|
+
};
|
|
1814
|
+
editAs?: "twoCells" | "oneCells" | "absolute";
|
|
1815
|
+
}
|
|
1816
|
+
/**
|
|
1817
|
+
* A data validation (`cell.dataValidation`, `worksheet.dataValidations`), as in exceljs
|
|
1818
|
+
* (index.d.ts `DataValidation`). `'any'` is a validation that only shows its input message.
|
|
1819
|
+
* `formulae` are formulas (`'"Yes,No"'` for a literal list, `'$D$1:$D$9'` for a range), numbers or
|
|
1820
|
+
* dates; reading gives numbers for whole, decimal and textLength validations and dates for date
|
|
1821
|
+
* validations, as exceljs does.
|
|
1822
|
+
*
|
|
1823
|
+
* @example
|
|
1824
|
+
* ```ts
|
|
1825
|
+
* import type { DataValidation } from '@xlvane/compat';
|
|
1826
|
+
*
|
|
1827
|
+
* const rule: DataValidation = { type: 'whole', operator: 'between', allowBlank: true, formulae: [1, 10], showErrorMessage: true, error: '1 to 10' };
|
|
1828
|
+
* ```
|
|
1829
|
+
*/
|
|
1830
|
+
interface DataValidation {
|
|
1831
|
+
type: "list" | "whole" | "decimal" | "date" | "time" | "textLength" | "custom" | "any";
|
|
1832
|
+
formulae?: unknown[];
|
|
1833
|
+
allowBlank?: boolean;
|
|
1834
|
+
operator?: "between" | "notBetween" | "equal" | "notEqual" | "greaterThan" | "lessThan" | "greaterThanOrEqual" | "lessThanOrEqual";
|
|
1835
|
+
error?: string;
|
|
1836
|
+
errorTitle?: string;
|
|
1837
|
+
errorStyle?: "stop" | "warning" | "information" | "error";
|
|
1838
|
+
prompt?: string;
|
|
1839
|
+
promptTitle?: string;
|
|
1840
|
+
showErrorMessage?: boolean;
|
|
1841
|
+
showInputMessage?: boolean;
|
|
1842
|
+
}
|
|
1843
|
+
/**
|
|
1844
|
+
* A conditional formatting rule, as in exceljs (index.d.ts `ConditionalFormattingRule`): the
|
|
1845
|
+
* rule type with its own properties (`formulae`, `operator`, `rank`, `cfvo`, `color`, `iconSet`,
|
|
1846
|
+
* `text`, `timePeriod`, …) and the `style` applied where the rule is true.
|
|
1847
|
+
*
|
|
1848
|
+
* @example
|
|
1849
|
+
* ```ts
|
|
1850
|
+
* import type { ConditionalFormattingRule } from '@xlvane/compat';
|
|
1851
|
+
*
|
|
1852
|
+
* const rule: ConditionalFormattingRule = { type: 'cellIs', operator: 'greaterThan', formulae: [100], style: { font: { bold: true } } };
|
|
1853
|
+
* ```
|
|
1854
|
+
*/
|
|
1855
|
+
type ConditionalFormattingRule = ExpressionRuleType | CellIsRuleType | Top10RuleType | AboveAverageRuleType | ColorScaleRuleType | IconSetRuleType | ContainsTextRuleType | TimePeriodRuleType | DataBarRuleType;
|
|
1856
|
+
/**
|
|
1857
|
+
* The argument of `worksheet.addConditionalFormatting()`: the range and its rules.
|
|
1858
|
+
*
|
|
1859
|
+
* @example
|
|
1860
|
+
* ```ts
|
|
1861
|
+
* import type { ConditionalFormattingOptions } from '@xlvane/compat';
|
|
1862
|
+
*
|
|
1863
|
+
* const cf: ConditionalFormattingOptions = { ref: 'B2:B20', rules: [{ type: 'top10', rank: 3, percent: false, bottom: false, style: { fill: { type: 'pattern', pattern: 'solid', bgColor: { argb: 'FFFFC7CE' } } } }] };
|
|
1864
|
+
* ```
|
|
1865
|
+
*/
|
|
1866
|
+
interface ConditionalFormattingOptions {
|
|
1867
|
+
ref: string;
|
|
1868
|
+
rules: ConditionalFormattingRule[];
|
|
1869
|
+
}
|
|
1870
|
+
/**
|
|
1871
|
+
* Page setup of a worksheet (`worksheet.pageSetup`), as in exceljs (index.d.ts `PageSetup`).
|
|
1872
|
+
* `printArea` (several areas joined by `&&`), `printTitlesRow` (`'1:2'`) and `printTitlesColumn`
|
|
1873
|
+
* (`'A:B'`) are stored as the built-in names Excel uses.
|
|
1874
|
+
*
|
|
1875
|
+
* @example
|
|
1876
|
+
* ```ts
|
|
1877
|
+
* import type { PageSetup } from '@xlvane/compat';
|
|
1878
|
+
*
|
|
1879
|
+
* const setup: Partial<PageSetup> = { orientation: 'landscape', paperSize: 9, fitToPage: true, fitToWidth: 1, fitToHeight: 0, printArea: 'A1:G40' };
|
|
1880
|
+
* ```
|
|
1881
|
+
*/
|
|
1882
|
+
interface PageSetup {
|
|
1883
|
+
margins?: {
|
|
1884
|
+
left: number;
|
|
1885
|
+
right: number;
|
|
1886
|
+
top: number;
|
|
1887
|
+
bottom: number;
|
|
1888
|
+
header: number;
|
|
1889
|
+
footer: number;
|
|
1890
|
+
} | undefined;
|
|
1891
|
+
orientation?: "portrait" | "landscape" | undefined;
|
|
1892
|
+
horizontalDpi?: number | undefined;
|
|
1893
|
+
verticalDpi?: number | undefined;
|
|
1894
|
+
fitToPage?: boolean | undefined;
|
|
1895
|
+
pageOrder?: "downThenOver" | "overThenDown" | undefined;
|
|
1896
|
+
blackAndWhite?: boolean | undefined;
|
|
1897
|
+
draft?: boolean | undefined;
|
|
1898
|
+
cellComments?: "atEnd" | "asDisplayed" | "asDisplyed" | "None" | undefined;
|
|
1899
|
+
errors?: "dash" | "blank" | "NA" | "displayed" | undefined;
|
|
1900
|
+
scale?: number | undefined;
|
|
1901
|
+
fitToWidth?: number | undefined;
|
|
1902
|
+
fitToHeight?: number | undefined;
|
|
1903
|
+
paperSize?: number | undefined;
|
|
1904
|
+
showRowColHeaders?: boolean | undefined;
|
|
1905
|
+
showGridLines?: boolean | undefined;
|
|
1906
|
+
firstPageNumber?: number | undefined;
|
|
1907
|
+
useFirstPageNumber?: boolean | undefined;
|
|
1908
|
+
usePrinterDefaults?: boolean | undefined;
|
|
1909
|
+
copies?: number | undefined;
|
|
1910
|
+
horizontalCentered?: boolean | undefined;
|
|
1911
|
+
verticalCentered?: boolean | undefined;
|
|
1912
|
+
rowBreaks?: unknown | undefined;
|
|
1913
|
+
colBreaks?: unknown | undefined;
|
|
1914
|
+
printArea?: string | undefined;
|
|
1915
|
+
printTitlesRow?: string | undefined;
|
|
1916
|
+
printTitlesColumn?: string | undefined;
|
|
1917
|
+
}
|
|
1918
|
+
/**
|
|
1919
|
+
* Headers and footers of a worksheet (`worksheet.headerFooter`), as in exceljs (index.d.ts
|
|
1920
|
+
* `HeaderFooter`). The texts use Excel's codes (`&C` centre section, `&P` page number, …).
|
|
1921
|
+
*
|
|
1922
|
+
* @example
|
|
1923
|
+
* ```ts
|
|
1924
|
+
* import type { HeaderFooter } from '@xlvane/compat';
|
|
1925
|
+
*
|
|
1926
|
+
* const hf: HeaderFooter = { oddHeader: '&CQuarterly report', oddFooter: '&RPage &P of &N' };
|
|
1927
|
+
* ```
|
|
1928
|
+
*/
|
|
1929
|
+
interface HeaderFooter {
|
|
1930
|
+
differentFirst?: boolean;
|
|
1931
|
+
differentOddEven?: boolean;
|
|
1932
|
+
oddHeader?: string | null;
|
|
1933
|
+
oddFooter?: string | null;
|
|
1934
|
+
evenHeader?: string | null;
|
|
1935
|
+
evenFooter?: string | null;
|
|
1936
|
+
firstHeader?: string | null;
|
|
1937
|
+
firstFooter?: string | null;
|
|
1938
|
+
}
|
|
1939
|
+
/**
|
|
1940
|
+
* A manual row break (`worksheet.rowBreaks`), as `row.addPageBreak()` stores it in exceljs:
|
|
1941
|
+
* the page ends after row `id`.
|
|
1942
|
+
*
|
|
1943
|
+
* @example
|
|
1944
|
+
* ```ts
|
|
1945
|
+
* import type { RowBreak } from '@xlvane/compat';
|
|
1946
|
+
*
|
|
1947
|
+
* const pageEndsAfterRow20: RowBreak = { id: 20, max: 16383, man: 1 };
|
|
1948
|
+
* ```
|
|
1949
|
+
*/
|
|
1950
|
+
interface RowBreak {
|
|
1951
|
+
id: number;
|
|
1952
|
+
max?: number;
|
|
1953
|
+
min?: number;
|
|
1954
|
+
man?: number;
|
|
1955
|
+
}
|
|
1956
|
+
/**
|
|
1957
|
+
* Options of `worksheet.protect()`, as in exceljs (index.d.ts `WorksheetProtection`): `true`
|
|
1958
|
+
* allows users to do the action on the protected sheet.
|
|
1959
|
+
*
|
|
1960
|
+
* @example
|
|
1961
|
+
* ```ts
|
|
1962
|
+
* import type { WorksheetProtection } from '@xlvane/compat';
|
|
1963
|
+
*
|
|
1964
|
+
* const options: Partial<WorksheetProtection> = { formatCells: true, sort: true, autoFilter: true };
|
|
1965
|
+
* ```
|
|
1966
|
+
*/
|
|
1967
|
+
interface WorksheetProtection {
|
|
1968
|
+
objects: boolean;
|
|
1969
|
+
scenarios: boolean;
|
|
1970
|
+
selectLockedCells: boolean;
|
|
1971
|
+
selectUnlockedCells: boolean;
|
|
1972
|
+
formatCells: boolean;
|
|
1973
|
+
formatColumns: boolean;
|
|
1974
|
+
formatRows: boolean;
|
|
1975
|
+
insertColumns: boolean;
|
|
1976
|
+
insertRows: boolean;
|
|
1977
|
+
insertHyperlinks: boolean;
|
|
1978
|
+
deleteColumns: boolean;
|
|
1979
|
+
deleteRows: boolean;
|
|
1980
|
+
sort: boolean;
|
|
1981
|
+
autoFilter: boolean;
|
|
1982
|
+
pivotTables: boolean;
|
|
1983
|
+
spinCount: number;
|
|
1984
|
+
}
|
|
1985
|
+
/** The totals functions of a table column (exceljs `TableColumnProperties.totalsRowFunction`). */
|
|
1986
|
+
type TotalsFunction = "none" | "average" | "countNums" | "count" | "max" | "min" | "stdDev" | "var" | "sum" | "custom";
|
|
1987
|
+
/**
|
|
1988
|
+
* A column of a table, as in exceljs `TableColumnProperties`. `style` is applied to the column's
|
|
1989
|
+
* cells (header, data and totals), as exceljs does.
|
|
1990
|
+
*
|
|
1991
|
+
* @example
|
|
1992
|
+
* ```ts
|
|
1993
|
+
* import type { TableColumnProperties } from '@xlvane/compat';
|
|
1994
|
+
*
|
|
1995
|
+
* const column: TableColumnProperties = { name: 'Revenue', totalsRowFunction: 'sum', filterButton: true };
|
|
1996
|
+
* ```
|
|
1997
|
+
*/
|
|
1998
|
+
interface TableColumnProperties {
|
|
1999
|
+
name: string;
|
|
2000
|
+
filterButton?: boolean | undefined;
|
|
2001
|
+
totalsRowLabel?: string | undefined;
|
|
2002
|
+
totalsRowFunction?: TotalsFunction | undefined;
|
|
2003
|
+
totalsRowFormula?: string | undefined;
|
|
2004
|
+
totalsRowResult?: unknown;
|
|
2005
|
+
style?: Partial<Style> | undefined;
|
|
2006
|
+
}
|
|
2007
|
+
/**
|
|
2008
|
+
* The definition of a table, as in exceljs `TableProperties` (`worksheet.addTable`). `ref` is the
|
|
2009
|
+
* top-left cell; the table covers the header row, the rows and the totals row.
|
|
2010
|
+
*
|
|
2011
|
+
* @example
|
|
2012
|
+
* ```ts
|
|
2013
|
+
* import type { TableProperties } from '@xlvane/compat';
|
|
2014
|
+
*
|
|
2015
|
+
* const table: TableProperties = {
|
|
2016
|
+
* name: 'Sales',
|
|
2017
|
+
* ref: 'A1',
|
|
2018
|
+
* totalsRow: true,
|
|
2019
|
+
* columns: [{ name: 'Region', totalsRowLabel: 'Total' }, { name: 'Revenue', totalsRowFunction: 'sum' }],
|
|
2020
|
+
* rows: [['North', 1200], ['South', 980]],
|
|
2021
|
+
* };
|
|
2022
|
+
* ```
|
|
2023
|
+
*/
|
|
2024
|
+
interface TableProperties {
|
|
2025
|
+
name: string;
|
|
2026
|
+
displayName?: string | undefined;
|
|
2027
|
+
ref: string;
|
|
2028
|
+
headerRow?: boolean | undefined;
|
|
2029
|
+
totalsRow?: boolean | undefined;
|
|
2030
|
+
style?: {
|
|
2031
|
+
theme?: string | null | undefined;
|
|
2032
|
+
showFirstColumn?: boolean | undefined;
|
|
2033
|
+
showLastColumn?: boolean | undefined;
|
|
2034
|
+
showRowStripes?: boolean | undefined;
|
|
2035
|
+
showColumnStripes?: boolean | undefined;
|
|
2036
|
+
} | undefined;
|
|
2037
|
+
columns: TableColumnProperties[];
|
|
2038
|
+
rows: unknown[][];
|
|
2039
|
+
}
|
|
2040
|
+
/** The model of a table: exceljs's fields plus the computed ranges (lib/doc/table.js L129–178). */
|
|
2041
|
+
interface TableModel extends TableProperties {
|
|
2042
|
+
tl: {
|
|
2043
|
+
row: number;
|
|
2044
|
+
col: number;
|
|
2045
|
+
};
|
|
2046
|
+
autoFilterRef: string;
|
|
2047
|
+
tableRef: string;
|
|
2048
|
+
}
|
|
2049
|
+
/**
|
|
2050
|
+
* A column of a table, as exceljs `Table.getColumn()` returns it. Changing `name` or the totals
|
|
2051
|
+
* settings takes effect at `table.commit()`.
|
|
2052
|
+
*
|
|
2053
|
+
* @example
|
|
2054
|
+
* ```ts
|
|
2055
|
+
* import ExcelJS from '@xlvane/compat';
|
|
2056
|
+
*
|
|
2057
|
+
* const sheet = new ExcelJS.Workbook().addWorksheet('Data');
|
|
2058
|
+
* const table = sheet.addTable({ name: 'Sales', ref: 'A1', columns: [{ name: 'Region' }, { name: 'Revenue' }], rows: [['North', 1200]] });
|
|
2059
|
+
* table.getColumn(1).totalsRowFunction = 'sum';
|
|
2060
|
+
* table.totalsRow = true;
|
|
2061
|
+
* table.commit();
|
|
2062
|
+
* ```
|
|
2063
|
+
*/
|
|
2064
|
+
export declare class TableColumn {
|
|
2065
|
+
readonly table: Table;
|
|
2066
|
+
readonly column: TableColumnProperties;
|
|
2067
|
+
readonly index: number;
|
|
2068
|
+
/** @internal */
|
|
2069
|
+
constructor(table: Table, column: TableColumnProperties, index: number);
|
|
2070
|
+
private set_;
|
|
2071
|
+
get name(): string;
|
|
2072
|
+
set name(v: string);
|
|
2073
|
+
get filterButton(): boolean | undefined;
|
|
2074
|
+
set filterButton(v: boolean | undefined);
|
|
2075
|
+
get style(): Partial<Style> | undefined;
|
|
2076
|
+
set style(v: Partial<Style> | undefined);
|
|
2077
|
+
get totalsRowLabel(): string | undefined;
|
|
2078
|
+
set totalsRowLabel(v: string | undefined);
|
|
2079
|
+
get totalsRowFunction(): TotalsFunction | undefined;
|
|
2080
|
+
set totalsRowFunction(v: TotalsFunction | undefined);
|
|
2081
|
+
get totalsRowResult(): unknown;
|
|
2082
|
+
set totalsRowResult(v: unknown);
|
|
2083
|
+
get totalsRowFormula(): string | undefined;
|
|
2084
|
+
set totalsRowFormula(v: string | undefined);
|
|
2085
|
+
}
|
|
2086
|
+
/**
|
|
2087
|
+
* A table on a worksheet, as exceljs `Table` (lib/doc/table.js). `worksheet.addTable()` writes
|
|
2088
|
+
* the header, rows and totals into the cells; methods that change the table take effect at
|
|
2089
|
+
* `commit()`, which clears the old area and writes the new one. Names and ranges follow Excel's
|
|
2090
|
+
* rules (`XLV_E_INVALID_TABLE`), which exceljs does not check.
|
|
2091
|
+
*
|
|
2092
|
+
* @example
|
|
2093
|
+
* ```ts
|
|
2094
|
+
* import ExcelJS from '@xlvane/compat';
|
|
2095
|
+
*
|
|
2096
|
+
* const sheet = new ExcelJS.Workbook().addWorksheet('Data');
|
|
2097
|
+
* const table = sheet.addTable({
|
|
2098
|
+
* name: 'Sales',
|
|
2099
|
+
* ref: 'B2',
|
|
2100
|
+
* columns: [{ name: 'Region' }, { name: 'Revenue' }],
|
|
2101
|
+
* rows: [['North', 1200]],
|
|
2102
|
+
* });
|
|
2103
|
+
* table.addRow(['South', 980]);
|
|
2104
|
+
* table.commit();
|
|
2105
|
+
* console.log(table.ref, sheet.getCell('C4').value); // "B2" 980
|
|
2106
|
+
* ```
|
|
2107
|
+
*/
|
|
2108
|
+
export declare class Table {
|
|
2109
|
+
readonly worksheet: Worksheet;
|
|
2110
|
+
/** @internal */
|
|
2111
|
+
table: TableModel;
|
|
2112
|
+
/** @internal Read from a file: a custom style name is then written without the name (D-R01). */
|
|
2113
|
+
readonly fromFile: boolean;
|
|
2114
|
+
private _cache;
|
|
2115
|
+
/** @internal Use `worksheet.addTable()`. */
|
|
2116
|
+
constructor(worksheet: Worksheet, table: TableProperties, store?: boolean);
|
|
2117
|
+
get width(): number;
|
|
2118
|
+
get height(): number;
|
|
2119
|
+
get filterHeight(): number;
|
|
2120
|
+
get tableHeight(): number;
|
|
2121
|
+
/** The formula of a column's totals cell, or `null` (exceljs `getFormula`, with the codes of [MS-OI29500]). */
|
|
2122
|
+
getFormula(column: TableColumnProperties): string | null;
|
|
2123
|
+
/**
|
|
2124
|
+
* Sets the defaults of exceljs and computes the ranges (table.js L129–178), then checks the
|
|
2125
|
+
* table against Excel's rules through xlvane, so that a table Excel would reject is refused
|
|
2126
|
+
* here rather than when the file is written.
|
|
2127
|
+
*/
|
|
2128
|
+
validate(): void;
|
|
2129
|
+
/** Writes the header, rows and totals into the worksheet's cells (exceljs `store`, table.js L180–234). */
|
|
2130
|
+
store(): void;
|
|
2131
|
+
/** @internal Remembers the table's area before the first change, for `commit()`. */
|
|
2132
|
+
cacheState(): void;
|
|
2133
|
+
/**
|
|
2134
|
+
* Applies the changes made since the last commit: clears the area the table left and writes
|
|
2135
|
+
* it again (table.js L295–335). The cache is cleared, so later changes are committed too
|
|
2136
|
+
* (exceljs keeps the first cache and clears the wrong cells after a second change).
|
|
2137
|
+
*/
|
|
2138
|
+
commit(): void;
|
|
2139
|
+
/** Adds a row of data at the end, or before the row with index `rowNumber` (0-based). */
|
|
2140
|
+
addRow(values: unknown[], rowNumber?: number): void;
|
|
2141
|
+
/** Removes `count` rows of data from index `rowIndex` (0-based). */
|
|
2142
|
+
removeRows(rowIndex: number, count?: number): void;
|
|
2143
|
+
/** The column with index `colIndex` (0-based). */
|
|
2144
|
+
getColumn(colIndex: number): TableColumn;
|
|
2145
|
+
/** Adds a column with its values, at the end or before index `colIndex` (0-based). */
|
|
2146
|
+
addColumn(column: TableColumnProperties, values: unknown[], colIndex?: number): void;
|
|
2147
|
+
/** Removes `count` columns from index `colIndex` (0-based), with their values. */
|
|
2148
|
+
removeColumns(colIndex: number, count?: number): void;
|
|
2149
|
+
/** The table's model, as exceljs `table.model`, with `ref` and `rows`. */
|
|
2150
|
+
get model(): TableProperties & {
|
|
2151
|
+
tableRef: string;
|
|
2152
|
+
autoFilterRef: string;
|
|
2153
|
+
};
|
|
2154
|
+
set model(v: TableProperties & {
|
|
2155
|
+
tableRef: string;
|
|
2156
|
+
autoFilterRef: string;
|
|
2157
|
+
});
|
|
2158
|
+
get ref(): string;
|
|
2159
|
+
set ref(v: string);
|
|
2160
|
+
get name(): string;
|
|
2161
|
+
set name(v: string);
|
|
2162
|
+
/** The display name; `name` when not set. exceljs reads a misspelled field here (`displyName`). */
|
|
2163
|
+
get displayName(): string;
|
|
2164
|
+
set displayName(v: string);
|
|
2165
|
+
get headerRow(): boolean;
|
|
2166
|
+
set headerRow(v: boolean);
|
|
2167
|
+
get totalsRow(): boolean;
|
|
2168
|
+
set totalsRow(v: boolean);
|
|
2169
|
+
/** The table style name. exceljs reads and writes `style.name` here, which is never written to the file. */
|
|
2170
|
+
get theme(): string | null | undefined;
|
|
2171
|
+
set theme(v: string | null | undefined);
|
|
2172
|
+
get showFirstColumn(): boolean;
|
|
2173
|
+
set showFirstColumn(v: boolean);
|
|
2174
|
+
get showLastColumn(): boolean;
|
|
2175
|
+
set showLastColumn(v: boolean);
|
|
2176
|
+
get showRowStripes(): boolean;
|
|
2177
|
+
set showRowStripes(v: boolean);
|
|
2178
|
+
get showColumnStripes(): boolean;
|
|
2179
|
+
set showColumnStripes(v: boolean);
|
|
2180
|
+
}
|
|
2181
|
+
/**
|
|
2182
|
+
* An image of the workbook, as exceljs `Image` (`workbook.addImage`). Give the file contents as
|
|
2183
|
+
* `buffer` (bytes) or `base64` (a data URL or plain base64). xlvane recognises PNG, JPEG and GIF
|
|
2184
|
+
* from the bytes; `extension` is kept but not used. `filename` names a file that is read when the
|
|
2185
|
+
* workbook is written (Node.js, Bun, Deno), as exceljs reads it (xlsx.js addMedia L421–442).
|
|
2186
|
+
*
|
|
2187
|
+
* @example
|
|
2188
|
+
* ```ts
|
|
2189
|
+
* import type { ImageData } from '@xlvane/compat';
|
|
2190
|
+
*
|
|
2191
|
+
* declare const png: Uint8Array;
|
|
2192
|
+
* const image: ImageData = { buffer: png, extension: 'png' };
|
|
2193
|
+
* ```
|
|
2194
|
+
*/
|
|
2195
|
+
interface ImageData {
|
|
2196
|
+
extension?: string;
|
|
2197
|
+
buffer?: Uint8Array;
|
|
2198
|
+
base64?: string;
|
|
2199
|
+
filename?: string;
|
|
2200
|
+
/** Set when read from a file: the media part's name without extension, as exceljs reads it. */
|
|
2201
|
+
name?: string;
|
|
2202
|
+
/** `"image"`, as in exceljs's media list. */
|
|
2203
|
+
type?: "image";
|
|
2204
|
+
}
|
|
2205
|
+
/** A corner of a picture as exceljs models it (lib/doc/anchor.js): a 0-based cell and an offset in EMU. */
|
|
2206
|
+
interface AnchorModel {
|
|
2207
|
+
nativeCol: number;
|
|
2208
|
+
nativeColOff: number;
|
|
2209
|
+
nativeRow: number;
|
|
2210
|
+
nativeRowOff: number;
|
|
2211
|
+
}
|
|
2212
|
+
/**
|
|
2213
|
+
* A corner of a picture, as exceljs `Anchor` (lib/doc/anchor.js): `nativeCol` and `nativeRow`
|
|
2214
|
+
* are 0-based, the offsets are in EMU, and `col`/`row` give the position as a fraction of the
|
|
2215
|
+
* cell, using exceljs's cell sizes (640000 per default column, 180000 per default row,
|
|
2216
|
+
* `width * 10000` and `height * 10000` for custom ones).
|
|
2217
|
+
*
|
|
2218
|
+
* @example
|
|
2219
|
+
* ```ts
|
|
2220
|
+
* import ExcelJS from '@xlvane/compat';
|
|
2221
|
+
*
|
|
2222
|
+
* const workbook = new ExcelJS.Workbook();
|
|
2223
|
+
* const sheet = workbook.addWorksheet('Report');
|
|
2224
|
+
* declare const png: Uint8Array;
|
|
2225
|
+
* sheet.addImage(workbook.addImage({ buffer: png, extension: 'png' }), 'B2:D6');
|
|
2226
|
+
* const corner = sheet.getImages()[0]?.range?.tl;
|
|
2227
|
+
* console.log(corner?.nativeCol, corner?.col); // 1 1
|
|
2228
|
+
* ```
|
|
2229
|
+
*/
|
|
2230
|
+
export declare class Anchor implements AnchorModel {
|
|
2231
|
+
readonly worksheet: Worksheet | undefined;
|
|
2232
|
+
nativeCol: number;
|
|
2233
|
+
nativeColOff: number;
|
|
2234
|
+
nativeRow: number;
|
|
2235
|
+
nativeRowOff: number;
|
|
2236
|
+
/** @internal */
|
|
2237
|
+
constructor(worksheet: Worksheet | undefined, address?: string | Partial<AnchorModel> | {
|
|
2238
|
+
col: number;
|
|
2239
|
+
row: number;
|
|
2240
|
+
}, offset?: number);
|
|
2241
|
+
get colWidth(): number;
|
|
2242
|
+
get rowHeight(): number;
|
|
2243
|
+
get col(): number;
|
|
2244
|
+
set col(v: number);
|
|
2245
|
+
get row(): number;
|
|
2246
|
+
set row(v: number);
|
|
2247
|
+
get model(): AnchorModel;
|
|
2248
|
+
}
|
|
2249
|
+
/**
|
|
2250
|
+
* Where a picture goes, as in exceljs `worksheet.addImage` (index.d.ts L915–928): a range such as
|
|
2251
|
+
* `"B2:D6"`, two corners `{ tl, br }`, or a corner and a size in pixels `{ tl, ext }`. Corners
|
|
2252
|
+
* are 0-based `{ col, row }` (fractions are parts of a cell) or exceljs `nativeCol` objects.
|
|
2253
|
+
*
|
|
2254
|
+
* @example
|
|
2255
|
+
* ```ts
|
|
2256
|
+
* import type { ImageRangeInput } from '@xlvane/compat';
|
|
2257
|
+
*
|
|
2258
|
+
* const cells: ImageRangeInput = 'B2:D6';
|
|
2259
|
+
* const sized: ImageRangeInput = { tl: { col: 1, row: 1 }, ext: { width: 160, height: 90 } };
|
|
2260
|
+
* ```
|
|
2261
|
+
*/
|
|
2262
|
+
type ImageRangeInput = string | {
|
|
2263
|
+
tl: string | Partial<AnchorModel> | {
|
|
2264
|
+
col: number;
|
|
2265
|
+
row: number;
|
|
2266
|
+
};
|
|
2267
|
+
br?: string | Partial<AnchorModel> | {
|
|
2268
|
+
col: number;
|
|
2269
|
+
row: number;
|
|
2270
|
+
};
|
|
2271
|
+
ext?: {
|
|
2272
|
+
width: number;
|
|
2273
|
+
height: number;
|
|
2274
|
+
};
|
|
2275
|
+
editAs?: "oneCell" | "twoCell" | "absolute";
|
|
2276
|
+
hyperlinks?: {
|
|
2277
|
+
hyperlink?: string;
|
|
2278
|
+
tooltip?: string;
|
|
2279
|
+
};
|
|
2280
|
+
};
|
|
2281
|
+
/** A picture or background of a worksheet (exceljs lib/doc/image.js). */
|
|
2282
|
+
interface SheetMedia {
|
|
2283
|
+
type: "image" | "background";
|
|
2284
|
+
imageId: number;
|
|
2285
|
+
range?: {
|
|
2286
|
+
tl: Anchor;
|
|
2287
|
+
br?: Anchor;
|
|
2288
|
+
ext?: {
|
|
2289
|
+
width: number;
|
|
2290
|
+
height: number;
|
|
2291
|
+
};
|
|
2292
|
+
editAs?: string;
|
|
2293
|
+
hyperlinks?: {
|
|
2294
|
+
hyperlink?: string;
|
|
2295
|
+
tooltip?: string;
|
|
2296
|
+
};
|
|
2297
|
+
};
|
|
2298
|
+
}
|
|
2299
|
+
/** A picture placed on a sheet: `range` is always set (exceljs `getImages()`, index.d.ts L1342-1346). */
|
|
2300
|
+
type SheetImageMedia = SheetMedia & {
|
|
2301
|
+
type: "image";
|
|
2302
|
+
range: NonNullable<SheetMedia["range"]>;
|
|
2303
|
+
};
|
|
2304
|
+
/**
|
|
2305
|
+
* The data validations of a worksheet (`worksheet.dataValidations`), keyed by cell address or
|
|
2306
|
+
* range as in exceljs (lib/doc/data-validations.js). `remove()` deletes the entry; exceljs
|
|
2307
|
+
* leaves an empty entry behind, which it writes as a validation without a type.
|
|
2308
|
+
*
|
|
2309
|
+
* @example
|
|
2310
|
+
* ```ts
|
|
2311
|
+
* import ExcelJS from '@xlvane/compat';
|
|
2312
|
+
*
|
|
2313
|
+
* const sheet = new ExcelJS.Workbook().addWorksheet('Form');
|
|
2314
|
+
* sheet.dataValidations.add('B2:B20', { type: 'list', allowBlank: true, formulae: ['"Yes,No"'] });
|
|
2315
|
+
* console.log(sheet.getCell('B5').dataValidation?.type); // list
|
|
2316
|
+
* ```
|
|
2317
|
+
*/
|
|
2318
|
+
export declare class DataValidations {
|
|
2319
|
+
private _model;
|
|
2320
|
+
constructor(model?: Record<string, DataValidation | undefined>);
|
|
2321
|
+
/** The validations by address or range, as exceljs `dataValidations.model`. Setting it copies the entries. */
|
|
2322
|
+
get model(): Record<string, DataValidation | undefined>;
|
|
2323
|
+
set model(value: Record<string, DataValidation | undefined>);
|
|
2324
|
+
add(address: string, validation: DataValidation): DataValidation;
|
|
2325
|
+
/** The validation of a cell: its own entry, or the entry of a range that contains it. */
|
|
2326
|
+
find(address: string): DataValidation | undefined;
|
|
2327
|
+
remove(address: string): void;
|
|
2328
|
+
}
|
|
2329
|
+
/** A splice on one axis: `count` positions from `at` are removed, then `inserts` positions are inserted at `at`. */
|
|
2330
|
+
interface SpliceChange {
|
|
2331
|
+
readonly sheet: string;
|
|
2332
|
+
readonly axis: "row" | "col";
|
|
2333
|
+
readonly at: number;
|
|
2334
|
+
readonly count: number;
|
|
2335
|
+
readonly inserts: number;
|
|
2336
|
+
}
|
|
2337
|
+
/** `results` of `fillFormula`, typed as exceljs (index.d.ts L1327). */
|
|
2338
|
+
type FillFormulaResults = ((r: number, c: number) => string | number) | number[] | number[][];
|
|
2339
|
+
/**
|
|
2340
|
+
* Value types, as in exceljs `lib/doc/enums.js` (ValueType).
|
|
2341
|
+
*
|
|
2342
|
+
* @example
|
|
2343
|
+
* ```ts
|
|
2344
|
+
* import ExcelJS from '@xlvane/compat';
|
|
2345
|
+
*
|
|
2346
|
+
* const cell = new ExcelJS.Workbook().addWorksheet('S').getCell('A1');
|
|
2347
|
+
* cell.value = 42;
|
|
2348
|
+
* console.log(cell.type === ExcelJS.ValueType.Number); // true
|
|
2349
|
+
* ```
|
|
2350
|
+
*/
|
|
2351
|
+
export declare const ValueType: {
|
|
2352
|
+
readonly Null: 0;
|
|
2353
|
+
readonly Merge: 1;
|
|
2354
|
+
readonly Number: 2;
|
|
2355
|
+
readonly String: 3;
|
|
2356
|
+
readonly Date: 4;
|
|
2357
|
+
readonly Hyperlink: 5;
|
|
2358
|
+
readonly Formula: 6;
|
|
2359
|
+
readonly SharedString: 7;
|
|
2360
|
+
readonly RichText: 8;
|
|
2361
|
+
readonly Boolean: 9;
|
|
2362
|
+
readonly Error: 10;
|
|
2363
|
+
};
|
|
2364
|
+
/** A value of {@link ValueType}, so that `ExcelJS.ValueType` also works as a type, as with the exceljs enum. */
|
|
2365
|
+
export type ValueType = (typeof ValueType)[keyof typeof ValueType];
|
|
2366
|
+
/**
|
|
2367
|
+
* Formula types, as in exceljs `lib/doc/enums.js` (FormulaType).
|
|
2368
|
+
*
|
|
2369
|
+
* @example
|
|
2370
|
+
* ```ts
|
|
2371
|
+
* import { FormulaType } from '@xlvane/compat';
|
|
2372
|
+
*
|
|
2373
|
+
* console.log(FormulaType.Master); // 1
|
|
2374
|
+
* ```
|
|
2375
|
+
*/
|
|
2376
|
+
export declare const FormulaType: {
|
|
2377
|
+
readonly None: 0;
|
|
2378
|
+
readonly Master: 1;
|
|
2379
|
+
readonly Shared: 2;
|
|
2380
|
+
};
|
|
2381
|
+
/** A value of {@link FormulaType} (usable as a type, as the exceljs enum). */
|
|
2382
|
+
export type FormulaType = (typeof FormulaType)[keyof typeof FormulaType];
|
|
2383
|
+
/**
|
|
2384
|
+
* Error values, as in exceljs `lib/doc/enums.js` (ErrorValue).
|
|
2385
|
+
*
|
|
2386
|
+
* @example
|
|
2387
|
+
* ```ts
|
|
2388
|
+
* import ExcelJS from '@xlvane/compat';
|
|
2389
|
+
*
|
|
2390
|
+
* const cell = new ExcelJS.Workbook().addWorksheet('S').getCell('A1');
|
|
2391
|
+
* cell.value = { error: ExcelJS.ErrorValue.NotApplicable };
|
|
2392
|
+
* ```
|
|
2393
|
+
*/
|
|
2394
|
+
export declare const ErrorValue: {
|
|
2395
|
+
readonly NotApplicable: "#N/A";
|
|
2396
|
+
readonly Ref: "#REF!";
|
|
2397
|
+
readonly Name: "#NAME?";
|
|
2398
|
+
readonly DivZero: "#DIV/0!";
|
|
2399
|
+
readonly Null: "#NULL!";
|
|
2400
|
+
readonly Value: "#VALUE!";
|
|
2401
|
+
readonly Num: "#NUM!";
|
|
2402
|
+
};
|
|
2403
|
+
/** A value of {@link ErrorValue} (usable as a type, as the exceljs enum). */
|
|
2404
|
+
export type ErrorValue = (typeof ErrorValue)[keyof typeof ErrorValue];
|
|
2405
|
+
/**
|
|
2406
|
+
* A cell, as exceljs `Cell` (lib/doc/cell.js).
|
|
2407
|
+
*
|
|
2408
|
+
* @example
|
|
2409
|
+
* ```ts
|
|
2410
|
+
* import ExcelJS from '@xlvane/compat';
|
|
2411
|
+
*
|
|
2412
|
+
* const sheet = new ExcelJS.Workbook().addWorksheet('Data');
|
|
2413
|
+
* const cell = sheet.getCell('B2');
|
|
2414
|
+
* cell.value = 42;
|
|
2415
|
+
* cell.font = { bold: true };
|
|
2416
|
+
* console.log(cell.address, cell.type === ExcelJS.ValueType.Number, cell.text); // B2 true 42
|
|
2417
|
+
* ```
|
|
2418
|
+
*/
|
|
2419
|
+
export declare class Cell {
|
|
2420
|
+
private readonly _row;
|
|
2421
|
+
/** @internal The column number; changed when cells are spliced. */
|
|
2422
|
+
_col: number;
|
|
2423
|
+
/** The cell's style; `font`, `fill`, … are shortcuts to its properties. */
|
|
2424
|
+
style: Style;
|
|
2425
|
+
private _value;
|
|
2426
|
+
private _note;
|
|
2427
|
+
/** @internal Master cell when this cell is part of a merged range but not its top-left cell. */
|
|
2428
|
+
_master: Cell | null;
|
|
2429
|
+
/** @internal Number of merged ranges this cell is the master of. */
|
|
2430
|
+
_mergeCount: number;
|
|
2431
|
+
/** @internal Use `worksheet.getCell()`. */
|
|
2432
|
+
constructor(_row: Row, _col: number);
|
|
2433
|
+
get worksheet(): Worksheet;
|
|
2434
|
+
get row(): number;
|
|
2435
|
+
get col(): number;
|
|
2436
|
+
get address(): string;
|
|
2437
|
+
get $col$row(): string;
|
|
2438
|
+
get value(): CellValue;
|
|
2439
|
+
set value(v: CellValue);
|
|
2440
|
+
/** The ValueType (Merge for the non-master cells of a merged range). */
|
|
2441
|
+
get type(): ValueType;
|
|
2442
|
+
/** The type of the value shown: for a formula, the type of its result. */
|
|
2443
|
+
get effectiveType(): ValueType;
|
|
2444
|
+
/** The value as text, as exceljs `cell.text`. */
|
|
2445
|
+
get text(): string;
|
|
2446
|
+
toString(): string;
|
|
2447
|
+
get isMerged(): boolean;
|
|
2448
|
+
/** The top-left cell of the merged range this cell belongs to (the cell itself otherwise). */
|
|
2449
|
+
get master(): Cell;
|
|
2450
|
+
/**
|
|
2451
|
+
* The formula text. For a `{ sharedFormula: master }` value it is the master's formula moved to
|
|
2452
|
+
* this cell, as exceljs translates it (lib/doc/cell.js `_getTranslatedFormula`; X4-29).
|
|
2453
|
+
*/
|
|
2454
|
+
get formula(): string | undefined;
|
|
2455
|
+
/** `FormulaType.Shared` for a `{ sharedFormula }` value, `Master` for other formulas, otherwise `None` (lib/doc/cell.js L807). */
|
|
2456
|
+
get formulaType(): FormulaType;
|
|
2457
|
+
get result(): unknown;
|
|
2458
|
+
get numFmt(): string | undefined;
|
|
2459
|
+
set numFmt(v: string | undefined);
|
|
2460
|
+
get font(): Partial<Font> | undefined;
|
|
2461
|
+
set font(v: Partial<Font> | undefined);
|
|
2462
|
+
get fill(): Fill | undefined;
|
|
2463
|
+
set fill(v: Fill | undefined);
|
|
2464
|
+
get border(): Partial<Borders> | undefined;
|
|
2465
|
+
set border(v: Partial<Borders> | undefined);
|
|
2466
|
+
get alignment(): Partial<Alignment> | undefined;
|
|
2467
|
+
set alignment(v: Partial<Alignment> | undefined);
|
|
2468
|
+
/** `{ locked, hidden }`, as exceljs `cell.protection` (lib/doc/cell.js); it takes effect on a protected sheet. */
|
|
2469
|
+
get protection(): Partial<Protection> | undefined;
|
|
2470
|
+
set protection(v: Partial<Protection> | undefined);
|
|
2471
|
+
/**
|
|
2472
|
+
* The cell's note: a string or `{ texts: [{ text, font? }] }`, as in exceljs (lib/doc/cell.js
|
|
2473
|
+
* L224–230). The note belongs to this cell, also inside a merged range. `undefined` removes it.
|
|
2474
|
+
*/
|
|
2475
|
+
get note(): string | Comment | undefined;
|
|
2476
|
+
set note(v: string | Comment | undefined);
|
|
2477
|
+
/** The data validation of this cell: its own, or that of a range containing it (`worksheet.dataValidations`). */
|
|
2478
|
+
get dataValidation(): DataValidation | undefined;
|
|
2479
|
+
set dataValidation(v: DataValidation | undefined);
|
|
2480
|
+
/** The link target of a `{ text, hyperlink }` value, as exceljs `cell.hyperlink` (lib/doc/cell.js L201). */
|
|
2481
|
+
get hyperlink(): string | undefined;
|
|
2482
|
+
/** Whether the value is a `{ text, hyperlink }` value (lib/doc/cell.js L197). */
|
|
2483
|
+
get isHyperlink(): boolean;
|
|
2484
|
+
get workbook(): Worksheet["workbook"];
|
|
2485
|
+
/** Whether this cell is merged into `master` (lib/doc/cell.js L185). */
|
|
2486
|
+
isMergedTo(master: Cell): boolean;
|
|
2487
|
+
/**
|
|
2488
|
+
* The value as a CSV field, as exceljs `cell.toCsvString` (lib/doc/cell.js L395–1049): text and
|
|
2489
|
+
* rich text in double quotes with `"` doubled, dates in ISO form, booleans 1/0, a link's
|
|
2490
|
+
* target, a formula's result (empty for none), an error's text (X4-30).
|
|
2491
|
+
*/
|
|
2492
|
+
toCsvString(): string;
|
|
2493
|
+
/** A plain-data snapshot `{ address, value, style, note? }` (X4-30); the setter takes the same shape. */
|
|
2494
|
+
get model(): {
|
|
2495
|
+
address: string;
|
|
2496
|
+
value: CellValue;
|
|
2497
|
+
style: Style;
|
|
2498
|
+
note?: string | Comment;
|
|
2499
|
+
};
|
|
2500
|
+
set model(m: {
|
|
2501
|
+
value?: CellValue;
|
|
2502
|
+
style?: Style;
|
|
2503
|
+
note?: string | Comment;
|
|
2504
|
+
});
|
|
2505
|
+
/** The cell's location for defined names: `{ sheetName, address, row, col }` (lib/doc/cell.js L270). */
|
|
2506
|
+
get fullAddress(): {
|
|
2507
|
+
sheetName: string;
|
|
2508
|
+
address: string;
|
|
2509
|
+
row: number;
|
|
2510
|
+
col: number;
|
|
2511
|
+
};
|
|
2512
|
+
private get definedNames();
|
|
2513
|
+
/** The first defined name that includes this cell. */
|
|
2514
|
+
get name(): string | undefined;
|
|
2515
|
+
set name(value: string);
|
|
2516
|
+
/** The defined names that include this cell. */
|
|
2517
|
+
get names(): string[];
|
|
2518
|
+
set names(value: string[]);
|
|
2519
|
+
addName(name: string): void;
|
|
2520
|
+
removeName(name: string): void;
|
|
2521
|
+
removeAllNames(): void;
|
|
2522
|
+
/**
|
|
2523
|
+
* Kept for exceljs code that calls it: exceljs deletes the cell's internal references here
|
|
2524
|
+
* (lib/doc/cell.js L41–47), after which the cell must not be used. In @xlvane/compat the cell
|
|
2525
|
+
* stays usable and nothing changes; memory is freed when the cell is no longer referenced.
|
|
2526
|
+
*/
|
|
2527
|
+
destroy(): void;
|
|
2528
|
+
/** @internal */
|
|
2529
|
+
_merge(master: Cell): void;
|
|
2530
|
+
/** @internal */
|
|
2531
|
+
_unmerge(): void;
|
|
2532
|
+
}
|
|
2533
|
+
/**
|
|
2534
|
+
* A row, as exceljs `Row` (lib/doc/row.js).
|
|
2535
|
+
*
|
|
2536
|
+
* @example
|
|
2537
|
+
* ```ts
|
|
2538
|
+
* import ExcelJS from '@xlvane/compat';
|
|
2539
|
+
*
|
|
2540
|
+
* const sheet = new ExcelJS.Workbook().addWorksheet('Data');
|
|
2541
|
+
* const row = sheet.addRow(['Tea', 3.5]);
|
|
2542
|
+
* row.font = { italic: true };
|
|
2543
|
+
* console.log(row.number, row.values); // 1 [ <1 empty item>, 'Tea', 3.5 ]
|
|
2544
|
+
* ```
|
|
2545
|
+
*/
|
|
2546
|
+
export declare class Row {
|
|
2547
|
+
readonly worksheet: Worksheet;
|
|
2548
|
+
/** Style applied to cells created in this row, and set on existing cells by the setters. */
|
|
2549
|
+
style: Style;
|
|
2550
|
+
height: number | undefined;
|
|
2551
|
+
private _hidden;
|
|
2552
|
+
/** @internal */
|
|
2553
|
+
_cells: (Cell | undefined)[];
|
|
2554
|
+
/** @internal The row number; changed when rows are spliced. */
|
|
2555
|
+
_number: number;
|
|
2556
|
+
/** @internal Use `worksheet.getRow()`. */
|
|
2557
|
+
constructor(worksheet: Worksheet, number: number);
|
|
2558
|
+
/** The row number. It follows the row when rows are inserted or removed above it. */
|
|
2559
|
+
get number(): number;
|
|
2560
|
+
get hidden(): boolean;
|
|
2561
|
+
set hidden(v: boolean);
|
|
2562
|
+
private _outlineLevel;
|
|
2563
|
+
/** Outline (grouping) level 0–7 (lib/doc/row.js L318). */
|
|
2564
|
+
get outlineLevel(): number;
|
|
2565
|
+
set outlineLevel(v: number);
|
|
2566
|
+
/** As exceljs: the level is at least the sheet's `properties.outlineLevelRow` (lib/doc/row.js L326). */
|
|
2567
|
+
get collapsed(): boolean;
|
|
2568
|
+
/**
|
|
2569
|
+
* Kept for exceljs code that calls it: exceljs deletes the row's internal references here
|
|
2570
|
+
* (lib/doc/row.js L34–38), after which the row must not be used. In @xlvane/compat the row
|
|
2571
|
+
* stays usable and nothing changes; memory is freed when the row is no longer referenced.
|
|
2572
|
+
*/
|
|
2573
|
+
destroy(): void;
|
|
2574
|
+
findCell(col: number): Cell | undefined;
|
|
2575
|
+
/** The cell at `address.col`, created if missing (lib/doc/row.js L45). */
|
|
2576
|
+
getCellEx(address: {
|
|
2577
|
+
col: number;
|
|
2578
|
+
}): Cell;
|
|
2579
|
+
/** The cell at a column number, letters or column key; created if missing. */
|
|
2580
|
+
getCell(col: number | string): Cell;
|
|
2581
|
+
/** Visits cells with a value (all cells up to the last one with `includeEmpty`). */
|
|
2582
|
+
eachCell(options: {
|
|
2583
|
+
includeEmpty?: boolean;
|
|
2584
|
+
} | ((cell: Cell, col: number) => void), iteratee?: (cell: Cell, col: number) => void): void;
|
|
2585
|
+
/** Sparse array of values, index 0 unused (lib/doc/row.js `values`). */
|
|
2586
|
+
get values(): CellValue[];
|
|
2587
|
+
/**
|
|
2588
|
+
* Replaces the row's values: a contiguous array starts at column A, a sparse array (index 0
|
|
2589
|
+
* unset) uses its indexes as column numbers, an object is matched to column keys.
|
|
2590
|
+
*/
|
|
2591
|
+
set values(value: CellValue[] | Record<string, CellValue> | null | undefined);
|
|
2592
|
+
get hasValues(): boolean;
|
|
2593
|
+
get cellCount(): number;
|
|
2594
|
+
get actualCellCount(): number;
|
|
2595
|
+
get dimensions(): {
|
|
2596
|
+
min: number;
|
|
2597
|
+
max: number;
|
|
2598
|
+
} | null;
|
|
2599
|
+
private applyStyle;
|
|
2600
|
+
get numFmt(): string | undefined;
|
|
2601
|
+
set numFmt(v: string | undefined);
|
|
2602
|
+
get font(): Partial<Font> | undefined;
|
|
2603
|
+
set font(v: Partial<Font> | undefined);
|
|
2604
|
+
get fill(): Fill | undefined;
|
|
2605
|
+
set fill(v: Fill | undefined);
|
|
2606
|
+
get border(): Partial<Borders> | undefined;
|
|
2607
|
+
set border(v: Partial<Borders> | undefined);
|
|
2608
|
+
get alignment(): Partial<Alignment> | undefined;
|
|
2609
|
+
set alignment(v: Partial<Alignment> | undefined);
|
|
2610
|
+
get protection(): Partial<Protection> | undefined;
|
|
2611
|
+
set protection(v: Partial<Protection> | undefined);
|
|
2612
|
+
/** Streaming writers write committed rows; in a normal workbook this does nothing (as in exceljs). */
|
|
2613
|
+
commit(): void;
|
|
2614
|
+
/**
|
|
2615
|
+
* Removes `count` cells from column `start` and inserts `inserts` there; the cells to the right
|
|
2616
|
+
* move with their values, styles and notes (as exceljs `row.splice`, lib/doc/row.js L77). A row
|
|
2617
|
+
* crossing a merged range at or right of `start` is refused, because the range cannot follow
|
|
2618
|
+
* cells of one row; use `worksheet.spliceColumns` or unmerge first. Formulas are not rewritten,
|
|
2619
|
+
* as in exceljs.
|
|
2620
|
+
*/
|
|
2621
|
+
splice(start: number, count: number, ...inserts: CellValue[]): void;
|
|
2622
|
+
/** @internal Moves the cell objects of this row for a column splice. */
|
|
2623
|
+
_spliceCells(change: SpliceChange, method: string): void;
|
|
2624
|
+
/**
|
|
2625
|
+
* Adds a manual page break after this row, as exceljs (lib/doc/row.js L150–162). The column
|
|
2626
|
+
* limits `lft`/`rght` are kept on the break; Office ignores them ([MS-OI29500] §2.1.589 b).
|
|
2627
|
+
*/
|
|
2628
|
+
addPageBreak(lft?: number, rght?: number): void;
|
|
2629
|
+
}
|
|
2630
|
+
/**
|
|
2631
|
+
* A column, as exceljs `Column` (lib/doc/column.js).
|
|
2632
|
+
*
|
|
2633
|
+
* @example
|
|
2634
|
+
* ```ts
|
|
2635
|
+
* import ExcelJS from '@xlvane/compat';
|
|
2636
|
+
*
|
|
2637
|
+
* const sheet = new ExcelJS.Workbook().addWorksheet('Data');
|
|
2638
|
+
* sheet.columns = [{ header: 'Name', key: 'name', width: 20 }, { header: 'Total', key: 'total' }];
|
|
2639
|
+
* sheet.getColumn('total').numFmt = '#,##0.00';
|
|
2640
|
+
* console.log(sheet.getColumn('name').letter); // A
|
|
2641
|
+
* ```
|
|
2642
|
+
*/
|
|
2643
|
+
export declare class Column {
|
|
2644
|
+
readonly worksheet: Worksheet;
|
|
2645
|
+
width: number | undefined;
|
|
2646
|
+
style: Style;
|
|
2647
|
+
private _hidden;
|
|
2648
|
+
private _key;
|
|
2649
|
+
private _header;
|
|
2650
|
+
/** @internal The column number; changed when columns are spliced. */
|
|
2651
|
+
_number: number;
|
|
2652
|
+
/** @internal Use `worksheet.getColumn()`. */
|
|
2653
|
+
constructor(worksheet: Worksheet, number: number);
|
|
2654
|
+
/** The column number. It follows the column when columns are inserted or removed before it. */
|
|
2655
|
+
get number(): number;
|
|
2656
|
+
get letter(): string;
|
|
2657
|
+
get key(): string | undefined;
|
|
2658
|
+
set key(value: string | undefined);
|
|
2659
|
+
get header(): string | string[] | undefined;
|
|
2660
|
+
set header(value: string | string[] | undefined);
|
|
2661
|
+
get headers(): (string | undefined)[];
|
|
2662
|
+
get hidden(): boolean;
|
|
2663
|
+
set hidden(v: boolean);
|
|
2664
|
+
get isCustomWidth(): boolean;
|
|
2665
|
+
private _outlineLevel;
|
|
2666
|
+
/** Outline (grouping) level 0–7 (lib/doc/column.js L116). */
|
|
2667
|
+
get outlineLevel(): number;
|
|
2668
|
+
set outlineLevel(v: number);
|
|
2669
|
+
/** As exceljs: the level is at least the sheet's `properties.outlineLevelCol` (lib/doc/column.js L124). */
|
|
2670
|
+
get collapsed(): boolean;
|
|
2671
|
+
/** A column that is written to the file only when it differs from the default (lib/doc/column.js L147). */
|
|
2672
|
+
get isDefault(): boolean;
|
|
2673
|
+
/** Number of header rows (lib/doc/column.js L164). */
|
|
2674
|
+
get headerCount(): number;
|
|
2675
|
+
/** `{ key, width, headers }` as JSON (lib/doc/column.js L130). */
|
|
2676
|
+
toString(): string;
|
|
2677
|
+
/** Same width, visibility, outline level and style (lib/doc/column.js L138). */
|
|
2678
|
+
equivalentTo(other: Column): boolean;
|
|
2679
|
+
get defn(): ColumnDefn;
|
|
2680
|
+
set defn(value: ColumnDefn | undefined);
|
|
2681
|
+
/** Cell values of this column by row number (index 0 unused). */
|
|
2682
|
+
get values(): CellValue[];
|
|
2683
|
+
set values(values: CellValue[]);
|
|
2684
|
+
eachCell(options: {
|
|
2685
|
+
includeEmpty?: boolean;
|
|
2686
|
+
} | ((cell: Cell, row: number) => void), iteratee?: (cell: Cell, row: number) => void): void;
|
|
2687
|
+
private applyStyle;
|
|
2688
|
+
get numFmt(): string | undefined;
|
|
2689
|
+
set numFmt(v: string | undefined);
|
|
2690
|
+
get font(): Partial<Font> | undefined;
|
|
2691
|
+
set font(v: Partial<Font> | undefined);
|
|
2692
|
+
get fill(): Fill | undefined;
|
|
2693
|
+
set fill(v: Fill | undefined);
|
|
2694
|
+
get border(): Partial<Borders> | undefined;
|
|
2695
|
+
set border(v: Partial<Borders> | undefined);
|
|
2696
|
+
get alignment(): Partial<Alignment> | undefined;
|
|
2697
|
+
set alignment(v: Partial<Alignment> | undefined);
|
|
2698
|
+
get protection(): Partial<Protection> | undefined;
|
|
2699
|
+
set protection(v: Partial<Protection> | undefined);
|
|
2700
|
+
}
|
|
2701
|
+
/**
|
|
2702
|
+
* A worksheet, as exceljs `Worksheet` (lib/doc/worksheet.js).
|
|
2703
|
+
*
|
|
2704
|
+
* @example
|
|
2705
|
+
* ```ts
|
|
2706
|
+
* import ExcelJS from '@xlvane/compat';
|
|
2707
|
+
*
|
|
2708
|
+
* const sheet = new ExcelJS.Workbook().addWorksheet('Sales', { views: [{ state: 'frozen', ySplit: 1 }] });
|
|
2709
|
+
* sheet.columns = [{ header: 'Region', key: 'region', width: 15 }, { header: 'Revenue', key: 'revenue' }];
|
|
2710
|
+
* sheet.addRow({ region: 'North', revenue: 1250 });
|
|
2711
|
+
* sheet.mergeCells('D1:E1');
|
|
2712
|
+
* sheet.eachRow((row, n) => console.log(n, row.values));
|
|
2713
|
+
* ```
|
|
2714
|
+
*/
|
|
2715
|
+
export declare class Worksheet {
|
|
2716
|
+
readonly workbook: {
|
|
2717
|
+
readonly _names: (exclude: Worksheet) => string[];
|
|
2718
|
+
readonly definedNames?: DefinedNames;
|
|
2719
|
+
readonly worksheets?: readonly Worksheet[];
|
|
2720
|
+
};
|
|
2721
|
+
readonly id: number;
|
|
2722
|
+
/**
|
|
2723
|
+
* The position of the sheet in `workbook.worksheets`, as exceljs `orderNo`: one more than the
|
|
2724
|
+
* largest of the other sheets for a new sheet (lib/doc/workbook.js L81-85), the 0-based position
|
|
2725
|
+
* in the file for a loaded one (L203). Worksheets are listed in this order.
|
|
2726
|
+
*/
|
|
2727
|
+
orderNo: number | undefined;
|
|
2728
|
+
state: "visible" | "hidden" | "veryHidden";
|
|
2729
|
+
views: WorksheetView[];
|
|
2730
|
+
autoFilter: string | {
|
|
2731
|
+
from: string | {
|
|
2732
|
+
row: number;
|
|
2733
|
+
column: number;
|
|
2734
|
+
};
|
|
2735
|
+
to: string | {
|
|
2736
|
+
row: number;
|
|
2737
|
+
column: number;
|
|
2738
|
+
};
|
|
2739
|
+
} | null;
|
|
2740
|
+
/** Sheet properties (exceljs `WorksheetProperties`); unknown keys are kept as given. */
|
|
2741
|
+
properties: WorksheetProperties & Record<string, unknown>;
|
|
2742
|
+
/** Printing settings, with the defaults of exceljs (lib/doc/worksheet.js L64–90). */
|
|
2743
|
+
pageSetup: PageSetup;
|
|
2744
|
+
/** Headers and footers, with the defaults of exceljs. */
|
|
2745
|
+
headerFooter: HeaderFooter;
|
|
2746
|
+
/** Manual row breaks (`row.addPageBreak()`). */
|
|
2747
|
+
rowBreaks: RowBreak[];
|
|
2748
|
+
/** Data validations by cell address or range. */
|
|
2749
|
+
dataValidations: DataValidations;
|
|
2750
|
+
/** Conditional formats, in the order they were added. */
|
|
2751
|
+
conditionalFormattings: ConditionalFormattingOptions[];
|
|
2752
|
+
/** The protection set by `protect()`, or `null`. */
|
|
2753
|
+
sheetProtection: (Partial<WorksheetProtection> & {
|
|
2754
|
+
sheet?: boolean;
|
|
2755
|
+
[key: string]: unknown;
|
|
2756
|
+
}) | null;
|
|
2757
|
+
/** @internal */
|
|
2758
|
+
_rows: (Row | undefined)[];
|
|
2759
|
+
/** @internal */
|
|
2760
|
+
_columns: Column[];
|
|
2761
|
+
/** @internal */
|
|
2762
|
+
_merges: Map<string, {
|
|
2763
|
+
top: number;
|
|
2764
|
+
left: number;
|
|
2765
|
+
bottom: number;
|
|
2766
|
+
right: number;
|
|
2767
|
+
}>;
|
|
2768
|
+
private readonly _keys;
|
|
2769
|
+
private _name;
|
|
2770
|
+
/** @internal Use `workbook.addWorksheet()`. */
|
|
2771
|
+
constructor(workbook: {
|
|
2772
|
+
readonly _names: (exclude: Worksheet) => string[];
|
|
2773
|
+
readonly definedNames?: DefinedNames;
|
|
2774
|
+
readonly worksheets?: readonly Worksheet[];
|
|
2775
|
+
}, id: number, name: string | undefined, options: WorksheetOptions | undefined);
|
|
2776
|
+
get name(): string;
|
|
2777
|
+
/** Sheet name rules of exceljs (lib/doc/worksheet.js L134–173), including truncation to 31 characters. */
|
|
2778
|
+
set name(value: string);
|
|
2779
|
+
/** Deprecated in exceljs in favour of `properties.tabColor`, which it reads and sets (lib/doc/worksheet.js L827). */
|
|
2780
|
+
get tabColor(): unknown;
|
|
2781
|
+
set tabColor(value: unknown);
|
|
2782
|
+
get columns(): Column[];
|
|
2783
|
+
set columns(defs: ColumnDefn[]);
|
|
2784
|
+
/** @internal */
|
|
2785
|
+
findColumn(n: number): Column | undefined;
|
|
2786
|
+
getColumn(c: number | string): Column;
|
|
2787
|
+
getColumnKey(key: string): Column | undefined;
|
|
2788
|
+
setColumnKey(key: string, column: Column): void;
|
|
2789
|
+
deleteColumnKey(key: string): void;
|
|
2790
|
+
eachColumnKey(f: (column: Column, key: string) => void): void;
|
|
2791
|
+
get columnCount(): number;
|
|
2792
|
+
get actualColumnCount(): number;
|
|
2793
|
+
/**
|
|
2794
|
+
* Removes `count` columns from `start` and inserts one column per item of `inserts` there; each
|
|
2795
|
+
* insert is an array of values by row (index 0 is row 1). Columns to the right move with their
|
|
2796
|
+
* cells, widths, styles, keys and notes, and merged ranges, the autofilter, defined names and
|
|
2797
|
+
* formulas follow, as in a spreadsheet application (exceljs 4.4.0 moves values and styles only,
|
|
2798
|
+
* docs/exceljs-compat.md). Falsy insert values such as `0` are kept.
|
|
2799
|
+
*/
|
|
2800
|
+
spliceColumns(start: number, count: number, ...inserts: CellValue[][]): void;
|
|
2801
|
+
/** @internal Rows already written and dropped by a streaming writer still count. */
|
|
2802
|
+
_committedRows: number;
|
|
2803
|
+
private get lastRowNumber();
|
|
2804
|
+
get rowCount(): number;
|
|
2805
|
+
get actualRowCount(): number;
|
|
2806
|
+
get lastRow(): Row | undefined;
|
|
2807
|
+
findRow(r: number): Row | undefined;
|
|
2808
|
+
getRow(r: number): Row;
|
|
2809
|
+
getRows(start: number, length: number): Row[] | undefined;
|
|
2810
|
+
/** Adds a row after the last one; style `'i'` / `'i+'` copies the style of the row above (exceljs `addRow`). */
|
|
2811
|
+
addRow(values: CellValue[] | Record<string, CellValue>, style?: string): Row;
|
|
2812
|
+
addRows(rows: (CellValue[] | Record<string, CellValue>)[], style?: string): Row[];
|
|
2813
|
+
/**
|
|
2814
|
+
* Inserts a row at `pos`; the rows from `pos` down move one row down. `style` copies a style as
|
|
2815
|
+
* exceljs does: `'i'` from the row above, `'o'` from the row below (the one that moved down),
|
|
2816
|
+
* with `+` also for empty cells, `'n'` none.
|
|
2817
|
+
*/
|
|
2818
|
+
insertRow(pos: number, value?: CellValue[] | Record<string, CellValue> | null, style?: string): Row;
|
|
2819
|
+
/** Inserts one row per item of `values` at `pos`, with the style options of `insertRow`. */
|
|
2820
|
+
insertRows(pos: number, values: (CellValue[] | Record<string, CellValue> | null)[], style?: string): Row[] | undefined;
|
|
2821
|
+
/**
|
|
2822
|
+
* Makes `count` copies of row `rowNum` below it, inserting new rows with `insert = true` or
|
|
2823
|
+
* overwriting the rows below with `insert = false` (the default of exceljs's code; its README
|
|
2824
|
+
* says `true`). Copies get the values, styles and height and the merged ranges inside the row;
|
|
2825
|
+
* a formula is copied as a spreadsheet application copies a cell: its relative references move by
|
|
2826
|
+
* the distance of the copy. With `insert = true` the rows below move first and every formula
|
|
2827
|
+
* follows (spliceRows); with `insert = false` the rows below are overwritten in place, merged
|
|
2828
|
+
* ranges that touch them are removed, and no other formula changes.
|
|
2829
|
+
*/
|
|
2830
|
+
duplicateRow(rowNum: number, count: number, insert?: boolean): void;
|
|
2831
|
+
/**
|
|
2832
|
+
* Removes `count` rows from `start` and inserts one row per item of `inserts` (an array or object
|
|
2833
|
+
* of values) there. Rows below move with their cells, styles, heights, hidden flag and notes, and
|
|
2834
|
+
* merged ranges, the autofilter, defined names and formulas follow, as in a spreadsheet
|
|
2835
|
+
* application. exceljs 4.4.0 moves values, styles and heights only (docs/exceljs-compat.md).
|
|
2836
|
+
*/
|
|
2837
|
+
spliceRows(start: number, count: number, ...inserts: (CellValue[] | Record<string, CellValue> | null | undefined)[]): void;
|
|
2838
|
+
/** exceljs `_setStyleOption` (worksheet.js L444–450). */
|
|
2839
|
+
private _setStyleOption;
|
|
2840
|
+
/** exceljs `_copyStyle` (worksheet.js L452–461), with copies instead of shared style objects. */
|
|
2841
|
+
private _copyStyle;
|
|
2842
|
+
/** @internal Removes every merged range and returns them, for a splice. */
|
|
2843
|
+
_takeMerges(): {
|
|
2844
|
+
top: number;
|
|
2845
|
+
left: number;
|
|
2846
|
+
bottom: number;
|
|
2847
|
+
right: number;
|
|
2848
|
+
}[];
|
|
2849
|
+
/**
|
|
2850
|
+
* @internal Merges the ranges again at their new place: a range loses the removed rows or
|
|
2851
|
+
* columns, grows when rows or columns are inserted inside it, and disappears when one cell or
|
|
2852
|
+
* nothing is left. When the top-left cell was removed, the new top-left cell becomes the master
|
|
2853
|
+
* with its own (empty) value.
|
|
2854
|
+
*/
|
|
2855
|
+
_restoreMerges(merges: readonly {
|
|
2856
|
+
top: number;
|
|
2857
|
+
left: number;
|
|
2858
|
+
bottom: number;
|
|
2859
|
+
right: number;
|
|
2860
|
+
}[], change: SpliceChange): void;
|
|
2861
|
+
/**
|
|
2862
|
+
* @internal Merges a range without the overlap check of `mergeCells`. Cells keep their own
|
|
2863
|
+
* style, except those for which `takeMasterStyle` returns true (cells inserted inside the range),
|
|
2864
|
+
* which get a copy of the master's style; style objects are never shared.
|
|
2865
|
+
*/
|
|
2866
|
+
_mergeRange(range: {
|
|
2867
|
+
top: number;
|
|
2868
|
+
left: number;
|
|
2869
|
+
bottom: number;
|
|
2870
|
+
right: number;
|
|
2871
|
+
}, takeMasterStyle?: (r: number, c: number) => boolean): void;
|
|
2872
|
+
/**
|
|
2873
|
+
* @internal The autofilter range and every formula of the workbook follow a splice of this
|
|
2874
|
+
* sheet. `formulas` are the new texts computed by `_checkFormulas` before the splice.
|
|
2875
|
+
*/
|
|
2876
|
+
_afterSplice(change: SpliceChange, formulas: ReadonlyMap<Cell, Record<string, unknown>>): void;
|
|
2877
|
+
/**
|
|
2878
|
+
* @internal Refuses a splice that tables or pictures cannot follow, before anything changes:
|
|
2879
|
+
* tables do not move in @xlvane/compat (as in exceljs), so rows or columns may not be inserted
|
|
2880
|
+
* or removed at or before a table's last row or column; a picture corner in a removed row or
|
|
2881
|
+
* column has no place to go.
|
|
2882
|
+
*/
|
|
2883
|
+
_checkMedia(change: SpliceChange, method: string): void;
|
|
2884
|
+
/**
|
|
2885
|
+
* @internal Computes the new text of every formula of the workbook that `change` alters, and
|
|
2886
|
+
* throws before anything changes when one cannot follow it. Each formula is parsed once.
|
|
2887
|
+
*/
|
|
2888
|
+
_checkFormulas(change: SpliceChange, method: string): Map<Cell, Record<string, unknown>>;
|
|
2889
|
+
private _sheetNames;
|
|
2890
|
+
private _eachFormula;
|
|
2891
|
+
eachRow(options: {
|
|
2892
|
+
includeEmpty?: boolean;
|
|
2893
|
+
} | ((row: Row, n: number) => void), iteratee?: (row: Row, n: number) => void): void;
|
|
2894
|
+
getSheetValues(): CellValue[][];
|
|
2895
|
+
/** @internal Overridden by the streaming writer. */
|
|
2896
|
+
_commitRow(_row: Row): void;
|
|
2897
|
+
findCell(r: number | string, c?: number): Cell | undefined;
|
|
2898
|
+
getCell(r: number | string, c?: number | string): Cell;
|
|
2899
|
+
/**
|
|
2900
|
+
* The range of the cells with values, as an exceljs `Range` (worksheet.js L186): `top`, `left`,
|
|
2901
|
+
* `bottom`, `right`, `tl`, `br`, `range`, `model` and `toString()`. An empty sheet gives the
|
|
2902
|
+
* model `{ top: 0, left: 0, bottom: 0, right: 0 }` and the range "A1:A1", as in exceljs.
|
|
2903
|
+
*/
|
|
2904
|
+
get dimensions(): Range;
|
|
2905
|
+
/** Rows from `start`, `length` of them, without creating missing rows (lib/doc/worksheet.js `findRows`). */
|
|
2906
|
+
findRows(start: number, length: number): (Row | undefined)[];
|
|
2907
|
+
/** The last column with a definition (lib/doc/worksheet.js `lastColumn`). */
|
|
2908
|
+
get lastColumn(): Column;
|
|
2909
|
+
/** Releases the worksheet's data (exceljs frees memory here); the sheet is empty afterwards. */
|
|
2910
|
+
destroy(): void;
|
|
2911
|
+
/**
|
|
2912
|
+
* Sets a shared formula (or an array formula with `shareType: 'array'`) over `range`, as exceljs
|
|
2913
|
+
* `fillFormula` (lib/doc/worksheet.js L678–721; X4-29): the top-left cell gets `{ shareType,
|
|
2914
|
+
* formula, ref, result }`, the others `{ sharedFormula: topLeft, result }` (shared) or their
|
|
2915
|
+
* result (array). `results` is a function `(row, col) => result`, a flat array or a 2-D array.
|
|
2916
|
+
*/
|
|
2917
|
+
fillFormula(range: string, formula: string, results?: FillFormulaResults, shareType?: "shared" | "array"): void;
|
|
2918
|
+
/**
|
|
2919
|
+
* A plain-data snapshot of the worksheet, as exceljs `worksheet.model` (X4-30): id, name, state,
|
|
2920
|
+
* properties, views, autoFilter, page setup, header and footer, breaks, protection, validations,
|
|
2921
|
+
* conditional formats, merges, column definitions and rows with their cells. The setter takes
|
|
2922
|
+
* the same shape. Tables and pictures are not part of it.
|
|
2923
|
+
*/
|
|
2924
|
+
get model(): Record<string, unknown>;
|
|
2925
|
+
set model(m: Record<string, unknown>);
|
|
2926
|
+
/** As `mergeCells`, but the other cells keep their own style (lib/doc/worksheet.js L606). */
|
|
2927
|
+
mergeCellsWithoutStyle(...args: unknown[]): void;
|
|
2928
|
+
private _mergeKeepStyle;
|
|
2929
|
+
mergeCells(...args: unknown[]): void;
|
|
2930
|
+
unMergeCells(...args: unknown[]): void;
|
|
2931
|
+
get hasMerges(): boolean;
|
|
2932
|
+
/** Adds conditional formatting for a range (exceljs `addConditionalFormatting`). */
|
|
2933
|
+
addConditionalFormatting(cf: ConditionalFormattingOptions): void;
|
|
2934
|
+
/**
|
|
2935
|
+
* Removes conditional formatting: the entry at an index, the entries a filter function rejects,
|
|
2936
|
+
* or all of them for any other argument (lib/doc/worksheet.js L815–822).
|
|
2937
|
+
*/
|
|
2938
|
+
removeConditionalFormatting(filter?: number | ((cf: ConditionalFormattingOptions, index: number) => boolean) | string | boolean | null | Record<string, unknown>): void;
|
|
2939
|
+
/**
|
|
2940
|
+
* Protects the sheet (exceljs `protect`). Options say what users may still do
|
|
2941
|
+
* (`formatCells: true` allows formatting). A non-empty password is stored as exceljs stores it:
|
|
2942
|
+
* a SHA-512 verifier with a random 16-byte salt and `spinCount` iterations (default 100000;
|
|
2943
|
+
* xlvane `hashPassword`, docs/decisions.md D-C08). The options object is not modified
|
|
2944
|
+
* (exceljs rounds its `spinCount` in place).
|
|
2945
|
+
*/
|
|
2946
|
+
protect(password?: string, options?: Partial<WorksheetProtection>): Promise<void>;
|
|
2947
|
+
/** Removes the protection. */
|
|
2948
|
+
unprotect(): void;
|
|
2949
|
+
/**
|
|
2950
|
+
* Tables by name, as exceljs `worksheet.tables`. The object has no prototype, so names such as
|
|
2951
|
+
* "constructor" or "__proto__" are plain entries (D-R01).
|
|
2952
|
+
*/
|
|
2953
|
+
tables: Record<string, Table>;
|
|
2954
|
+
/** @internal Pictures and the background, as exceljs `worksheet._media`. */
|
|
2955
|
+
_media: SheetMedia[];
|
|
2956
|
+
/**
|
|
2957
|
+
* Adds a table and writes its header, rows and totals into the cells (exceljs `addTable`).
|
|
2958
|
+
* Names are unique in the workbook, ignoring case (`XLV_E_INVALID_TABLE`); exceljs replaces a
|
|
2959
|
+
* table of the same name on this sheet.
|
|
2960
|
+
*/
|
|
2961
|
+
addTable(model: TableProperties): Table;
|
|
2962
|
+
/**
|
|
2963
|
+
* The table with this name. Typed `Table` as in exceljs (index.d.ts L1365), so exceljs code
|
|
2964
|
+
* type-checks unchanged; at run time a missing name gives `undefined`, as exceljs does
|
|
2965
|
+
* (lib/doc/worksheet.js L797-799).
|
|
2966
|
+
*/
|
|
2967
|
+
getTable(name: string): Table;
|
|
2968
|
+
/** Removes the table; its cells are kept, as in exceljs. */
|
|
2969
|
+
removeTable(name: string): void;
|
|
2970
|
+
/** The tables of the sheet (an array; exceljs's typings say tuples). */
|
|
2971
|
+
getTables(): Table[];
|
|
2972
|
+
/** Places an image of the workbook (`workbook.addImage`) on the sheet. */
|
|
2973
|
+
addImage(imageId: number, range: ImageRangeInput): void;
|
|
2974
|
+
/**
|
|
2975
|
+
* The pictures of the sheet, as exceljs `getImages()`: `{ type, imageId, range }`; `range` is
|
|
2976
|
+
* always set for a picture (index.d.ts L1342-1346 types it as required).
|
|
2977
|
+
*/
|
|
2978
|
+
getImages(): SheetImageMedia[];
|
|
2979
|
+
/** Uses an image of the workbook as the sheet background. */
|
|
2980
|
+
addBackgroundImage(imageId: number): void;
|
|
2981
|
+
/** The id of the background image, or `undefined`. */
|
|
2982
|
+
getBackgroundImageId(): number | undefined;
|
|
2983
|
+
}
|
|
2984
|
+
/** Implements exceljs `Range` for sheet dimensions; created by the worksheet, not by users. */
|
|
2985
|
+
declare class Dimensions implements Range {
|
|
2986
|
+
readonly model: Location & {
|
|
2987
|
+
sheetName?: string;
|
|
2988
|
+
};
|
|
2989
|
+
get top(): number;
|
|
2990
|
+
get left(): number;
|
|
2991
|
+
get bottom(): number;
|
|
2992
|
+
get right(): number;
|
|
2993
|
+
/** Grows the range to include the given rectangle (exceljs `expand`, range.js L163). */
|
|
2994
|
+
expand(top: number, left: number, bottom: number, right: number): void;
|
|
2995
|
+
/** Grows the range to include the cells of a row (exceljs `expandRow`, range.js L170). */
|
|
2996
|
+
expandRow(row: {
|
|
2997
|
+
readonly number: number;
|
|
2998
|
+
readonly dimensions: {
|
|
2999
|
+
min: number;
|
|
3000
|
+
max: number;
|
|
3001
|
+
} | null;
|
|
3002
|
+
}): void;
|
|
3003
|
+
get tl(): string;
|
|
3004
|
+
get $t$l(): string;
|
|
3005
|
+
get br(): string;
|
|
3006
|
+
get $b$r(): string;
|
|
3007
|
+
get range(): string;
|
|
3008
|
+
get $range(): string;
|
|
3009
|
+
get shortRange(): string;
|
|
3010
|
+
get $shortRange(): string;
|
|
3011
|
+
get count(): number;
|
|
3012
|
+
toString(): string;
|
|
3013
|
+
}
|
|
3014
|
+
/** A writable Node.js stream. */
|
|
3015
|
+
interface WritableLike {
|
|
3016
|
+
write(chunk: Uint8Array, callback?: (error?: unknown) => void): unknown;
|
|
3017
|
+
end(callback?: () => void): unknown;
|
|
3018
|
+
}
|
|
3019
|
+
/**
|
|
3020
|
+
* Options of {@link WorkbookWriter}, as exceljs `WorkbookWriter` options.
|
|
3021
|
+
*
|
|
3022
|
+
* @example
|
|
3023
|
+
* ```ts
|
|
3024
|
+
* import type { WorkbookWriterOptions } from '@xlvane/compat';
|
|
3025
|
+
*
|
|
3026
|
+
* const options: WorkbookWriterOptions = { filename: 'big.xlsx', useSharedStrings: false, useStyles: true };
|
|
3027
|
+
* ```
|
|
3028
|
+
*/
|
|
3029
|
+
interface WorkbookWriterOptions {
|
|
3030
|
+
/** Output file (Node.js). */
|
|
3031
|
+
filename?: string;
|
|
3032
|
+
/** Output stream. */
|
|
3033
|
+
stream?: WritableLike;
|
|
3034
|
+
/** Use a shared string table (default false: strings are stored in their cells). */
|
|
3035
|
+
useSharedStrings?: boolean;
|
|
3036
|
+
/** Write cell styles (default false, as in exceljs). */
|
|
3037
|
+
useStyles?: boolean;
|
|
3038
|
+
/** Document properties written to `docProps/core.xml` (defaults as in exceljs). */
|
|
3039
|
+
created?: Date;
|
|
3040
|
+
modified?: Date;
|
|
3041
|
+
creator?: string;
|
|
3042
|
+
lastModifiedBy?: string;
|
|
3043
|
+
lastPrinted?: Date;
|
|
3044
|
+
/** archiver options; `zlib.level` (0–9) sets the Deflate level of the parts. */
|
|
3045
|
+
zip?: unknown;
|
|
3046
|
+
}
|
|
3047
|
+
/**
|
|
3048
|
+
* A worksheet of a {@link WorkbookWriter}: rows are written when committed and then dropped.
|
|
3049
|
+
*
|
|
3050
|
+
* @example
|
|
3051
|
+
* ```ts
|
|
3052
|
+
* import ExcelJS from '@xlvane/compat';
|
|
3053
|
+
*
|
|
3054
|
+
* const writer = new ExcelJS.stream.xlsx.WorkbookWriter({ filename: 'big.xlsx' });
|
|
3055
|
+
* const sheet = writer.addWorksheet('Data');
|
|
3056
|
+
* sheet.addRow([1, 'one']).commit();
|
|
3057
|
+
* sheet.commit();
|
|
3058
|
+
* await writer.commit();
|
|
3059
|
+
* ```
|
|
3060
|
+
*/
|
|
3061
|
+
export declare class WorksheetWriter extends Worksheet {
|
|
3062
|
+
private readonly writer;
|
|
3063
|
+
private readonly rowsOut;
|
|
3064
|
+
private started;
|
|
3065
|
+
private committedUpTo;
|
|
3066
|
+
/** The layout written when the sheet started, to detect later changes that would be lost. */
|
|
3067
|
+
private layout;
|
|
3068
|
+
/** @internal */
|
|
3069
|
+
constructor(writer: WorkbookWriter, id: number, name: string | undefined, options: WorksheetOptions | undefined);
|
|
3070
|
+
/** @internal The sheet spec, made when the first row is committed (layout must be set by then). */
|
|
3071
|
+
_spec(): StreamSheetSpec;
|
|
3072
|
+
private currentLayout;
|
|
3073
|
+
/** The background (exceljs `addBackgroundImage`, worksheet-writer.js L474) and pictures, by image id. */
|
|
3074
|
+
private mediaSpec;
|
|
3075
|
+
override addTable(): never;
|
|
3076
|
+
override mergeCells(...args: unknown[]): void;
|
|
3077
|
+
override spliceRows(): void;
|
|
3078
|
+
override insertRow(): Row;
|
|
3079
|
+
override insertRows(): Row[] | undefined;
|
|
3080
|
+
override duplicateRow(): void;
|
|
3081
|
+
override spliceColumns(): void;
|
|
3082
|
+
/** Formulas of written rows, by address, for later `{ sharedFormula }` dependents. */
|
|
3083
|
+
private readonly formulaMasters;
|
|
3084
|
+
/** @internal Writes every row up to `row` and drops it from memory. */
|
|
3085
|
+
override _commitRow(row: Row): void;
|
|
3086
|
+
private flush;
|
|
3087
|
+
/** Commits the remaining rows and closes the worksheet. */
|
|
3088
|
+
commit(): void;
|
|
3089
|
+
}
|
|
3090
|
+
/**
|
|
3091
|
+
* The streaming writer of exceljs (`ExcelJS.stream.xlsx.WorkbookWriter`). Committed rows are
|
|
3092
|
+
* written at once and dropped, so memory stays constant. Strings are stored in their cells
|
|
3093
|
+
* unless `useSharedStrings` is set; styles are written only with `useStyles: true`, as in exceljs.
|
|
3094
|
+
*
|
|
3095
|
+
* @example
|
|
3096
|
+
* ```ts
|
|
3097
|
+
* import ExcelJS from '@xlvane/compat';
|
|
3098
|
+
*
|
|
3099
|
+
* const workbook = new ExcelJS.stream.xlsx.WorkbookWriter({ filename: 'big.xlsx', useStyles: true });
|
|
3100
|
+
* const sheet = workbook.addWorksheet('Data');
|
|
3101
|
+
* sheet.columns = [{ header: 'Id', key: 'id', width: 10 }];
|
|
3102
|
+
* for (let id = 1; id <= 100_000; id++) sheet.addRow({ id }).commit();
|
|
3103
|
+
* sheet.commit();
|
|
3104
|
+
* await workbook.commit();
|
|
3105
|
+
* ```
|
|
3106
|
+
*/
|
|
3107
|
+
export declare class WorkbookWriter {
|
|
3108
|
+
/** @internal */
|
|
3109
|
+
readonly _book: Workbook;
|
|
3110
|
+
/** @internal */
|
|
3111
|
+
readonly _useStyles: boolean;
|
|
3112
|
+
private readonly sheets;
|
|
3113
|
+
private readonly open;
|
|
3114
|
+
private done;
|
|
3115
|
+
private readonly options;
|
|
3116
|
+
private written;
|
|
3117
|
+
private nextId;
|
|
3118
|
+
created: Date;
|
|
3119
|
+
modified: Date;
|
|
3120
|
+
creator: string;
|
|
3121
|
+
lastModifiedBy: string;
|
|
3122
|
+
lastPrinted: Date | undefined;
|
|
3123
|
+
/** Workbook windows, written as exceljs's workbook writer writes them (workbook-writer.js L43, L321; D-E06). */
|
|
3124
|
+
views: Record<string, unknown>[];
|
|
3125
|
+
constructor(options?: WorkbookWriterOptions);
|
|
3126
|
+
/**
|
|
3127
|
+
* Adds an image (PNG, JPEG or GIF; `buffer` or `base64`) and returns its id, as exceljs
|
|
3128
|
+
* `workbookWriter.addImage`. Images are written when the first sheet starts, so they must be
|
|
3129
|
+
* added before the first row is committed.
|
|
3130
|
+
*/
|
|
3131
|
+
addImage(image: ImageData): number;
|
|
3132
|
+
/** The image with this id (typed `Image` as in exceljs, index.d.ts L1780; `undefined` for an unknown id). */
|
|
3133
|
+
getImage(id: number): Image;
|
|
3134
|
+
/** Defined names, as exceljs `workbookWriter.definedNames`; set them before the first row is committed. */
|
|
3135
|
+
get definedNames(): DefinedNames;
|
|
3136
|
+
/** The document properties and names written; they are fixed when writing starts. */
|
|
3137
|
+
private meta;
|
|
3138
|
+
/** Starts the xlvane stream (once): when the first sheet starts or at commit. */
|
|
3139
|
+
private begin;
|
|
3140
|
+
/** Adds a worksheet. Sheets are written in the order their first rows are committed. */
|
|
3141
|
+
addWorksheet(name?: string, options?: WorksheetOptions): WorksheetWriter;
|
|
3142
|
+
getWorksheet(id?: number | string): WorksheetWriter | undefined;
|
|
3143
|
+
/** @internal Starts writing a sheet (once). */
|
|
3144
|
+
_start(sheet: WorksheetWriter): void;
|
|
3145
|
+
/** Commits all worksheets and finishes the file. */
|
|
3146
|
+
commit(): Promise<void>;
|
|
3147
|
+
}
|
|
3148
|
+
type Listener = (...args: unknown[]) => void;
|
|
3149
|
+
/** The part of Node.js `EventEmitter` that exceljs's streaming reader uses; no node:events import. */
|
|
3150
|
+
declare class Emitter {
|
|
3151
|
+
private readonly listeners;
|
|
3152
|
+
on(event: string, fn: Listener): this;
|
|
3153
|
+
addListener(event: string, fn: Listener): this;
|
|
3154
|
+
once(event: string, fn: Listener): this;
|
|
3155
|
+
off(event: string, fn: Listener): this;
|
|
3156
|
+
removeListener(event: string, fn: Listener): this;
|
|
3157
|
+
removeAllListeners(event?: string): this;
|
|
3158
|
+
listenerCount(event: string): number;
|
|
3159
|
+
emit(event: string, ...args: unknown[]): boolean;
|
|
3160
|
+
}
|
|
3161
|
+
/**
|
|
3162
|
+
* Options of {@link WorkbookReader}, as exceljs `WorkbookStreamReaderOptions` (index.d.ts L1988).
|
|
3163
|
+
*
|
|
3164
|
+
* @example
|
|
3165
|
+
* ```ts
|
|
3166
|
+
* import type { WorkbookReaderOptions } from '@xlvane/compat';
|
|
3167
|
+
*
|
|
3168
|
+
* const options: WorkbookReaderOptions = { styles: 'cache', entries: 'emit' };
|
|
3169
|
+
* ```
|
|
3170
|
+
*/
|
|
3171
|
+
interface WorkbookReaderOptions {
|
|
3172
|
+
worksheets?: "emit" | "ignore";
|
|
3173
|
+
/** Only `cache` (the default): `emit` and `ignore` throw `XLV_E_NOT_SUPPORTED`. */
|
|
3174
|
+
sharedStrings?: "cache" | "emit" | "ignore";
|
|
3175
|
+
/** `ignore` (default) or `cache`, which changes nothing for files in schema order (links follow the rows); `emit` throws `XLV_E_NOT_SUPPORTED`. */
|
|
3176
|
+
hyperlinks?: "cache" | "emit" | "ignore";
|
|
3177
|
+
/** `cache` gives the cells their styles; `ignore` (default) does not. */
|
|
3178
|
+
styles?: "cache" | "ignore";
|
|
3179
|
+
/** `emit` sends `entry` events for the workbook and each worksheet. */
|
|
3180
|
+
entries?: "emit" | "ignore";
|
|
3181
|
+
}
|
|
3182
|
+
/**
|
|
3183
|
+
* A worksheet read by {@link WorkbookReader}, as exceljs `WorksheetReader`: iterate its rows with
|
|
3184
|
+
* `for await`, or call `read()` and listen to `row` and `finished` events.
|
|
3185
|
+
*
|
|
3186
|
+
* @example
|
|
3187
|
+
* ```ts
|
|
3188
|
+
* import ExcelJS from '@xlvane/compat';
|
|
3189
|
+
*
|
|
3190
|
+
* const reader = new ExcelJS.stream.xlsx.WorkbookReader('big.xlsx', {});
|
|
3191
|
+
* for await (const worksheet of reader) {
|
|
3192
|
+
* console.log(worksheet.name, worksheet.state);
|
|
3193
|
+
* for await (const row of worksheet) console.log(row.number);
|
|
3194
|
+
* console.log(worksheet.dimensions.range);
|
|
3195
|
+
* }
|
|
3196
|
+
* ```
|
|
3197
|
+
*/
|
|
3198
|
+
export declare class WorksheetReader extends Emitter implements AsyncIterable<Row> {
|
|
3199
|
+
readonly workbook: WorkbookReader;
|
|
3200
|
+
readonly id: number;
|
|
3201
|
+
readonly name: string;
|
|
3202
|
+
readonly state: "visible" | "hidden" | "veryHidden";
|
|
3203
|
+
private readonly sheet;
|
|
3204
|
+
private readonly rows;
|
|
3205
|
+
/** The range of the rows read so far, as exceljs's `Range` (lib/doc/range.js). */
|
|
3206
|
+
readonly dimensions: Dimensions;
|
|
3207
|
+
/** @internal */
|
|
3208
|
+
constructor(workbook: WorkbookReader, id: number, name: string, state: "visible" | "hidden" | "veryHidden", sheet: Worksheet, rows: () => AsyncIterable<Row>);
|
|
3209
|
+
/** Column definitions read so far, or `null` (as exceljs before any `getColumn`). */
|
|
3210
|
+
get columns(): ReturnType<Worksheet["getColumn"]>[] | null;
|
|
3211
|
+
getColumn(c: number | string): ReturnType<Worksheet["getColumn"]>;
|
|
3212
|
+
getColumnKey(key: string): ReturnType<Worksheet["getColumnKey"]>;
|
|
3213
|
+
setColumnKey(key: string, value: ReturnType<Worksheet["getColumn"]>): void;
|
|
3214
|
+
deleteColumnKey(key: string): void;
|
|
3215
|
+
eachColumnKey(f: Parameters<Worksheet["eachColumnKey"]>[0]): void;
|
|
3216
|
+
/** Not valid on a streamed worksheet (it throws in exceljs too). */
|
|
3217
|
+
destroy(): never;
|
|
3218
|
+
[Symbol.asyncIterator](): AsyncIterator<Row>;
|
|
3219
|
+
/** Events of the rows: `row` (a Row), then `finished`; `error` on failure. */
|
|
3220
|
+
parse(): AsyncGenerator<{
|
|
3221
|
+
eventType: string;
|
|
3222
|
+
value: unknown;
|
|
3223
|
+
}[]>;
|
|
3224
|
+
/** Reads the rows and emits `row` events, then `finished` (or `error`). */
|
|
3225
|
+
read(): Promise<void>;
|
|
3226
|
+
}
|
|
3227
|
+
/**
|
|
3228
|
+
* The streaming reader of exceljs (`ExcelJS.stream.xlsx.WorkbookReader`): iterate worksheets
|
|
3229
|
+
* and their rows with `for await`, or call `read()` and listen to `worksheet`, `end`,
|
|
3230
|
+
* `finished` and `error` events (and `entry` with `entries: 'emit'`). Rows are not kept.
|
|
3231
|
+
*
|
|
3232
|
+
* @example
|
|
3233
|
+
* ```ts
|
|
3234
|
+
* import ExcelJS from '@xlvane/compat';
|
|
3235
|
+
*
|
|
3236
|
+
* const reader = new ExcelJS.stream.xlsx.WorkbookReader('big.xlsx', { styles: 'cache' });
|
|
3237
|
+
* for await (const worksheet of reader) {
|
|
3238
|
+
* for await (const row of worksheet) console.log(row.number, row.values);
|
|
3239
|
+
* }
|
|
3240
|
+
* ```
|
|
3241
|
+
*/
|
|
3242
|
+
export declare class WorkbookReader extends Emitter implements AsyncIterable<WorksheetReader> {
|
|
3243
|
+
private readonly input;
|
|
3244
|
+
private options;
|
|
3245
|
+
constructor(input: string | Uint8Array | ArrayBuffer | AsyncIterable<Uint8Array>, options?: WorkbookReaderOptions | Record<string, unknown>);
|
|
3246
|
+
private open;
|
|
3247
|
+
/** Worksheet events in workbook order, as exceljs `parse()` yields them (`{ eventType: 'worksheet', value }`). */
|
|
3248
|
+
parse(input?: string | Uint8Array | ArrayBuffer | AsyncIterable<Uint8Array>, options?: WorkbookReaderOptions): AsyncGenerator<{
|
|
3249
|
+
eventType: string;
|
|
3250
|
+
value: unknown;
|
|
3251
|
+
}>;
|
|
3252
|
+
[Symbol.asyncIterator](): AsyncIterator<WorksheetReader>;
|
|
3253
|
+
/**
|
|
3254
|
+
* Reads the workbook and emits events, as exceljs `read()`: `worksheet` for each worksheet
|
|
3255
|
+
* (its rows are read after the listeners run; listen to the worksheet's `row` events), then
|
|
3256
|
+
* `end` and `finished`; `error` on failure.
|
|
3257
|
+
*/
|
|
3258
|
+
read(input?: string | Uint8Array | ArrayBuffer | AsyncIterable<Uint8Array>, options?: WorkbookReaderOptions): Promise<void>;
|
|
3259
|
+
}
|
|
3260
|
+
/**
|
|
3261
|
+
* exceljs `RelationshipType` (lib/doc/enums.js), kept for code that reads it.
|
|
3262
|
+
*
|
|
3263
|
+
* @example
|
|
3264
|
+
* ```ts
|
|
3265
|
+
* import ExcelJS from '@xlvane/compat';
|
|
3266
|
+
*
|
|
3267
|
+
* console.log(ExcelJS.RelationshipType.Worksheet); // 2
|
|
3268
|
+
* ```
|
|
3269
|
+
*/
|
|
3270
|
+
export declare const RelationshipType: {
|
|
3271
|
+
readonly None: 0;
|
|
3272
|
+
readonly OfficeDocument: 1;
|
|
3273
|
+
readonly Worksheet: 2;
|
|
3274
|
+
readonly CalcChain: 3;
|
|
3275
|
+
readonly SharedStrings: 4;
|
|
3276
|
+
readonly Styles: 5;
|
|
3277
|
+
readonly Theme: 6;
|
|
3278
|
+
readonly Hyperlink: 7;
|
|
3279
|
+
};
|
|
3280
|
+
/** A value of {@link RelationshipType} (usable as a type, as the exceljs enum). */
|
|
3281
|
+
export type RelationshipType = (typeof RelationshipType)[keyof typeof RelationshipType];
|
|
3282
|
+
/**
|
|
3283
|
+
* exceljs `DocumentType` (lib/doc/enums.js).
|
|
3284
|
+
*
|
|
3285
|
+
* @example
|
|
3286
|
+
* ```ts
|
|
3287
|
+
* import ExcelJS from '@xlvane/compat';
|
|
3288
|
+
*
|
|
3289
|
+
* console.log(ExcelJS.DocumentType.Xlsx); // 1
|
|
3290
|
+
* ```
|
|
3291
|
+
*/
|
|
3292
|
+
export declare const DocumentType: {
|
|
3293
|
+
readonly Xlsx: 1;
|
|
3294
|
+
};
|
|
3295
|
+
/** A value of {@link DocumentType} (usable as a type, as the exceljs enum). */
|
|
3296
|
+
export type DocumentType = (typeof DocumentType)[keyof typeof DocumentType];
|
|
3297
|
+
/**
|
|
3298
|
+
* exceljs `ReadingOrder` (lib/doc/enums.js).
|
|
3299
|
+
*
|
|
3300
|
+
* @example
|
|
3301
|
+
* ```ts
|
|
3302
|
+
* import ExcelJS from '@xlvane/compat';
|
|
3303
|
+
*
|
|
3304
|
+
* console.log(ExcelJS.ReadingOrder.RightToLeft); // 2
|
|
3305
|
+
* ```
|
|
3306
|
+
*/
|
|
3307
|
+
export declare const ReadingOrder: {
|
|
3308
|
+
readonly LeftToRight: 1;
|
|
3309
|
+
readonly RightToLeft: 2;
|
|
3310
|
+
};
|
|
3311
|
+
/** A value of {@link ReadingOrder} (usable as a type, as the exceljs enum). */
|
|
3312
|
+
export type ReadingOrder = (typeof ReadingOrder)[keyof typeof ReadingOrder];
|
|
3313
|
+
/**
|
|
3314
|
+
* The streaming API, as `ExcelJS.stream`.
|
|
3315
|
+
*
|
|
3316
|
+
* @example
|
|
3317
|
+
* ```ts
|
|
3318
|
+
* import { stream } from '@xlvane/compat';
|
|
3319
|
+
*
|
|
3320
|
+
* const writer = new stream.xlsx.WorkbookWriter({ filename: 'out.xlsx' });
|
|
3321
|
+
* writer.addWorksheet('Data').addRow([1]).commit();
|
|
3322
|
+
* await writer.commit();
|
|
3323
|
+
* ```
|
|
3324
|
+
*/
|
|
3325
|
+
export declare const stream: {
|
|
3326
|
+
readonly xlsx: {
|
|
3327
|
+
readonly WorkbookWriter: typeof WorkbookWriter;
|
|
3328
|
+
readonly WorkbookReader: typeof WorkbookReader;
|
|
3329
|
+
};
|
|
3330
|
+
};
|
|
3331
|
+
/** Types of the streaming API as exceljs declares them (`ExcelJS.stream.xlsx.WorkbookWriterOptions`). */
|
|
3332
|
+
export declare namespace stream {
|
|
3333
|
+
namespace xlsx {
|
|
3334
|
+
type WorkbookWriter = XlvTypeOfWorkbookWriter;
|
|
3335
|
+
type WorkbookReader = XlvTypeOfWorkbookReader;
|
|
3336
|
+
type WorksheetWriter = XlvTypeOfWorksheetWriter;
|
|
3337
|
+
type WorksheetReader = XlvTypeOfWorksheetReader;
|
|
3338
|
+
type WorkbookWriterOptions = XlvTypeOfWorkbookWriterOptions;
|
|
3339
|
+
type WorkbookReaderOptions = XlvTypeOfWorkbookReaderOptions;
|
|
3340
|
+
/** The name exceljs's index.d.ts uses for the reader options. */
|
|
3341
|
+
type WorkbookStreamReaderOptions = XlvTypeOfWorkbookReaderOptions;
|
|
3342
|
+
}
|
|
3343
|
+
}
|
|
3344
|
+
/**
|
|
3345
|
+
* Kept for exceljs compatibility (`ExcelJS.ModelContainer`); not supported.
|
|
3346
|
+
*
|
|
3347
|
+
* @example
|
|
3348
|
+
* ```ts
|
|
3349
|
+
* import ExcelJS from '@xlvane/compat';
|
|
3350
|
+
*
|
|
3351
|
+
* console.log(typeof ExcelJS.ModelContainer); // function
|
|
3352
|
+
* ```
|
|
3353
|
+
*/
|
|
3354
|
+
export declare class ModelContainer {
|
|
3355
|
+
constructor();
|
|
3356
|
+
}
|
|
3357
|
+
/**
|
|
3358
|
+
* The shape of the default export (and of `require('exceljs')`).
|
|
3359
|
+
*
|
|
3360
|
+
* @example
|
|
3361
|
+
* ```ts
|
|
3362
|
+
* import ExcelJS, { type ExcelJSModule } from '@xlvane/compat';
|
|
3363
|
+
*
|
|
3364
|
+
* const lib: ExcelJSModule = ExcelJS;
|
|
3365
|
+
* const workbook = new lib.Workbook();
|
|
3366
|
+
* ```
|
|
3367
|
+
*/
|
|
3368
|
+
export interface ExcelJSModule {
|
|
3369
|
+
readonly Workbook: typeof Workbook;
|
|
3370
|
+
readonly ModelContainer: typeof ModelContainer;
|
|
3371
|
+
readonly stream: typeof stream;
|
|
3372
|
+
readonly ValueType: typeof ValueType;
|
|
3373
|
+
readonly FormulaType: typeof FormulaType;
|
|
3374
|
+
readonly ErrorValue: typeof ErrorValue;
|
|
3375
|
+
readonly RelationshipType: typeof RelationshipType;
|
|
3376
|
+
readonly DocumentType: typeof DocumentType;
|
|
3377
|
+
readonly ReadingOrder: typeof ReadingOrder;
|
|
3378
|
+
readonly PaperSize: typeof PaperSize;
|
|
3379
|
+
}
|
|
3380
|
+
/**
|
|
3381
|
+
* The exceljs-compatible API as one object: `import ExcelJS from 'exceljs'` and
|
|
3382
|
+
* `const ExcelJS = require('exceljs')` both give it.
|
|
3383
|
+
*
|
|
3384
|
+
* @example
|
|
3385
|
+
* ```ts
|
|
3386
|
+
* import ExcelJS from '@xlvane/compat';
|
|
3387
|
+
*
|
|
3388
|
+
* const workbook = new ExcelJS.Workbook();
|
|
3389
|
+
* const sheet = workbook.addWorksheet('Sheet1');
|
|
3390
|
+
* sheet.addRow(['Hello', 'world']);
|
|
3391
|
+
* const buffer = await workbook.xlsx.writeBuffer();
|
|
3392
|
+
* console.log(buffer.length > 0);
|
|
3393
|
+
* ```
|
|
3394
|
+
*/
|
|
3395
|
+
declare const ExcelJS: ExcelJSModule;
|
|
3396
|
+
type ModelContainerInstance = ModelContainer;
|
|
3397
|
+
type XlvTypeOfWorkbookWriter = WorkbookWriter;
|
|
3398
|
+
type XlvTypeOfWorkbookReader = WorkbookReader;
|
|
3399
|
+
type XlvTypeOfWorksheetWriter = WorksheetWriter;
|
|
3400
|
+
type XlvTypeOfWorksheetReader = WorksheetReader;
|
|
3401
|
+
type XlvTypeOfWorkbookWriterOptions = WorkbookWriterOptions;
|
|
3402
|
+
type XlvTypeOfWorkbookReaderOptions = WorkbookReaderOptions;
|
|
3403
|
+
type XlvTypeOfColor = Color;
|
|
3404
|
+
type XlvTypeOfFont = Font;
|
|
3405
|
+
type XlvTypeOfFillPatterns = FillPatterns;
|
|
3406
|
+
type XlvTypeOfFill = Fill;
|
|
3407
|
+
type XlvTypeOfBorderStyle = BorderStyle;
|
|
3408
|
+
type XlvTypeOfBorder = Border;
|
|
3409
|
+
type XlvTypeOfBorders = Borders;
|
|
3410
|
+
type XlvTypeOfAlignment = Alignment;
|
|
3411
|
+
type XlvTypeOfStyle = Style;
|
|
3412
|
+
type XlvTypeOfProtection = Protection;
|
|
3413
|
+
type XlvTypeOfCellErrorValue = CellErrorValue;
|
|
3414
|
+
type XlvTypeOfCellFormulaValue = CellFormulaValue;
|
|
3415
|
+
type XlvTypeOfCellValue = CellValue;
|
|
3416
|
+
type XlvTypeOfColumnDefn = ColumnDefn;
|
|
3417
|
+
type XlvTypeOfWorksheetView = WorksheetView;
|
|
3418
|
+
type XlvTypeOfWorksheetOptions = WorksheetOptions;
|
|
3419
|
+
type XlvTypeOfComment = Comment;
|
|
3420
|
+
type XlvTypeOfDataValidation = DataValidation;
|
|
3421
|
+
type XlvTypeOfConditionalFormattingRule = ConditionalFormattingRule;
|
|
3422
|
+
type XlvTypeOfConditionalFormattingOptions = ConditionalFormattingOptions;
|
|
3423
|
+
type XlvTypeOfPageSetup = PageSetup;
|
|
3424
|
+
type XlvTypeOfHeaderFooter = HeaderFooter;
|
|
3425
|
+
type XlvTypeOfRowBreak = RowBreak;
|
|
3426
|
+
type XlvTypeOfWorksheetProtection = WorksheetProtection;
|
|
3427
|
+
type XlvTypeOfBuffer = Buffer;
|
|
3428
|
+
type XlvTypeOfGradientStop = GradientStop;
|
|
3429
|
+
type XlvTypeOfFillGradientAngle = FillGradientAngle;
|
|
3430
|
+
type XlvTypeOfFillGradientPath = FillGradientPath;
|
|
3431
|
+
type XlvTypeOfBorderDiagonal = BorderDiagonal;
|
|
3432
|
+
type XlvTypeOfMargins = Margins;
|
|
3433
|
+
type XlvTypeOfDataValidationOperator = DataValidationOperator;
|
|
3434
|
+
type XlvTypeOfRichText = RichText;
|
|
3435
|
+
type XlvTypeOfCellRichTextValue = CellRichTextValue;
|
|
3436
|
+
type XlvTypeOfCellHyperlinkValue = CellHyperlinkValue;
|
|
3437
|
+
type XlvTypeOfAddress = Address;
|
|
3438
|
+
type XlvTypeOfCellModel = CellModel;
|
|
3439
|
+
type XlvTypeOfRowModel = RowModel;
|
|
3440
|
+
type XlvTypeOfAutoFilter = AutoFilter;
|
|
3441
|
+
type XlvTypeOfImage = Image;
|
|
3442
|
+
type XlvTypeOfImageRange = ImageRange;
|
|
3443
|
+
type XlvTypeOfIAnchorPosition = IAnchorPosition;
|
|
3444
|
+
type XlvTypeOfImagePosition = ImagePosition;
|
|
3445
|
+
type XlvTypeOfImageHyperlinkValue = ImageHyperlinkValue;
|
|
3446
|
+
type XlvTypeOfLocation = Location;
|
|
3447
|
+
type XlvTypeOfRange = Range;
|
|
3448
|
+
type XlvTypeOfMedia = Media;
|
|
3449
|
+
type XlvTypeOfWorksheetState = WorksheetState;
|
|
3450
|
+
type XlvTypeOfCellIsOperators = CellIsOperators;
|
|
3451
|
+
type XlvTypeOfContainsTextOperators = ContainsTextOperators;
|
|
3452
|
+
type XlvTypeOfTimePeriodTypes = TimePeriodTypes;
|
|
3453
|
+
type XlvTypeOfIconSetTypes = IconSetTypes;
|
|
3454
|
+
type XlvTypeOfCfvoTypes = CfvoTypes;
|
|
3455
|
+
type XlvTypeOfCvfo = Cvfo;
|
|
3456
|
+
type XlvTypeOfExpressionRuleType = ExpressionRuleType;
|
|
3457
|
+
type XlvTypeOfCellIsRuleType = CellIsRuleType;
|
|
3458
|
+
type XlvTypeOfAboveAverageRuleType = AboveAverageRuleType;
|
|
3459
|
+
type XlvTypeOfColorScaleRuleType = ColorScaleRuleType;
|
|
3460
|
+
type XlvTypeOfIconSetRuleType = IconSetRuleType;
|
|
3461
|
+
type XlvTypeOfContainsTextRuleType = ContainsTextRuleType;
|
|
3462
|
+
type XlvTypeOfTimePeriodRuleType = TimePeriodRuleType;
|
|
3463
|
+
type XlvTypeOfDataBarRuleType = DataBarRuleType;
|
|
3464
|
+
type XlvTypeOfRowValues = RowValues;
|
|
3465
|
+
type XlvTypeOfCalculationProperties = CalculationProperties;
|
|
3466
|
+
type XlvTypeOfWorkbookProperties = WorkbookProperties;
|
|
3467
|
+
type XlvTypeOfJSZipGeneratorOptions = JSZipGeneratorOptions;
|
|
3468
|
+
type XlvTypeOfXlsx = Xlsx;
|
|
3469
|
+
type XlvTypeOfCsv = Csv;
|
|
3470
|
+
type XlvTypeOfFastCsvParserOptionsArgs = FastCsvParserOptionsArgs;
|
|
3471
|
+
type XlvTypeOfFastCsvFormatterOptionsArgs = FastCsvFormatterOptionsArgs;
|
|
3472
|
+
type XlvTypeOfWorksheetModel = WorksheetModel;
|
|
3473
|
+
type XlvTypeOfWorkbookModel = WorkbookModel;
|
|
3474
|
+
type XlvTypeOfWorksheetViewCommon = WorksheetViewCommon;
|
|
3475
|
+
type XlvTypeOfWorksheetViewNormal = WorksheetViewNormal;
|
|
3476
|
+
type XlvTypeOfWorksheetViewFrozen = WorksheetViewFrozen;
|
|
3477
|
+
type XlvTypeOfWorksheetViewSplit = WorksheetViewSplit;
|
|
3478
|
+
type XlvTypeOfWorkbookView = WorkbookView;
|
|
3479
|
+
type XlvTypeOfFillPattern = FillPattern;
|
|
3480
|
+
type XlvTypeOfCellSharedFormulaValue = CellSharedFormulaValue;
|
|
3481
|
+
type XlvTypeOfIAnchor = IAnchor;
|
|
3482
|
+
type XlvTypeOfConditionalFormattingBaseRule = ConditionalFormattingBaseRule;
|
|
3483
|
+
type XlvTypeOfTop10RuleType = Top10RuleType;
|
|
3484
|
+
type XlvTypeOfWorksheetProperties = WorksheetProperties;
|
|
3485
|
+
type XlvTypeOfAddWorksheetOptions = AddWorksheetOptions;
|
|
3486
|
+
type XlvTypeOfDefinedNamesRanges = DefinedNamesRanges;
|
|
3487
|
+
type XlvTypeOfDefinedNamesModel = DefinedNamesModel;
|
|
3488
|
+
type XlvTypeOfTableStyleProperties = TableStyleProperties;
|
|
3489
|
+
type XlvTypeOfPaperSize = PaperSize;
|
|
3490
|
+
type XlvTypeOfCell = Cell;
|
|
3491
|
+
type XlvTypeOfColumn = Column;
|
|
3492
|
+
type XlvTypeOfRow = Row;
|
|
3493
|
+
type XlvTypeOfWorksheet = Worksheet;
|
|
3494
|
+
type XlvTypeOfValueType = ValueType;
|
|
3495
|
+
type XlvTypeOfFormulaType = FormulaType;
|
|
3496
|
+
type XlvTypeOfErrorValue = ErrorValue;
|
|
3497
|
+
type XlvTypeOfCsvIO = CsvIO;
|
|
3498
|
+
type XlvTypeOfCsvReadOptions = CsvReadOptions;
|
|
3499
|
+
type XlvTypeOfCsvWriteOptions = CsvWriteOptions;
|
|
3500
|
+
type XlvTypeOfCellMatrix = CellMatrix;
|
|
3501
|
+
type XlvTypeOfDefinedNames = DefinedNames;
|
|
3502
|
+
type XlvTypeOfDecodedLocation = DecodedLocation;
|
|
3503
|
+
type XlvTypeOfNameCell = NameCell;
|
|
3504
|
+
type XlvTypeOfWorkbook = Workbook;
|
|
3505
|
+
type XlvTypeOfXlsxIO = XlsxIO;
|
|
3506
|
+
type XlvTypeOfXlsxReadOptions = XlsxReadOptions;
|
|
3507
|
+
type XlvTypeOfXlsxWriteOptions = XlsxWriteOptions;
|
|
3508
|
+
type XlvTypeOfDataValidations = DataValidations;
|
|
3509
|
+
type XlvTypeOfAnchor = Anchor;
|
|
3510
|
+
type XlvTypeOfTable = Table;
|
|
3511
|
+
type XlvTypeOfTableColumn = TableColumn;
|
|
3512
|
+
type XlvTypeOfImageData = ImageData;
|
|
3513
|
+
type XlvTypeOfImageRangeInput = ImageRangeInput;
|
|
3514
|
+
type XlvTypeOfTableColumnProperties = TableColumnProperties;
|
|
3515
|
+
type XlvTypeOfTableProperties = TableProperties;
|
|
3516
|
+
type XlvTypeOfRelationshipType = (typeof RelationshipType)[keyof typeof RelationshipType];
|
|
3517
|
+
type XlvTypeOfDocumentType = (typeof DocumentType)[keyof typeof DocumentType];
|
|
3518
|
+
type XlvTypeOfReadingOrder = (typeof ReadingOrder)[keyof typeof ReadingOrder];
|
|
3519
|
+
type XlvTypeOfModelContainer = ModelContainerInstance;
|
|
3520
|
+
/**
|
|
3521
|
+
* The types of the exceljs-compatible API under the default export, so that exceljs code such as
|
|
3522
|
+
* `let sheet: ExcelJS.Worksheet` type-checks with `import ExcelJS from 'exceljs'` and with
|
|
3523
|
+
* `import ExcelJS = require('exceljs')` (D-R01).
|
|
3524
|
+
*/
|
|
3525
|
+
declare namespace ExcelJS {
|
|
3526
|
+
type Color = XlvTypeOfColor;
|
|
3527
|
+
type Font = XlvTypeOfFont;
|
|
3528
|
+
type FillPatterns = XlvTypeOfFillPatterns;
|
|
3529
|
+
type Fill = XlvTypeOfFill;
|
|
3530
|
+
type BorderStyle = XlvTypeOfBorderStyle;
|
|
3531
|
+
type Border = XlvTypeOfBorder;
|
|
3532
|
+
type Borders = XlvTypeOfBorders;
|
|
3533
|
+
type Alignment = XlvTypeOfAlignment;
|
|
3534
|
+
type Style = XlvTypeOfStyle;
|
|
3535
|
+
type Protection = XlvTypeOfProtection;
|
|
3536
|
+
type CellErrorValue = XlvTypeOfCellErrorValue;
|
|
3537
|
+
type CellFormulaValue = XlvTypeOfCellFormulaValue;
|
|
3538
|
+
type CellValue = XlvTypeOfCellValue;
|
|
3539
|
+
type ColumnDefn = XlvTypeOfColumnDefn;
|
|
3540
|
+
type WorksheetView = XlvTypeOfWorksheetView;
|
|
3541
|
+
type WorksheetOptions = XlvTypeOfWorksheetOptions;
|
|
3542
|
+
type Comment = XlvTypeOfComment;
|
|
3543
|
+
type DataValidation = XlvTypeOfDataValidation;
|
|
3544
|
+
type ConditionalFormattingRule = XlvTypeOfConditionalFormattingRule;
|
|
3545
|
+
type ConditionalFormattingOptions = XlvTypeOfConditionalFormattingOptions;
|
|
3546
|
+
type PageSetup = XlvTypeOfPageSetup;
|
|
3547
|
+
type HeaderFooter = XlvTypeOfHeaderFooter;
|
|
3548
|
+
type RowBreak = XlvTypeOfRowBreak;
|
|
3549
|
+
type WorksheetProtection = XlvTypeOfWorksheetProtection;
|
|
3550
|
+
type Buffer = XlvTypeOfBuffer;
|
|
3551
|
+
type GradientStop = XlvTypeOfGradientStop;
|
|
3552
|
+
type FillGradientAngle = XlvTypeOfFillGradientAngle;
|
|
3553
|
+
type FillGradientPath = XlvTypeOfFillGradientPath;
|
|
3554
|
+
type BorderDiagonal = XlvTypeOfBorderDiagonal;
|
|
3555
|
+
type Margins = XlvTypeOfMargins;
|
|
3556
|
+
type DataValidationOperator = XlvTypeOfDataValidationOperator;
|
|
3557
|
+
type RichText = XlvTypeOfRichText;
|
|
3558
|
+
type CellRichTextValue = XlvTypeOfCellRichTextValue;
|
|
3559
|
+
type CellHyperlinkValue = XlvTypeOfCellHyperlinkValue;
|
|
3560
|
+
type Address = XlvTypeOfAddress;
|
|
3561
|
+
type CellModel = XlvTypeOfCellModel;
|
|
3562
|
+
type RowModel = XlvTypeOfRowModel;
|
|
3563
|
+
type AutoFilter = XlvTypeOfAutoFilter;
|
|
3564
|
+
type Image = XlvTypeOfImage;
|
|
3565
|
+
type ImageRange = XlvTypeOfImageRange;
|
|
3566
|
+
type IAnchorPosition = XlvTypeOfIAnchorPosition;
|
|
3567
|
+
type ImagePosition = XlvTypeOfImagePosition;
|
|
3568
|
+
type ImageHyperlinkValue = XlvTypeOfImageHyperlinkValue;
|
|
3569
|
+
type Location = XlvTypeOfLocation;
|
|
3570
|
+
type Range = XlvTypeOfRange;
|
|
3571
|
+
type Media = XlvTypeOfMedia;
|
|
3572
|
+
type WorksheetState = XlvTypeOfWorksheetState;
|
|
3573
|
+
type CellIsOperators = XlvTypeOfCellIsOperators;
|
|
3574
|
+
type ContainsTextOperators = XlvTypeOfContainsTextOperators;
|
|
3575
|
+
type TimePeriodTypes = XlvTypeOfTimePeriodTypes;
|
|
3576
|
+
type IconSetTypes = XlvTypeOfIconSetTypes;
|
|
3577
|
+
type CfvoTypes = XlvTypeOfCfvoTypes;
|
|
3578
|
+
type Cvfo = XlvTypeOfCvfo;
|
|
3579
|
+
type ExpressionRuleType = XlvTypeOfExpressionRuleType;
|
|
3580
|
+
type CellIsRuleType = XlvTypeOfCellIsRuleType;
|
|
3581
|
+
type AboveAverageRuleType = XlvTypeOfAboveAverageRuleType;
|
|
3582
|
+
type ColorScaleRuleType = XlvTypeOfColorScaleRuleType;
|
|
3583
|
+
type IconSetRuleType = XlvTypeOfIconSetRuleType;
|
|
3584
|
+
type ContainsTextRuleType = XlvTypeOfContainsTextRuleType;
|
|
3585
|
+
type TimePeriodRuleType = XlvTypeOfTimePeriodRuleType;
|
|
3586
|
+
type DataBarRuleType = XlvTypeOfDataBarRuleType;
|
|
3587
|
+
type RowValues = XlvTypeOfRowValues;
|
|
3588
|
+
type CalculationProperties = XlvTypeOfCalculationProperties;
|
|
3589
|
+
type WorkbookProperties = XlvTypeOfWorkbookProperties;
|
|
3590
|
+
type JSZipGeneratorOptions = XlvTypeOfJSZipGeneratorOptions;
|
|
3591
|
+
type Xlsx = XlvTypeOfXlsx;
|
|
3592
|
+
type Csv = XlvTypeOfCsv;
|
|
3593
|
+
type FastCsvParserOptionsArgs = XlvTypeOfFastCsvParserOptionsArgs;
|
|
3594
|
+
type FastCsvFormatterOptionsArgs = XlvTypeOfFastCsvFormatterOptionsArgs;
|
|
3595
|
+
type WorksheetModel = XlvTypeOfWorksheetModel;
|
|
3596
|
+
type WorkbookModel = XlvTypeOfWorkbookModel;
|
|
3597
|
+
type WorksheetViewCommon = XlvTypeOfWorksheetViewCommon;
|
|
3598
|
+
type WorksheetViewNormal = XlvTypeOfWorksheetViewNormal;
|
|
3599
|
+
type WorksheetViewFrozen = XlvTypeOfWorksheetViewFrozen;
|
|
3600
|
+
type WorksheetViewSplit = XlvTypeOfWorksheetViewSplit;
|
|
3601
|
+
type WorkbookView = XlvTypeOfWorkbookView;
|
|
3602
|
+
type FillPattern = XlvTypeOfFillPattern;
|
|
3603
|
+
type CellSharedFormulaValue = XlvTypeOfCellSharedFormulaValue;
|
|
3604
|
+
type IAnchor = XlvTypeOfIAnchor;
|
|
3605
|
+
type ConditionalFormattingBaseRule = XlvTypeOfConditionalFormattingBaseRule;
|
|
3606
|
+
type Top10RuleType = XlvTypeOfTop10RuleType;
|
|
3607
|
+
type WorksheetProperties = XlvTypeOfWorksheetProperties;
|
|
3608
|
+
type AddWorksheetOptions = XlvTypeOfAddWorksheetOptions;
|
|
3609
|
+
type DefinedNamesRanges = XlvTypeOfDefinedNamesRanges;
|
|
3610
|
+
type DefinedNamesModel = XlvTypeOfDefinedNamesModel;
|
|
3611
|
+
type TableStyleProperties = XlvTypeOfTableStyleProperties;
|
|
3612
|
+
type PaperSize = XlvTypeOfPaperSize;
|
|
3613
|
+
type Cell = XlvTypeOfCell;
|
|
3614
|
+
type Column = XlvTypeOfColumn;
|
|
3615
|
+
type Row = XlvTypeOfRow;
|
|
3616
|
+
type Worksheet = XlvTypeOfWorksheet;
|
|
3617
|
+
type ValueType = XlvTypeOfValueType;
|
|
3618
|
+
type FormulaType = XlvTypeOfFormulaType;
|
|
3619
|
+
type ErrorValue = XlvTypeOfErrorValue;
|
|
3620
|
+
type WorkbookReader = XlvTypeOfWorkbookReader;
|
|
3621
|
+
type WorkbookWriter = XlvTypeOfWorkbookWriter;
|
|
3622
|
+
type WorksheetReader = XlvTypeOfWorksheetReader;
|
|
3623
|
+
type WorksheetWriter = XlvTypeOfWorksheetWriter;
|
|
3624
|
+
type WorkbookReaderOptions = XlvTypeOfWorkbookReaderOptions;
|
|
3625
|
+
type WorkbookWriterOptions = XlvTypeOfWorkbookWriterOptions;
|
|
3626
|
+
type CsvIO = XlvTypeOfCsvIO;
|
|
3627
|
+
type CsvReadOptions = XlvTypeOfCsvReadOptions;
|
|
3628
|
+
type CsvWriteOptions = XlvTypeOfCsvWriteOptions;
|
|
3629
|
+
type CellMatrix = XlvTypeOfCellMatrix;
|
|
3630
|
+
type DefinedNames = XlvTypeOfDefinedNames;
|
|
3631
|
+
type DecodedLocation = XlvTypeOfDecodedLocation;
|
|
3632
|
+
type NameCell = XlvTypeOfNameCell;
|
|
3633
|
+
type Workbook = XlvTypeOfWorkbook;
|
|
3634
|
+
type XlsxIO = XlvTypeOfXlsxIO;
|
|
3635
|
+
type XlsxReadOptions = XlvTypeOfXlsxReadOptions;
|
|
3636
|
+
type XlsxWriteOptions = XlvTypeOfXlsxWriteOptions;
|
|
3637
|
+
type DataValidations = XlvTypeOfDataValidations;
|
|
3638
|
+
type Anchor = XlvTypeOfAnchor;
|
|
3639
|
+
type Table = XlvTypeOfTable;
|
|
3640
|
+
type TableColumn = XlvTypeOfTableColumn;
|
|
3641
|
+
type ImageData = XlvTypeOfImageData;
|
|
3642
|
+
type ImageRangeInput = XlvTypeOfImageRangeInput;
|
|
3643
|
+
type TableColumnProperties = XlvTypeOfTableColumnProperties;
|
|
3644
|
+
type TableProperties = XlvTypeOfTableProperties;
|
|
3645
|
+
type RelationshipType = XlvTypeOfRelationshipType;
|
|
3646
|
+
type DocumentType = XlvTypeOfDocumentType;
|
|
3647
|
+
type ReadingOrder = XlvTypeOfReadingOrder;
|
|
3648
|
+
type ModelContainer = XlvTypeOfModelContainer;
|
|
3649
|
+
namespace stream {
|
|
3650
|
+
namespace xlsx {
|
|
3651
|
+
type WorkbookWriter = XlvTypeOfWorkbookWriter;
|
|
3652
|
+
type WorkbookReader = XlvTypeOfWorkbookReader;
|
|
3653
|
+
type WorksheetWriter = XlvTypeOfWorksheetWriter;
|
|
3654
|
+
type WorksheetReader = XlvTypeOfWorksheetReader;
|
|
3655
|
+
type WorkbookWriterOptions = XlvTypeOfWorkbookWriterOptions;
|
|
3656
|
+
type WorkbookReaderOptions = XlvTypeOfWorkbookReaderOptions;
|
|
3657
|
+
type WorkbookStreamReaderOptions = XlvTypeOfWorkbookReaderOptions;
|
|
3658
|
+
}
|
|
3659
|
+
}
|
|
3660
|
+
}
|
|
3661
|
+
export { type AboveAverageRuleType, type AddWorksheetOptions, type Address, type Alignment, type AutoFilter, type Border, type BorderDiagonal, type BorderStyle, type Borders, type Buffer, type CalculationProperties, type CellErrorValue, type CellFormulaValue, type CellHyperlinkValue, type CellIsOperators, type CellIsRuleType, type CellModel, type CellRichTextValue, type CellSharedFormulaValue, type CellValue, type CfvoTypes, type Color, type ColorScaleRuleType, type ColumnDefn, type Comment, type ConditionalFormattingBaseRule, type ConditionalFormattingOptions, type ConditionalFormattingRule, type ContainsTextOperators, type ContainsTextRuleType, type Csv, type CsvReadOptions, type CsvWriteOptions, type Cvfo, type DataBarRuleType, type DataValidation, type DataValidationOperator, type DecodedLocation, type DefinedNamesModel, type DefinedNamesRanges, type ExpressionRuleType, type FastCsvFormatterOptionsArgs, type FastCsvParserOptionsArgs, type Fill, type FillGradientAngle, type FillGradientPath, type FillPattern, type FillPatterns, type Font, type GradientStop, type HeaderFooter, type IAnchor, type IAnchorPosition, type IconSetRuleType, type IconSetTypes, type Image, type ImageData, type ImageHyperlinkValue, type ImagePosition, type ImageRange, type ImageRangeInput, type JSZipGeneratorOptions, type Location, type Margins, type Media, type NameCell, type PageSetup, type Protection, type Range, type RichText, type RowBreak, type RowModel, type RowValues, type Style, type TableColumnProperties, type TableProperties, type TableStyleProperties, type TimePeriodRuleType, type TimePeriodTypes, type Top10RuleType, type WorkbookModel, type WorkbookProperties, type WorkbookReaderOptions, type WorkbookView, type WorkbookWriterOptions, type WorksheetModel, type WorksheetOptions, type WorksheetProperties, type WorksheetProtection, type WorksheetState, type WorksheetView, type WorksheetViewCommon, type WorksheetViewFrozen, type WorksheetViewNormal, type WorksheetViewSplit, type Xlsx, type XlsxReadOptions, type XlsxWriteOptions, type config, ExcelJS as default, ExcelJS as "module.exports" };
|