sheetra 1.0.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,1730 @@
1
+ /**
2
+ * Cell value types supported by Sheetra
3
+ */
4
+ type CellValueType = 'string' | 'number' | 'date' | 'boolean' | 'formula' | 'error';
5
+ /**
6
+ * Cell alignment options
7
+ */
8
+ type HorizontalAlignment = 'left' | 'center' | 'right' | 'fill' | 'justify' | 'centerContinuous' | 'distributed';
9
+ type VerticalAlignment = 'top' | 'middle' | 'bottom' | 'distributed' | 'justify';
10
+ /**
11
+ * Border style options
12
+ */
13
+ type BorderStyleType$1 = 'thin' | 'medium' | 'thick' | 'dotted' | 'dashed' | 'double' | 'hair' | 'mediumDashed' | 'dashDot' | 'mediumDashDot' | 'dashDotDot' | 'mediumDashDotDot' | 'slantDashDot';
14
+ /**
15
+ * Font styling options
16
+ */
17
+ interface FontStyle {
18
+ /** Font name (e.g., 'Arial', 'Calibri') */
19
+ name?: string;
20
+ /** Font size in points */
21
+ size?: number;
22
+ /** Bold text */
23
+ bold?: boolean;
24
+ /** Italic text */
25
+ italic?: boolean;
26
+ /** Underline style */
27
+ underline?: boolean | 'single' | 'double' | 'singleAccounting' | 'doubleAccounting';
28
+ /** Strikethrough text */
29
+ strike?: boolean;
30
+ /** Font color in hex or RGB */
31
+ color?: string;
32
+ /** Font family */
33
+ family?: number;
34
+ /** Font scheme */
35
+ scheme?: 'major' | 'minor' | 'none';
36
+ /** Character set */
37
+ charset?: number;
38
+ /** Outline font */
39
+ outline?: boolean;
40
+ /** Shadow font */
41
+ shadow?: boolean;
42
+ /** Condense font */
43
+ condense?: boolean;
44
+ /** Extend font */
45
+ extend?: boolean;
46
+ /** Vertical alignment text */
47
+ verticalAlign?: 'superscript' | 'subscript' | 'baseline';
48
+ }
49
+ /**
50
+ * Border definition for a single side
51
+ */
52
+ interface BorderEdge$1 {
53
+ /** Border style */
54
+ style?: BorderStyleType$1;
55
+ /** Border color in hex or RGB */
56
+ color?: string;
57
+ }
58
+ /**
59
+ * Complete border configuration
60
+ */
61
+ interface Border {
62
+ /** Top border */
63
+ top?: BorderEdge$1;
64
+ /** Bottom border */
65
+ bottom?: BorderEdge$1;
66
+ /** Left border */
67
+ left?: BorderEdge$1;
68
+ /** Right border */
69
+ right?: BorderEdge$1;
70
+ /** Diagonal border (top-left to bottom-right) */
71
+ diagonal?: BorderEdge$1;
72
+ /** Diagonal border (bottom-left to top-right) */
73
+ diagonalDown?: BorderEdge$1;
74
+ /** Diagonal border (top-right to bottom-left) */
75
+ diagonalUp?: BorderEdge$1;
76
+ /** Diagonal border type */
77
+ diagonalType?: 'both' | 'up' | 'down';
78
+ }
79
+ /**
80
+ * Fill pattern types
81
+ */
82
+ type FillPattern = 'none' | 'solid' | 'gray125' | 'gray0625' | 'gray75' | 'gray50' | 'gray25' | 'gray12' | 'gray6' | 'horizontalStripe' | 'verticalStripe' | 'reverseDiagonalStripe' | 'diagonalStripe' | 'diagonalCrosshatch' | 'thickDiagonalCrosshatch' | 'thinHorizontalStripe' | 'thinVerticalStripe' | 'thinReverseDiagonalStripe' | 'thinDiagonalStripe' | 'thinHorizontalCrosshatch' | 'thinDiagonalCrosshatch';
83
+ /**
84
+ * Fill configuration for cell background
85
+ */
86
+ interface Fill {
87
+ /** Fill pattern type */
88
+ patternType?: FillPattern;
89
+ /** Foreground color (pattern color) */
90
+ fgColor?: string;
91
+ /** Background color */
92
+ bgColor?: string;
93
+ }
94
+ /**
95
+ * Number format configuration
96
+ */
97
+ interface NumberFormat {
98
+ /** Format code (e.g., '#,##0.00', '0%', 'm/d/yyyy') */
99
+ format: string;
100
+ /** Number of decimal places */
101
+ decimals?: number;
102
+ /** Thousands separator */
103
+ thousandsSeparator?: boolean;
104
+ /** Currency symbol */
105
+ currencySymbol?: string;
106
+ /** Negative number format */
107
+ negativeFormat?: 'parentheses' | 'minus' | 'red';
108
+ }
109
+ /**
110
+ * Complete cell style configuration
111
+ */
112
+ interface CellStyle {
113
+ /** Font styling */
114
+ font?: FontStyle;
115
+ /** Border configuration */
116
+ border?: Border;
117
+ /** Fill configuration */
118
+ fill?: Fill;
119
+ /** Number format */
120
+ numberFormat?: string | NumberFormat;
121
+ /** Horizontal alignment */
122
+ alignment?: HorizontalAlignment;
123
+ /** Vertical alignment */
124
+ verticalAlignment?: VerticalAlignment;
125
+ /** Text wrapping */
126
+ wrapText?: boolean;
127
+ /** Text rotation in degrees */
128
+ textRotation?: number;
129
+ /** Indentation level */
130
+ indent?: number;
131
+ /** Shrink to fit */
132
+ shrinkToFit?: boolean;
133
+ /** Reading order */
134
+ readingOrder?: 'context' | 'leftToRight' | 'rightToLeft';
135
+ /** Hidden cell */
136
+ hidden?: boolean;
137
+ /** Locked cell (for protection) */
138
+ locked?: boolean;
139
+ bold?: boolean;
140
+ italic?: boolean;
141
+ underline?: boolean | 'single' | 'double' | 'singleAccounting' | 'doubleAccounting';
142
+ fontSize?: number;
143
+ fontFamily?: string;
144
+ color?: string;
145
+ backgroundColor?: string;
146
+ borderAll?: {
147
+ style: BorderStyleType$1;
148
+ color?: string;
149
+ };
150
+ }
151
+ /**
152
+ * Cell data structure
153
+ */
154
+ interface CellData {
155
+ /** Cell value */
156
+ value: string | number | boolean | Date | null;
157
+ /** Cell style */
158
+ style?: CellStyle;
159
+ /** Cell formula (if any) */
160
+ formula?: string;
161
+ /** Cell value type */
162
+ type?: CellValueType;
163
+ /** Cell comment */
164
+ comment?: string;
165
+ /** Hyperlink */
166
+ hyperlink?: string;
167
+ /** Tooltip */
168
+ tooltip?: string;
169
+ /** Cell error value */
170
+ error?: string;
171
+ /** Shared formula reference */
172
+ sharedFormula?: string;
173
+ /** Array formula */
174
+ arrayFormula?: {
175
+ formula: string;
176
+ range: string;
177
+ };
178
+ /** Rich text (array of formatted text runs) */
179
+ richText?: Array<{
180
+ text: string;
181
+ font?: FontStyle;
182
+ }>;
183
+ }
184
+ /**
185
+ * Cell address (A1 notation)
186
+ */
187
+ interface CellAddress {
188
+ /** Column name (A, B, C, etc.) */
189
+ column: string;
190
+ /** Row number (1-based) */
191
+ row: number;
192
+ /** Absolute column ($A) */
193
+ absoluteColumn?: boolean;
194
+ /** Absolute row ($1) */
195
+ absoluteRow?: boolean;
196
+ }
197
+ /**
198
+ * Cell range (A1:B2 notation)
199
+ */
200
+ interface CellRange {
201
+ /** Start cell */
202
+ start: CellAddress;
203
+ /** End cell */
204
+ end: CellAddress;
205
+ }
206
+ /**
207
+ * Data validation rules
208
+ */
209
+ interface DataValidation {
210
+ /** Validation type */
211
+ type: 'whole' | 'decimal' | 'list' | 'date' | 'time' | 'textLength' | 'custom';
212
+ /** Operator for comparison */
213
+ operator?: 'between' | 'notBetween' | 'equal' | 'notEqual' | 'greaterThan' | 'lessThan' | 'greaterThanOrEqual' | 'lessThanOrEqual';
214
+ /** Formula 1 (value or range) */
215
+ formula1?: string | number;
216
+ /** Formula 2 (for between operators) */
217
+ formula2?: string | number;
218
+ /** Allow blank */
219
+ allowBlank?: boolean;
220
+ /** Show input message */
221
+ showInputMessage?: boolean;
222
+ /** Show error message */
223
+ showErrorMessage?: boolean;
224
+ /** Input title */
225
+ inputTitle?: string;
226
+ /** Input message */
227
+ inputMessage?: string;
228
+ /** Error title */
229
+ errorTitle?: string;
230
+ /** Error message */
231
+ errorMessage?: string;
232
+ /** Error style */
233
+ errorStyle?: 'stop' | 'warning' | 'information';
234
+ /** List of values (for list type) */
235
+ values?: any[];
236
+ /** Reference to list range */
237
+ listRange?: string;
238
+ }
239
+ /**
240
+ * Conditional formatting rule
241
+ */
242
+ interface ConditionalFormatRule {
243
+ /** Rule type */
244
+ type: 'expression' | 'cellIs' | 'colorScale' | 'dataBar' | 'iconSet' | 'top10' | 'uniqueValues' | 'duplicateValues' | 'containsText' | 'notContainsText' | 'beginsWith' | 'endsWith' | 'containsBlanks' | 'notContainsBlanks' | 'containsErrors' | 'notContainsErrors' | 'timePeriod' | 'aboveAverage';
245
+ /** Priority of rule */
246
+ priority: number;
247
+ /** Stop if true */
248
+ stopIfTrue?: boolean;
249
+ /** Formula for expression type */
250
+ formula?: string;
251
+ /** Operator for cellIs type */
252
+ operator?: string;
253
+ /** Value for comparison */
254
+ value?: any;
255
+ /** Style to apply */
256
+ style?: CellStyle;
257
+ /** Format for data bars */
258
+ dataBar?: {
259
+ minLength?: number;
260
+ maxLength?: number;
261
+ showValue?: boolean;
262
+ gradient?: boolean;
263
+ border?: boolean;
264
+ negativeBarColor?: string;
265
+ axisColor?: string;
266
+ direction?: 'context' | 'leftToRight' | 'rightToLeft';
267
+ };
268
+ /** Format for color scales */
269
+ colorScale?: {
270
+ minColor?: string;
271
+ midColor?: string;
272
+ maxColor?: string;
273
+ };
274
+ /** Format for icon sets */
275
+ iconSet?: {
276
+ iconSet?: '3Arrows' | '3ArrowsGray' | '3Flags' | '3TrafficLights1' | '3TrafficLights2' | '3Signs' | '3Symbols' | '3Symbols2' | '4Arrows' | '4ArrowsGray' | '4RedToBlack' | '4Rating' | '4TrafficLights' | '5Arrows' | '5ArrowsGray' | '5Rating' | '5Quarters';
277
+ showValue?: boolean;
278
+ percent?: boolean;
279
+ reverse?: boolean;
280
+ };
281
+ }
282
+ /**
283
+ * Border style
284
+ */
285
+ interface BorderStyle {
286
+ style: BorderStyleType$1;
287
+ color?: string;
288
+ }
289
+
290
+ /**
291
+ * Row properties
292
+ */
293
+ interface RowProperties {
294
+ /** Row height in points */
295
+ height?: number;
296
+ /** Hidden row */
297
+ hidden?: boolean;
298
+ /** Outline level (for grouping) */
299
+ outlineLevel?: number;
300
+ /** Collapsed state */
301
+ collapsed?: boolean;
302
+ /** Custom row style */
303
+ style?: CellStyle;
304
+ /** Row page break */
305
+ pageBreak?: boolean;
306
+ /** Phonetic (for Asian languages) */
307
+ phonetic?: boolean;
308
+ }
309
+ /**
310
+ * Row data structure
311
+ */
312
+ interface RowData extends RowProperties {
313
+ /** Cells in the row */
314
+ cells: CellData[];
315
+ }
316
+ /**
317
+ * Column properties
318
+ */
319
+ interface ColumnProperties {
320
+ /** Column width in characters */
321
+ width?: number;
322
+ /** Hidden column */
323
+ hidden?: boolean;
324
+ /** Outline level (for grouping) */
325
+ outlineLevel?: number;
326
+ /** Collapsed state */
327
+ collapsed?: boolean;
328
+ /** Custom column style */
329
+ style?: CellStyle;
330
+ /** Column page break */
331
+ pageBreak?: boolean;
332
+ /** Best fit width */
333
+ bestFit?: boolean;
334
+ /** Phonetic (for Asian languages) */
335
+ phonetic?: boolean;
336
+ }
337
+ /**
338
+ * Column data structure
339
+ */
340
+ interface ColumnData extends ColumnProperties {
341
+ /** Column index */
342
+ index?: number;
343
+ }
344
+ /**
345
+ * Merged cell range
346
+ */
347
+ interface MergeCell {
348
+ /** Start row index (0-based) */
349
+ startRow: number;
350
+ /** Start column index (0-based) */
351
+ startCol: number;
352
+ /** End row index (0-based) */
353
+ endRow: number;
354
+ /** End column index (0-based) */
355
+ endCol: number;
356
+ }
357
+ /**
358
+ * Frozen pane configuration
359
+ */
360
+ interface FreezePane {
361
+ /** Number of frozen rows */
362
+ rows?: number;
363
+ /** Number of frozen columns */
364
+ columns?: number;
365
+ /** Active cell in the unfrozen area */
366
+ activeCell?: string;
367
+ }
368
+ /**
369
+ * Sheet view settings
370
+ */
371
+ interface SheetView {
372
+ /** Right-to-left mode */
373
+ rightToLeft?: boolean;
374
+ /** Show grid lines */
375
+ showGridLines?: boolean;
376
+ /** Show row and column headers */
377
+ showRowColHeaders?: boolean;
378
+ /** Show zero values */
379
+ showZeros?: boolean;
380
+ /** Zoom scale percentage */
381
+ zoomScale?: number;
382
+ /** Zoom scale for page layout view */
383
+ zoomScaleNormal?: number;
384
+ /** Zoom scale for page break preview */
385
+ zoomScalePageBreakPreview?: number;
386
+ /** Zoom scale for page layout view */
387
+ zoomScaleSheetLayoutView?: number;
388
+ /** View type */
389
+ view?: 'normal' | 'pageBreakPreview' | 'pageLayout';
390
+ /** Top-left visible cell */
391
+ topLeftCell?: string;
392
+ /** Split state */
393
+ split?: {
394
+ xSplit?: number;
395
+ ySplit?: number;
396
+ activePane?: 'bottomRight' | 'topRight' | 'bottomLeft' | 'topLeft';
397
+ };
398
+ }
399
+ /**
400
+ * Print options for worksheet
401
+ */
402
+ interface PrintOptions {
403
+ /** Orientation */
404
+ orientation?: 'portrait' | 'landscape';
405
+ /** Fit to page */
406
+ fitToPage?: boolean;
407
+ /** Fit to width (in pages) */
408
+ fitToWidth?: number;
409
+ /** Fit to height (in pages) */
410
+ fitToHeight?: number;
411
+ /** Paper size */
412
+ paperSize?: string | number;
413
+ /** Scale percentage */
414
+ scale?: number;
415
+ /** Print area range */
416
+ printArea?: string;
417
+ /** Print titles (rows to repeat) */
418
+ printTitles?: {
419
+ rows?: string;
420
+ columns?: string;
421
+ };
422
+ /** Center on page */
423
+ center?: {
424
+ horizontal?: boolean;
425
+ vertical?: boolean;
426
+ };
427
+ /** Print grid lines */
428
+ printGridLines?: boolean;
429
+ /** Print row and column headers */
430
+ printHeadings?: boolean;
431
+ /** Black and white */
432
+ blackAndWhite?: boolean;
433
+ /** Draft quality */
434
+ draft?: boolean;
435
+ /** Page order */
436
+ pageOrder?: 'downThenOver' | 'overThenDown';
437
+ /** Comments display */
438
+ comments?: 'none' | 'asDisplayed' | 'atEnd';
439
+ /** Errors display */
440
+ errors?: 'displayed' | 'blank' | 'dash' | 'NA';
441
+ /** First page number */
442
+ firstPageNumber?: number;
443
+ /** Horizontal DPI */
444
+ horizontalDpi?: number;
445
+ /** Vertical DPI */
446
+ verticalDpi?: number;
447
+ /** Header margin */
448
+ headerMargin?: number;
449
+ /** Footer margin */
450
+ footerMargin?: number;
451
+ /** Top margin */
452
+ topMargin?: number;
453
+ /** Bottom margin */
454
+ bottomMargin?: number;
455
+ /** Left margin */
456
+ leftMargin?: number;
457
+ /** Right margin */
458
+ rightMargin?: number;
459
+ }
460
+ /**
461
+ * Header/Footer configuration
462
+ */
463
+ interface HeaderFooter {
464
+ /** Different first page */
465
+ differentFirst?: boolean;
466
+ /** Different odd and even pages */
467
+ differentOddEven?: boolean;
468
+ /** Scale with document */
469
+ scaleWithDoc?: boolean;
470
+ /** Align with margins */
471
+ alignWithMargins?: boolean;
472
+ /** Odd page header */
473
+ oddHeader?: string;
474
+ /** Odd page footer */
475
+ oddFooter?: string;
476
+ /** Even page header */
477
+ evenHeader?: string;
478
+ /** Even page footer */
479
+ evenFooter?: string;
480
+ /** First page header */
481
+ firstHeader?: string;
482
+ /** First page footer */
483
+ firstFooter?: string;
484
+ }
485
+ /**
486
+ * Auto-filter configuration
487
+ */
488
+ interface AutoFilter {
489
+ /** Filter range */
490
+ range: string;
491
+ /** Filter columns */
492
+ columns?: Record<number, {
493
+ /** Filter criteria */
494
+ criteria?: any;
495
+ /** Custom filters */
496
+ customFilters?: any[];
497
+ /** Dynamic filter */
498
+ dynamicFilter?: string;
499
+ /** Top 10 filter */
500
+ top10?: {
501
+ top?: boolean;
502
+ percent?: boolean;
503
+ val?: number;
504
+ };
505
+ /** Color filter */
506
+ colorFilter?: string;
507
+ /** Icon filter */
508
+ iconFilter?: string;
509
+ }>;
510
+ }
511
+ /**
512
+ * Table configuration
513
+ */
514
+ interface TableConfig {
515
+ /** Table name */
516
+ name: string;
517
+ /** Table range */
518
+ range: string;
519
+ /** Table style */
520
+ style?: string;
521
+ /** Header row */
522
+ headerRow?: boolean;
523
+ /** Total row */
524
+ totalRow?: boolean;
525
+ /** Banded rows */
526
+ bandedRows?: boolean;
527
+ /** Banded columns */
528
+ bandedColumns?: boolean;
529
+ /** First column */
530
+ firstColumn?: boolean;
531
+ /** Last column */
532
+ lastColumn?: boolean;
533
+ /** Show auto-filter */
534
+ showFilter?: boolean;
535
+ /** Table columns */
536
+ columns?: Array<{
537
+ name: string;
538
+ totalsRowFunction?: 'none' | 'sum' | 'min' | 'max' | 'average' | 'count' | 'countNums' | 'stdDev' | 'var' | 'custom';
539
+ totalsRowLabel?: string;
540
+ totalsRowFormula?: string;
541
+ }>;
542
+ }
543
+ /**
544
+ * Pivot table configuration
545
+ */
546
+ interface PivotTableConfig {
547
+ /** Pivot table name */
548
+ name: string;
549
+ /** Source data range */
550
+ source: string;
551
+ /** Destination cell */
552
+ destination: string;
553
+ /** Row fields */
554
+ rows?: Array<{
555
+ name: string;
556
+ axis?: 'row' | 'column' | 'page' | 'data';
557
+ sort?: 'ascending' | 'descending' | 'manual';
558
+ position?: number;
559
+ }>;
560
+ /** Column fields */
561
+ columns?: Array<{
562
+ name: string;
563
+ axis?: 'row' | 'column' | 'page' | 'data';
564
+ sort?: 'ascending' | 'descending' | 'manual';
565
+ position?: number;
566
+ }>;
567
+ /** Data fields */
568
+ data?: Array<{
569
+ name: string;
570
+ summarize?: 'sum' | 'count' | 'average' | 'max' | 'min' | 'product' | 'countNums' | 'stdDev' | 'stdDevp' | 'var' | 'varp';
571
+ numberFormat?: string;
572
+ }>;
573
+ /** Page fields */
574
+ pages?: Array<{
575
+ name: string;
576
+ axis?: 'row' | 'column' | 'page' | 'data';
577
+ sort?: 'ascending' | 'descending' | 'manual';
578
+ position?: number;
579
+ }>;
580
+ /** Filter fields */
581
+ filters?: Array<{
582
+ name: string;
583
+ axis?: 'row' | 'column' | 'page' | 'data';
584
+ sort?: 'ascending' | 'descending' | 'manual';
585
+ position?: number;
586
+ }>;
587
+ /** Style */
588
+ style?: string;
589
+ /** Grand total columns */
590
+ grandTotalColumns?: boolean;
591
+ /** Grand total rows */
592
+ grandTotalRows?: boolean;
593
+ /** Show row headers */
594
+ showRowHeaders?: boolean;
595
+ /** Show column headers */
596
+ showColumnHeaders?: boolean;
597
+ /** Compact form */
598
+ compact?: boolean;
599
+ /** Outline form */
600
+ outline?: boolean;
601
+ /** Tabular form */
602
+ tabular?: boolean;
603
+ }
604
+ /**
605
+ * Chart configuration
606
+ */
607
+ interface ChartConfig$1 {
608
+ /** Chart title */
609
+ title?: string;
610
+ /** Chart type */
611
+ type: 'area' | 'bar' | 'column' | 'line' | 'pie' | 'doughnut' | 'radar' | 'scatter' | 'stock' | 'surface' | 'bubble';
612
+ /** Data range */
613
+ dataRange: string;
614
+ /** X-axis range (for scatter) */
615
+ xAxisRange?: string;
616
+ /** Legend position */
617
+ legend?: 'top' | 'bottom' | 'left' | 'right' | 'corner' | 'none';
618
+ /** Chart size */
619
+ size?: {
620
+ width: number;
621
+ height: number;
622
+ };
623
+ /** Chart position */
624
+ position?: {
625
+ x: number;
626
+ y: number;
627
+ };
628
+ /** Chart style */
629
+ style?: number;
630
+ /** Show data labels */
631
+ showDataLabels?: boolean;
632
+ /** Show gridlines */
633
+ showGridlines?: boolean;
634
+ /** 3D */
635
+ threeD?: boolean;
636
+ }
637
+ /**
638
+ * Complete worksheet data structure
639
+ */
640
+ interface WorksheetData {
641
+ /** Sheet name */
642
+ name: string;
643
+ /** Rows in the sheet */
644
+ rows: RowData[];
645
+ /** Column definitions */
646
+ columns?: ColumnData[];
647
+ /** Merged cells */
648
+ mergeCells?: MergeCell[];
649
+ /** Frozen panes */
650
+ freezePane?: FreezePane;
651
+ /** Print options */
652
+ printOptions?: PrintOptions;
653
+ /** Sheet view settings */
654
+ sheetView?: SheetView;
655
+ /** Header/Footer */
656
+ headerFooter?: HeaderFooter;
657
+ /** Auto-filter */
658
+ autoFilter?: AutoFilter;
659
+ /** Tables */
660
+ tables?: TableConfig[];
661
+ /** Pivot tables */
662
+ pivotTables?: PivotTableConfig[];
663
+ /** Charts */
664
+ charts?: ChartConfig$1[];
665
+ /** Data validations */
666
+ dataValidations?: Record<string, DataValidation>;
667
+ /** Conditional formatting */
668
+ conditionalFormats?: Record<string, ConditionalFormatRule[]>;
669
+ /** Sheet protection password */
670
+ protection?: {
671
+ password?: string;
672
+ sheet?: boolean;
673
+ objects?: boolean;
674
+ scenarios?: boolean;
675
+ formatCells?: boolean;
676
+ formatColumns?: boolean;
677
+ formatRows?: boolean;
678
+ insertColumns?: boolean;
679
+ insertRows?: boolean;
680
+ insertHyperlinks?: boolean;
681
+ deleteColumns?: boolean;
682
+ deleteRows?: boolean;
683
+ sort?: boolean;
684
+ autoFilter?: boolean;
685
+ pivotTables?: boolean;
686
+ };
687
+ /** Sheet tab color */
688
+ tabColor?: string;
689
+ /** Sheet state (visible, hidden, veryHidden) */
690
+ state?: 'visible' | 'hidden' | 'veryHidden';
691
+ /** Background image */
692
+ background?: string;
693
+ }
694
+ /**
695
+ * Workbook properties
696
+ */
697
+ interface WorkbookProperties {
698
+ /** Creator name */
699
+ creator?: string;
700
+ /** Last modified by */
701
+ lastModifiedBy?: string;
702
+ /** Creation date */
703
+ created?: Date;
704
+ /** Last modified date */
705
+ modified?: Date;
706
+ /** Company name */
707
+ company?: string;
708
+ /** Manager name */
709
+ manager?: string;
710
+ /** Title */
711
+ title?: string;
712
+ /** Subject */
713
+ subject?: string;
714
+ /** Keywords */
715
+ keywords?: string;
716
+ /** Category */
717
+ category?: string;
718
+ /** Description */
719
+ description?: string;
720
+ /** Status */
721
+ status?: string;
722
+ /** Custom properties */
723
+ custom?: Record<string, string | number | boolean | Date>;
724
+ }
725
+ /**
726
+ * Workbook calculation properties
727
+ */
728
+ interface CalculationProperties {
729
+ /** Calculation mode */
730
+ calcMode?: 'auto' | 'autoNoTable' | 'manual';
731
+ /** Full calculation on load */
732
+ fullCalcOnLoad?: boolean;
733
+ /** Force full calculation */
734
+ forceFullCalc?: boolean;
735
+ /** Iteration */
736
+ iteration?: boolean;
737
+ /** Max iterations */
738
+ maxIterations?: number;
739
+ /** Max change */
740
+ maxChange?: number;
741
+ /** Reference style (A1 or R1C1) */
742
+ refMode?: 'A1' | 'R1C1';
743
+ }
744
+ /**
745
+ * Complete workbook data structure
746
+ */
747
+ interface WorkbookData {
748
+ /** Worksheets in the workbook */
749
+ sheets: WorksheetData[];
750
+ /** Workbook properties */
751
+ properties?: WorkbookProperties;
752
+ /** Calculation properties */
753
+ calculation?: CalculationProperties;
754
+ /** Named ranges */
755
+ namedRanges?: Record<string, {
756
+ range: string;
757
+ localSheet?: number;
758
+ comment?: string;
759
+ hidden?: boolean;
760
+ }>;
761
+ /** External references */
762
+ externalReferences?: Array<{
763
+ name: string;
764
+ path: string;
765
+ type: 'dde' | 'ole' | 'external';
766
+ }>;
767
+ /** Active sheet index */
768
+ activeSheet?: number;
769
+ /** Selected tabs */
770
+ selectedTabs?: number[];
771
+ /** Tab ratio */
772
+ tabRatio?: number;
773
+ /** First visible tab */
774
+ firstVisibleTab?: number;
775
+ /** Workbook views */
776
+ views?: Array<{
777
+ activeTab?: number;
778
+ firstSheet?: number;
779
+ showHorizontalScroll?: boolean;
780
+ showVerticalScroll?: boolean;
781
+ showSheetTabs?: boolean;
782
+ xWindow?: number;
783
+ yWindow?: number;
784
+ windowWidth?: number;
785
+ windowHeight?: number;
786
+ tabRatio?: number;
787
+ }>;
788
+ }
789
+
790
+ /**
791
+ * Export options for exporting sheets, workbooks, etc.
792
+ */
793
+ interface ExportOptions {
794
+ /** Output file name (with extension) */
795
+ filename?: string;
796
+ /** File format: 'xlsx', 'csv', 'json', etc. */
797
+ format?: 'xlsx' | 'csv' | 'json';
798
+ /** Whether to include styles in export */
799
+ includeStyles?: boolean;
800
+ /** Whether to include hidden rows/columns */
801
+ includeHidden?: boolean;
802
+ /** Password for protected export (if supported) */
803
+ password?: string;
804
+ /** Sheet name (for single-sheet export) */
805
+ sheetName?: string;
806
+ /** Locale for formatting */
807
+ locale?: string;
808
+ /** Custom options for writers */
809
+ [key: string]: any;
810
+ }
811
+ /**
812
+ * Chart series data
813
+ */
814
+ interface ChartSeries {
815
+ /** Series name */
816
+ name?: string;
817
+ /** Categories (X-axis) */
818
+ categories?: any[];
819
+ /** Values (Y-axis) */
820
+ values: any[];
821
+ /** Series color */
822
+ color?: string;
823
+ /** Series style */
824
+ style?: number;
825
+ /** Marker style (for line charts) */
826
+ marker?: {
827
+ symbol?: 'circle' | 'diamond' | 'square' | 'triangle' | 'none';
828
+ size?: number;
829
+ fill?: string;
830
+ stroke?: string;
831
+ };
832
+ /** Trendline */
833
+ trendline?: {
834
+ type: 'linear' | 'exponential' | 'logarithmic' | 'polynomial' | 'movingAverage';
835
+ order?: number;
836
+ period?: number;
837
+ forward?: number;
838
+ backward?: number;
839
+ intercept?: number;
840
+ displayEquation?: boolean;
841
+ displayRSquared?: boolean;
842
+ name?: string;
843
+ };
844
+ /** Error bars */
845
+ errorBars?: {
846
+ type: 'fixed' | 'percentage' | 'standardDeviation' | 'standardError' | 'custom';
847
+ value?: number;
848
+ plusValues?: any[];
849
+ minusValues?: any[];
850
+ direction?: 'both' | 'plus' | 'minus';
851
+ endStyle?: 'cap' | 'noCap';
852
+ };
853
+ }
854
+ /**
855
+ * Chart axis configuration
856
+ */
857
+ interface ChartAxis {
858
+ /** Axis title */
859
+ title?: string;
860
+ /** Minimum value */
861
+ min?: number;
862
+ /** Maximum value */
863
+ max?: number;
864
+ /** Major unit */
865
+ majorUnit?: number;
866
+ /** Minor unit */
867
+ minorUnit?: number;
868
+ /** Reverse order */
869
+ reverse?: boolean;
870
+ /** Logarithmic scale */
871
+ logarithmic?: boolean;
872
+ /** Base for logarithmic scale */
873
+ logBase?: number;
874
+ /** Format code */
875
+ format?: string;
876
+ /** Axis position */
877
+ position?: 'bottom' | 'left' | 'right' | 'top';
878
+ /** Crossing point */
879
+ crosses?: 'auto' | 'min' | 'max' | number;
880
+ /** Gridlines */
881
+ gridlines?: {
882
+ major?: boolean;
883
+ minor?: boolean;
884
+ color?: string;
885
+ };
886
+ /** Tick marks */
887
+ tickMarks?: {
888
+ major?: 'none' | 'inside' | 'outside' | 'cross';
889
+ minor?: 'none' | 'inside' | 'outside' | 'cross';
890
+ };
891
+ /** Font */
892
+ font?: {
893
+ name?: string;
894
+ size?: number;
895
+ bold?: boolean;
896
+ color?: string;
897
+ };
898
+ }
899
+ /**
900
+ * Complete chart configuration
901
+ */
902
+ interface ChartConfig {
903
+ /** Chart title */
904
+ title?: string;
905
+ /** Chart type */
906
+ type: 'area' | 'bar' | 'column' | 'line' | 'pie' | 'doughnut' | 'radar' | 'scatter' | 'stock' | 'surface' | 'bubble' | 'radarArea' | 'radarLine' | 'radarFilled' | 'barStacked' | 'columnStacked' | 'barPercent' | 'columnPercent' | 'areaStacked' | 'areaPercent' | 'lineStacked' | 'linePercent' | 'pie3D' | 'bar3D' | 'column3D' | 'line3D' | 'area3D' | 'surface3D';
907
+ /** Chart sub-type */
908
+ subType?: 'clustered' | 'stacked' | 'percent' | '3D' | '3DClustered' | '3DStacked' | '3DPercent';
909
+ /** Data range */
910
+ dataRange?: string;
911
+ /** Series data */
912
+ series?: ChartSeries[];
913
+ /** X-axis configuration */
914
+ xAxis?: ChartAxis;
915
+ /** Y-axis configuration */
916
+ yAxis?: ChartAxis;
917
+ /** Secondary X-axis */
918
+ xAxis2?: ChartAxis;
919
+ /** Secondary Y-axis */
920
+ yAxis2?: ChartAxis;
921
+ /** Legend */
922
+ legend?: {
923
+ position?: 'top' | 'bottom' | 'left' | 'right' | 'corner' | 'none';
924
+ layout?: 'stack' | 'overlay';
925
+ showSeriesName?: boolean;
926
+ font?: {
927
+ name?: string;
928
+ size?: number;
929
+ bold?: boolean;
930
+ color?: string;
931
+ };
932
+ };
933
+ /** Data labels */
934
+ dataLabels?: {
935
+ show?: boolean;
936
+ position?: 'center' | 'insideEnd' | 'insideBase' | 'outsideEnd' | 'bestFit';
937
+ format?: string;
938
+ font?: {
939
+ name?: string;
940
+ size?: number;
941
+ bold?: boolean;
942
+ color?: string;
943
+ };
944
+ separator?: string;
945
+ showSeriesName?: boolean;
946
+ showCategoryName?: boolean;
947
+ showValue?: boolean;
948
+ showPercentage?: boolean;
949
+ showLeaderLines?: boolean;
950
+ };
951
+ /** Chart size in pixels */
952
+ size?: {
953
+ width: number;
954
+ height: number;
955
+ };
956
+ /** Chart position in pixels (from top-left of sheet) */
957
+ position?: {
958
+ x: number;
959
+ y: number;
960
+ };
961
+ /** Chart style (1-48) */
962
+ style?: number;
963
+ /** Chart template */
964
+ template?: string;
965
+ /** Gap width (for bar/column) */
966
+ gapWidth?: number;
967
+ /** Overlap (for bar/column) */
968
+ overlap?: number;
969
+ /** Vary colors by point */
970
+ varyColors?: boolean;
971
+ /** Smooth lines */
972
+ smooth?: boolean;
973
+ /** Show data table */
974
+ dataTable?: {
975
+ show?: boolean;
976
+ showLegendKeys?: boolean;
977
+ border?: boolean;
978
+ font?: {
979
+ name?: string;
980
+ size?: number;
981
+ bold?: boolean;
982
+ color?: string;
983
+ };
984
+ };
985
+ /** 3D options */
986
+ threeD?: {
987
+ rotation?: number;
988
+ perspective?: number;
989
+ height?: number;
990
+ depth?: number;
991
+ rightAngleAxes?: boolean;
992
+ lighting?: boolean;
993
+ };
994
+ /** Plot area */
995
+ plotArea?: {
996
+ border?: Border;
997
+ fill?: Fill;
998
+ transparency?: number;
999
+ };
1000
+ /** Chart area */
1001
+ chartArea?: {
1002
+ border?: Border;
1003
+ fill?: Fill;
1004
+ transparency?: number;
1005
+ };
1006
+ }
1007
+ /**
1008
+ * Drawing object (image, shape, etc.)
1009
+ */
1010
+ interface Drawing {
1011
+ /** Drawing type */
1012
+ type: 'image' | 'shape' | 'chart' | 'smartArt';
1013
+ /** Drawing position */
1014
+ from: {
1015
+ col: number;
1016
+ row: number;
1017
+ colOffset?: number;
1018
+ rowOffset?: number;
1019
+ };
1020
+ /** Drawing size */
1021
+ to?: {
1022
+ col: number;
1023
+ row: number;
1024
+ colOffset?: number;
1025
+ rowOffset?: number;
1026
+ };
1027
+ /** Image data (for images) */
1028
+ image?: {
1029
+ data: string | ArrayBuffer;
1030
+ format: 'png' | 'jpg' | 'gif' | 'bmp' | 'svg';
1031
+ name?: string;
1032
+ description?: string;
1033
+ };
1034
+ /** Shape data (for shapes) */
1035
+ shape?: {
1036
+ type: 'rectangle' | 'ellipse' | 'triangle' | 'line' | 'arrow' | 'callout' | 'flowchart' | 'star' | 'banner';
1037
+ text?: string;
1038
+ fill?: Fill;
1039
+ border?: Border;
1040
+ rotation?: number;
1041
+ flipHorizontal?: boolean;
1042
+ flipVertical?: boolean;
1043
+ };
1044
+ /** Chart reference */
1045
+ chart?: ChartConfig;
1046
+ /** Alternative text */
1047
+ altText?: string;
1048
+ /** Hyperlink */
1049
+ hyperlink?: string;
1050
+ /** Lock aspect ratio */
1051
+ lockAspect?: boolean;
1052
+ /** Lock position */
1053
+ lockPosition?: boolean;
1054
+ /** Print object */
1055
+ print?: boolean;
1056
+ /** Hidden */
1057
+ hidden?: boolean;
1058
+ }
1059
+ /**
1060
+ * Section configuration for export (e.g., for splitting sheets into sections)
1061
+ */
1062
+ interface SectionConfig {
1063
+ /** Section title */
1064
+ title?: string;
1065
+ /** Section description */
1066
+ description?: string;
1067
+ /** Range of rows included in this section (e.g., "A1:D10") */
1068
+ range?: string;
1069
+ /** Whether the section is collapsible */
1070
+ collapsible?: boolean;
1071
+ /** Whether the section is initially collapsed */
1072
+ collapsed?: boolean;
1073
+ /** Custom styles for the section */
1074
+ style?: {
1075
+ backgroundColor?: string;
1076
+ fontColor?: string;
1077
+ fontSize?: number;
1078
+ bold?: boolean;
1079
+ italic?: boolean;
1080
+ border?: Border;
1081
+ fill?: Fill;
1082
+ };
1083
+ /** Additional custom options */
1084
+ [key: string]: any;
1085
+ }
1086
+ /**
1087
+ * Export filters
1088
+ */
1089
+ interface ExportFilters {
1090
+ [key: string]: any;
1091
+ }
1092
+
1093
+ type DeepPartial<T> = {
1094
+ [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
1095
+ };
1096
+ type Nullable<T> = T | null | undefined;
1097
+ type Record$1 = {
1098
+ [key: string]: unknown;
1099
+ };
1100
+
1101
+ declare class Cell {
1102
+ private value;
1103
+ private style?;
1104
+ private formula?;
1105
+ private type;
1106
+ constructor(value?: any, style?: CellStyle);
1107
+ setValue(value: any): this;
1108
+ setStyle(style?: CellStyle): this;
1109
+ setFormula(formula: string): this;
1110
+ setType(type: 'string' | 'number' | 'date' | 'boolean' | 'formula'): this;
1111
+ private inferType;
1112
+ getFormattedValue(): string;
1113
+ toData(): CellData;
1114
+ static fromData(data: CellData): Cell;
1115
+ }
1116
+
1117
+ declare class Row {
1118
+ private cells;
1119
+ private height?;
1120
+ private hidden;
1121
+ private outlineLevel;
1122
+ private collapsed;
1123
+ constructor(cells?: Cell[]);
1124
+ addCell(cell: Cell): this;
1125
+ createCell(value?: any, style?: CellStyle): Cell;
1126
+ setCell(index: number, value: any, style?: CellStyle): this;
1127
+ getCell(index: number): CellData | undefined;
1128
+ getCells(): Cell[];
1129
+ setHeight(height: number): this;
1130
+ setHidden(hidden: boolean): this;
1131
+ setOutlineLevel(level: number, collapsed?: boolean): this;
1132
+ toData(): RowData;
1133
+ static fromData(data: RowData): Row;
1134
+ }
1135
+
1136
+ declare class Column {
1137
+ private width?;
1138
+ private hidden;
1139
+ private outlineLevel;
1140
+ private collapsed;
1141
+ constructor(width?: number);
1142
+ setWidth(width: number): this;
1143
+ setHidden(hidden: boolean): this;
1144
+ setOutlineLevel(level: number, collapsed?: boolean): this;
1145
+ toData(): ColumnData;
1146
+ static fromData(data: ColumnData): Column;
1147
+ }
1148
+
1149
+ declare class Worksheet {
1150
+ private name;
1151
+ private rows;
1152
+ private columns;
1153
+ private mergedCells;
1154
+ private freezePane?;
1155
+ private printOptions?;
1156
+ constructor(name: string);
1157
+ getName(): string;
1158
+ setName(name: string): this;
1159
+ addRow(row: Row): this;
1160
+ createRow(index?: number): Row;
1161
+ getRow(index: number): Row | undefined;
1162
+ getRows(): Row[];
1163
+ removeRow(index: number): boolean;
1164
+ addColumn(column: Column): this;
1165
+ createColumn(width?: number): Column;
1166
+ getColumn(index: number): Column | undefined;
1167
+ getColumns(): Column[];
1168
+ setCell(row: number, col: number, value: any, style?: any): this;
1169
+ getCell(row: number, col: number): CellData | undefined;
1170
+ mergeCells(startRow: number, startCol: number, endRow: number, endCol: number): this;
1171
+ setFreezePane(row?: number, col?: number): this;
1172
+ setPrintOptions(options: PrintOptions): this;
1173
+ setOutlineLevel(row: number, level: number, collapsed?: boolean): this;
1174
+ setColumnOutlineLevel(col: number, level: number, collapsed?: boolean): this;
1175
+ toData(): WorksheetData;
1176
+ static fromData(data: WorksheetData): Worksheet;
1177
+ }
1178
+
1179
+ declare class Workbook {
1180
+ private sheets;
1181
+ private properties;
1182
+ constructor(data?: WorkbookData);
1183
+ addSheet(sheet: Worksheet): this;
1184
+ createSheet(name: string): Worksheet;
1185
+ getSheet(index: number): Worksheet | undefined;
1186
+ getSheetByName(name: string): Worksheet | undefined;
1187
+ removeSheet(index: number): boolean;
1188
+ setProperty(key: string, value: any): this;
1189
+ toData(): WorkbookData;
1190
+ fromData(data: WorkbookData): void;
1191
+ export(options?: ExportOptions): Promise<Blob>;
1192
+ download(options?: ExportOptions): void;
1193
+ static create(): Workbook;
1194
+ static fromData(data: WorkbookData): Workbook;
1195
+ }
1196
+
1197
+ declare class StyleBuilder {
1198
+ private style;
1199
+ bold(bold?: boolean): this;
1200
+ italic(italic?: boolean): this;
1201
+ underline(underline?: boolean): this;
1202
+ fontSize(size: number): this;
1203
+ fontFamily(family: string): this;
1204
+ color(color: string): this;
1205
+ backgroundColor(color: string): this;
1206
+ align(alignment: 'left' | 'center' | 'right'): this;
1207
+ verticalAlign(alignment: 'top' | 'middle' | 'bottom'): this;
1208
+ wrapText(wrap?: boolean): this;
1209
+ border(border: Border): this;
1210
+ borderTop(style?: BorderStyle['style'], color?: string): this;
1211
+ borderRight(style?: BorderStyle['style'], color?: string): this;
1212
+ borderBottom(style?: BorderStyle['style'], color?: string): this;
1213
+ borderLeft(style?: BorderStyle['style'], color?: string): this;
1214
+ borderAll(style?: BorderStyle['style'], color?: string): this;
1215
+ numberFormat(format: string): this;
1216
+ build(): CellStyle;
1217
+ static create(): StyleBuilder;
1218
+ }
1219
+
1220
+ declare class ExportBuilder {
1221
+ private workbook;
1222
+ private currentSheet;
1223
+ constructor(sheetName?: string);
1224
+ addHeaderRow(headers: string[], style?: any): this;
1225
+ addDataRows(data: any[], fields?: string[]): this;
1226
+ addSection(config: SectionConfig): this;
1227
+ addSections(sections: SectionConfig[]): this;
1228
+ setColumnWidths(widths: number[]): this;
1229
+ autoSizeColumns(): this;
1230
+ addStyle(style: any): this;
1231
+ private groupData;
1232
+ private getNestedValue;
1233
+ build(): Workbook;
1234
+ export(options: ExportOptions): Promise<Blob>;
1235
+ download(options?: ExportOptions): void;
1236
+ static create(sheetName?: string): ExportBuilder;
1237
+ }
1238
+
1239
+ /**
1240
+ * SheetBuilder provides a fluent API for building Excel worksheets
1241
+ */
1242
+ declare class SheetBuilder {
1243
+ private worksheet;
1244
+ private currentRow;
1245
+ /**
1246
+ * Create a new SheetBuilder instance
1247
+ * @param name Worksheet name
1248
+ */
1249
+ constructor(name?: string);
1250
+ /**
1251
+ * Get the underlying worksheet
1252
+ */
1253
+ getWorksheet(): Worksheet;
1254
+ /**
1255
+ * Set the worksheet name
1256
+ */
1257
+ setName(name: string): this;
1258
+ /**
1259
+ * Add a header row with styling
1260
+ * @param headers Array of header text
1261
+ * @param style Optional style for all headers
1262
+ */
1263
+ addHeaderRow(headers: string[], style?: CellStyle): this;
1264
+ /**
1265
+ * Add a title row
1266
+ * @param title Title text
1267
+ * @param colSpan Number of columns to span
1268
+ */
1269
+ addTitle(title: string, colSpan?: number): this;
1270
+ /**
1271
+ * Add a subtitle row
1272
+ * @param subtitle Subtitle text
1273
+ * @param colSpan Number of columns to span
1274
+ */
1275
+ addSubtitle(subtitle: string, colSpan?: number): this;
1276
+ /**
1277
+ * Add a row of data
1278
+ * @param data Array of cell values
1279
+ * @param styles Optional array of styles per cell
1280
+ */
1281
+ addRow(data: any[], styles?: (CellStyle | undefined)[]): this;
1282
+ /**
1283
+ * Add multiple rows of data
1284
+ * @param rows Array of row data
1285
+ * @param styles Optional array of styles per row or per cell
1286
+ */
1287
+ addRows(rows: any[][], styles?: (CellStyle | CellStyle[] | undefined)[]): this;
1288
+ /**
1289
+ * Add data from objects
1290
+ * @param data Array of objects
1291
+ * @param fields Fields to extract (keys or dot notation paths)
1292
+ * @param headers Optional header labels
1293
+ */
1294
+ addObjects<T extends Record<string, any>>(data: T[], fields: (keyof T | string)[], headers?: string[]): this;
1295
+ /**
1296
+ * Add a section with header and data
1297
+ * @param title Section title
1298
+ * @param data Section data
1299
+ * @param fields Fields to display
1300
+ * @param level Outline level
1301
+ */
1302
+ addSection(title: string, data: any[], fields: string[], level?: number): this;
1303
+ /**
1304
+ * Add grouped data with sub-sections
1305
+ * @param data Data to group
1306
+ * @param groupBy Field to group by
1307
+ * @param fields Fields to display
1308
+ * @param level Outline level
1309
+ */
1310
+ addGroupedData(data: any[], groupBy: string, fields: string[], level?: number): this;
1311
+ /**
1312
+ * Add summary row for a group
1313
+ */
1314
+ private addGroupSummary;
1315
+ /**
1316
+ * Add a summary row with totals
1317
+ * @param fields Fields to summarize
1318
+ * @param functions Summary functions (sum, average, count, min, max)
1319
+ * @param label Summary label
1320
+ */
1321
+ addSummaryRow(fields: string[], functions: Array<'sum' | 'average' | 'count' | 'min' | 'max'>, label?: string): this;
1322
+ /**
1323
+ * Set column widths
1324
+ * @param widths Array of column widths
1325
+ */
1326
+ setColumnWidths(widths: number[]): this;
1327
+ /**
1328
+ * Auto-size columns based on content
1329
+ * @param maxWidth Maximum width in characters
1330
+ */
1331
+ autoSizeColumns(maxWidth?: number): this;
1332
+ /**
1333
+ * Set column to auto-fit
1334
+ * @param colIndex Column index
1335
+ */
1336
+ setColumnAutoFit(colIndex: number): this;
1337
+ /**
1338
+ * Hide a column
1339
+ * @param colIndex Column index
1340
+ */
1341
+ hideColumn(colIndex: number): this;
1342
+ /**
1343
+ * Hide a row
1344
+ * @param rowIndex Row index
1345
+ */
1346
+ hideRow(rowIndex: number): this;
1347
+ /**
1348
+ * Set outline level for a row
1349
+ * @param rowIndex Row index
1350
+ * @param level Outline level (0-7)
1351
+ * @param collapsed Whether the outline is collapsed
1352
+ */
1353
+ setRowOutlineLevel(rowIndex: number, level: number, collapsed?: boolean): this;
1354
+ /**
1355
+ * Set outline level for a column
1356
+ * @param colIndex Column index
1357
+ * @param level Outline level (0-7)
1358
+ * @param collapsed Whether the outline is collapsed
1359
+ */
1360
+ setColumnOutlineLevel(colIndex: number, level: number, collapsed?: boolean): this;
1361
+ /**
1362
+ * Create an outline group for rows
1363
+ * @param startRow Start row index
1364
+ * @param endRow End row index
1365
+ * @param level Outline level
1366
+ * @param collapsed Whether the group is collapsed
1367
+ */
1368
+ groupRows(startRow: number, endRow: number, level?: number, collapsed?: boolean): this;
1369
+ /**
1370
+ * Create an outline group for columns
1371
+ * @param startCol Start column index
1372
+ * @param endCol End column index
1373
+ * @param level Outline level
1374
+ * @param collapsed Whether the group is collapsed
1375
+ */
1376
+ groupColumns(startCol: number, endCol: number, level?: number, collapsed?: boolean): this;
1377
+ /**
1378
+ * Merge cells
1379
+ * @param startRow Start row
1380
+ * @param startCol Start column
1381
+ * @param endRow End row
1382
+ * @param endCol End column
1383
+ */
1384
+ mergeCells(startRow: number, startCol: number, endRow: number, endCol: number): this;
1385
+ /**
1386
+ * Freeze panes
1387
+ * @param rows Number of rows to freeze
1388
+ * @param columns Number of columns to freeze
1389
+ */
1390
+ freezePanes(rows?: number, columns?: number): this;
1391
+ /**
1392
+ * Set print options
1393
+ * @param options Print options
1394
+ */
1395
+ setPrintOptions(options: PrintOptions): this;
1396
+ /**
1397
+ * Set header and footer
1398
+ * @param headerFooter Header/footer configuration
1399
+ */
1400
+ setHeaderFooter(headerFooter: HeaderFooter): this;
1401
+ /**
1402
+ * Add auto-filter
1403
+ * @param startRow Start row
1404
+ * @param startCol Start column
1405
+ * @param endRow End row
1406
+ * @param endCol End column
1407
+ */
1408
+ addAutoFilter(startRow: number, startCol: number, endRow: number, endCol: number): this;
1409
+ /**
1410
+ * Add a table
1411
+ * @param config Table configuration
1412
+ */
1413
+ addTable(config: TableConfig): this;
1414
+ /**
1415
+ * Add data validation to a cell or range
1416
+ * @param range Cell range (e.g., 'A1:B10')
1417
+ * @param validation Data validation rules
1418
+ */
1419
+ addDataValidation(range: string, validation: DataValidation): this;
1420
+ /**
1421
+ * Add conditional formatting
1422
+ * @param range Cell range
1423
+ * @param rules Conditional formatting rules
1424
+ */
1425
+ addConditionalFormatting(range: string, rules: ConditionalFormatRule[]): this;
1426
+ /**
1427
+ * Add a chart
1428
+ * @param config Chart configuration
1429
+ */
1430
+ addChart(config: ChartConfig$1): this;
1431
+ /**
1432
+ * Add an image or drawing
1433
+ * @param drawing Drawing configuration
1434
+ */
1435
+ addDrawing(drawing: Drawing): this;
1436
+ /**
1437
+ * Set cell value with style
1438
+ * @param row Row index
1439
+ * @param col Column index
1440
+ * @param value Cell value
1441
+ * @param style Cell style
1442
+ */
1443
+ setCell(row: number, col: number, value: any, style?: CellStyle): this;
1444
+ /**
1445
+ * Get cell value
1446
+ * @param row Row index
1447
+ * @param col Column index
1448
+ */
1449
+ getCell(row: number, col: number): CellData | undefined;
1450
+ /**
1451
+ * Add a comment to a cell
1452
+ * @param row Row index
1453
+ * @param col Column index
1454
+ * @param comment Comment text
1455
+ * @param author Comment author
1456
+ */
1457
+ addComment(row: number, col: number, comment: string, author?: string): this;
1458
+ /**
1459
+ * Add a hyperlink to a cell
1460
+ * @param row Row index
1461
+ * @param col Column index
1462
+ * @param url Hyperlink URL
1463
+ * @param displayText Display text (optional)
1464
+ */
1465
+ addHyperlink(row: number, col: number, url: string, displayText?: string): this;
1466
+ /**
1467
+ * Apply a style to a range
1468
+ * @param startRow Start row
1469
+ * @param startCol Start column
1470
+ * @param endRow End row
1471
+ * @param endCol End column
1472
+ * @param style Style to apply
1473
+ */
1474
+ applyStyleToRange(startRow: number, startCol: number, endRow: number, endCol: number, style: CellStyle): this;
1475
+ /**
1476
+ * Insert a blank row
1477
+ * @param count Number of blank rows to insert
1478
+ */
1479
+ insertBlankRows(count?: number): this;
1480
+ /**
1481
+ * Create a new row
1482
+ */
1483
+ private createRow;
1484
+ /**
1485
+ * Get or create a column
1486
+ */
1487
+ private getOrCreateColumn;
1488
+ /**
1489
+ * Get nested value from object using dot notation
1490
+ */
1491
+ private getNestedValue;
1492
+ /**
1493
+ * Format field name for display
1494
+ */
1495
+ private formatFieldName;
1496
+ /**
1497
+ * Group data by field
1498
+ */
1499
+ private groupData;
1500
+ /**
1501
+ * Convert column index to letter (A, B, C, ...)
1502
+ */
1503
+ private columnToLetter;
1504
+ /**
1505
+ * Get column range for formula (e.g., A:A)
1506
+ */
1507
+ private getColumnRange;
1508
+ /**
1509
+ * Build and return the worksheet
1510
+ */
1511
+ build(): Worksheet;
1512
+ /**
1513
+ * Reset the builder
1514
+ */
1515
+ reset(): this;
1516
+ /**
1517
+ * Create a new SheetBuilder instance
1518
+ */
1519
+ static create(name?: string): SheetBuilder;
1520
+ /**
1521
+ * Create from existing worksheet
1522
+ */
1523
+ static fromWorksheet(worksheet: Worksheet): SheetBuilder;
1524
+ }
1525
+ declare module '../types/cell.types' {
1526
+ interface CellStyle {
1527
+ borderTop?: BorderStyleType | BorderEdge;
1528
+ borderBottom?: BorderStyleType | BorderEdge;
1529
+ borderLeft?: BorderStyleType | BorderEdge;
1530
+ borderRight?: BorderStyleType | BorderEdge;
1531
+ }
1532
+ }
1533
+
1534
+ /**
1535
+ * Builder class for creating collapsible sections in worksheets
1536
+ * Supports nested sections, grouping, summaries, and conditional styling
1537
+ */
1538
+ declare class SectionBuilder {
1539
+ private worksheet;
1540
+ private currentRow;
1541
+ private sections;
1542
+ private styles;
1543
+ private formatters;
1544
+ private conditionalFormats;
1545
+ constructor(worksheet: Worksheet);
1546
+ /**
1547
+ * Add a section to the worksheet
1548
+ */
1549
+ addSection(config: SectionConfig): this;
1550
+ /**
1551
+ * Add multiple sections at once
1552
+ */
1553
+ addSections(configs: SectionConfig[]): this;
1554
+ /**
1555
+ * Add a nested section (child of current section)
1556
+ */
1557
+ addNestedSection(parentTitle: string, config: SectionConfig): this;
1558
+ /**
1559
+ * Create a section from data with automatic grouping
1560
+ */
1561
+ createFromData<T>(data: T[], options: {
1562
+ title: string;
1563
+ groupBy?: keyof T | ((item: T) => string);
1564
+ fields?: Array<keyof T | string>;
1565
+ fieldLabels?: Record<string, string>;
1566
+ level?: number;
1567
+ collapsed?: boolean;
1568
+ summary?: {
1569
+ fields: Array<keyof T>;
1570
+ functions: Array<'sum' | 'average' | 'count' | 'min' | 'max'>;
1571
+ };
1572
+ }): this;
1573
+ /**
1574
+ * Add a summary section (totals, averages, etc.)
1575
+ */
1576
+ addSummarySection(data: any[], fields: string[], functions: Array<'sum' | 'average' | 'count' | 'min' | 'max'>, options?: {
1577
+ level?: number;
1578
+ style?: CellStyle;
1579
+ showPercentage?: boolean;
1580
+ label?: string;
1581
+ }): this;
1582
+ /**
1583
+ * Add a hierarchical section (tree structure)
1584
+ */
1585
+ addHierarchicalSection<T>(items: T[], childrenAccessor: (item: T) => T[], options?: {
1586
+ title?: string;
1587
+ level?: number;
1588
+ fields?: Array<keyof T>;
1589
+ collapsed?: boolean;
1590
+ showCount?: boolean;
1591
+ }): this;
1592
+ /**
1593
+ * Add a pivot-like section with multiple dimensions
1594
+ */
1595
+ addPivotSection(data: any[], dimensions: {
1596
+ rows: string[];
1597
+ columns: string[];
1598
+ values: Array<{
1599
+ field: string;
1600
+ aggregate: 'sum' | 'average' | 'count' | 'min' | 'max';
1601
+ }>;
1602
+ }, options?: {
1603
+ level?: number;
1604
+ showGrandTotals?: boolean;
1605
+ showSubTotals?: boolean;
1606
+ }): this;
1607
+ /**
1608
+ * Add a timeline section (grouped by date periods)
1609
+ */
1610
+ addTimelineSection(data: any[], dateField: string, period: 'day' | 'week' | 'month' | 'quarter' | 'year', options?: {
1611
+ fields?: string[];
1612
+ level?: number;
1613
+ showTrends?: boolean;
1614
+ format?: string;
1615
+ }): this;
1616
+ /**
1617
+ * Add a filtered section
1618
+ */
1619
+ addFilteredSection(config: SectionConfig, filters: ExportFilters): this;
1620
+ /**
1621
+ * Add conditional formatting to the current section
1622
+ */
1623
+ addConditionalFormat(rule: ConditionalFormatRule): this;
1624
+ /**
1625
+ * Add a custom formatter for a field
1626
+ */
1627
+ addFormatter(field: string, formatter: (value: any) => any): this;
1628
+ /**
1629
+ * Register a reusable style
1630
+ */
1631
+ registerStyle(name: string, style: CellStyle): this;
1632
+ /**
1633
+ * Apply a registered style
1634
+ */
1635
+ applyStyle(styleName: string): this;
1636
+ /**
1637
+ * Get the current row count
1638
+ */
1639
+ getCurrentRow(): number;
1640
+ /**
1641
+ * Reset the builder
1642
+ */
1643
+ reset(): this;
1644
+ private groupData;
1645
+ private groupMultiLevel;
1646
+ private groupByDate;
1647
+ private getWeekNumber;
1648
+ private getPreviousPeriod;
1649
+ private calculateTrend;
1650
+ private applyFilters;
1651
+ private getNestedValue;
1652
+ }
1653
+
1654
+ declare class ExcelWriter {
1655
+ static write(workbook: Workbook, _options: ExportOptions): Promise<Blob>;
1656
+ private static generateExcelData;
1657
+ private static generateSheetData;
1658
+ private static getSheetRange;
1659
+ private static columnToLetter;
1660
+ private static createExcelFile;
1661
+ private static generateWorkbookXML;
1662
+ }
1663
+
1664
+ declare class CSVWriter {
1665
+ static write(workbook: Workbook, _options: ExportOptions): Promise<Blob>;
1666
+ private static generateCSVData;
1667
+ }
1668
+
1669
+ declare class JSONWriter {
1670
+ static write(workbook: Workbook, _options: ExportOptions): Promise<Blob>;
1671
+ private static generateJSONData;
1672
+ }
1673
+
1674
+ declare class DateFormatter {
1675
+ static format(date: Date | string | number, format?: string): string;
1676
+ static toExcelDate(date: Date | string | number): number;
1677
+ private static parseDate;
1678
+ private static formatWithPattern;
1679
+ private static pad;
1680
+ }
1681
+
1682
+ declare class NumberFormatter {
1683
+ static format(value: number, format?: string): string;
1684
+ private static formatWithPattern;
1685
+ private static formatCurrency;
1686
+ private static formatPercentage;
1687
+ }
1688
+
1689
+ /**
1690
+ * Format currency values
1691
+ */
1692
+ declare const formatCurrency: (value: number) => string;
1693
+ /**
1694
+ * Format date values
1695
+ */
1696
+ declare const formatDate: (date: string | Date) => string;
1697
+ /**
1698
+ * Format number with commas
1699
+ */
1700
+ declare const formatNumber: (num: number) => string;
1701
+ /**
1702
+ * Truncate text with ellipsis
1703
+ */
1704
+ declare const truncateText: (text: string, maxLength: number) => string;
1705
+ /**
1706
+ * Generate random ID
1707
+ */
1708
+ declare const generateId: () => string;
1709
+ /**
1710
+ * Debounce function
1711
+ */
1712
+ declare const debounce: <T extends (...args: any[]) => any>(func: T, wait: number) => ((...args: Parameters<T>) => void);
1713
+ /**
1714
+ * Group array by key
1715
+ */
1716
+ declare const groupBy: <T>(array: T[], key: keyof T) => Record<string, T[]>;
1717
+ /**
1718
+ * Calculate percentage
1719
+ */
1720
+ declare const calculatePercentage: (value: number, total: number) => number;
1721
+ /**
1722
+ * Download file
1723
+ */
1724
+ declare const downloadFile: (content: string, filename: string, type: string) => void;
1725
+
1726
+ declare function exportToExcel(data: any[], options?: any): Workbook;
1727
+ declare function exportToCSV(data: any[], options?: any): string;
1728
+ declare const VERSION = "1.0.0";
1729
+
1730
+ export { AutoFilter, Border, BorderEdge$1 as BorderEdge, BorderStyle, BorderStyleType$1 as BorderStyleType, CSVWriter, CalculationProperties, Cell, CellAddress, CellData, CellRange, CellStyle, CellValueType, ChartConfig$1 as ChartConfig, Column, ColumnData, ColumnProperties, ConditionalFormatRule, DataValidation, DateFormatter, DeepPartial, Drawing, ExcelWriter, ExportBuilder, ExportFilters, ExportOptions, Fill, FillPattern, FontStyle, FreezePane, HeaderFooter, HorizontalAlignment, JSONWriter, MergeCell, Nullable, NumberFormat, NumberFormatter, PivotTableConfig, PrintOptions, Record$1 as Record, Row, RowData, RowProperties, SectionBuilder, SectionConfig, SheetBuilder, SheetView, StyleBuilder, TableConfig, VERSION, VerticalAlignment, Workbook, WorkbookData, WorkbookProperties, Worksheet, WorksheetData, calculatePercentage, debounce, downloadFile, exportToCSV, exportToExcel, formatCurrency, formatDate, formatNumber, generateId, groupBy, truncateText };