@ai-matrx/alchemy 0.20.6 → 0.22.2
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/CHANGELOG.md +38 -0
- package/dist/core.cjs +1 -6
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +2 -6
- package/dist/core.d.ts +2 -6
- package/dist/core.js +1 -6
- package/dist/core.js.map +1 -1
- package/dist/index.cjs +1 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -6
- package/dist/index.d.ts +2 -6
- package/dist/index.js +1 -6
- package/dist/index.js.map +1 -1
- package/dist/operate-read.cjs +1 -1
- package/dist/operate-read.cjs.map +1 -1
- package/dist/operate-read.d.cts +5 -69
- package/dist/operate-read.d.ts +5 -69
- package/dist/operate-read.js +1 -1
- package/dist/operate-read.js.map +1 -1
- package/dist/operate-xlsx.cjs +2 -148
- package/dist/operate-xlsx.cjs.map +1 -1
- package/dist/operate-xlsx.d.cts +8 -1225
- package/dist/operate-xlsx.d.ts +8 -1225
- package/dist/operate-xlsx.js +2 -148
- package/dist/operate-xlsx.js.map +1 -1
- package/dist/operate.cjs +1 -6
- package/dist/operate.cjs.map +1 -1
- package/dist/operate.d.cts +2 -6
- package/dist/operate.d.ts +2 -6
- package/dist/operate.js +1 -6
- package/dist/operate.js.map +1 -1
- package/dist/react-surface.cjs +3 -0
- package/dist/react-surface.cjs.map +1 -0
- package/dist/react-surface.d.cts +19 -0
- package/dist/react-surface.d.ts +19 -0
- package/dist/react-surface.js +3 -0
- package/dist/react-surface.js.map +1 -0
- package/dist/react-workspace.cjs +2 -2
- package/dist/react-workspace.cjs.map +1 -1
- package/dist/react-workspace.d.cts +3 -6
- package/dist/react-workspace.d.ts +3 -6
- package/dist/react-workspace.js +2 -2
- package/dist/react-workspace.js.map +1 -1
- package/package.json +14 -3
package/dist/operate-xlsx.d.ts
CHANGED
|
@@ -1,1144 +1,5 @@
|
|
|
1
1
|
import { Payload } from '@ai-matrx/kit/transfer-json';
|
|
2
|
-
|
|
3
|
-
/* index.d.ts (C) 2015-present SheetJS and contributors */
|
|
4
|
-
// TypeScript Version: 2.2
|
|
5
|
-
// import * as CFB from "cfb";
|
|
6
|
-
// import * as SSF from "ssf";
|
|
7
|
-
|
|
8
|
-
/** Version string */
|
|
9
|
-
declare const version: string;
|
|
10
|
-
|
|
11
|
-
/** SSF Formatter Library */
|
|
12
|
-
// export { SSF };
|
|
13
|
-
declare const SSF: any;
|
|
14
|
-
|
|
15
|
-
/** CFB Library */
|
|
16
|
-
// export { CFB };
|
|
17
|
-
declare const CFB: any;
|
|
18
|
-
|
|
19
|
-
/** Set internal `fs` instance */
|
|
20
|
-
declare function set_fs(fs: any): void;
|
|
21
|
-
/** Set internal codepage tables */
|
|
22
|
-
declare function set_cptable(cptable: any): void;
|
|
23
|
-
|
|
24
|
-
/** NODE ONLY! Attempts to read filename and parse */
|
|
25
|
-
declare function readFile(filename: string, opts?: ParsingOptions): WorkBook;
|
|
26
|
-
/** Attempts to parse data */
|
|
27
|
-
declare function read(data: any, opts?: ParsingOptions): WorkBook;
|
|
28
|
-
/** Attempts to write or download workbook data to file */
|
|
29
|
-
declare function writeFile(data: WorkBook, filename: string, opts?: WritingOptions): void;
|
|
30
|
-
/** Attempts to write or download workbook data to XLSX file */
|
|
31
|
-
declare function writeFileXLSX(data: WorkBook, filename: string, opts?: WritingOptions): void;
|
|
32
|
-
/** Attempts to write or download workbook data to file asynchronously */
|
|
33
|
-
type CBFunc = () => void;
|
|
34
|
-
declare function writeFileAsync(filename: string, data: WorkBook, opts: WritingOptions | CBFunc, cb?: CBFunc): void;
|
|
35
|
-
/** Attempts to write the workbook data */
|
|
36
|
-
declare function write(data: WorkBook, opts: WritingOptions): any;
|
|
37
|
-
/** Attempts to write the workbook data as XLSX */
|
|
38
|
-
declare function writeXLSX(data: WorkBook, opts: WritingOptions): any;
|
|
39
|
-
|
|
40
|
-
/** Utility Functions */
|
|
41
|
-
declare const utils: XLSX$Utils;
|
|
42
|
-
/** Stream Utility Functions */
|
|
43
|
-
declare const stream: StreamUtils;
|
|
44
|
-
|
|
45
|
-
/** Number Format (either a string or an index to the format table) */
|
|
46
|
-
type NumberFormat = string | number;
|
|
47
|
-
|
|
48
|
-
/** Worksheet specifier (string, number, worksheet) */
|
|
49
|
-
type WSSpec = string | number | WorkSheet;
|
|
50
|
-
|
|
51
|
-
/** Range specifier (string or range or cell), single-cell lifted to range */
|
|
52
|
-
type RangeSpec = string | Range | CellAddress;
|
|
53
|
-
|
|
54
|
-
/** Basic File Properties */
|
|
55
|
-
interface Properties {
|
|
56
|
-
/** Summary tab "Title" */
|
|
57
|
-
Title?: string;
|
|
58
|
-
/** Summary tab "Subject" */
|
|
59
|
-
Subject?: string;
|
|
60
|
-
/** Summary tab "Author" */
|
|
61
|
-
Author?: string;
|
|
62
|
-
/** Summary tab "Manager" */
|
|
63
|
-
Manager?: string;
|
|
64
|
-
/** Summary tab "Company" */
|
|
65
|
-
Company?: string;
|
|
66
|
-
/** Summary tab "Category" */
|
|
67
|
-
Category?: string;
|
|
68
|
-
/** Summary tab "Keywords" */
|
|
69
|
-
Keywords?: string;
|
|
70
|
-
/** Summary tab "Comments" */
|
|
71
|
-
Comments?: string;
|
|
72
|
-
/** Statistics tab "Last saved by" */
|
|
73
|
-
LastAuthor?: string;
|
|
74
|
-
/** Statistics tab "Created" */
|
|
75
|
-
CreatedDate?: Date;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/** Other supported properties */
|
|
79
|
-
interface FullProperties extends Properties {
|
|
80
|
-
ModifiedDate?: Date;
|
|
81
|
-
Application?: string;
|
|
82
|
-
AppVersion?: string;
|
|
83
|
-
DocSecurity?: string;
|
|
84
|
-
HyperlinksChanged?: boolean;
|
|
85
|
-
SharedDoc?: boolean;
|
|
86
|
-
LinksUpToDate?: boolean;
|
|
87
|
-
ScaleCrop?: boolean;
|
|
88
|
-
Worksheets?: number;
|
|
89
|
-
SheetNames?: string[];
|
|
90
|
-
ContentStatus?: string;
|
|
91
|
-
LastPrinted?: string;
|
|
92
|
-
Revision?: string | number;
|
|
93
|
-
Version?: string;
|
|
94
|
-
Identifier?: string;
|
|
95
|
-
Language?: string;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
interface CommonOptions {
|
|
99
|
-
/**
|
|
100
|
-
* If true, throw errors when features are not understood
|
|
101
|
-
* @default false
|
|
102
|
-
*/
|
|
103
|
-
WTF?: boolean;
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* When reading a file with VBA macros, expose CFB blob to `vbaraw` field
|
|
107
|
-
* When writing BIFF8/XLSB/XLSM, reseat `vbaraw` and export to file
|
|
108
|
-
* @default false
|
|
109
|
-
*/
|
|
110
|
-
bookVBA?: boolean;
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* When reading a file, store dates as type d (default is n)
|
|
114
|
-
* When writing XLSX/XLSM file, use native date (default uses date codes)
|
|
115
|
-
* @default false
|
|
116
|
-
*/
|
|
117
|
-
cellDates?: boolean;
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* Create cell objects for stub cells
|
|
121
|
-
* @default false
|
|
122
|
-
*/
|
|
123
|
-
sheetStubs?: boolean;
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* When reading a file, save style/theme info to the .s field
|
|
127
|
-
* When writing a file, export style/theme info
|
|
128
|
-
* @default false
|
|
129
|
-
*/
|
|
130
|
-
cellStyles?: boolean;
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* If defined and file is encrypted, use password
|
|
134
|
-
* @default ''
|
|
135
|
-
*/
|
|
136
|
-
password?: string;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
interface DateNFOption {
|
|
140
|
-
/** Use specified date format */
|
|
141
|
-
dateNF?: NumberFormat;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
interface UTCOption {
|
|
145
|
-
/**
|
|
146
|
-
* For plaintext formats, interpret ambiguous datetimes in UTC
|
|
147
|
-
* If explicitly set to `false`, dates will be parsed in local time.
|
|
148
|
-
*
|
|
149
|
-
* The `true` option is consistent with spreadsheet application export.
|
|
150
|
-
*
|
|
151
|
-
* @default true
|
|
152
|
-
*/
|
|
153
|
-
UTC?: boolean;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
interface DenseOption {
|
|
157
|
-
/** If true, generate dense-mode worksheets */
|
|
158
|
-
dense?: boolean;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
/** Options for read and readFile */
|
|
162
|
-
interface ParsingOptions extends UTCOption, CommonOptions, DenseOption {
|
|
163
|
-
/** Input data encoding */
|
|
164
|
-
type?: 'base64' | 'binary' | 'buffer' | 'file' | 'array' | 'string';
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* Default codepage for legacy files
|
|
168
|
-
*
|
|
169
|
-
* This requires encoding support to be loaded. It is automatically loaded
|
|
170
|
-
* in `xlsx.full.min.js` and in CommonJS / Extendscript, but an extra step
|
|
171
|
-
* is required in React / Angular / Webpack ESM deployments.
|
|
172
|
-
*
|
|
173
|
-
* Check the relevant guide https://docs.sheetjs.com/docs/getting-started/
|
|
174
|
-
*/
|
|
175
|
-
codepage?: number;
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* Save formulae to the .f field
|
|
179
|
-
* @default true
|
|
180
|
-
*/
|
|
181
|
-
cellFormula?: boolean;
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* Parse rich text and save HTML to the .h field
|
|
185
|
-
* @default true
|
|
186
|
-
*/
|
|
187
|
-
cellHTML?: boolean;
|
|
188
|
-
|
|
189
|
-
/**
|
|
190
|
-
* Save number format string to the .z field
|
|
191
|
-
* @default false
|
|
192
|
-
*/
|
|
193
|
-
cellNF?: boolean;
|
|
194
|
-
|
|
195
|
-
/**
|
|
196
|
-
* Generate formatted text to the .w field
|
|
197
|
-
* @default true
|
|
198
|
-
*/
|
|
199
|
-
cellText?: boolean;
|
|
200
|
-
|
|
201
|
-
/** Override default date format (code 14) */
|
|
202
|
-
dateNF?: string;
|
|
203
|
-
|
|
204
|
-
/** Field Separator ("Delimiter" override) */
|
|
205
|
-
FS?: string;
|
|
206
|
-
|
|
207
|
-
/**
|
|
208
|
-
* If >0, read the first sheetRows rows
|
|
209
|
-
* @default 0
|
|
210
|
-
*/
|
|
211
|
-
sheetRows?: number;
|
|
212
|
-
|
|
213
|
-
/**
|
|
214
|
-
* If true, parse calculation chains
|
|
215
|
-
* @default false
|
|
216
|
-
*/
|
|
217
|
-
bookDeps?: boolean;
|
|
218
|
-
|
|
219
|
-
/**
|
|
220
|
-
* If true, add raw files to book object
|
|
221
|
-
* @default false
|
|
222
|
-
*/
|
|
223
|
-
bookFiles?: boolean;
|
|
224
|
-
|
|
225
|
-
/**
|
|
226
|
-
* If true, only parse enough to get book metadata
|
|
227
|
-
* @default false
|
|
228
|
-
*/
|
|
229
|
-
bookProps?: boolean;
|
|
230
|
-
|
|
231
|
-
/**
|
|
232
|
-
* If true, only parse enough to get the sheet names
|
|
233
|
-
* @default false
|
|
234
|
-
*/
|
|
235
|
-
bookSheets?: boolean;
|
|
236
|
-
|
|
237
|
-
/** If specified, only parse the specified sheets or sheet names */
|
|
238
|
-
sheets?: number | string | Array<number | string>;
|
|
239
|
-
|
|
240
|
-
/** If true, plaintext parsing will not parse values */
|
|
241
|
-
raw?: boolean;
|
|
242
|
-
|
|
243
|
-
/** If true, ignore "dimensions" records and guess range using every cell */
|
|
244
|
-
nodim?: boolean;
|
|
245
|
-
|
|
246
|
-
/** If true, preserve _xlfn. prefixes in formula function names */
|
|
247
|
-
xlfn?: boolean;
|
|
248
|
-
|
|
249
|
-
/**
|
|
250
|
-
* For single-sheet formats (including CSV), override the worksheet name
|
|
251
|
-
* @default "Sheet1"
|
|
252
|
-
*/
|
|
253
|
-
sheet?: string;
|
|
254
|
-
|
|
255
|
-
PRN?: boolean;
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
/** Options for write and writeFile */
|
|
260
|
-
interface WritingOptions extends CommonOptions {
|
|
261
|
-
/** Output data encoding */
|
|
262
|
-
type?: 'base64' | 'binary' | 'buffer' | 'file' | 'array' | 'string';
|
|
263
|
-
|
|
264
|
-
/**
|
|
265
|
-
* Generate Shared String Table
|
|
266
|
-
* @default false
|
|
267
|
-
*/
|
|
268
|
-
bookSST?: boolean;
|
|
269
|
-
|
|
270
|
-
/**
|
|
271
|
-
* File format of generated workbook
|
|
272
|
-
* @default 'xlsx'
|
|
273
|
-
*/
|
|
274
|
-
bookType?: BookType;
|
|
275
|
-
|
|
276
|
-
/**
|
|
277
|
-
* Use ZIP compression for ZIP-based formats
|
|
278
|
-
* @default false
|
|
279
|
-
*/
|
|
280
|
-
compression?: boolean;
|
|
281
|
-
|
|
282
|
-
/** Override theme XML when exporting to XLSX/XLSM/XLSB */
|
|
283
|
-
themeXLSX?: string;
|
|
284
|
-
|
|
285
|
-
/**
|
|
286
|
-
* Suppress "number stored as text" errors in generated files
|
|
287
|
-
* @default true
|
|
288
|
-
*/
|
|
289
|
-
ignoreEC?: boolean;
|
|
290
|
-
|
|
291
|
-
/** Override workbook properties on save */
|
|
292
|
-
Props?: Properties;
|
|
293
|
-
|
|
294
|
-
/**
|
|
295
|
-
* Desired codepage for legacy file formats
|
|
296
|
-
*
|
|
297
|
-
* This requires encoding support to be loaded. It is automatically loaded
|
|
298
|
-
* in `xlsx.full.min.js` and in CommonJS / Extendscript, but an extra step
|
|
299
|
-
* is required in React / Angular / Webpack / ESM deployments.
|
|
300
|
-
*
|
|
301
|
-
* Check the relevant guide https://docs.sheetjs.com/docs/getting-started/
|
|
302
|
-
*/
|
|
303
|
-
codepage?: number;
|
|
304
|
-
|
|
305
|
-
/** Base64 encoding of NUMBERS base for exports */
|
|
306
|
-
numbers?: string;
|
|
307
|
-
|
|
308
|
-
/**
|
|
309
|
-
* For single-sheet formats, export the specified worksheet.
|
|
310
|
-
*
|
|
311
|
-
* The property must be a string (sheet name) or number (`SheetNames` index).
|
|
312
|
-
*
|
|
313
|
-
* If this option is omitted, the first worksheet will be exported.
|
|
314
|
-
*/
|
|
315
|
-
sheet?: string | number;
|
|
316
|
-
|
|
317
|
-
/** Field Separator ("delimiter") for CSV / Text output */
|
|
318
|
-
FS?: string;
|
|
319
|
-
|
|
320
|
-
/** Record Separator ("row separator") for CSV / Text output */
|
|
321
|
-
RS?: string;
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
/** Workbook Object */
|
|
325
|
-
interface WorkBook {
|
|
326
|
-
/**
|
|
327
|
-
* A dictionary of the worksheets in the workbook.
|
|
328
|
-
* Use SheetNames to reference these.
|
|
329
|
-
*/
|
|
330
|
-
Sheets: { [sheet: string]: WorkSheet };
|
|
331
|
-
|
|
332
|
-
/** Ordered list of the sheet names in the workbook */
|
|
333
|
-
SheetNames: string[];
|
|
334
|
-
|
|
335
|
-
/** Standard workbook Properties */
|
|
336
|
-
Props?: FullProperties;
|
|
337
|
-
|
|
338
|
-
/** Custom workbook Properties */
|
|
339
|
-
Custprops?: object;
|
|
340
|
-
|
|
341
|
-
Workbook?: WBProps;
|
|
342
|
-
|
|
343
|
-
vbaraw?: any;
|
|
344
|
-
|
|
345
|
-
/** Original file type (when parsed with `read` or `readFile`) */
|
|
346
|
-
bookType?: BookType;
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
interface SheetProps {
|
|
350
|
-
/** Name of Sheet */
|
|
351
|
-
name?: string;
|
|
352
|
-
|
|
353
|
-
/** Sheet Visibility (0=Visible 1=Hidden 2=VeryHidden) */
|
|
354
|
-
Hidden?: 0 | 1 | 2;
|
|
355
|
-
|
|
356
|
-
/** Name of Document Module in associated VBA Project */
|
|
357
|
-
CodeName?: string;
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
/** Defined Name Object */
|
|
361
|
-
interface DefinedName {
|
|
362
|
-
/** Name */
|
|
363
|
-
Name: string;
|
|
364
|
-
|
|
365
|
-
/** Reference */
|
|
366
|
-
Ref: string;
|
|
367
|
-
|
|
368
|
-
/** Scope (undefined for workbook scope) */
|
|
369
|
-
Sheet?: number;
|
|
370
|
-
|
|
371
|
-
/** Name comment */
|
|
372
|
-
Comment?: string;
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
/** Workbook-Level Attributes */
|
|
376
|
-
interface WBProps {
|
|
377
|
-
/** Sheet Properties */
|
|
378
|
-
Sheets?: SheetProps[];
|
|
379
|
-
|
|
380
|
-
/** Defined Names */
|
|
381
|
-
Names?: DefinedName[];
|
|
382
|
-
|
|
383
|
-
/** Workbook Views */
|
|
384
|
-
Views?: WBView[];
|
|
385
|
-
|
|
386
|
-
/** Other Workbook Properties */
|
|
387
|
-
WBProps?: WorkbookProperties;
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
/** Workbook View */
|
|
391
|
-
interface WBView {
|
|
392
|
-
/** Right-to-left mode */
|
|
393
|
-
RTL?: boolean;
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
/** Other Workbook Properties */
|
|
397
|
-
interface WorkbookProperties {
|
|
398
|
-
/** Worksheet Epoch (1904 if true, 1900 if false) */
|
|
399
|
-
date1904?: boolean;
|
|
400
|
-
|
|
401
|
-
/** Warn or strip personally identifying info on save */
|
|
402
|
-
filterPrivacy?: boolean;
|
|
403
|
-
|
|
404
|
-
/** Name of Document Module in associated VBA Project */
|
|
405
|
-
CodeName?: string;
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
/** DBF Field Header */
|
|
409
|
-
interface DBFField {
|
|
410
|
-
/** Original Field Name */
|
|
411
|
-
name?: string;
|
|
412
|
-
|
|
413
|
-
/** Field Type */
|
|
414
|
-
type?: string;
|
|
415
|
-
|
|
416
|
-
/** Field Length */
|
|
417
|
-
len?: number;
|
|
418
|
-
|
|
419
|
-
/** Field Decimal Count */
|
|
420
|
-
dec?: number;
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
/** Column Properties Object */
|
|
424
|
-
interface ColInfo {
|
|
425
|
-
/* --- visibility --- */
|
|
426
|
-
|
|
427
|
-
/** if true, the column is hidden */
|
|
428
|
-
hidden?: boolean;
|
|
429
|
-
|
|
430
|
-
/* --- column width --- */
|
|
431
|
-
|
|
432
|
-
/** width in Excel's "Max Digit Width", width*256 is integral */
|
|
433
|
-
width?: number;
|
|
434
|
-
|
|
435
|
-
/** width in screen pixels */
|
|
436
|
-
wpx?: number;
|
|
437
|
-
|
|
438
|
-
/** width in "characters" */
|
|
439
|
-
wch?: number;
|
|
440
|
-
|
|
441
|
-
/** outline / group level */
|
|
442
|
-
level?: number;
|
|
443
|
-
|
|
444
|
-
/** Excel's "Max Digit Width" unit, always integral */
|
|
445
|
-
MDW?: number;
|
|
446
|
-
|
|
447
|
-
/** DBF Field Header */
|
|
448
|
-
DBF?: DBFField;
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
/** Row Properties Object */
|
|
452
|
-
interface RowInfo {
|
|
453
|
-
/* --- visibility --- */
|
|
454
|
-
|
|
455
|
-
/** if true, the column is hidden */
|
|
456
|
-
hidden?: boolean;
|
|
457
|
-
|
|
458
|
-
/* --- row height --- */
|
|
459
|
-
|
|
460
|
-
/** height in screen pixels */
|
|
461
|
-
hpx?: number;
|
|
462
|
-
|
|
463
|
-
/** height in points */
|
|
464
|
-
hpt?: number;
|
|
465
|
-
|
|
466
|
-
/** outline / group level */
|
|
467
|
-
level?: number;
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
/**
|
|
471
|
-
* Write sheet protection properties.
|
|
472
|
-
*/
|
|
473
|
-
interface ProtectInfo {
|
|
474
|
-
/**
|
|
475
|
-
* The password for formats that support password-protected sheets
|
|
476
|
-
* (XLSX/XLSB/XLS). The writer uses the XOR obfuscation method.
|
|
477
|
-
*/
|
|
478
|
-
password?: string;
|
|
479
|
-
/**
|
|
480
|
-
* Select locked cells
|
|
481
|
-
* @default: true
|
|
482
|
-
*/
|
|
483
|
-
selectLockedCells?: boolean;
|
|
484
|
-
/**
|
|
485
|
-
* Select unlocked cells
|
|
486
|
-
* @default: true
|
|
487
|
-
*/
|
|
488
|
-
selectUnlockedCells?: boolean;
|
|
489
|
-
/**
|
|
490
|
-
* Format cells
|
|
491
|
-
* @default: false
|
|
492
|
-
*/
|
|
493
|
-
formatCells?: boolean;
|
|
494
|
-
/**
|
|
495
|
-
* Format columns
|
|
496
|
-
* @default: false
|
|
497
|
-
*/
|
|
498
|
-
formatColumns?: boolean;
|
|
499
|
-
/**
|
|
500
|
-
* Format rows
|
|
501
|
-
* @default: false
|
|
502
|
-
*/
|
|
503
|
-
formatRows?: boolean;
|
|
504
|
-
/**
|
|
505
|
-
* Insert columns
|
|
506
|
-
* @default: false
|
|
507
|
-
*/
|
|
508
|
-
insertColumns?: boolean;
|
|
509
|
-
/**
|
|
510
|
-
* Insert rows
|
|
511
|
-
* @default: false
|
|
512
|
-
*/
|
|
513
|
-
insertRows?: boolean;
|
|
514
|
-
/**
|
|
515
|
-
* Insert hyperlinks
|
|
516
|
-
* @default: false
|
|
517
|
-
*/
|
|
518
|
-
insertHyperlinks?: boolean;
|
|
519
|
-
/**
|
|
520
|
-
* Delete columns
|
|
521
|
-
* @default: false
|
|
522
|
-
*/
|
|
523
|
-
deleteColumns?: boolean;
|
|
524
|
-
/**
|
|
525
|
-
* Delete rows
|
|
526
|
-
* @default: false
|
|
527
|
-
*/
|
|
528
|
-
deleteRows?: boolean;
|
|
529
|
-
/**
|
|
530
|
-
* Sort
|
|
531
|
-
* @default: false
|
|
532
|
-
*/
|
|
533
|
-
sort?: boolean;
|
|
534
|
-
/**
|
|
535
|
-
* Filter
|
|
536
|
-
* @default: false
|
|
537
|
-
*/
|
|
538
|
-
autoFilter?: boolean;
|
|
539
|
-
/**
|
|
540
|
-
* Use PivotTable reports
|
|
541
|
-
* @default: false
|
|
542
|
-
*/
|
|
543
|
-
pivotTables?: boolean;
|
|
544
|
-
/**
|
|
545
|
-
* Edit objects
|
|
546
|
-
* @default: true
|
|
547
|
-
*/
|
|
548
|
-
objects?: boolean;
|
|
549
|
-
/**
|
|
550
|
-
* Edit scenarios
|
|
551
|
-
* @default: true
|
|
552
|
-
*/
|
|
553
|
-
scenarios?: boolean;
|
|
554
|
-
}
|
|
555
|
-
|
|
556
|
-
/** Page Margins -- see Excel Page Setup .. Margins diagram for explanation */
|
|
557
|
-
interface MarginInfo {
|
|
558
|
-
/** Left side margin (inches) */
|
|
559
|
-
left?: number;
|
|
560
|
-
/** Right side margin (inches) */
|
|
561
|
-
right?: number;
|
|
562
|
-
/** Top side margin (inches) */
|
|
563
|
-
top?: number;
|
|
564
|
-
/** Bottom side margin (inches) */
|
|
565
|
-
bottom?: number;
|
|
566
|
-
/** Header top margin (inches) */
|
|
567
|
-
header?: number;
|
|
568
|
-
/** Footer bottom height (inches) */
|
|
569
|
-
footer?: number;
|
|
570
|
-
}
|
|
571
|
-
type SheetType = 'sheet' | 'chart';
|
|
572
|
-
type SheetKeys = string | MarginInfo | SheetType;
|
|
573
|
-
/** General object representing a Sheet (worksheet or chartsheet) */
|
|
574
|
-
interface Sheet {
|
|
575
|
-
/**
|
|
576
|
-
* Sparse-mode store cells with keys corresponding to A1-style address
|
|
577
|
-
* Dense-mode store cells in the '!data' key
|
|
578
|
-
* Special keys start with '!'
|
|
579
|
-
*/
|
|
580
|
-
[cell: string]: CellObject | CellObject[][] | SheetKeys | any;
|
|
581
|
-
|
|
582
|
-
/**
|
|
583
|
-
* Dense-mode worksheets store data in an array of arrays
|
|
584
|
-
*
|
|
585
|
-
* Cells are accessed with sheet['!data'][R][C] (where R and C are 0-indexed)
|
|
586
|
-
*/
|
|
587
|
-
'!data'?: CellObject[][];
|
|
588
|
-
|
|
589
|
-
/** Sheet type */
|
|
590
|
-
'!type'?: SheetType;
|
|
591
|
-
|
|
592
|
-
/** Sheet Range (A1-style) */
|
|
593
|
-
'!ref'?: string;
|
|
594
|
-
|
|
595
|
-
/** Page Margins */
|
|
596
|
-
'!margins'?: MarginInfo;
|
|
597
|
-
}
|
|
598
|
-
/** General object representing a dense Sheet (worksheet or chartsheet) */
|
|
599
|
-
interface DenseSheet extends Sheet {
|
|
600
|
-
/**
|
|
601
|
-
* Special keys start with '!'
|
|
602
|
-
* Dense-mode worksheets store data in the '!data' key
|
|
603
|
-
*/
|
|
604
|
-
[cell: string]: CellObject[][] | SheetKeys | any;
|
|
605
|
-
|
|
606
|
-
/**
|
|
607
|
-
* Dense-mode worksheets store data in an array of arrays
|
|
608
|
-
*
|
|
609
|
-
* Cells are accessed with sheet['!data'][R][C] (where R and C are 0-indexed)
|
|
610
|
-
*/
|
|
611
|
-
'!data': CellObject[][];
|
|
612
|
-
}
|
|
613
|
-
/** General object representing a sparse Sheet (worksheet or chartsheet) */
|
|
614
|
-
interface SparseSheet extends Sheet {
|
|
615
|
-
/**
|
|
616
|
-
* Sparse-mode store cells with keys corresponding to A1-style address
|
|
617
|
-
* Cells are accessed with sheet[addr]
|
|
618
|
-
*/
|
|
619
|
-
'!data': never;
|
|
620
|
-
}
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
/** AutoFilter properties */
|
|
624
|
-
interface AutoFilterInfo {
|
|
625
|
-
/** Range of the AutoFilter table */
|
|
626
|
-
ref: string;
|
|
627
|
-
}
|
|
628
|
-
|
|
629
|
-
type WSKeys = SheetKeys | ColInfo[] | RowInfo[] | Range[] | ProtectInfo | AutoFilterInfo;
|
|
630
|
-
|
|
631
|
-
/** Worksheet Object */
|
|
632
|
-
interface WorkSheet extends Sheet {
|
|
633
|
-
/**
|
|
634
|
-
* Indexing with a cell address string maps to a cell object
|
|
635
|
-
* Special keys start with '!'
|
|
636
|
-
*/
|
|
637
|
-
[cell: string]: CellObject | WSKeys | any;
|
|
638
|
-
|
|
639
|
-
/** Column Info */
|
|
640
|
-
'!cols'?: ColInfo[];
|
|
641
|
-
|
|
642
|
-
/** Row Info */
|
|
643
|
-
'!rows'?: RowInfo[];
|
|
644
|
-
|
|
645
|
-
/** Merge Ranges */
|
|
646
|
-
'!merges'?: Range[];
|
|
647
|
-
|
|
648
|
-
/** Worksheet Protection info */
|
|
649
|
-
'!protect'?: ProtectInfo;
|
|
650
|
-
|
|
651
|
-
/** AutoFilter info */
|
|
652
|
-
'!autofilter'?: AutoFilterInfo;
|
|
653
|
-
}
|
|
654
|
-
/** Dense Worksheet Object */
|
|
655
|
-
interface DenseWorkSheet extends DenseSheet {
|
|
656
|
-
/**
|
|
657
|
-
* Dense-mode worksheets store data in an array of arrays
|
|
658
|
-
*
|
|
659
|
-
* Cells are accessed with sheet['!data'][R][C] (where R and C are 0-indexed)
|
|
660
|
-
*/
|
|
661
|
-
'!data': CellObject[][];
|
|
662
|
-
}
|
|
663
|
-
|
|
664
|
-
/**
|
|
665
|
-
* Worksheet Object with CellObject type
|
|
666
|
-
*
|
|
667
|
-
* The normal Worksheet type uses indexer of type `any` -- this enforces CellObject
|
|
668
|
-
*/
|
|
669
|
-
interface StrictWS { [addr: string]: CellObject; }
|
|
670
|
-
|
|
671
|
-
/**
|
|
672
|
-
* The Excel data type for a cell.
|
|
673
|
-
* b Boolean, n Number, e error, s String, d Date, z Stub
|
|
674
|
-
*/
|
|
675
|
-
type ExcelDataType = 'b' | 'n' | 'e' | 's' | 'd' | 'z';
|
|
676
|
-
|
|
677
|
-
/**
|
|
678
|
-
* Type of generated workbook
|
|
679
|
-
* @default 'xlsx'
|
|
680
|
-
*/
|
|
681
|
-
type BookType = 'xlsx' | 'xlsm' | 'xlsb' | 'xls' | 'xla' | 'biff8' | 'biff5' | 'biff2' | 'xlml' | 'ods' | 'fods' | 'csv' | 'txt' | 'sylk' | 'slk' | 'html' | 'dif' | 'rtf' | 'prn' | 'eth' | 'dbf' | 'numbers';
|
|
682
|
-
|
|
683
|
-
/** Comment element */
|
|
684
|
-
interface Comment {
|
|
685
|
-
/** Author of the comment block */
|
|
686
|
-
a?: string;
|
|
687
|
-
|
|
688
|
-
/** Plaintext of the comment */
|
|
689
|
-
t: string;
|
|
690
|
-
|
|
691
|
-
/** If true, mark the comment as a part of a thread */
|
|
692
|
-
T?: boolean;
|
|
693
|
-
}
|
|
694
|
-
|
|
695
|
-
/** Cell comments */
|
|
696
|
-
interface Comments extends Array<Comment> {
|
|
697
|
-
/** Hide comment by default */
|
|
698
|
-
hidden?: boolean;
|
|
699
|
-
}
|
|
700
|
-
|
|
701
|
-
/** Link object */
|
|
702
|
-
interface Hyperlink {
|
|
703
|
-
/** Target of the link (HREF) */
|
|
704
|
-
Target: string;
|
|
705
|
-
|
|
706
|
-
/** Plaintext tooltip to display when mouse is over cell */
|
|
707
|
-
Tooltip?: string;
|
|
708
|
-
}
|
|
709
|
-
|
|
710
|
-
/** Worksheet Cell Object */
|
|
711
|
-
interface CellObject {
|
|
712
|
-
/** The raw value of the cell. Can be omitted if a formula is specified */
|
|
713
|
-
v?: string | number | boolean | Date;
|
|
714
|
-
|
|
715
|
-
/** Formatted text (if applicable) */
|
|
716
|
-
w?: string;
|
|
717
|
-
|
|
718
|
-
/**
|
|
719
|
-
* The Excel Data Type of the cell.
|
|
720
|
-
* b Boolean, n Number, e Error, s String, d Date, z Empty
|
|
721
|
-
*/
|
|
722
|
-
t: ExcelDataType;
|
|
723
|
-
|
|
724
|
-
/** Cell formula (if applicable) */
|
|
725
|
-
f?: string;
|
|
726
|
-
|
|
727
|
-
/** Range of enclosing array if formula is array formula (if applicable) */
|
|
728
|
-
F?: string;
|
|
729
|
-
|
|
730
|
-
/** If true, cell is a dynamic array formula (for supported file formats) */
|
|
731
|
-
D?: boolean;
|
|
732
|
-
|
|
733
|
-
/** Rich text encoding (if applicable) */
|
|
734
|
-
r?: any;
|
|
735
|
-
|
|
736
|
-
/** HTML rendering of the rich text (if applicable) */
|
|
737
|
-
h?: string;
|
|
738
|
-
|
|
739
|
-
/** Comments associated with the cell */
|
|
740
|
-
c?: Comments;
|
|
741
|
-
|
|
742
|
-
/** Number format string associated with the cell (if requested) */
|
|
743
|
-
z?: NumberFormat;
|
|
744
|
-
|
|
745
|
-
/** Cell hyperlink object (.Target holds link, .tooltip is tooltip) */
|
|
746
|
-
l?: Hyperlink;
|
|
747
|
-
|
|
748
|
-
/** The style/theme of the cell (if applicable) */
|
|
749
|
-
s?: any;
|
|
750
|
-
}
|
|
751
|
-
|
|
752
|
-
/** Simple Cell Address */
|
|
753
|
-
interface CellAddress {
|
|
754
|
-
/** Column number */
|
|
755
|
-
c: number;
|
|
756
|
-
/** Row number */
|
|
757
|
-
r: number;
|
|
758
|
-
}
|
|
759
|
-
|
|
760
|
-
/** Range object (representing ranges like "A1:B2") */
|
|
761
|
-
interface Range {
|
|
762
|
-
/** Starting cell */
|
|
763
|
-
s: CellAddress;
|
|
764
|
-
/** Ending cell */
|
|
765
|
-
e: CellAddress;
|
|
766
|
-
}
|
|
767
|
-
|
|
768
|
-
interface Sheet2CSVOpts extends DateNFOption {
|
|
769
|
-
/** Field Separator ("delimiter") */
|
|
770
|
-
FS?: string;
|
|
771
|
-
|
|
772
|
-
/** Record Separator ("row separator") */
|
|
773
|
-
RS?: string;
|
|
774
|
-
|
|
775
|
-
/** Remove trailing field separators in each record */
|
|
776
|
-
strip?: boolean;
|
|
777
|
-
|
|
778
|
-
/** Include blank lines in the CSV output */
|
|
779
|
-
blankrows?: boolean;
|
|
780
|
-
|
|
781
|
-
/** Skip hidden rows and columns in the CSV output */
|
|
782
|
-
skipHidden?: boolean;
|
|
783
|
-
|
|
784
|
-
/** Force quotes around fields */
|
|
785
|
-
forceQuotes?: boolean;
|
|
786
|
-
|
|
787
|
-
/** if true, return raw numbers; if false, return formatted numbers */
|
|
788
|
-
rawNumbers?: boolean;
|
|
789
|
-
}
|
|
790
|
-
|
|
791
|
-
interface OriginOption {
|
|
792
|
-
/** Top-Left cell for operation (CellAddress or A1 string or row) */
|
|
793
|
-
origin?: number | string | CellAddress;
|
|
794
|
-
}
|
|
795
|
-
|
|
796
|
-
interface Sheet2HTMLOpts {
|
|
797
|
-
/** TABLE element id attribute */
|
|
798
|
-
id?: string;
|
|
799
|
-
|
|
800
|
-
/** Add contenteditable to every cell */
|
|
801
|
-
editable?: boolean;
|
|
802
|
-
|
|
803
|
-
/** Header HTML */
|
|
804
|
-
header?: string;
|
|
805
|
-
|
|
806
|
-
/** Footer HTML */
|
|
807
|
-
footer?: string;
|
|
808
|
-
}
|
|
809
|
-
|
|
810
|
-
interface Sheet2JSONOpts extends DateNFOption {
|
|
811
|
-
/** Output format */
|
|
812
|
-
header?: "A"|number|string[];
|
|
813
|
-
|
|
814
|
-
/** Override worksheet range */
|
|
815
|
-
range?: any;
|
|
816
|
-
|
|
817
|
-
/** Include or omit blank lines in the output */
|
|
818
|
-
blankrows?: boolean;
|
|
819
|
-
|
|
820
|
-
/** Default value for null/undefined values */
|
|
821
|
-
defval?: any;
|
|
822
|
-
|
|
823
|
-
/** if true, return raw data; if false, return formatted text */
|
|
824
|
-
raw?: boolean;
|
|
825
|
-
|
|
826
|
-
/** if true, skip hidden rows and columns */
|
|
827
|
-
skipHidden?: boolean;
|
|
828
|
-
|
|
829
|
-
/** if true, return raw numbers; if false, return formatted numbers */
|
|
830
|
-
rawNumbers?: boolean;
|
|
831
|
-
|
|
832
|
-
/**
|
|
833
|
-
* If true, return dates whose UTC interpretation is correct
|
|
834
|
-
* By default, return dates whose local interpretation is correct
|
|
835
|
-
*
|
|
836
|
-
* @default false
|
|
837
|
-
*/
|
|
838
|
-
UTC?: boolean;
|
|
839
|
-
}
|
|
840
|
-
|
|
841
|
-
interface Sheet2FormulaOpts {
|
|
842
|
-
/**
|
|
843
|
-
* If false, only export cells with formulae.
|
|
844
|
-
* By default, synthetic formulae are generated for each cell.
|
|
845
|
-
*/
|
|
846
|
-
values?: boolean;
|
|
847
|
-
}
|
|
848
|
-
|
|
849
|
-
interface UTCDateOption {
|
|
850
|
-
/**
|
|
851
|
-
* If true, dates are interpreted using the UTC methods
|
|
852
|
-
* By default, dates are interpreted in the local timezone
|
|
853
|
-
*
|
|
854
|
-
* @default false
|
|
855
|
-
*/
|
|
856
|
-
UTC?: boolean;
|
|
857
|
-
}
|
|
858
|
-
|
|
859
|
-
interface AOA2SheetOpts extends CommonOptions, UTCDateOption, DateNFOption, DenseOption {
|
|
860
|
-
/**
|
|
861
|
-
* Create cell objects for stub cells
|
|
862
|
-
* @default false
|
|
863
|
-
*/
|
|
864
|
-
sheetStubs?: boolean;
|
|
865
|
-
}
|
|
866
|
-
|
|
867
|
-
interface SheetAOAOpts extends AOA2SheetOpts, OriginOption {}
|
|
868
|
-
|
|
869
|
-
interface JSON2SheetOpts extends CommonOptions, UTCDateOption, DateNFOption, OriginOption, DenseOption {
|
|
870
|
-
/** Use specified column order */
|
|
871
|
-
header?: string[];
|
|
872
|
-
|
|
873
|
-
/** Skip header row in generated sheet */
|
|
874
|
-
skipHeader?: boolean;
|
|
875
|
-
}
|
|
876
|
-
|
|
877
|
-
interface Table2SheetOpts extends CommonOptions, DateNFOption, OriginOption {
|
|
878
|
-
/** If true, plaintext parsing will not parse values */
|
|
879
|
-
raw?: boolean;
|
|
880
|
-
|
|
881
|
-
/**
|
|
882
|
-
* If >0, read the first sheetRows rows
|
|
883
|
-
* @default 0
|
|
884
|
-
*/
|
|
885
|
-
sheetRows?: number;
|
|
886
|
-
|
|
887
|
-
/** If true, hidden rows and cells will not be parsed */
|
|
888
|
-
display?: boolean;
|
|
889
|
-
|
|
890
|
-
/**
|
|
891
|
-
* Override the worksheet name
|
|
892
|
-
* @default "Sheet1"
|
|
893
|
-
*/
|
|
894
|
-
sheet?: string;
|
|
895
|
-
|
|
896
|
-
/**
|
|
897
|
-
* If true, interpret date strings as if they are UTC.
|
|
898
|
-
* By default, date strings are interpreted in the local timezone.
|
|
899
|
-
*
|
|
900
|
-
* @default false
|
|
901
|
-
*/
|
|
902
|
-
UTC?: boolean;
|
|
903
|
-
}
|
|
904
|
-
|
|
905
|
-
interface Table2BookOpts extends Table2SheetOpts {
|
|
906
|
-
/**
|
|
907
|
-
* Override the worksheet name
|
|
908
|
-
* @default "Sheet1"
|
|
909
|
-
*/
|
|
910
|
-
sheet?: string;
|
|
911
|
-
}
|
|
912
|
-
|
|
913
|
-
/** General utilities */
|
|
914
|
-
interface XLSX$Utils {
|
|
915
|
-
/* --- Import Functions --- */
|
|
916
|
-
|
|
917
|
-
/** Converts an array of arrays of JS data to a worksheet. */
|
|
918
|
-
aoa_to_sheet<T>(data: T[][], opts?: AOA2SheetOpts): WorkSheet;
|
|
919
|
-
aoa_to_sheet(data: any[][], opts?: AOA2SheetOpts): WorkSheet;
|
|
920
|
-
|
|
921
|
-
/** Converts an array of JS objects to a worksheet. */
|
|
922
|
-
json_to_sheet<T>(data: T[], opts?: JSON2SheetOpts): WorkSheet;
|
|
923
|
-
json_to_sheet(data: any[], opts?: JSON2SheetOpts): WorkSheet;
|
|
924
|
-
|
|
925
|
-
/** BROWSER ONLY! Converts a TABLE DOM element to a worksheet. */
|
|
926
|
-
table_to_sheet(data: any, opts?: Table2SheetOpts): WorkSheet;
|
|
927
|
-
table_to_book(data: any, opts?: Table2BookOpts): WorkBook;
|
|
928
|
-
sheet_add_dom(ws: WorkSheet, data: any, opts?: Table2SheetOpts): WorkSheet;
|
|
929
|
-
|
|
930
|
-
/* --- Export Functions --- */
|
|
931
|
-
|
|
932
|
-
/** Converts a worksheet object to an array of JSON objects */
|
|
933
|
-
sheet_to_json<T>(worksheet: WorkSheet, opts?: Sheet2JSONOpts): T[];
|
|
934
|
-
sheet_to_json(worksheet: WorkSheet, opts?: Sheet2JSONOpts): any[][];
|
|
935
|
-
sheet_to_json(worksheet: WorkSheet, opts?: Sheet2JSONOpts): any[];
|
|
936
|
-
|
|
937
|
-
/** Generates delimiter-separated-values output */
|
|
938
|
-
sheet_to_csv(worksheet: WorkSheet, options?: Sheet2CSVOpts): string;
|
|
939
|
-
|
|
940
|
-
/** Generates UTF16 Formatted Text */
|
|
941
|
-
sheet_to_txt(worksheet: WorkSheet, options?: Sheet2CSVOpts): string;
|
|
942
|
-
|
|
943
|
-
/** Generates HTML */
|
|
944
|
-
sheet_to_html(worksheet: WorkSheet, options?: Sheet2HTMLOpts): string;
|
|
945
|
-
|
|
946
|
-
/** Generates a list of the formulae (with value fallbacks) */
|
|
947
|
-
sheet_to_formulae(worksheet: WorkSheet, options?: Sheet2FormulaOpts): string[];
|
|
948
|
-
|
|
949
|
-
/* --- Cell Address Utilities --- */
|
|
950
|
-
|
|
951
|
-
/** Converts 0-indexed cell address to A1 form */
|
|
952
|
-
encode_cell(cell: CellAddress): string;
|
|
953
|
-
|
|
954
|
-
/** Converts 0-indexed row to A1 form */
|
|
955
|
-
encode_row(row: number): string;
|
|
956
|
-
|
|
957
|
-
/** Converts 0-indexed column to A1 form */
|
|
958
|
-
encode_col(col: number): string;
|
|
959
|
-
|
|
960
|
-
/** Converts 0-indexed range to A1 form */
|
|
961
|
-
encode_range(s: CellAddress, e: CellAddress): string;
|
|
962
|
-
encode_range(r: Range): string;
|
|
963
|
-
|
|
964
|
-
/** Converts A1 cell address to 0-indexed form */
|
|
965
|
-
decode_cell(address: string): CellAddress;
|
|
966
|
-
|
|
967
|
-
/** Converts A1 row to 0-indexed form */
|
|
968
|
-
decode_row(row: string): number;
|
|
969
|
-
|
|
970
|
-
/** Converts A1 column to 0-indexed form */
|
|
971
|
-
decode_col(col: string): number;
|
|
972
|
-
|
|
973
|
-
/** Converts A1 range to 0-indexed form */
|
|
974
|
-
decode_range(range: string): Range;
|
|
975
|
-
|
|
976
|
-
/** Format cell */
|
|
977
|
-
format_cell(cell: CellObject, v?: any, opts?: any): string;
|
|
978
|
-
|
|
979
|
-
/* --- General Utilities --- */
|
|
980
|
-
|
|
981
|
-
/** Create a new workbook */
|
|
982
|
-
book_new(ws?: WorkSheet, wsname?: string): WorkBook;
|
|
983
|
-
|
|
984
|
-
/** Create a new worksheet */
|
|
985
|
-
sheet_new(opts?: DenseOption): WorkSheet;
|
|
986
|
-
|
|
987
|
-
/** Append a worksheet to a workbook, returns new worksheet name */
|
|
988
|
-
book_append_sheet(workbook: WorkBook, worksheet: WorkSheet, name?: string, roll?: boolean): string;
|
|
989
|
-
|
|
990
|
-
/** Set sheet visibility (visible/hidden/very hidden) */
|
|
991
|
-
book_set_sheet_visibility(workbook: WorkBook, sheet: number|string, visibility: number): void;
|
|
992
|
-
|
|
993
|
-
/** Set number format for a cell */
|
|
994
|
-
cell_set_number_format(cell: CellObject, fmt: string|number): CellObject;
|
|
995
|
-
|
|
996
|
-
/** Set hyperlink for a cell */
|
|
997
|
-
cell_set_hyperlink(cell: CellObject, target: string, tooltip?: string): CellObject;
|
|
998
|
-
|
|
999
|
-
/** Set internal link for a cell */
|
|
1000
|
-
cell_set_internal_link(cell: CellObject, target: string, tooltip?: string): CellObject;
|
|
1001
|
-
|
|
1002
|
-
/** Add comment to a cell */
|
|
1003
|
-
cell_add_comment(cell: CellObject, text: string, author?: string): void;
|
|
1004
|
-
|
|
1005
|
-
/** Assign an Array Formula to a range */
|
|
1006
|
-
sheet_set_array_formula(ws: WorkSheet, range: Range|string, formula: string, dynamic?: boolean): WorkSheet;
|
|
1007
|
-
|
|
1008
|
-
/** Add an array of arrays of JS data to a worksheet */
|
|
1009
|
-
sheet_add_aoa<T>(ws: WorkSheet, data: T[][], opts?: SheetAOAOpts): WorkSheet;
|
|
1010
|
-
sheet_add_aoa(ws: WorkSheet, data: any[][], opts?: SheetAOAOpts): WorkSheet;
|
|
1011
|
-
|
|
1012
|
-
/** Add an array of JS objects to a worksheet */
|
|
1013
|
-
sheet_add_json(ws: WorkSheet, data: any[], opts?: JSON2SheetOpts): WorkSheet;
|
|
1014
|
-
sheet_add_json<T>(ws: WorkSheet, data: T[], opts?: JSON2SheetOpts): WorkSheet;
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
consts: XLSX$Consts;
|
|
1018
|
-
}
|
|
1019
|
-
|
|
1020
|
-
interface XLSX$Consts {
|
|
1021
|
-
/* --- Sheet Visibility --- */
|
|
1022
|
-
|
|
1023
|
-
/** Visibility: Visible */
|
|
1024
|
-
SHEET_VISIBLE: 0;
|
|
1025
|
-
|
|
1026
|
-
/** Visibility: Hidden */
|
|
1027
|
-
SHEET_HIDDEN: 1;
|
|
1028
|
-
|
|
1029
|
-
/** Visibility: Very Hidden */
|
|
1030
|
-
SHEET_VERYHIDDEN: 2;
|
|
1031
|
-
}
|
|
1032
|
-
|
|
1033
|
-
interface StrideOption {
|
|
1034
|
-
/** Number of rows to write per step */
|
|
1035
|
-
stride?: number;
|
|
1036
|
-
}
|
|
1037
|
-
|
|
1038
|
-
interface XLMLStreamOpts extends WritingOptions, StrideOption {}
|
|
1039
|
-
|
|
1040
|
-
/**
|
|
1041
|
-
* Streaming write methods
|
|
1042
|
-
*
|
|
1043
|
-
* These methods are directly compatible with NodeJS `stream.Readable` API
|
|
1044
|
-
*
|
|
1045
|
-
* Web Streams (modern browsers) can play nice with NodeJS streams. See the Web
|
|
1046
|
-
* Demo at https://docs.sheetjs.com/docs/demos/bigdata/worker#streaming-write
|
|
1047
|
-
*
|
|
1048
|
-
* NOTE: These methods are not included in the `xlsx.mini.min.js` build!
|
|
1049
|
-
*/
|
|
1050
|
-
interface StreamUtils {
|
|
1051
|
-
/** Set `Readable` (for environments that do not support NodeJS Streams) */
|
|
1052
|
-
set_readable(Readable: any): void;
|
|
1053
|
-
|
|
1054
|
-
/* --- Worksheet writers --- */
|
|
1055
|
-
|
|
1056
|
-
/** CSV output stream, generate one line at a time */
|
|
1057
|
-
to_csv(sheet: WorkSheet, opts?: Sheet2CSVOpts): any;
|
|
1058
|
-
/** HTML output stream, generate one line at a time */
|
|
1059
|
-
to_html(sheet: WorkSheet, opts?: Sheet2HTMLOpts): any;
|
|
1060
|
-
/** JSON object stream, generate one row at a time */
|
|
1061
|
-
to_json(sheet: WorkSheet, opts?: Sheet2JSONOpts): any;
|
|
1062
|
-
|
|
1063
|
-
/* --- Workbook writers --- */
|
|
1064
|
-
|
|
1065
|
-
/** XLML output string stream (bookType `xlml`) */
|
|
1066
|
-
to_xlml(data: WorkBook, opts?: XLMLStreamOpts): any;
|
|
1067
|
-
}
|
|
1068
|
-
|
|
1069
|
-
type xlsx_AOA2SheetOpts = AOA2SheetOpts;
|
|
1070
|
-
type xlsx_AutoFilterInfo = AutoFilterInfo;
|
|
1071
|
-
type xlsx_BookType = BookType;
|
|
1072
|
-
declare const xlsx_CFB: typeof CFB;
|
|
1073
|
-
type xlsx_CellAddress = CellAddress;
|
|
1074
|
-
type xlsx_CellObject = CellObject;
|
|
1075
|
-
type xlsx_ColInfo = ColInfo;
|
|
1076
|
-
type xlsx_Comment = Comment;
|
|
1077
|
-
type xlsx_Comments = Comments;
|
|
1078
|
-
type xlsx_CommonOptions = CommonOptions;
|
|
1079
|
-
type xlsx_DBFField = DBFField;
|
|
1080
|
-
type xlsx_DateNFOption = DateNFOption;
|
|
1081
|
-
type xlsx_DefinedName = DefinedName;
|
|
1082
|
-
type xlsx_DenseOption = DenseOption;
|
|
1083
|
-
type xlsx_DenseSheet = DenseSheet;
|
|
1084
|
-
type xlsx_DenseWorkSheet = DenseWorkSheet;
|
|
1085
|
-
type xlsx_ExcelDataType = ExcelDataType;
|
|
1086
|
-
type xlsx_FullProperties = FullProperties;
|
|
1087
|
-
type xlsx_Hyperlink = Hyperlink;
|
|
1088
|
-
type xlsx_JSON2SheetOpts = JSON2SheetOpts;
|
|
1089
|
-
type xlsx_MarginInfo = MarginInfo;
|
|
1090
|
-
type xlsx_NumberFormat = NumberFormat;
|
|
1091
|
-
type xlsx_OriginOption = OriginOption;
|
|
1092
|
-
type xlsx_ParsingOptions = ParsingOptions;
|
|
1093
|
-
type xlsx_Properties = Properties;
|
|
1094
|
-
type xlsx_ProtectInfo = ProtectInfo;
|
|
1095
|
-
type xlsx_Range = Range;
|
|
1096
|
-
type xlsx_RangeSpec = RangeSpec;
|
|
1097
|
-
type xlsx_RowInfo = RowInfo;
|
|
1098
|
-
declare const xlsx_SSF: typeof SSF;
|
|
1099
|
-
type xlsx_Sheet = Sheet;
|
|
1100
|
-
type xlsx_Sheet2CSVOpts = Sheet2CSVOpts;
|
|
1101
|
-
type xlsx_Sheet2FormulaOpts = Sheet2FormulaOpts;
|
|
1102
|
-
type xlsx_Sheet2HTMLOpts = Sheet2HTMLOpts;
|
|
1103
|
-
type xlsx_Sheet2JSONOpts = Sheet2JSONOpts;
|
|
1104
|
-
type xlsx_SheetAOAOpts = SheetAOAOpts;
|
|
1105
|
-
type xlsx_SheetKeys = SheetKeys;
|
|
1106
|
-
type xlsx_SheetProps = SheetProps;
|
|
1107
|
-
type xlsx_SheetType = SheetType;
|
|
1108
|
-
type xlsx_SparseSheet = SparseSheet;
|
|
1109
|
-
type xlsx_StreamUtils = StreamUtils;
|
|
1110
|
-
type xlsx_StrictWS = StrictWS;
|
|
1111
|
-
type xlsx_StrideOption = StrideOption;
|
|
1112
|
-
type xlsx_Table2BookOpts = Table2BookOpts;
|
|
1113
|
-
type xlsx_Table2SheetOpts = Table2SheetOpts;
|
|
1114
|
-
type xlsx_UTCDateOption = UTCDateOption;
|
|
1115
|
-
type xlsx_UTCOption = UTCOption;
|
|
1116
|
-
type xlsx_WBProps = WBProps;
|
|
1117
|
-
type xlsx_WBView = WBView;
|
|
1118
|
-
type xlsx_WSKeys = WSKeys;
|
|
1119
|
-
type xlsx_WSSpec = WSSpec;
|
|
1120
|
-
type xlsx_WorkBook = WorkBook;
|
|
1121
|
-
type xlsx_WorkSheet = WorkSheet;
|
|
1122
|
-
type xlsx_WorkbookProperties = WorkbookProperties;
|
|
1123
|
-
type xlsx_WritingOptions = WritingOptions;
|
|
1124
|
-
type xlsx_XLMLStreamOpts = XLMLStreamOpts;
|
|
1125
|
-
type xlsx_XLSX$Consts = XLSX$Consts;
|
|
1126
|
-
type xlsx_XLSX$Utils = XLSX$Utils;
|
|
1127
|
-
declare const xlsx_read: typeof read;
|
|
1128
|
-
declare const xlsx_readFile: typeof readFile;
|
|
1129
|
-
declare const xlsx_set_cptable: typeof set_cptable;
|
|
1130
|
-
declare const xlsx_set_fs: typeof set_fs;
|
|
1131
|
-
declare const xlsx_stream: typeof stream;
|
|
1132
|
-
declare const xlsx_utils: typeof utils;
|
|
1133
|
-
declare const xlsx_version: typeof version;
|
|
1134
|
-
declare const xlsx_write: typeof write;
|
|
1135
|
-
declare const xlsx_writeFile: typeof writeFile;
|
|
1136
|
-
declare const xlsx_writeFileAsync: typeof writeFileAsync;
|
|
1137
|
-
declare const xlsx_writeFileXLSX: typeof writeFileXLSX;
|
|
1138
|
-
declare const xlsx_writeXLSX: typeof writeXLSX;
|
|
1139
|
-
declare namespace xlsx {
|
|
1140
|
-
export { type xlsx_AOA2SheetOpts as AOA2SheetOpts, type xlsx_AutoFilterInfo as AutoFilterInfo, type xlsx_BookType as BookType, xlsx_CFB as CFB, type xlsx_CellAddress as CellAddress, type xlsx_CellObject as CellObject, type xlsx_ColInfo as ColInfo, type xlsx_Comment as Comment, type xlsx_Comments as Comments, type xlsx_CommonOptions as CommonOptions, type xlsx_DBFField as DBFField, type xlsx_DateNFOption as DateNFOption, type xlsx_DefinedName as DefinedName, type xlsx_DenseOption as DenseOption, type xlsx_DenseSheet as DenseSheet, type xlsx_DenseWorkSheet as DenseWorkSheet, type xlsx_ExcelDataType as ExcelDataType, type xlsx_FullProperties as FullProperties, type xlsx_Hyperlink as Hyperlink, type xlsx_JSON2SheetOpts as JSON2SheetOpts, type xlsx_MarginInfo as MarginInfo, type xlsx_NumberFormat as NumberFormat, type xlsx_OriginOption as OriginOption, type xlsx_ParsingOptions as ParsingOptions, type xlsx_Properties as Properties, type xlsx_ProtectInfo as ProtectInfo, type xlsx_Range as Range, type xlsx_RangeSpec as RangeSpec, type xlsx_RowInfo as RowInfo, xlsx_SSF as SSF, type xlsx_Sheet as Sheet, type xlsx_Sheet2CSVOpts as Sheet2CSVOpts, type xlsx_Sheet2FormulaOpts as Sheet2FormulaOpts, type xlsx_Sheet2HTMLOpts as Sheet2HTMLOpts, type xlsx_Sheet2JSONOpts as Sheet2JSONOpts, type xlsx_SheetAOAOpts as SheetAOAOpts, type xlsx_SheetKeys as SheetKeys, type xlsx_SheetProps as SheetProps, type xlsx_SheetType as SheetType, type xlsx_SparseSheet as SparseSheet, type xlsx_StreamUtils as StreamUtils, type xlsx_StrictWS as StrictWS, type xlsx_StrideOption as StrideOption, type xlsx_Table2BookOpts as Table2BookOpts, type xlsx_Table2SheetOpts as Table2SheetOpts, type xlsx_UTCDateOption as UTCDateOption, type xlsx_UTCOption as UTCOption, type xlsx_WBProps as WBProps, type xlsx_WBView as WBView, type xlsx_WSKeys as WSKeys, type xlsx_WSSpec as WSSpec, type xlsx_WorkBook as WorkBook, type xlsx_WorkSheet as WorkSheet, type xlsx_WorkbookProperties as WorkbookProperties, type xlsx_WritingOptions as WritingOptions, type xlsx_XLMLStreamOpts as XLMLStreamOpts, type xlsx_XLSX$Consts as XLSX$Consts, type xlsx_XLSX$Utils as XLSX$Utils, xlsx_read as read, xlsx_readFile as readFile, xlsx_set_cptable as set_cptable, xlsx_set_fs as set_fs, xlsx_stream as stream, xlsx_utils as utils, xlsx_version as version, xlsx_write as write, xlsx_writeFile as writeFile, xlsx_writeFileAsync as writeFileAsync, xlsx_writeFileXLSX as writeFileXLSX, xlsx_writeXLSX as writeXLSX };
|
|
1141
|
-
}
|
|
2
|
+
export { loadSheetJs, readWorkbookBytes, writeWorkbookBytes } from '@ai-matrx/print/xlsx';
|
|
1142
3
|
|
|
1143
4
|
interface AssetResolverPort {
|
|
1144
5
|
resolve(url: string, signal: AbortSignal): Promise<{
|
|
@@ -1221,95 +82,17 @@ interface FormatEngine {
|
|
|
1221
82
|
}
|
|
1222
83
|
|
|
1223
84
|
/**
|
|
1224
|
-
* `@ai-matrx/alchemy/operate/
|
|
85
|
+
* `@ai-matrx/alchemy/operate/formats/xlsx` — the Excel workbook (CONTRACT §1.9: records' headless
|
|
86
|
+
* bytes-in/bytes-out shape over the `rows` payload; SheetJS loads only here).
|
|
1225
87
|
*
|
|
1226
|
-
*
|
|
1227
|
-
*
|
|
1228
|
-
*
|
|
1229
|
-
*
|
|
1230
|
-
* `transformHeader`, `dynamicTyping`) and answers the same `{ data, errors, meta }` shape and
|
|
1231
|
-
* error codes, so a repointed importer keeps its behaviour.
|
|
1232
|
-
* - XLSX / XLS / ODS: SheetJS, the library the `xlsx` writer uses, loaded on first use from the
|
|
1233
|
-
* `/operate/formats/xlsx` leaf (`readWorkbook`). A caller that needs spreadsheet typing of a CSV
|
|
1234
|
-
* (dates, numbers, formulas as SheetJS reads them) reads it through `readWorkbook` too.
|
|
88
|
+
* The projection rules are the same as CSV/TSV: only visible, exportable, non-secret columns;
|
|
89
|
+
* `null` is an empty cell; nested values are compact JSON text. Cells are written as values,
|
|
90
|
+
* never formulas (a typed text cell is never evaluated, so the workbook itself is not formula-guarded).
|
|
91
|
+
* The artifact's plain text is the spreadsheet-safe TSV of the same rows, through kit `toDelimited`.
|
|
1235
92
|
*/
|
|
1236
93
|
|
|
1237
|
-
type WorkbookCellAddress = {
|
|
1238
|
-
r: number;
|
|
1239
|
-
c: number;
|
|
1240
|
-
};
|
|
1241
|
-
type WorkbookCellRange = {
|
|
1242
|
-
s: WorkbookCellAddress;
|
|
1243
|
-
e: WorkbookCellAddress;
|
|
1244
|
-
};
|
|
1245
|
-
/** A cell as the workbook engine reads it: type, raw value, formatted text, formula source. */
|
|
1246
|
-
type WorkbookCell = {
|
|
1247
|
-
t: "s" | "n" | "b" | "d" | "e" | "z";
|
|
1248
|
-
v?: string | number | boolean | Date;
|
|
1249
|
-
w?: string;
|
|
1250
|
-
f?: string;
|
|
1251
|
-
styled: boolean;
|
|
1252
|
-
};
|
|
1253
|
-
/** Grid shape options (header row included): `raw: false` → formatted text; `defval` fills gaps. */
|
|
1254
|
-
type WorkbookGridOptions = {
|
|
1255
|
-
raw?: boolean;
|
|
1256
|
-
defval?: unknown;
|
|
1257
|
-
blankrows?: boolean;
|
|
1258
|
-
dateNF?: string;
|
|
1259
|
-
rawNumbers?: boolean;
|
|
1260
|
-
};
|
|
1261
|
-
type WorkbookRecordOptions = {
|
|
1262
|
-
raw?: boolean;
|
|
1263
|
-
defval?: unknown;
|
|
1264
|
-
blankrows?: boolean;
|
|
1265
|
-
dateNF?: string;
|
|
1266
|
-
rawNumbers?: boolean;
|
|
1267
|
-
};
|
|
1268
|
-
interface WorkbookSheet {
|
|
1269
|
-
name: string;
|
|
1270
|
-
/** The used range, null for a sheet without one. */
|
|
1271
|
-
range: WorkbookCellRange | null;
|
|
1272
|
-
merges: WorkbookCellRange[];
|
|
1273
|
-
cell(r: number, c: number): WorkbookCell | null;
|
|
1274
|
-
cells(): Iterable<readonly [WorkbookCellAddress, WorkbookCell]>;
|
|
1275
|
-
grid(options?: WorkbookGridOptions): unknown[][];
|
|
1276
|
-
records(options?: WorkbookRecordOptions): Record<string, unknown>[];
|
|
1277
|
-
}
|
|
1278
|
-
interface Workbook {
|
|
1279
|
-
sheetNames: string[];
|
|
1280
|
-
sheets: WorkbookSheet[];
|
|
1281
|
-
sheet(name: string): WorkbookSheet | undefined;
|
|
1282
|
-
}
|
|
1283
|
-
/** `dates`: date cells as Date (`t: "d"`); `formulas`: keep formula source; `styles`: read cell styles. */
|
|
1284
|
-
type WorkbookReadOptions = {
|
|
1285
|
-
dates?: boolean;
|
|
1286
|
-
formulas?: boolean;
|
|
1287
|
-
styles?: boolean;
|
|
1288
|
-
};
|
|
1289
|
-
/** A typed cell for the `xlsx-workbook` format; a bare string/number/boolean is a value cell. */
|
|
1290
|
-
type WorkbookCellJson = {
|
|
1291
|
-
t?: "s" | "n" | "b";
|
|
1292
|
-
v?: string | number | boolean | null;
|
|
1293
|
-
f?: string;
|
|
1294
|
-
};
|
|
1295
|
-
/** The `xlsx-workbook` payload value (`{ kind: "registered", format: "workbook", value }`). */
|
|
1296
|
-
type WorkbookJson = {
|
|
1297
|
-
sheets: {
|
|
1298
|
-
name: string;
|
|
1299
|
-
rows: (WorkbookCellJson | string | number | boolean | null)[][];
|
|
1300
|
-
merges?: WorkbookCellRange[];
|
|
1301
|
-
}[];
|
|
1302
|
-
};
|
|
1303
|
-
|
|
1304
94
|
declare const xlsxEngine: FormatEngine;
|
|
1305
|
-
type SheetJs = typeof xlsx;
|
|
1306
|
-
/** The bundled SheetJS module itself — ONLY for the code runtime's user-code scope (a person's code imports `xlsx`). App code reads and writes through the functions here. */
|
|
1307
|
-
declare function loadSheetJs(): Promise<SheetJs>;
|
|
1308
|
-
/** Read workbook bytes (XLSX, XLS, ODS — and CSV/TSV text when a caller needs spreadsheet typing). */
|
|
1309
|
-
declare function readWorkbookBytes(bytes: ArrayBuffer | Uint8Array, options?: WorkbookReadOptions): Promise<Workbook>;
|
|
1310
|
-
/** The workbook bytes for a `WorkbookJson` (the `xlsx-workbook` format's engine; no download). */
|
|
1311
|
-
declare function writeWorkbookBytes(value: WorkbookJson): Promise<Uint8Array>;
|
|
1312
95
|
/** `xlsx-workbook`: a `registered` payload of format "workbook" (`WorkbookJson`) → .xlsx. */
|
|
1313
96
|
declare const workbookEngine: FormatEngine;
|
|
1314
97
|
|
|
1315
|
-
export {
|
|
98
|
+
export { workbookEngine, xlsxEngine };
|