styled-exceljs 0.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1396 @@
1
+ /* index.d.ts (C) 2015-present SheetJS and contributors */
2
+ // TypeScript Version: 2.2
3
+ // import * as CFB from "cfb";
4
+ // import * as SSF from "ssf";
5
+
6
+ /** Version string */
7
+ export const version: string;
8
+
9
+ /** SSF Formatter Library */
10
+ // export { SSF };
11
+ export const SSF: any;
12
+
13
+ /** CFB Library */
14
+ // export { CFB };
15
+ export const CFB: any;
16
+
17
+ /** Set internal `fs` instance */
18
+ export function set_fs(fs: any): void;
19
+ /** Set internal codepage tables */
20
+ export function set_cptable(cptable: any): void;
21
+
22
+ /** NODE ONLY! Attempts to read filename and parse */
23
+ export function readFile(filename: string, opts?: ParsingOptions): WorkBook;
24
+ /** Attempts to parse data */
25
+ export function read(data: any, opts?: ParsingOptions): WorkBook;
26
+ /** Attempts to write or download workbook data to file */
27
+ export function writeFile(data: WorkBook, filename: string, opts?: WritingOptions): void;
28
+ /** Attempts to write or download workbook data to XLSX file */
29
+ export function writeFileXLSX(data: WorkBook, filename: string, opts?: WritingOptions): void;
30
+ /** Attempts to write or download workbook data to file asynchronously */
31
+ type CBFunc = () => void;
32
+ export function writeFileAsync(filename: string, data: WorkBook, opts: WritingOptions | CBFunc, cb?: CBFunc): void;
33
+ /** Attempts to write the workbook data */
34
+ export function write(data: WorkBook, opts: WritingOptions): any;
35
+ /** Attempts to write the workbook data as XLSX */
36
+ export function writeXLSX(data: WorkBook, opts: WritingOptions): any;
37
+
38
+ /** Utility Functions */
39
+ export const utils: XLSX$Utils;
40
+ /** Stream Utility Functions */
41
+ export const stream: StreamUtils;
42
+
43
+ /** Number Format (either a string or an index to the format table) */
44
+ export type NumberFormat = string | number;
45
+
46
+ /** Worksheet specifier (string, number, worksheet) */
47
+ export type WSSpec = string | number | WorkSheet;
48
+
49
+ /** Range specifier (string or range or cell), single-cell lifted to range */
50
+ export type RangeSpec = string | Range | CellAddress;
51
+
52
+ /** Basic File Properties */
53
+ export interface Properties {
54
+ /** Summary tab "Title" */
55
+ Title?: string;
56
+ /** Summary tab "Subject" */
57
+ Subject?: string;
58
+ /** Summary tab "Author" */
59
+ Author?: string;
60
+ /** Summary tab "Manager" */
61
+ Manager?: string;
62
+ /** Summary tab "Company" */
63
+ Company?: string;
64
+ /** Summary tab "Category" */
65
+ Category?: string;
66
+ /** Summary tab "Keywords" */
67
+ Keywords?: string;
68
+ /** Summary tab "Comments" */
69
+ Comments?: string;
70
+ /** Statistics tab "Last saved by" */
71
+ LastAuthor?: string;
72
+ /** Statistics tab "Created" */
73
+ CreatedDate?: Date;
74
+ }
75
+
76
+ /** Other supported properties */
77
+ export interface FullProperties extends Properties {
78
+ ModifiedDate?: Date;
79
+ Application?: string;
80
+ AppVersion?: string;
81
+ DocSecurity?: string;
82
+ HyperlinksChanged?: boolean;
83
+ SharedDoc?: boolean;
84
+ LinksUpToDate?: boolean;
85
+ ScaleCrop?: boolean;
86
+ Worksheets?: number;
87
+ SheetNames?: string[];
88
+ ContentStatus?: string;
89
+ LastPrinted?: string;
90
+ Revision?: string | number;
91
+ Version?: string;
92
+ Identifier?: string;
93
+ Language?: string;
94
+ }
95
+
96
+ export interface CommonOptions {
97
+ /**
98
+ * If true, throw errors when features are not understood
99
+ * @default false
100
+ */
101
+ WTF?: boolean;
102
+
103
+ /**
104
+ * When reading a file with VBA macros, expose CFB blob to `vbaraw` field
105
+ * When writing BIFF8/XLSB/XLSM, reseat `vbaraw` and export to file
106
+ * @default false
107
+ */
108
+ bookVBA?: boolean;
109
+
110
+ /**
111
+ * When reading a file, store dates as type d (default is n)
112
+ * When writing XLSX/XLSM file, use native date (default uses date codes)
113
+ * @default false
114
+ */
115
+ cellDates?: boolean;
116
+
117
+ /**
118
+ * Create cell objects for stub cells
119
+ * @default false
120
+ */
121
+ sheetStubs?: boolean;
122
+
123
+ /**
124
+ * When reading a file, save style/theme info to the .s field
125
+ * When writing a file, export style/theme info
126
+ * @default false
127
+ */
128
+ cellStyles?: boolean;
129
+
130
+ /**
131
+ * If true, preserve row heights and column widths as browser CSS pixels
132
+ * @default false
133
+ */
134
+ browserPixels?: boolean;
135
+
136
+ /**
137
+ * If true, parse supported chart records and expose worksheet `!charts`
138
+ * @default false
139
+ */
140
+ charts?: boolean;
141
+
142
+ /**
143
+ * If true, parse supported drawing/image records and expose worksheet `!drawings`
144
+ * @default false
145
+ */
146
+ drawings?: boolean;
147
+
148
+ /**
149
+ * If true, validate merge ranges and throw on invalid or overlapping ranges
150
+ * @default false
151
+ */
152
+ validateMerges?: boolean;
153
+
154
+ /**
155
+ * If defined and file is encrypted, use password
156
+ * @default ''
157
+ */
158
+ password?: string;
159
+ }
160
+
161
+ export interface DateNFOption {
162
+ /** Use specified date format */
163
+ dateNF?: NumberFormat;
164
+ }
165
+
166
+ export interface UTCOption {
167
+ /**
168
+ * For plaintext formats, interpret ambiguous datetimes in UTC
169
+ * If explicitly set to `false`, dates will be parsed in local time.
170
+ *
171
+ * The `true` option is consistent with spreadsheet application export.
172
+ *
173
+ * @default true
174
+ */
175
+ UTC?: boolean;
176
+ }
177
+
178
+ export interface DenseOption {
179
+ /** If true, generate dense-mode worksheets */
180
+ dense?: boolean;
181
+ }
182
+
183
+ /** Options for read and readFile */
184
+ export interface ParsingOptions extends UTCOption, CommonOptions, DenseOption {
185
+ /** Input data encoding */
186
+ type?: 'base64' | 'binary' | 'buffer' | 'file' | 'array' | 'string';
187
+
188
+ /**
189
+ * Default codepage for legacy files
190
+ *
191
+ * This requires encoding support to be loaded. It is automatically loaded
192
+ * in `xlsx.full.min.js` and in CommonJS / Extendscript, but an extra step
193
+ * is required in React / Angular / Webpack ESM deployments.
194
+ *
195
+ * Check the relevant guide https://docs.sheetjs.com/docs/getting-started/
196
+ */
197
+ codepage?: number;
198
+
199
+ /**
200
+ * Save formulae to the .f field
201
+ * @default true
202
+ */
203
+ cellFormula?: boolean;
204
+
205
+ /**
206
+ * Parse rich text and save HTML to the .h field
207
+ * @default true
208
+ */
209
+ cellHTML?: boolean;
210
+
211
+ /**
212
+ * Save number format string to the .z field
213
+ * @default false
214
+ */
215
+ cellNF?: boolean;
216
+
217
+ /**
218
+ * Generate formatted text to the .w field
219
+ * @default true
220
+ */
221
+ cellText?: boolean;
222
+
223
+ /** Override default date format (code 14) */
224
+ dateNF?: string;
225
+
226
+ /** Field Separator ("Delimiter" override) */
227
+ FS?: string;
228
+
229
+ /**
230
+ * If >0, read the first sheetRows rows
231
+ * @default 0
232
+ */
233
+ sheetRows?: number;
234
+
235
+ /**
236
+ * If true, parse calculation chains
237
+ * @default false
238
+ */
239
+ bookDeps?: boolean;
240
+
241
+ /**
242
+ * If true, add raw files to book object
243
+ * @default false
244
+ */
245
+ bookFiles?: boolean;
246
+
247
+ /**
248
+ * If true, only parse enough to get book metadata
249
+ * @default false
250
+ */
251
+ bookProps?: boolean;
252
+
253
+ /**
254
+ * If true, only parse enough to get the sheet names
255
+ * @default false
256
+ */
257
+ bookSheets?: boolean;
258
+
259
+ /** If specified, only parse the specified sheets or sheet names */
260
+ sheets?: number | string | Array<number | string>;
261
+
262
+ /** If true, plaintext parsing will not parse values */
263
+ raw?: boolean;
264
+
265
+ /** If true, ignore "dimensions" records and guess range using every cell */
266
+ nodim?: boolean;
267
+
268
+ /** If true, preserve _xlfn. prefixes in formula function names */
269
+ xlfn?: boolean;
270
+
271
+ /**
272
+ * For single-sheet formats (including CSV), override the worksheet name
273
+ * @default "Sheet1"
274
+ */
275
+ sheet?: string;
276
+
277
+ PRN?: boolean;
278
+ }
279
+
280
+
281
+ /** Options for write and writeFile */
282
+ export interface WritingOptions extends CommonOptions {
283
+ /** Output data encoding */
284
+ type?: 'base64' | 'binary' | 'buffer' | 'file' | 'array' | 'string';
285
+
286
+ /**
287
+ * Generate Shared String Table
288
+ * @default false
289
+ */
290
+ bookSST?: boolean;
291
+
292
+ /**
293
+ * File format of generated workbook
294
+ * @default 'xlsx'
295
+ */
296
+ bookType?: BookType;
297
+
298
+ /**
299
+ * Use ZIP compression for ZIP-based formats
300
+ * @default false
301
+ */
302
+ compression?: boolean;
303
+
304
+ /** Override theme XML when exporting to XLSX/XLSM/XLSB */
305
+ themeXLSX?: string;
306
+
307
+ /**
308
+ * Suppress "number stored as text" errors in generated files
309
+ * @default true
310
+ */
311
+ ignoreEC?: boolean;
312
+
313
+ /** Override workbook properties on save */
314
+ Props?: Properties;
315
+
316
+ /**
317
+ * Desired codepage for legacy file formats
318
+ *
319
+ * This requires encoding support to be loaded. It is automatically loaded
320
+ * in `xlsx.full.min.js` and in CommonJS / Extendscript, but an extra step
321
+ * is required in React / Angular / Webpack / ESM deployments.
322
+ *
323
+ * Check the relevant guide https://docs.sheetjs.com/docs/getting-started/
324
+ */
325
+ codepage?: number;
326
+
327
+ /** Base64 encoding of NUMBERS base for exports */
328
+ numbers?: string;
329
+
330
+ /**
331
+ * For single-sheet formats, export the specified worksheet.
332
+ *
333
+ * The property must be a string (sheet name) or number (`SheetNames` index).
334
+ *
335
+ * If this option is omitted, the first worksheet will be exported.
336
+ */
337
+ sheet?: string | number;
338
+
339
+ /** Field Separator ("delimiter") for CSV / Text output */
340
+ FS?: string;
341
+
342
+ /** Record Separator ("row separator") for CSV / Text output */
343
+ RS?: string;
344
+
345
+ /** Skip certain validity checks (NOTE: generated files may not open in Excel) */
346
+ unsafe?: boolean;
347
+ }
348
+
349
+ /** Workbook Object */
350
+ export interface WorkBook {
351
+ /**
352
+ * A dictionary of the worksheets in the workbook.
353
+ * Use SheetNames to reference these.
354
+ */
355
+ Sheets: { [sheet: string]: WorkSheet };
356
+
357
+ /** Ordered list of the sheet names in the workbook */
358
+ SheetNames: string[];
359
+
360
+ /** Standard workbook Properties */
361
+ Props?: FullProperties;
362
+
363
+ /** Custom workbook Properties */
364
+ Custprops?: object;
365
+
366
+ Workbook?: WBProps;
367
+
368
+ vbaraw?: any;
369
+
370
+ /** Original file type (when parsed with `read` or `readFile`) */
371
+ bookType?: BookType;
372
+ }
373
+
374
+ export interface SheetProps {
375
+ /** Name of Sheet */
376
+ name?: string;
377
+
378
+ /** Sheet Visibility (0=Visible 1=Hidden 2=VeryHidden) */
379
+ Hidden?: 0 | 1 | 2;
380
+
381
+ /** Name of Document Module in associated VBA Project */
382
+ CodeName?: string;
383
+ }
384
+
385
+ /** Defined Name Object */
386
+ export interface DefinedName {
387
+ /** Name */
388
+ Name: string;
389
+
390
+ /** Reference */
391
+ Ref: string;
392
+
393
+ /** Scope (undefined for workbook scope) */
394
+ Sheet?: number;
395
+
396
+ /** Name comment */
397
+ Comment?: string;
398
+ }
399
+
400
+ /** Workbook-Level Attributes */
401
+ export interface WBProps {
402
+ /** Sheet Properties */
403
+ Sheets?: SheetProps[];
404
+
405
+ /** Defined Names */
406
+ Names?: DefinedName[];
407
+
408
+ /** Workbook Views */
409
+ Views?: WBView[];
410
+
411
+ /** Other Workbook Properties */
412
+ WBProps?: WorkbookProperties;
413
+ }
414
+
415
+ /** Workbook View */
416
+ export interface WBView {
417
+ /** Right-to-left mode */
418
+ RTL?: boolean;
419
+ }
420
+
421
+ /** Other Workbook Properties */
422
+ export interface WorkbookProperties {
423
+ /** Worksheet Epoch (1904 if true, 1900 if false) */
424
+ date1904?: boolean;
425
+
426
+ /** Warn or strip personally identifying info on save */
427
+ filterPrivacy?: boolean;
428
+
429
+ /** Name of Document Module in associated VBA Project */
430
+ CodeName?: string;
431
+ }
432
+
433
+ /** DBF Field Header */
434
+ export interface DBFField {
435
+ /** Original Field Name */
436
+ name?: string;
437
+
438
+ /** Field Type */
439
+ type?: string;
440
+
441
+ /** Field Length */
442
+ len?: number;
443
+
444
+ /** Field Decimal Count */
445
+ dec?: number;
446
+ }
447
+
448
+ /** Column Properties Object */
449
+ export interface ColInfo {
450
+ /* --- visibility --- */
451
+
452
+ /** if true, the column is hidden */
453
+ hidden?: boolean;
454
+
455
+ /* --- column width --- */
456
+
457
+ /** width in Excel's "Max Digit Width", width*256 is integral */
458
+ width?: number;
459
+
460
+ /** width in screen pixels */
461
+ wpx?: number;
462
+
463
+ /** width in "characters" */
464
+ wch?: number;
465
+
466
+ /** outline / group level */
467
+ level?: number;
468
+
469
+ /** XLSX column style index */
470
+ style?: number | string;
471
+
472
+ /** Column best-fit flag */
473
+ bestFit?: boolean | string;
474
+ bestfit?: boolean | string;
475
+
476
+ /** Column custom-width flag */
477
+ customWidth?: boolean | string;
478
+ customwidth?: boolean | string;
479
+
480
+ /** Excel's "Max Digit Width" unit, always integral */
481
+ MDW?: number;
482
+
483
+ /** default column style */
484
+ s?: CellStyle | any;
485
+
486
+ /** DBF Field Header */
487
+ DBF?: DBFField;
488
+ }
489
+
490
+ /** Row Properties Object */
491
+ export interface RowInfo {
492
+ /* --- visibility --- */
493
+
494
+ /** if true, the column is hidden */
495
+ hidden?: boolean;
496
+
497
+ /* --- row height --- */
498
+
499
+ /** height in screen pixels */
500
+ hpx?: number;
501
+
502
+ /** height in points */
503
+ hpt?: number;
504
+
505
+ /** outline / group level */
506
+ level?: number;
507
+
508
+ /** XLS row style index */
509
+ ixfe?: number;
510
+
511
+ /** Row custom-height flag */
512
+ customHeight?: boolean | string;
513
+ customheight?: boolean | string;
514
+
515
+ /** default row style */
516
+ s?: CellStyle | any;
517
+ }
518
+
519
+ export type FontVertAlign = "baseline" | "superscript" | "subscript";
520
+ export type FontScheme = "major" | "minor" | "none";
521
+ export type FillPatternType = "none" | "solid" | "mediumGray" | "darkGray" | "lightGray" | "darkHorizontal" | "darkVertical" | "darkDown" | "darkUp" | "darkGrid" | "darkTrellis" | "lightHorizontal" | "lightVertical" | "lightDown" | "lightUp" | "lightGrid" | "lightTrellis" | "gray125" | "gray0625" | string;
522
+ export type BorderStyleName = "none" | "thin" | "medium" | "dashed" | "dotted" | "thick" | "double" | "hair" | "mediumDashed" | "dashDot" | "mediumDashDot" | "dashDotDot" | "mediumDashDotDot" | "slantDashDot" | string;
523
+ export type HorizontalAlign = "left" | "center" | "right" | "fill" | "justify" | "centerContinuous" | "distributed" | string;
524
+ export type VerticalAlign = "top" | "center" | "bottom" | "justify" | "distributed" | string;
525
+ export type DrawingAnchorType = "twoCellAnchor" | "oneCellAnchor" | "absoluteAnchor" | string;
526
+ export type ChartType = "barChart" | "lineChart" | "areaChart" | "scatterChart" | "pieChart" | "doughnutChart" | "bubbleChart" | "radarChart" | "surfaceChart" | string;
527
+
528
+ /** Spreadsheet style color */
529
+ export interface StyleColor {
530
+ /** ARGB or RGB hex string */
531
+ rgb?: string;
532
+ /** Theme color index */
533
+ theme?: number;
534
+ /** Tint adjustment in the range -1..1 */
535
+ tint?: number;
536
+ /** Indexed palette color */
537
+ indexed?: number;
538
+ /** Alias for indexed palette color */
539
+ index?: number;
540
+ /** Automatic color flag */
541
+ auto?: boolean;
542
+ /** Original theme RGB before tint application */
543
+ raw_rgb?: string;
544
+ }
545
+
546
+ /** Spreadsheet font style */
547
+ export interface FontStyle {
548
+ name?: string;
549
+ sz?: number;
550
+ color?: StyleColor;
551
+ bold?: boolean | number;
552
+ italic?: boolean | number;
553
+ underline?: boolean | number | string;
554
+ strike?: boolean | number;
555
+ outline?: boolean | number;
556
+ shadow?: boolean | number;
557
+ condense?: boolean | number;
558
+ extend?: boolean | number;
559
+ vertAlign?: FontVertAlign | string;
560
+ family?: number;
561
+ charset?: number;
562
+ scheme?: FontScheme | string;
563
+ }
564
+
565
+ /** Spreadsheet fill style */
566
+ export interface FillStyle {
567
+ patternType?: FillPatternType;
568
+ fgColor?: StyleColor;
569
+ bgColor?: StyleColor;
570
+ gradientFill?: any;
571
+ }
572
+
573
+ /** Spreadsheet border side */
574
+ export interface BorderPr {
575
+ style?: BorderStyleName;
576
+ color?: StyleColor;
577
+ }
578
+
579
+ /** Spreadsheet border style */
580
+ export interface BorderStyle {
581
+ left?: BorderPr;
582
+ right?: BorderPr;
583
+ top?: BorderPr;
584
+ bottom?: BorderPr;
585
+ diagonal?: BorderPr;
586
+ horizontal?: BorderPr;
587
+ vertical?: BorderPr;
588
+ start?: BorderPr;
589
+ end?: BorderPr;
590
+ diagonalUp?: boolean;
591
+ diagonalDown?: boolean;
592
+ }
593
+
594
+ /** Spreadsheet alignment style */
595
+ export interface AlignmentStyle {
596
+ horizontal?: HorizontalAlign;
597
+ vertical?: VerticalAlign;
598
+ textRotation?: number;
599
+ indent?: number;
600
+ relativeIndent?: number;
601
+ readingOrder?: number;
602
+ wrapText?: boolean;
603
+ shrinkToFit?: boolean;
604
+ justifyLastLine?: boolean;
605
+ }
606
+
607
+ /** Spreadsheet protection style */
608
+ export interface ProtectionStyle {
609
+ locked?: boolean;
610
+ hidden?: boolean;
611
+ }
612
+
613
+ /** Resolved cell style */
614
+ export interface CellStyle extends FillStyle {
615
+ /** Style index in the source workbook */
616
+ id?: number;
617
+ /** Raw XF/style record */
618
+ xf?: any;
619
+ numFmtId?: number;
620
+ numFmt?: string;
621
+ font?: FontStyle;
622
+ fill?: FillStyle;
623
+ border?: BorderStyle;
624
+ alignment?: AlignmentStyle;
625
+ protection?: ProtectionStyle;
626
+ /** Compatibility alias for fill.fgColor */
627
+ fgColor?: StyleColor;
628
+ /** Compatibility alias for fill.bgColor */
629
+ bgColor?: StyleColor;
630
+ }
631
+
632
+ /** Drawing relationship entry */
633
+ export interface DrawingRelationship {
634
+ Type?: string;
635
+ Target?: string;
636
+ Id?: string;
637
+ TargetMode?: string;
638
+ }
639
+
640
+ /** Parsed drawing marker */
641
+ export interface DrawingMarker {
642
+ col: number;
643
+ colOff: number;
644
+ row: number;
645
+ rowOff: number;
646
+ }
647
+
648
+ /** Parsed drawing anchor */
649
+ export interface DrawingAnchor {
650
+ type?: DrawingAnchorType;
651
+ flags?: number;
652
+ from?: DrawingMarker;
653
+ to?: DrawingMarker;
654
+ pos?: { x: number; y: number; };
655
+ ext?: { cx: number; cy: number; };
656
+ }
657
+
658
+ /** Cached chart series values */
659
+ export interface ChartCache {
660
+ values?: Array<number | string>;
661
+ formatCode?: string;
662
+ formula?: string;
663
+ }
664
+
665
+ /** Parsed chart series */
666
+ export interface ChartSeries {
667
+ name?: string;
668
+ idx?: number;
669
+ order?: number;
670
+ chartType?: ChartType;
671
+ cat?: ChartCache;
672
+ val?: ChartCache;
673
+ xVal?: ChartCache;
674
+ yVal?: ChartCache;
675
+ bubbleSize?: ChartCache;
676
+ data?: Array<number | string>;
677
+ raw?: any;
678
+ }
679
+
680
+ /** Parsed chart legend */
681
+ export interface ChartLegend {
682
+ position?: string;
683
+ raw?: any;
684
+ }
685
+
686
+ /** Parsed chart model from XLSX chartSpace or XLS chart records */
687
+ export interface ChartModel {
688
+ target?: string;
689
+ raw?: any;
690
+ rels?: any;
691
+ type?: ChartType;
692
+ grouping?: string;
693
+ title?: string;
694
+ legend?: ChartLegend;
695
+ series?: ChartSeries[];
696
+ }
697
+
698
+ /** Parsed chart information */
699
+ export interface ChartInfo {
700
+ id?: string;
701
+ rel?: DrawingRelationship;
702
+ objectId?: number;
703
+ biffType?: string;
704
+ target?: string;
705
+ path?: string;
706
+ title?: string;
707
+ anchor?: DrawingAnchor;
708
+ model?: ChartModel;
709
+ data?: WorkSheet;
710
+ raw?: any;
711
+ }
712
+
713
+ /** Parsed drawing image */
714
+ export interface DrawingImage {
715
+ id?: string;
716
+ rel?: DrawingRelationship;
717
+ objectId?: number;
718
+ biffType?: string;
719
+ target?: string;
720
+ path?: string;
721
+ anchor?: DrawingAnchor;
722
+ dataURI?: string;
723
+ contentType?: string;
724
+ raw?: any;
725
+ }
726
+
727
+ /** Parsed drawing shape/textbox or unsupported drawing fallback */
728
+ export interface DrawingShape {
729
+ id?: string;
730
+ rel?: DrawingRelationship;
731
+ objectId?: number;
732
+ biffType?: string;
733
+ target?: string;
734
+ anchor?: DrawingAnchor;
735
+ text?: string;
736
+ props?: any;
737
+ raw?: any;
738
+ }
739
+
740
+ /** Parsed drawing information */
741
+ export interface DrawingInfo {
742
+ /** Raw DrawingML XML, BIFF OfficeArt blobs, or parser-specific fallback */
743
+ raw?: any;
744
+ /** Primary chart target in chart sheets */
745
+ chart?: string;
746
+ charts?: ChartInfo[];
747
+ images?: DrawingImage[];
748
+ shapes?: DrawingShape[];
749
+ groups?: boolean;
750
+ }
751
+
752
+ /** Merge validation error */
753
+ export interface MergeError {
754
+ code: string;
755
+ message: string;
756
+ index: number;
757
+ other?: number;
758
+ range?: string | Range;
759
+ otherRange?: string;
760
+ ref?: string;
761
+ }
762
+
763
+ /**
764
+ * Write sheet protection properties.
765
+ */
766
+ export interface ProtectInfo {
767
+ /**
768
+ * The password for formats that support password-protected sheets
769
+ * (XLSX/XLSB/XLS). The writer uses the XOR obfuscation method.
770
+ */
771
+ password?: string;
772
+ /**
773
+ * Select locked cells
774
+ * @default: true
775
+ */
776
+ selectLockedCells?: boolean;
777
+ /**
778
+ * Select unlocked cells
779
+ * @default: true
780
+ */
781
+ selectUnlockedCells?: boolean;
782
+ /**
783
+ * Format cells
784
+ * @default: false
785
+ */
786
+ formatCells?: boolean;
787
+ /**
788
+ * Format columns
789
+ * @default: false
790
+ */
791
+ formatColumns?: boolean;
792
+ /**
793
+ * Format rows
794
+ * @default: false
795
+ */
796
+ formatRows?: boolean;
797
+ /**
798
+ * Insert columns
799
+ * @default: false
800
+ */
801
+ insertColumns?: boolean;
802
+ /**
803
+ * Insert rows
804
+ * @default: false
805
+ */
806
+ insertRows?: boolean;
807
+ /**
808
+ * Insert hyperlinks
809
+ * @default: false
810
+ */
811
+ insertHyperlinks?: boolean;
812
+ /**
813
+ * Delete columns
814
+ * @default: false
815
+ */
816
+ deleteColumns?: boolean;
817
+ /**
818
+ * Delete rows
819
+ * @default: false
820
+ */
821
+ deleteRows?: boolean;
822
+ /**
823
+ * Sort
824
+ * @default: false
825
+ */
826
+ sort?: boolean;
827
+ /**
828
+ * Filter
829
+ * @default: false
830
+ */
831
+ autoFilter?: boolean;
832
+ /**
833
+ * Use PivotTable reports
834
+ * @default: false
835
+ */
836
+ pivotTables?: boolean;
837
+ /**
838
+ * Edit objects
839
+ * @default: true
840
+ */
841
+ objects?: boolean;
842
+ /**
843
+ * Edit scenarios
844
+ * @default: true
845
+ */
846
+ scenarios?: boolean;
847
+ }
848
+
849
+ /** Page Margins -- see Excel Page Setup .. Margins diagram for explanation */
850
+ export interface MarginInfo {
851
+ /** Left side margin (inches) */
852
+ left?: number;
853
+ /** Right side margin (inches) */
854
+ right?: number;
855
+ /** Top side margin (inches) */
856
+ top?: number;
857
+ /** Bottom side margin (inches) */
858
+ bottom?: number;
859
+ /** Header top margin (inches) */
860
+ header?: number;
861
+ /** Footer bottom height (inches) */
862
+ footer?: number;
863
+ }
864
+ export type SheetType = 'sheet' | 'chart';
865
+ export type SheetKeys = string | MarginInfo | SheetType;
866
+ /** General object representing a Sheet (worksheet or chartsheet) */
867
+ export interface Sheet {
868
+ /**
869
+ * Sparse-mode store cells with keys corresponding to A1-style address
870
+ * Dense-mode store cells in the '!data' key
871
+ * Special keys start with '!'
872
+ */
873
+ [cell: string]: CellObject | DenseSheetData | SheetKeys | any;
874
+
875
+ /**
876
+ * Dense-mode worksheets store data in an array of arrays
877
+ *
878
+ * Cells are accessed with sheet['!data'][R][C] (where R and C are 0-indexed)
879
+ */
880
+ '!data'?: DenseSheetData;
881
+
882
+ /** Sheet type */
883
+ '!type'?: SheetType;
884
+
885
+ /** Sheet Range (A1-style) */
886
+ '!ref'?: string;
887
+
888
+ /** Page Margins */
889
+ '!margins'?: MarginInfo;
890
+ }
891
+ /** General object representing a dense Sheet (worksheet or chartsheet) */
892
+ export interface DenseSheet extends Sheet {
893
+ /**
894
+ * Special keys start with '!'
895
+ * Dense-mode worksheets store data in the '!data' key
896
+ */
897
+ [cell: string]: DenseSheetData | SheetKeys | any;
898
+
899
+ /**
900
+ * Dense-mode worksheets store data in an array of arrays
901
+ *
902
+ * Cells are accessed with sheet['!data'][R][C] (where R and C are 0-indexed)
903
+ */
904
+ '!data': DenseSheetData;
905
+ }
906
+ export type DenseSheetData = Array<Array<CellObject|undefined>|undefined>;
907
+ /** General object representing a sparse Sheet (worksheet or chartsheet) */
908
+ export interface SparseSheet extends Sheet {
909
+ /**
910
+ * Sparse-mode store cells with keys corresponding to A1-style address
911
+ * Cells are accessed with sheet[addr]
912
+ */
913
+ '!data': never;
914
+ }
915
+
916
+
917
+ /** AutoFilter properties */
918
+ export interface AutoFilterInfo {
919
+ /** Range of the AutoFilter table */
920
+ ref: string;
921
+ }
922
+
923
+ export type WSKeys = SheetKeys | ColInfo[] | RowInfo[] | Range[] | ProtectInfo | AutoFilterInfo | ChartModel | ChartInfo[] | DrawingInfo | MergeError[];
924
+
925
+ /** Worksheet Object */
926
+ export interface WorkSheet extends Sheet {
927
+ /**
928
+ * Indexing with a cell address string maps to a cell object
929
+ * Special keys start with '!'
930
+ */
931
+ [cell: string]: CellObject | WSKeys | any;
932
+
933
+ /** Column Info */
934
+ '!cols'?: ColInfo[];
935
+
936
+ /** Row Info */
937
+ '!rows'?: RowInfo[];
938
+
939
+ /** Merge Ranges */
940
+ '!merges'?: Range[];
941
+
942
+ /** Merge validation errors */
943
+ '!mergeErrors'?: MergeError[];
944
+
945
+ /** Parsed chart drawings */
946
+ '!charts'?: ChartInfo[];
947
+
948
+ /** Parsed chart model for chartsheets */
949
+ '!chart'?: ChartModel;
950
+
951
+ /** Parsed drawing information */
952
+ '!drawings'?: DrawingInfo;
953
+
954
+ /** Worksheet Protection info */
955
+ '!protect'?: ProtectInfo;
956
+
957
+ /** AutoFilter info */
958
+ '!autofilter'?: AutoFilterInfo;
959
+ }
960
+ /** Dense Worksheet Object */
961
+ export type DenseWorkSheet = DenseSheet;
962
+
963
+ /**
964
+ * Worksheet Object with CellObject type
965
+ *
966
+ * The normal Worksheet type uses indexer of type `any` -- this enforces CellObject
967
+ */
968
+ export interface StrictWS { [addr: string]: CellObject; }
969
+
970
+ /**
971
+ * The Excel data type for a cell.
972
+ * b Boolean, n Number, e error, s String, d Date, z Stub
973
+ */
974
+ export type ExcelDataType = 'b' | 'n' | 'e' | 's' | 'd' | 'z';
975
+
976
+ /**
977
+ * Type of generated workbook
978
+ * @default 'xlsx'
979
+ */
980
+ export type BookType = 'xlsx' | 'xlsm' | 'xlsb' | 'xls' | 'xla' | 'biff8' | 'biff5' | 'biff2' | 'xlml' | 'ods' | 'fods' | 'csv' | 'txt' | 'sylk' | 'slk' | 'html' | 'dif' | 'rtf' | 'prn' | 'eth' | 'dbf' | 'numbers';
981
+
982
+ /** Comment element */
983
+ export interface Comment {
984
+ /** Author of the comment block */
985
+ a?: string;
986
+
987
+ /** Plaintext of the comment */
988
+ t: string;
989
+
990
+ /** If true, mark the comment as a part of a thread */
991
+ T?: boolean;
992
+ }
993
+
994
+ /** Cell comments */
995
+ export interface Comments extends Array<Comment> {
996
+ /** Hide comment by default */
997
+ hidden?: boolean;
998
+ }
999
+
1000
+ /** Link object */
1001
+ export interface Hyperlink {
1002
+ /** Target of the link (HREF) */
1003
+ Target: string;
1004
+
1005
+ /** Plaintext tooltip to display when mouse is over cell */
1006
+ Tooltip?: string;
1007
+ }
1008
+
1009
+ /** Worksheet Cell Object */
1010
+ export interface CellObject {
1011
+ /** The raw value of the cell. Can be omitted if a formula is specified */
1012
+ v?: string | number | boolean | Date;
1013
+
1014
+ /** Formatted text (if applicable) */
1015
+ w?: string;
1016
+
1017
+ /**
1018
+ * The Excel Data Type of the cell.
1019
+ * b Boolean, n Number, e Error, s String, d Date, z Empty
1020
+ */
1021
+ t: ExcelDataType;
1022
+
1023
+ /** Cell formula (if applicable) */
1024
+ f?: string;
1025
+
1026
+ /** Range of enclosing array if formula is array formula (if applicable) */
1027
+ F?: string;
1028
+
1029
+ /** If true, cell is a dynamic array formula (for supported file formats) */
1030
+ D?: boolean;
1031
+
1032
+ /** Rich text encoding (if applicable) */
1033
+ r?: any;
1034
+
1035
+ /** HTML rendering of the rich text (if applicable) */
1036
+ h?: string;
1037
+
1038
+ /** Comments associated with the cell */
1039
+ c?: Comments;
1040
+
1041
+ /** Number format string associated with the cell (if requested) */
1042
+ z?: NumberFormat;
1043
+
1044
+ /** Cell hyperlink object (.Target holds link, .tooltip is tooltip) */
1045
+ l?: Hyperlink;
1046
+
1047
+ /** The style/theme of the cell (if applicable) */
1048
+ s?: CellStyle | any;
1049
+ }
1050
+
1051
+ /** Simple Cell Address */
1052
+ export interface CellAddress {
1053
+ /** Column number */
1054
+ c: number;
1055
+ /** Row number */
1056
+ r: number;
1057
+ }
1058
+
1059
+ /** Range object (representing ranges like "A1:B2") */
1060
+ export interface Range {
1061
+ /** Starting cell */
1062
+ s: CellAddress;
1063
+ /** Ending cell */
1064
+ e: CellAddress;
1065
+ }
1066
+
1067
+ export interface Sheet2CSVOpts extends DateNFOption {
1068
+ /** Field Separator ("delimiter") */
1069
+ FS?: string;
1070
+
1071
+ /** Record Separator ("row separator") */
1072
+ RS?: string;
1073
+
1074
+ /** Remove trailing field separators in each record */
1075
+ strip?: boolean;
1076
+
1077
+ /** Include blank lines in the CSV output */
1078
+ blankrows?: boolean;
1079
+
1080
+ /** Skip hidden rows and columns in the CSV output */
1081
+ skipHidden?: boolean;
1082
+
1083
+ /** Force quotes around fields */
1084
+ forceQuotes?: boolean;
1085
+
1086
+ /** if true, return raw numbers; if false, return formatted numbers */
1087
+ rawNumbers?: boolean;
1088
+ }
1089
+
1090
+ export interface OriginOption {
1091
+ /** Top-Left cell for operation (CellAddress or A1 string or row) */
1092
+ origin?: number | string | CellAddress;
1093
+ }
1094
+
1095
+ export interface Sheet2HTMLOpts {
1096
+ /** TABLE element id attribute */
1097
+ id?: string;
1098
+
1099
+ /** Add contenteditable to every cell */
1100
+ editable?: boolean;
1101
+
1102
+ /** Header HTML */
1103
+ header?: string;
1104
+
1105
+ /** Footer HTML */
1106
+ footer?: string;
1107
+
1108
+ /** If true, remove javascript: URLs from hyperlinks */
1109
+ sanitizeLinks?: boolean;
1110
+
1111
+ /** If true, emit CSS for parsed cell styles */
1112
+ cellStyles?: boolean;
1113
+
1114
+ /** If true, emit browser pixel column widths and row heights */
1115
+ browserPixels?: boolean;
1116
+
1117
+ /** If true, render parsed charts as inline SVG */
1118
+ charts?: boolean;
1119
+
1120
+ /** If true, render parsed drawing images */
1121
+ drawings?: boolean;
1122
+ }
1123
+
1124
+ export interface Sheet2JSONOpts extends DateNFOption {
1125
+ /** Output format */
1126
+ header?: "A"|number|string[];
1127
+
1128
+ /** Override worksheet range */
1129
+ range?: any;
1130
+
1131
+ /** Include or omit blank lines in the output */
1132
+ blankrows?: boolean;
1133
+
1134
+ /** Default value for null/undefined values */
1135
+ defval?: any;
1136
+
1137
+ /** if true, return raw data; if false, return formatted text */
1138
+ raw?: boolean;
1139
+
1140
+ /** if true, skip hidden rows and columns */
1141
+ skipHidden?: boolean;
1142
+
1143
+ /** if true, return raw numbers; if false, return formatted numbers */
1144
+ rawNumbers?: boolean;
1145
+
1146
+ /**
1147
+ * If true, return dates whose UTC interpretation is correct
1148
+ * By default, return dates whose local interpretation is correct
1149
+ *
1150
+ * @default false
1151
+ */
1152
+ UTC?: boolean;
1153
+ }
1154
+
1155
+ export interface Sheet2FormulaOpts {
1156
+ /**
1157
+ * If false, only export cells with formulae.
1158
+ * By default, synthetic formulae are generated for each cell.
1159
+ */
1160
+ values?: boolean;
1161
+ }
1162
+
1163
+ export interface UTCDateOption {
1164
+ /**
1165
+ * If true, dates are interpreted using the UTC methods
1166
+ * By default, dates are interpreted in the local timezone
1167
+ *
1168
+ * @default false
1169
+ */
1170
+ UTC?: boolean;
1171
+ }
1172
+
1173
+ export interface AOA2SheetOpts extends CommonOptions, UTCDateOption, DateNFOption, DenseOption {
1174
+ /**
1175
+ * Create cell objects for stub cells
1176
+ * @default false
1177
+ */
1178
+ sheetStubs?: boolean;
1179
+ }
1180
+
1181
+ export interface SheetAOAOpts extends AOA2SheetOpts, OriginOption {}
1182
+
1183
+ export interface JSON2SheetOpts extends CommonOptions, UTCDateOption, DateNFOption, OriginOption, DenseOption {
1184
+ /** Use specified column order */
1185
+ header?: string[];
1186
+
1187
+ /** Skip header row in generated sheet */
1188
+ skipHeader?: boolean;
1189
+ }
1190
+
1191
+ export interface Table2SheetOpts extends CommonOptions, DateNFOption, OriginOption {
1192
+ /** If true, plaintext parsing will not parse values */
1193
+ raw?: boolean;
1194
+
1195
+ /**
1196
+ * If >0, read the first sheetRows rows
1197
+ * @default 0
1198
+ */
1199
+ sheetRows?: number;
1200
+
1201
+ /** If true, hidden rows and cells will not be parsed */
1202
+ display?: boolean;
1203
+
1204
+ /**
1205
+ * Override the worksheet name
1206
+ * @default "Sheet1"
1207
+ */
1208
+ sheet?: string;
1209
+
1210
+ /**
1211
+ * If true, interpret date strings as if they are UTC.
1212
+ * By default, date strings are interpreted in the local timezone.
1213
+ *
1214
+ * @default false
1215
+ */
1216
+ UTC?: boolean;
1217
+ }
1218
+
1219
+ export interface Table2BookOpts extends Table2SheetOpts {
1220
+ /**
1221
+ * Override the worksheet name
1222
+ * @default "Sheet1"
1223
+ */
1224
+ sheet?: string;
1225
+ }
1226
+
1227
+ /** General utilities */
1228
+ export interface XLSX$Utils {
1229
+ /* --- Import Functions --- */
1230
+
1231
+ /** Converts an array of arrays of JS data to a worksheet. */
1232
+ aoa_to_sheet<T>(data: T[][], opts?: AOA2SheetOpts): WorkSheet;
1233
+ aoa_to_sheet(data: any[][], opts?: AOA2SheetOpts): WorkSheet;
1234
+
1235
+ /** Converts an array of JS objects to a worksheet. */
1236
+ json_to_sheet<T>(data: T[], opts?: JSON2SheetOpts): WorkSheet;
1237
+ json_to_sheet(data: any[], opts?: JSON2SheetOpts): WorkSheet;
1238
+
1239
+ /** BROWSER ONLY! Converts a TABLE DOM element to a worksheet. */
1240
+ table_to_sheet(data: any, opts?: Table2SheetOpts): WorkSheet;
1241
+ table_to_book(data: any, opts?: Table2BookOpts): WorkBook;
1242
+ sheet_add_dom(ws: WorkSheet, data: any, opts?: Table2SheetOpts): WorkSheet;
1243
+
1244
+ /* --- Export Functions --- */
1245
+
1246
+ /** Converts a worksheet object to an array of JSON objects */
1247
+ sheet_to_json<T>(worksheet: WorkSheet, opts?: Sheet2JSONOpts): T[];
1248
+ sheet_to_json(worksheet: WorkSheet, opts?: Sheet2JSONOpts): any[][];
1249
+ sheet_to_json(worksheet: WorkSheet, opts?: Sheet2JSONOpts): any[];
1250
+
1251
+ /** Generates delimiter-separated-values output */
1252
+ sheet_to_csv(worksheet: WorkSheet, options?: Sheet2CSVOpts): string;
1253
+
1254
+ /** Generates UTF16 Formatted Text */
1255
+ sheet_to_txt(worksheet: WorkSheet, options?: Sheet2CSVOpts): string;
1256
+
1257
+ /** Generates HTML */
1258
+ sheet_to_html(worksheet: WorkSheet, options?: Sheet2HTMLOpts): string;
1259
+
1260
+ /** Validate worksheet merge ranges */
1261
+ validate_merges(worksheet: WorkSheet, opts?: CommonOptions): MergeError[];
1262
+
1263
+ /** Convert XLSX column width to browser pixels */
1264
+ col_width_to_px(width: number): number;
1265
+
1266
+ /** Convert browser pixels to XLSX column width */
1267
+ px_to_col_width(px: number): number;
1268
+
1269
+ /** Convert row height points to browser pixels */
1270
+ row_height_to_px(hpt: number): number;
1271
+
1272
+ /** Convert browser pixels to row height points */
1273
+ px_to_row_height(hpx: number): number;
1274
+
1275
+ /** Generates a list of the formulae (with value fallbacks) */
1276
+ sheet_to_formulae(worksheet: WorkSheet, options?: Sheet2FormulaOpts): string[];
1277
+
1278
+ /* --- Cell Address Utilities --- */
1279
+
1280
+ /** Converts 0-indexed cell address to A1 form */
1281
+ encode_cell(cell: CellAddress): string;
1282
+
1283
+ /** Converts 0-indexed row to A1 form */
1284
+ encode_row(row: number): string;
1285
+
1286
+ /** Converts 0-indexed column to A1 form */
1287
+ encode_col(col: number): string;
1288
+
1289
+ /** Converts 0-indexed range to A1 form */
1290
+ encode_range(s: CellAddress, e: CellAddress): string;
1291
+ encode_range(r: Range): string;
1292
+
1293
+ /** Converts A1 cell address to 0-indexed form */
1294
+ decode_cell(address: string): CellAddress;
1295
+
1296
+ /** Converts A1 row to 0-indexed form */
1297
+ decode_row(row: string): number;
1298
+
1299
+ /** Converts A1 column to 0-indexed form */
1300
+ decode_col(col: string): number;
1301
+
1302
+ /** Converts A1 range to 0-indexed form */
1303
+ decode_range(range: string): Range;
1304
+
1305
+ /** Format cell */
1306
+ format_cell(cell: CellObject, v?: any, opts?: any): string;
1307
+
1308
+ /* --- General Utilities --- */
1309
+
1310
+ /** Create a new workbook */
1311
+ book_new(ws?: WorkSheet, wsname?: string): WorkBook;
1312
+
1313
+ /** Create a new worksheet */
1314
+ sheet_new(opts?: DenseOption): WorkSheet;
1315
+
1316
+ /** Append a worksheet to a workbook, returns new worksheet name */
1317
+ book_append_sheet(workbook: WorkBook, worksheet: WorkSheet, name?: string, roll?: boolean): string;
1318
+
1319
+ /** Set sheet visibility (visible/hidden/very hidden) */
1320
+ book_set_sheet_visibility(workbook: WorkBook, sheet: number|string, visibility: number): void;
1321
+
1322
+ /** Set number format for a cell */
1323
+ cell_set_number_format(cell: CellObject, fmt: string|number): CellObject;
1324
+
1325
+ /** Set hyperlink for a cell */
1326
+ cell_set_hyperlink(cell: CellObject, target: string, tooltip?: string): CellObject;
1327
+
1328
+ /** Set internal link for a cell */
1329
+ cell_set_internal_link(cell: CellObject, target: string, tooltip?: string): CellObject;
1330
+
1331
+ /** Add comment to a cell */
1332
+ cell_add_comment(cell: CellObject, text: string, author?: string): void;
1333
+
1334
+ /** Assign an Array Formula to a range */
1335
+ sheet_set_array_formula(ws: WorkSheet, range: Range|string, formula: string, dynamic?: boolean): WorkSheet;
1336
+
1337
+ /** Add an array of arrays of JS data to a worksheet */
1338
+ sheet_add_aoa<T>(ws: WorkSheet, data: T[][], opts?: SheetAOAOpts): WorkSheet;
1339
+ sheet_add_aoa(ws: WorkSheet, data: any[][], opts?: SheetAOAOpts): WorkSheet;
1340
+
1341
+ /** Add an array of JS objects to a worksheet */
1342
+ sheet_add_json(ws: WorkSheet, data: any[], opts?: JSON2SheetOpts): WorkSheet;
1343
+ sheet_add_json<T>(ws: WorkSheet, data: T[], opts?: JSON2SheetOpts): WorkSheet;
1344
+
1345
+
1346
+ consts: XLSX$Consts;
1347
+ }
1348
+
1349
+ export interface XLSX$Consts {
1350
+ /* --- Sheet Visibility --- */
1351
+
1352
+ /** Visibility: Visible */
1353
+ SHEET_VISIBLE: 0;
1354
+
1355
+ /** Visibility: Hidden */
1356
+ SHEET_HIDDEN: 1;
1357
+
1358
+ /** Visibility: Very Hidden */
1359
+ SHEET_VERYHIDDEN: 2;
1360
+ }
1361
+
1362
+ export interface StrideOption {
1363
+ /** Number of rows to write per step */
1364
+ stride?: number;
1365
+ }
1366
+
1367
+ export interface XLMLStreamOpts extends WritingOptions, StrideOption {}
1368
+
1369
+ /**
1370
+ * Streaming write methods
1371
+ *
1372
+ * These methods are directly compatible with NodeJS `stream.Readable` API
1373
+ *
1374
+ * Web Streams (modern browsers) can play nice with NodeJS streams. See the Web
1375
+ * Demo at https://docs.sheetjs.com/docs/demos/bigdata/worker#streaming-write
1376
+ *
1377
+ * NOTE: These methods are not included in the `xlsx.mini.min.js` build!
1378
+ */
1379
+ export interface StreamUtils {
1380
+ /** Set `Readable` (for environments that do not support NodeJS Streams) */
1381
+ set_readable(Readable: any): void;
1382
+
1383
+ /* --- Worksheet writers --- */
1384
+
1385
+ /** CSV output stream, generate one line at a time */
1386
+ to_csv(sheet: WorkSheet, opts?: Sheet2CSVOpts): any;
1387
+ /** HTML output stream, generate one line at a time */
1388
+ to_html(sheet: WorkSheet, opts?: Sheet2HTMLOpts): any;
1389
+ /** JSON object stream, generate one row at a time */
1390
+ to_json(sheet: WorkSheet, opts?: Sheet2JSONOpts): any;
1391
+
1392
+ /* --- Workbook writers --- */
1393
+
1394
+ /** XLML output string stream (bookType `xlml`) */
1395
+ to_xlml(data: WorkBook, opts?: XLMLStreamOpts): any;
1396
+ }