han-excel-builder 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,1568 @@
1
+ import { CellValue } from 'exceljs';
2
+ import { default as default_2 } from 'exceljs';
3
+
4
+ /**
5
+ * Border style options
6
+ */
7
+ export declare enum BorderStyle {
8
+ THIN = "thin",
9
+ MEDIUM = "medium",
10
+ THICK = "thick",
11
+ DOTTED = "dotted",
12
+ DASHED = "dashed",
13
+ DOUBLE = "double",
14
+ HAIR = "hair",
15
+ MEDIUM_DASHED = "mediumDashed",
16
+ DASH_DOT = "dashDot",
17
+ MEDIUM_DASH_DOT = "mediumDashDot",
18
+ DASH_DOT_DOT = "dashDotDot",
19
+ MEDIUM_DASH_DOT_DOT = "mediumDashDotDot",
20
+ SLANT_DASH_DOT = "slantDashDot"
21
+ }
22
+
23
+ /**
24
+ * Builder event types
25
+ */
26
+ export declare enum BuilderEventType {
27
+ WORKSHEET_ADDED = "worksheetAdded",
28
+ WORKSHEET_REMOVED = "worksheetRemoved",
29
+ WORKSHEET_UPDATED = "worksheetUpdated",
30
+ BUILD_STARTED = "buildStarted",
31
+ BUILD_PROGRESS = "buildProgress",
32
+ BUILD_COMPLETED = "buildCompleted",
33
+ BUILD_ERROR = "buildError",
34
+ DOWNLOAD_STARTED = "downloadStarted",
35
+ DOWNLOAD_PROGRESS = "downloadProgress",
36
+ DOWNLOAD_COMPLETED = "downloadCompleted",
37
+ DOWNLOAD_ERROR = "downloadError"
38
+ }
39
+
40
+ /**
41
+ * Cell event types
42
+ */
43
+ export declare enum CellEventType {
44
+ CREATED = "created",
45
+ UPDATED = "updated",
46
+ DELETED = "deleted",
47
+ STYLED = "styled",
48
+ VALIDATED = "validated"
49
+ }
50
+
51
+ /**
52
+ * Supported cell data types
53
+ */
54
+ export declare enum CellType {
55
+ STRING = "string",
56
+ NUMBER = "number",
57
+ BOOLEAN = "boolean",
58
+ DATE = "date",
59
+ PERCENTAGE = "percentage",
60
+ CURRENCY = "currency",
61
+ LINK = "link",
62
+ FORMULA = "formula"
63
+ }
64
+
65
+ /**
66
+ * Color type - can be hex string, RGB object, or theme color
67
+ */
68
+ export declare type Color = string | {
69
+ r: number;
70
+ g: number;
71
+ b: number;
72
+ } | {
73
+ theme: number;
74
+ };
75
+
76
+ /**
77
+ * Error types for validation
78
+ */
79
+ export declare enum ErrorType {
80
+ VALIDATION_ERROR = "VALIDATION_ERROR",
81
+ BUILD_ERROR = "BUILD_ERROR",
82
+ STYLE_ERROR = "STYLE_ERROR",
83
+ WORKSHEET_ERROR = "WORKSHEET_ERROR",
84
+ CELL_ERROR = "CELL_ERROR"
85
+ }
86
+
87
+ /**
88
+ * EventEmitter class for handling events
89
+ */
90
+ export declare class EventEmitter {
91
+ private listeners;
92
+ /**
93
+ * Add an event listener
94
+ */
95
+ on<T = any>(type: string, listener: EventListener_3<T>, options?: EventListenerOptions_2): string;
96
+ /**
97
+ * Add a one-time event listener
98
+ */
99
+ once<T = any>(type: string, listener: EventListener_3<T>, options?: EventListenerOptions_2): string;
100
+ /**
101
+ * Remove an event listener
102
+ */
103
+ off(type: string, listenerId: string): boolean;
104
+ /**
105
+ * Remove all listeners for an event type
106
+ */
107
+ offAll(type: string): number;
108
+ /**
109
+ * Emit an event
110
+ */
111
+ emit<T = any>(event: T): Promise<void>;
112
+ /**
113
+ * Emit an event synchronously
114
+ */
115
+ emitSync<T = any>(event: T): void;
116
+ /**
117
+ * Clear all listeners
118
+ */
119
+ clear(): void;
120
+ /**
121
+ * Get listeners for an event type
122
+ */
123
+ getListeners(type: string): EventListenerRegistration[];
124
+ /**
125
+ * Get listener count for an event type
126
+ */
127
+ getListenerCount(type: string): number;
128
+ /**
129
+ * Get all registered event types
130
+ */
131
+ getEventTypes(): string[];
132
+ private generateId;
133
+ private cleanupInactiveListeners;
134
+ }
135
+
136
+ /**
137
+ * Event listener function type
138
+ */
139
+ declare type EventListener_2 = (event: IBuilderEvent) => void;
140
+ export { EventListener_2 as EventListener }
141
+
142
+ /**
143
+ * Simple EventEmitter implementation
144
+ */
145
+ /**
146
+ * Event listener function type
147
+ */
148
+ declare type EventListener_3<T = any> = (event: T) => void | Promise<void>;
149
+
150
+ /**
151
+ * Event listener options
152
+ */
153
+ declare interface EventListenerOptions_2 {
154
+ /** Whether to execute the listener only once */
155
+ once?: boolean;
156
+ /** Whether to execute the listener asynchronously */
157
+ async?: boolean;
158
+ /** Priority of the listener (higher = executed first) */
159
+ priority?: number;
160
+ /** Whether to stop event propagation */
161
+ stopPropagation?: boolean;
162
+ }
163
+
164
+ /**
165
+ * Event listener registration
166
+ */
167
+ declare interface EventListenerRegistration {
168
+ /** Event type */
169
+ type: string;
170
+ /** Listener function */
171
+ listener: EventListener_3;
172
+ /** Listener options */
173
+ options: EventListenerOptions_2;
174
+ /** Registration ID */
175
+ id: string;
176
+ /** Whether the listener is active */
177
+ active: boolean;
178
+ /** Registration timestamp */
179
+ timestamp: Date;
180
+ }
181
+
182
+ /**
183
+ * ExcelBuilder class for creating Excel workbooks
184
+ */
185
+ declare class ExcelBuilder implements IExcelBuilder {
186
+ config: IExcelBuilderConfig;
187
+ worksheets: Map<string, IWorksheet>;
188
+ currentWorksheet: IWorksheet | undefined;
189
+ isBuilding: boolean;
190
+ stats: IBuildStats;
191
+ private eventEmitter;
192
+ constructor(config?: IExcelBuilderConfig);
193
+ /**
194
+ * Add a new worksheet to the workbook
195
+ */
196
+ addWorksheet(name: string, worksheetConfig?: Partial<IWorksheetConfig>): IWorksheet;
197
+ /**
198
+ * Get a worksheet by name
199
+ */
200
+ getWorksheet(name: string): IWorksheet | undefined;
201
+ /**
202
+ * Remove a worksheet by name
203
+ */
204
+ removeWorksheet(name: string): boolean;
205
+ /**
206
+ * Set the current worksheet
207
+ */
208
+ setCurrentWorksheet(name: string): boolean;
209
+ /**
210
+ * Build the workbook and return as ArrayBuffer
211
+ */
212
+ build(options?: IBuildOptions): Promise<Result<ArrayBuffer>>;
213
+ /**
214
+ * Generate and download the file
215
+ */
216
+ generateAndDownload(fileName: string, options?: IDownloadOptions): Promise<Result<void>>;
217
+ /**
218
+ * Get workbook as buffer
219
+ */
220
+ toBuffer(options?: IBuildOptions): Promise<Result<ArrayBuffer>>;
221
+ /**
222
+ * Get workbook as blob
223
+ */
224
+ toBlob(options?: IBuildOptions): Promise<Result<Blob>>;
225
+ /**
226
+ * Validate the workbook
227
+ */
228
+ validate(): Result<boolean>;
229
+ /**
230
+ * Clear all worksheets
231
+ */
232
+ clear(): void;
233
+ /**
234
+ * Get workbook statistics
235
+ */
236
+ getStats(): IBuildStats;
237
+ /**
238
+ * Event handling methods
239
+ */
240
+ on(eventType: BuilderEventType, listener: (event: IBuilderEvent) => void): string;
241
+ off(eventType: BuilderEventType, listenerId: string): boolean;
242
+ removeAllListeners(eventType?: BuilderEventType): void;
243
+ /**
244
+ * Private methods
245
+ */
246
+ private emitEvent;
247
+ private initializeStats;
248
+ }
249
+ export { ExcelBuilder }
250
+ export default ExcelBuilder;
251
+
252
+ /**
253
+ * Font style options
254
+ */
255
+ export declare enum FontStyle {
256
+ NORMAL = "normal",
257
+ BOLD = "bold",
258
+ ITALIC = "italic",
259
+ BOLD_ITALIC = "bold italic"
260
+ }
261
+
262
+ /**
263
+ * Horizontal alignment options
264
+ */
265
+ export declare enum HorizontalAlignment {
266
+ LEFT = "left",
267
+ CENTER = "center",
268
+ RIGHT = "right",
269
+ FILL = "fill",
270
+ JUSTIFY = "justify",
271
+ CENTER_CONTINUOUS = "centerContinuous",
272
+ DISTRIBUTED = "distributed"
273
+ }
274
+
275
+ /**
276
+ * Alignment configuration interface
277
+ */
278
+ export declare interface IAlignment {
279
+ /** Horizontal alignment */
280
+ horizontal?: HorizontalAlignment;
281
+ /** Vertical alignment */
282
+ vertical?: VerticalAlignment;
283
+ /** Text rotation (0-180 degrees) */
284
+ textRotation?: number;
285
+ /** Whether to wrap text */
286
+ wrapText?: boolean;
287
+ /** Whether to shrink text to fit */
288
+ shrinkToFit?: boolean;
289
+ /** Indent level */
290
+ indent?: number;
291
+ /** Whether to merge cells */
292
+ mergeCell?: boolean;
293
+ /** Reading order */
294
+ readingOrder?: 'left-to-right' | 'right-to-left';
295
+ }
296
+
297
+ /**
298
+ * Base cell properties interface
299
+ */
300
+ export declare interface IBaseCell {
301
+ /** Unique identifier for the cell */
302
+ key: string;
303
+ /** Cell data type */
304
+ type: CellType;
305
+ /** Cell value */
306
+ value: CellValue;
307
+ /** Optional cell reference (e.g., A1, B2) */
308
+ reference?: string;
309
+ /** Whether to merge this cell with others */
310
+ mergeCell?: boolean;
311
+ /** Number of columns to merge (if mergeCell is true) */
312
+ mergeTo?: number;
313
+ /** Row height for this cell */
314
+ rowHeight?: number;
315
+ /** Column width for this cell */
316
+ colWidth?: number;
317
+ /** Whether to move to next row after this cell */
318
+ jump?: boolean;
319
+ /** Hyperlink URL */
320
+ link?: string;
321
+ /** Excel formula */
322
+ formula?: string;
323
+ /** Number format for numeric cells */
324
+ numberFormat?: NumberFormat | string;
325
+ /** Custom number format string */
326
+ customNumberFormat?: string;
327
+ /** Whether the cell is protected */
328
+ protected?: boolean;
329
+ /** Whether the cell is hidden */
330
+ hidden?: boolean;
331
+ /** Cell comment */
332
+ comment?: string;
333
+ /** Data validation rules */
334
+ validation?: IDataValidation;
335
+ /** Optional styles for the cell */
336
+ styles?: IStyle;
337
+ /** Legacy children cells */
338
+ childrens?: IBaseCell[];
339
+ /** Modern children cells */
340
+ children?: IBaseCell[];
341
+ }
342
+
343
+ /**
344
+ * Border configuration interface
345
+ */
346
+ export declare interface IBorder {
347
+ /** Border style */
348
+ style?: BorderStyle;
349
+ /** Border color */
350
+ color?: Color;
351
+ /** Border width */
352
+ width?: number;
353
+ }
354
+
355
+ /**
356
+ * Border sides interface
357
+ */
358
+ export declare interface IBorderSides {
359
+ /** Top border */
360
+ top?: IBorder;
361
+ /** Left border */
362
+ left?: IBorder;
363
+ /** Bottom border */
364
+ bottom?: IBorder;
365
+ /** Right border */
366
+ right?: IBorder;
367
+ /** Diagonal border */
368
+ diagonal?: IBorder;
369
+ /** Diagonal direction */
370
+ diagonalDirection?: 'up' | 'down' | 'both';
371
+ }
372
+
373
+ /**
374
+ * Builder event interface
375
+ */
376
+ export declare interface IBuilderEvent {
377
+ type: BuilderEventType;
378
+ data?: Record<string, unknown>;
379
+ timestamp: Date;
380
+ }
381
+
382
+ /**
383
+ * Builder event listener interface
384
+ */
385
+ export declare interface IBuilderEventListener {
386
+ (event: IBuilderEvent): void;
387
+ }
388
+
389
+ /**
390
+ * Builder validation result interface
391
+ */
392
+ export declare interface IBuilderValidationResult {
393
+ /** Whether the builder is valid */
394
+ isValid: boolean;
395
+ /** Validation errors */
396
+ errors: string[];
397
+ /** Validation warnings */
398
+ warnings: string[];
399
+ /** Worksheet validation results */
400
+ worksheetResults: Map<string, boolean>;
401
+ }
402
+
403
+ /**
404
+ * Build options interface
405
+ */
406
+ export declare interface IBuildOptions {
407
+ /** Output format */
408
+ format?: 'xlsx' | 'xls' | 'csv';
409
+ /** Whether to include styles */
410
+ includeStyles?: boolean;
411
+ /** Whether to include formulas */
412
+ includeFormulas?: boolean;
413
+ /** Whether to include comments */
414
+ includeComments?: boolean;
415
+ /** Whether to include data validation */
416
+ includeValidation?: boolean;
417
+ /** Whether to include conditional formatting */
418
+ includeConditionalFormatting?: boolean;
419
+ /** Compression level (0-9) */
420
+ compressionLevel?: number;
421
+ /** Whether to optimize for size */
422
+ optimizeForSize?: boolean;
423
+ /** Whether to optimize for speed */
424
+ optimizeForSpeed?: boolean;
425
+ }
426
+
427
+ /**
428
+ * Build statistics interface
429
+ */
430
+ export declare interface IBuildStats {
431
+ /** Total number of worksheets */
432
+ totalWorksheets: number;
433
+ /** Total number of cells */
434
+ totalCells: number;
435
+ /** Total memory usage in bytes */
436
+ memoryUsage: number;
437
+ /** Build time in milliseconds */
438
+ buildTime: number;
439
+ /** File size in bytes */
440
+ fileSize: number;
441
+ /** Number of styles used */
442
+ stylesUsed: number;
443
+ /** Number of formulas used */
444
+ formulasUsed: number;
445
+ /** Number of conditional formats used */
446
+ conditionalFormatsUsed: number;
447
+ /** Performance metrics */
448
+ performance: {
449
+ /** Time spent building headers */
450
+ headersTime: number;
451
+ /** Time spent building data */
452
+ dataTime: number;
453
+ /** Time spent applying styles */
454
+ stylesTime: number;
455
+ /** Time spent writing to buffer */
456
+ writeTime: number;
457
+ };
458
+ }
459
+
460
+ /**
461
+ * Cell data for different types
462
+ */
463
+ export declare interface ICellData {
464
+ /** String cell data */
465
+ string?: {
466
+ value: string;
467
+ maxLength?: number;
468
+ trim?: boolean;
469
+ };
470
+ /** Number cell data */
471
+ number?: {
472
+ value: number;
473
+ min?: number;
474
+ max?: number;
475
+ precision?: number;
476
+ allowNegative?: boolean;
477
+ };
478
+ /** Date cell data */
479
+ date?: {
480
+ value: Date;
481
+ min?: Date;
482
+ max?: Date;
483
+ format?: string;
484
+ };
485
+ /** Boolean cell data */
486
+ boolean?: {
487
+ value: boolean;
488
+ trueText?: string;
489
+ falseText?: string;
490
+ };
491
+ /** Percentage cell data */
492
+ percentage?: {
493
+ value: number;
494
+ min?: number;
495
+ max?: number;
496
+ precision?: number;
497
+ showSymbol?: boolean;
498
+ };
499
+ /** Currency cell data */
500
+ currency?: {
501
+ value: number;
502
+ currency?: string;
503
+ precision?: number;
504
+ showSymbol?: boolean;
505
+ };
506
+ /** Link cell data */
507
+ link?: {
508
+ value: string;
509
+ text?: string;
510
+ tooltip?: string;
511
+ };
512
+ /** Formula cell data */
513
+ formula?: {
514
+ value: string;
515
+ result?: CellValue;
516
+ };
517
+ }
518
+
519
+ /**
520
+ * Cell event interface
521
+ */
522
+ export declare interface ICellEvent {
523
+ type: CellEventType;
524
+ cell: IDataCell | IHeaderCell | IFooterCell;
525
+ position: ICellPosition;
526
+ timestamp: Date;
527
+ data?: Record<string, unknown>;
528
+ }
529
+
530
+ /**
531
+ * Cell position interface
532
+ */
533
+ export declare interface ICellPosition {
534
+ /** Row index (1-based) */
535
+ row: number;
536
+ /** Column index (1-based) */
537
+ col: number;
538
+ /** Cell reference (e.g., A1) */
539
+ reference: string;
540
+ }
541
+
542
+ /**
543
+ * Cell range interface
544
+ */
545
+ export declare interface ICellRange {
546
+ /** Start position */
547
+ start: ICellPosition;
548
+ /** End position */
549
+ end: ICellPosition;
550
+ /** Range reference (e.g., A1:B10) */
551
+ reference: string;
552
+ }
553
+
554
+ /**
555
+ * Cell type validation interface
556
+ */
557
+ export declare interface ICellTypeValidation {
558
+ /** Expected cell type */
559
+ expectedType: CellType;
560
+ /** Whether to allow null/undefined values */
561
+ allowNull?: boolean;
562
+ /** Whether to allow empty strings */
563
+ allowEmpty?: boolean;
564
+ /** Type conversion options */
565
+ conversion?: {
566
+ /** Whether to attempt type conversion */
567
+ enabled: boolean;
568
+ /** Whether to be strict about conversion */
569
+ strict: boolean;
570
+ };
571
+ }
572
+
573
+ /**
574
+ * Cell validation result
575
+ */
576
+ export declare interface ICellValidationResult {
577
+ /** Whether the cell is valid */
578
+ isValid: boolean;
579
+ /** Validation errors */
580
+ errors: string[];
581
+ /** Validation warnings */
582
+ warnings: string[];
583
+ }
584
+
585
+ /**
586
+ * Conditional formatting interface
587
+ */
588
+ export declare interface IConditionalFormat {
589
+ /** Condition type */
590
+ type: 'cellIs' | 'containsText' | 'beginsWith' | 'endsWith' | 'containsBlanks' | 'notContainsBlanks' | 'containsErrors' | 'notContainsErrors' | 'timePeriod' | 'top' | 'bottom' | 'aboveAverage' | 'belowAverage' | 'duplicateValues' | 'uniqueValues' | 'expression' | 'colorScale' | 'dataBar' | 'iconSet';
591
+ /** Condition operator */
592
+ operator?: 'between' | 'notBetween' | 'equal' | 'notEqual' | 'greaterThan' | 'lessThan' | 'greaterThanOrEqual' | 'lessThanOrEqual';
593
+ /** Condition values */
594
+ values?: Array<string | number | Date>;
595
+ /** Condition formula */
596
+ formula?: string;
597
+ /** Style to apply when condition is met */
598
+ style?: IStyle;
599
+ /** Priority of the condition */
600
+ priority?: number;
601
+ /** Whether to stop if true */
602
+ stopIfTrue?: boolean;
603
+ }
604
+
605
+ /**
606
+ * Data cell interface
607
+ */
608
+ export declare interface IDataCell extends IBaseCell {
609
+ /** Reference to header key */
610
+ header: string;
611
+ /** Reference to main header key */
612
+ mainHeaderKey?: string;
613
+ /** Child data cells */
614
+ children?: IDataCell[];
615
+ /** Whether this cell has alternating row color */
616
+ striped?: boolean;
617
+ /** Row index */
618
+ rowIndex?: number;
619
+ /** Column index */
620
+ colIndex?: number;
621
+ }
622
+
623
+ /**
624
+ * Data validation interface
625
+ */
626
+ export declare interface IDataValidation {
627
+ /** Validation type */
628
+ type: 'list' | 'whole' | 'decimal' | 'textLength' | 'date' | 'time' | 'custom';
629
+ /** Validation operator */
630
+ operator?: 'between' | 'notBetween' | 'equal' | 'notEqual' | 'greaterThan' | 'lessThan' | 'greaterThanOrEqual' | 'lessThanOrEqual';
631
+ /** Validation formula or values */
632
+ formula1?: string | number | Date;
633
+ /** Second validation formula or value (for between/notBetween) */
634
+ formula2?: string | number | Date;
635
+ /** Whether to show error message */
636
+ showErrorMessage?: boolean;
637
+ /** Error message text */
638
+ errorMessage?: string;
639
+ /** Whether to show input message */
640
+ showInputMessage?: boolean;
641
+ /** Input message text */
642
+ inputMessage?: string;
643
+ /** Whether to allow blank values */
644
+ allowBlank?: boolean;
645
+ }
646
+
647
+ /**
648
+ * Download options interface
649
+ */
650
+ export declare interface IDownloadOptions extends IBuildOptions {
651
+ /** File name */
652
+ fileName?: string;
653
+ /** Whether to show download progress */
654
+ showProgress?: boolean;
655
+ /** Progress callback */
656
+ onProgress?: (progress: number) => void;
657
+ /** Whether to auto-download */
658
+ autoDownload?: boolean;
659
+ /** MIME type */
660
+ mimeType?: string;
661
+ }
662
+
663
+ /**
664
+ * Error interface
665
+ */
666
+ export declare interface IError {
667
+ type: ErrorType;
668
+ message: string;
669
+ code?: string;
670
+ details?: Record<string, unknown>;
671
+ stack?: string;
672
+ }
673
+
674
+ /**
675
+ * Error result interface
676
+ */
677
+ export declare interface IErrorResult {
678
+ success: false;
679
+ error: IError;
680
+ }
681
+
682
+ /**
683
+ * Event emitter interface
684
+ */
685
+ export declare interface IEventEmitter {
686
+ on(event: BuilderEventType, listener: EventListener_2): void;
687
+ off(event: BuilderEventType, listener: EventListener_2): void;
688
+ emit(event: BuilderEventType, data?: Record<string, unknown>): void;
689
+ removeAllListeners(event?: BuilderEventType): void;
690
+ }
691
+
692
+ /**
693
+ * Excel builder interface
694
+ */
695
+ export declare interface IExcelBuilder {
696
+ /** Builder configuration */
697
+ config: IExcelBuilderConfig;
698
+ /** Worksheets in the workbook */
699
+ worksheets: Map<string, IWorksheet>;
700
+ /** Current worksheet */
701
+ currentWorksheet: IWorksheet | undefined;
702
+ /** Whether the builder is building */
703
+ isBuilding: boolean;
704
+ /** Build statistics */
705
+ stats: IBuildStats;
706
+ /** Add a new worksheet */
707
+ addWorksheet(name: string, config?: Partial<IWorksheetConfig>): IWorksheet;
708
+ /** Get a worksheet by name */
709
+ getWorksheet(name: string): IWorksheet | undefined;
710
+ /** Remove a worksheet */
711
+ removeWorksheet(name: string): boolean;
712
+ /** Set the current worksheet */
713
+ setCurrentWorksheet(name: string): boolean;
714
+ /** Build the workbook */
715
+ build(options?: IBuildOptions): Promise<Result<ArrayBuffer>>;
716
+ /** Generate and download the file */
717
+ generateAndDownload(fileName: string, options?: IDownloadOptions): Promise<Result<void>>;
718
+ /** Get workbook as buffer */
719
+ toBuffer(options?: IBuildOptions): Promise<Result<ArrayBuffer>>;
720
+ /** Get workbook as blob */
721
+ toBlob(options?: IBuildOptions): Promise<Result<Blob>>;
722
+ /** Validate the workbook */
723
+ validate(): Result<boolean>;
724
+ /** Clear all worksheets */
725
+ clear(): void;
726
+ /** Get workbook statistics */
727
+ getStats(): IBuildStats;
728
+ }
729
+
730
+ /**
731
+ * Excel builder configuration interface
732
+ */
733
+ export declare interface IExcelBuilderConfig {
734
+ /** Workbook metadata */
735
+ metadata?: IWorkbookMetadata;
736
+ /** Default worksheet configuration */
737
+ defaultWorksheetConfig?: Partial<IWorksheetConfig>;
738
+ /** Default styles */
739
+ defaultStyles?: {
740
+ header?: IStyle;
741
+ subheader?: IStyle;
742
+ data?: IStyle;
743
+ footer?: IStyle;
744
+ total?: IStyle;
745
+ };
746
+ /** Whether to enable validation */
747
+ enableValidation?: boolean;
748
+ /** Whether to enable events */
749
+ enableEvents?: boolean;
750
+ /** Whether to enable performance monitoring */
751
+ enablePerformanceMonitoring?: boolean;
752
+ /** Maximum number of worksheets */
753
+ maxWorksheets?: number;
754
+ /** Maximum number of rows per worksheet */
755
+ maxRowsPerWorksheet?: number;
756
+ /** Maximum number of columns per worksheet */
757
+ maxColumnsPerWorksheet?: number;
758
+ /** Memory limit in bytes */
759
+ memoryLimit?: number;
760
+ }
761
+
762
+ /**
763
+ * Fill pattern interface
764
+ */
765
+ export declare interface IFill {
766
+ /** Fill type */
767
+ type: 'pattern' | 'gradient';
768
+ /** Pattern type (for pattern fills) */
769
+ pattern?: 'none' | 'solid' | 'darkGray' | 'mediumGray' | 'lightGray' | 'gray125' | 'gray0625' | 'darkHorizontal' | 'darkVertical' | 'darkDown' | 'darkUp' | 'darkGrid' | 'darkTrellis' | 'lightHorizontal' | 'lightVertical' | 'lightDown' | 'lightUp' | 'lightGrid' | 'lightTrellis';
770
+ /** Background color */
771
+ backgroundColor?: Color;
772
+ /** Foreground color */
773
+ foregroundColor?: Color;
774
+ /** Gradient type (for gradient fills) */
775
+ gradient?: 'linear' | 'path';
776
+ /** Gradient stops */
777
+ stops?: Array<{
778
+ position: number;
779
+ color: Color;
780
+ }>;
781
+ /** Gradient angle (for linear gradients) */
782
+ angle?: number;
783
+ }
784
+
785
+ /**
786
+ * Font configuration interface
787
+ */
788
+ export declare interface IFont {
789
+ /** Font name */
790
+ name?: string;
791
+ /** Font size */
792
+ size?: number;
793
+ /** Font style */
794
+ style?: FontStyle;
795
+ /** Font color */
796
+ color?: Color;
797
+ /** Whether the font is bold */
798
+ bold?: boolean;
799
+ /** Whether the font is italic */
800
+ italic?: boolean;
801
+ /** Whether the font is underlined */
802
+ underline?: boolean;
803
+ /** Whether the font is strikethrough */
804
+ strikethrough?: boolean;
805
+ /** Font family */
806
+ family?: string;
807
+ /** Font scheme */
808
+ scheme?: 'major' | 'minor' | 'none';
809
+ }
810
+
811
+ /**
812
+ * Footer cell interface
813
+ */
814
+ export declare interface IFooterCell extends IBaseCell {
815
+ /** Reference to header key */
816
+ header: string;
817
+ /** Child footer cells */
818
+ children?: IDataCell[];
819
+ /** Whether this is a total row */
820
+ isTotal?: boolean;
821
+ /** Footer type */
822
+ footerType?: 'total' | 'subtotal' | 'average' | 'count' | 'custom';
823
+ }
824
+
825
+ /**
826
+ * Format validation interface
827
+ */
828
+ export declare interface IFormatValidation {
829
+ /** Format pattern (regex or format string) */
830
+ pattern: string | RegExp;
831
+ /** Format type */
832
+ type: 'regex' | 'date' | 'email' | 'url' | 'phone' | 'custom';
833
+ /** Custom format function */
834
+ formatFunction?: (value: unknown) => boolean;
835
+ }
836
+
837
+ /**
838
+ * Header cell interface
839
+ */
840
+ export declare interface IHeaderCell extends IBaseCell {
841
+ /** Reference to parent header key */
842
+ mainHeaderKey?: string;
843
+ /** Child headers */
844
+ children?: IHeaderCell[];
845
+ /** Whether this is a main header */
846
+ isMainHeader?: boolean;
847
+ /** Header level (1 = main, 2 = sub, etc.) */
848
+ level?: number;
849
+ }
850
+
851
+ /**
852
+ * Length validation interface
853
+ */
854
+ export declare interface ILengthValidation {
855
+ /** Minimum length */
856
+ min?: number;
857
+ /** Maximum length */
858
+ max?: number;
859
+ /** Exact length */
860
+ exact?: number;
861
+ /** Whether to trim whitespace before validation */
862
+ trim?: boolean;
863
+ }
864
+
865
+ /**
866
+ * Protection configuration interface
867
+ */
868
+ export declare interface IProtection {
869
+ /** Whether the cell is locked */
870
+ locked?: boolean;
871
+ /** Whether the cell is hidden */
872
+ hidden?: boolean;
873
+ }
874
+
875
+ /**
876
+ * Range validation interface
877
+ */
878
+ export declare interface IRangeValidation {
879
+ /** Minimum value */
880
+ min?: number | Date | string;
881
+ /** Maximum value */
882
+ max?: number | Date | string;
883
+ /** Whether the range is inclusive */
884
+ inclusive?: boolean;
885
+ /** Custom range function */
886
+ rangeFunction?: (value: unknown) => boolean;
887
+ }
888
+
889
+ /**
890
+ * Reference validation interface
891
+ */
892
+ export declare interface IReferenceValidation {
893
+ /** Reference type */
894
+ type: 'formula' | 'hyperlink' | 'comment' | 'validation';
895
+ /** Reference target */
896
+ target: string;
897
+ /** Whether the reference is required */
898
+ required?: boolean;
899
+ /** Reference validation function */
900
+ validateReference?: (reference: string) => boolean;
901
+ }
902
+
903
+ /**
904
+ * Main style interface
905
+ */
906
+ export declare interface IStyle {
907
+ /** Font configuration */
908
+ font?: IFont;
909
+ /** Border configuration */
910
+ border?: IBorderSides;
911
+ /** Fill configuration */
912
+ fill?: IFill;
913
+ /** Alignment configuration */
914
+ alignment?: IAlignment;
915
+ /** Protection configuration */
916
+ protection?: IProtection;
917
+ /** Conditional formatting */
918
+ conditionalFormats?: IConditionalFormat[];
919
+ /** Number format */
920
+ numberFormat?: string;
921
+ /** Whether to apply alternating row colors */
922
+ striped?: boolean;
923
+ /** Custom CSS-like properties */
924
+ custom?: Record<string, unknown>;
925
+ }
926
+
927
+ /**
928
+ * Style builder interface
929
+ */
930
+ export declare interface IStyleBuilder {
931
+ /** Set font name */
932
+ fontName(name: string): IStyleBuilder;
933
+ /** Set font size */
934
+ fontSize(size: number): IStyleBuilder;
935
+ /** Set font style */
936
+ fontStyle(style: FontStyle): IStyleBuilder;
937
+ /** Set font color */
938
+ fontColor(color: Color): IStyleBuilder;
939
+ /** Make font bold */
940
+ fontBold(): IStyleBuilder;
941
+ /** Make font italic */
942
+ fontItalic(): IStyleBuilder;
943
+ /** Make font underlined */
944
+ fontUnderline(): IStyleBuilder;
945
+ /** Set border */
946
+ border(style: BorderStyle, color?: Color): IStyleBuilder;
947
+ /** Set specific border */
948
+ borderTop(style: BorderStyle, color?: Color): IStyleBuilder;
949
+ borderLeft(style: BorderStyle, color?: Color): IStyleBuilder;
950
+ borderBottom(style: BorderStyle, color?: Color): IStyleBuilder;
951
+ borderRight(style: BorderStyle, color?: Color): IStyleBuilder;
952
+ /** Set background color */
953
+ backgroundColor(color: Color): IStyleBuilder;
954
+ /** Set horizontal alignment */
955
+ horizontalAlign(alignment: HorizontalAlignment): IStyleBuilder;
956
+ /** Set vertical alignment */
957
+ verticalAlign(alignment: VerticalAlignment): IStyleBuilder;
958
+ /** Center align text */
959
+ centerAlign(): IStyleBuilder;
960
+ /** Left align text */
961
+ leftAlign(): IStyleBuilder;
962
+ /** Right align text */
963
+ rightAlign(): IStyleBuilder;
964
+ /** Wrap text */
965
+ wrapText(): IStyleBuilder;
966
+ /** Set number format */
967
+ numberFormat(format: string): IStyleBuilder;
968
+ /** Set striped rows */
969
+ striped(): IStyleBuilder;
970
+ /** Add conditional formatting */
971
+ conditionalFormat(format: IConditionalFormat): IStyleBuilder;
972
+ /** Build the final style */
973
+ build(): IStyle;
974
+ }
975
+
976
+ /**
977
+ * Style theme interface
978
+ */
979
+ export declare interface IStyleTheme {
980
+ /** Theme name */
981
+ name: string;
982
+ /** Theme description */
983
+ description?: string;
984
+ /** Color palette */
985
+ colors: {
986
+ primary: Color;
987
+ secondary: Color;
988
+ accent: Color;
989
+ background: Color;
990
+ text: Color;
991
+ border: Color;
992
+ success: Color;
993
+ warning: Color;
994
+ error: Color;
995
+ info: Color;
996
+ };
997
+ /** Font family */
998
+ fontFamily: string;
999
+ /** Base font size */
1000
+ fontSize: number;
1001
+ /** Style presets */
1002
+ presets: Record<StylePreset, IStyle>;
1003
+ }
1004
+
1005
+ /**
1006
+ * Success result interface
1007
+ */
1008
+ export declare interface ISuccessResult<T = unknown> {
1009
+ success: true;
1010
+ data: T;
1011
+ message?: string;
1012
+ }
1013
+
1014
+ /**
1015
+ * Table structure interface
1016
+ */
1017
+ export declare interface ITable {
1018
+ /** Table name */
1019
+ name?: string;
1020
+ /** Table headers */
1021
+ headers?: IHeaderCell[];
1022
+ /** Table sub-headers */
1023
+ subHeaders?: IHeaderCell[];
1024
+ /** Table data rows */
1025
+ body?: IDataCell[];
1026
+ /** Table footers */
1027
+ footers?: IFooterCell[];
1028
+ /** Table range */
1029
+ range?: ICellRange;
1030
+ /** Whether to show table borders */
1031
+ showBorders?: boolean;
1032
+ /** Whether to show alternating row colors */
1033
+ showStripes?: boolean;
1034
+ /** Table style */
1035
+ style?: 'TableStyleLight1' | 'TableStyleLight2' | 'TableStyleMedium1' | 'TableStyleMedium2' | 'TableStyleDark1' | 'TableStyleDark2';
1036
+ }
1037
+
1038
+ /**
1039
+ * Unique validation interface
1040
+ */
1041
+ export declare interface IUniqueValidation {
1042
+ /** Scope for uniqueness check */
1043
+ scope: 'worksheet' | 'table' | 'column' | 'row' | 'custom';
1044
+ /** Custom scope function */
1045
+ scopeFunction?: (cell: IDataCell | IHeaderCell | IFooterCell) => string;
1046
+ /** Whether to ignore case */
1047
+ ignoreCase?: boolean;
1048
+ /** Whether to ignore whitespace */
1049
+ ignoreWhitespace?: boolean;
1050
+ }
1051
+
1052
+ /**
1053
+ * Validation context interface
1054
+ */
1055
+ export declare interface IValidationContext {
1056
+ /** Cell being validated */
1057
+ cell: IDataCell | IHeaderCell | IFooterCell;
1058
+ /** Cell position */
1059
+ position?: {
1060
+ row: number;
1061
+ col: number;
1062
+ };
1063
+ /** Worksheet name */
1064
+ worksheetName?: string;
1065
+ /** Table name */
1066
+ tableName?: string;
1067
+ /** Validation rules */
1068
+ rules?: IValidationRule[];
1069
+ /** Additional context data */
1070
+ data?: Record<string, unknown>;
1071
+ }
1072
+
1073
+ /**
1074
+ * Validation engine interface
1075
+ */
1076
+ export declare interface IValidationEngine {
1077
+ /** Validation schemas */
1078
+ schemas: Map<string, IValidationSchema>;
1079
+ /** Active schema */
1080
+ activeSchema?: IValidationSchema;
1081
+ /** Whether validation is enabled */
1082
+ enabled: boolean;
1083
+ /** Validation cache */
1084
+ cache: Map<string, IValidationResult>;
1085
+ /** Add a validation schema */
1086
+ addSchema(schema: IValidationSchema): void;
1087
+ /** Remove a validation schema */
1088
+ removeSchema(name: string): boolean;
1089
+ /** Set the active schema */
1090
+ setActiveSchema(name: string): boolean;
1091
+ /** Validate a cell */
1092
+ validateCell(cell: IDataCell | IHeaderCell | IFooterCell, context?: IValidationContext): IValidationResult;
1093
+ /** Validate a worksheet */
1094
+ validateWorksheet(worksheet: unknown): IValidationResult[];
1095
+ /** Clear validation cache */
1096
+ clearCache(): void;
1097
+ /** Get validation statistics */
1098
+ getStats(): IValidationStats;
1099
+ }
1100
+
1101
+ /**
1102
+ * Validation result interface
1103
+ */
1104
+ export declare interface IValidationResult {
1105
+ /** Whether the validation passed */
1106
+ isValid: boolean;
1107
+ /** Validation errors */
1108
+ errors: string[];
1109
+ /** Validation warnings */
1110
+ warnings: string[];
1111
+ /** Validation info messages */
1112
+ info: string[];
1113
+ /** Suggested fixes */
1114
+ suggestions: string[];
1115
+ /** Validation metadata */
1116
+ metadata?: Record<string, unknown>;
1117
+ }
1118
+
1119
+ /**
1120
+ * Validation rule interface
1121
+ */
1122
+ export declare interface IValidationRule {
1123
+ /** Rule name */
1124
+ name: string;
1125
+ /** Rule description */
1126
+ description?: string;
1127
+ /** Rule type */
1128
+ type: 'required' | 'type' | 'range' | 'length' | 'format' | 'custom' | 'unique' | 'reference';
1129
+ /** Rule severity */
1130
+ severity: 'error' | 'warning' | 'info';
1131
+ /** Whether the rule is enabled */
1132
+ enabled: boolean;
1133
+ /** Rule parameters */
1134
+ params?: Record<string, unknown>;
1135
+ /** Custom validation function */
1136
+ validator?: (value: unknown, context?: IValidationContext) => IValidationResult;
1137
+ }
1138
+
1139
+ /**
1140
+ * Validation schema interface
1141
+ */
1142
+ export declare interface IValidationSchema {
1143
+ /** Schema name */
1144
+ name: string;
1145
+ /** Schema description */
1146
+ description?: string;
1147
+ /** Schema version */
1148
+ version?: string;
1149
+ /** Default rules */
1150
+ defaultRules: IValidationRule[];
1151
+ /** Cell type rules */
1152
+ cellTypeRules: Map<CellType, IValidationRule[]>;
1153
+ /** Custom rules */
1154
+ customRules: Map<string, IValidationRule>;
1155
+ /** Whether the schema is enabled */
1156
+ enabled: boolean;
1157
+ }
1158
+
1159
+ /**
1160
+ * Validation statistics interface
1161
+ */
1162
+ export declare interface IValidationStats {
1163
+ /** Total validations performed */
1164
+ totalValidations: number;
1165
+ /** Number of passed validations */
1166
+ passedValidations: number;
1167
+ /** Number of failed validations */
1168
+ failedValidations: number;
1169
+ /** Number of warnings */
1170
+ warnings: number;
1171
+ /** Average validation time in milliseconds */
1172
+ averageValidationTime: number;
1173
+ /** Cache hit rate */
1174
+ cacheHitRate: number;
1175
+ /** Most common validation errors */
1176
+ commonErrors: Array<{
1177
+ error: string;
1178
+ count: number;
1179
+ }>;
1180
+ }
1181
+
1182
+ /**
1183
+ * Workbook metadata interface
1184
+ */
1185
+ export declare interface IWorkbookMetadata {
1186
+ /** Workbook author */
1187
+ author?: string;
1188
+ /** Workbook title */
1189
+ title?: string;
1190
+ /** Workbook subject */
1191
+ subject?: string;
1192
+ /** Workbook keywords */
1193
+ keywords?: string;
1194
+ /** Workbook category */
1195
+ category?: string;
1196
+ /** Workbook description */
1197
+ description?: string;
1198
+ /** Workbook company */
1199
+ company?: string;
1200
+ /** Workbook manager */
1201
+ manager?: string;
1202
+ /** Creation date */
1203
+ created?: Date;
1204
+ /** Last modified date */
1205
+ modified?: Date;
1206
+ /** Application name */
1207
+ application?: string;
1208
+ /** Application version */
1209
+ appVersion?: string;
1210
+ /** Hyperlink base */
1211
+ hyperlinkBase?: string;
1212
+ }
1213
+
1214
+ /**
1215
+ * Worksheet interface
1216
+ */
1217
+ export declare interface IWorksheet {
1218
+ /** Worksheet configuration */
1219
+ config: IWorksheetConfig;
1220
+ /** Tables in the worksheet */
1221
+ tables: ITable[];
1222
+ /** Current row pointer */
1223
+ currentRow: number;
1224
+ /** Current column pointer */
1225
+ currentCol: number;
1226
+ /** Header pointers for navigation */
1227
+ headerPointers: Map<string, ICellPosition>;
1228
+ /** Whether the worksheet has been built */
1229
+ isBuilt: boolean;
1230
+ /** Add a header */
1231
+ addHeader(header: IHeaderCell): this;
1232
+ /** Add subheaders */
1233
+ addSubHeaders(subHeaders: IHeaderCell[]): this;
1234
+ /** Add a row or rows */
1235
+ addRow(row: IDataCell[] | IDataCell): this;
1236
+ /** Add a footer or footers */
1237
+ addFooter(footer: IFooterCell[] | IFooterCell): this;
1238
+ /** Build the worksheet */
1239
+ build(workbook: any, options?: any): Promise<void>;
1240
+ /** Validate the worksheet */
1241
+ validate(): Result<boolean>;
1242
+ }
1243
+
1244
+ /**
1245
+ * Worksheet configuration interface
1246
+ */
1247
+ export declare interface IWorksheetConfig {
1248
+ /** Worksheet name */
1249
+ name: string;
1250
+ /** Tab color */
1251
+ tabColor?: Color;
1252
+ /** Default row height */
1253
+ defaultRowHeight?: number;
1254
+ /** Default column width */
1255
+ defaultColWidth?: number;
1256
+ /** Whether the worksheet is hidden */
1257
+ hidden?: boolean;
1258
+ /** Whether the worksheet is protected */
1259
+ protected?: boolean;
1260
+ /** Protection password */
1261
+ protectionPassword?: string;
1262
+ /** Whether to show grid lines */
1263
+ showGridLines?: boolean;
1264
+ /** Whether to show row and column headers */
1265
+ showRowColHeaders?: boolean;
1266
+ /** Zoom level (1-400) */
1267
+ zoom?: number;
1268
+ /** Freeze panes position */
1269
+ freezePanes?: ICellPosition;
1270
+ /** Print area */
1271
+ printArea?: ICellRange;
1272
+ /** Fit to page settings */
1273
+ fitToPage?: {
1274
+ fitToWidth?: number;
1275
+ fitToHeight?: number;
1276
+ };
1277
+ /** Page setup */
1278
+ pageSetup?: {
1279
+ orientation?: 'portrait' | 'landscape';
1280
+ paperSize?: number;
1281
+ fitToPage?: boolean;
1282
+ fitToWidth?: number;
1283
+ fitToHeight?: number;
1284
+ scale?: number;
1285
+ horizontalCentered?: boolean;
1286
+ verticalCentered?: boolean;
1287
+ margins?: {
1288
+ top?: number;
1289
+ left?: number;
1290
+ bottom?: number;
1291
+ right?: number;
1292
+ header?: number;
1293
+ footer?: number;
1294
+ };
1295
+ };
1296
+ }
1297
+
1298
+ /**
1299
+ * Worksheet event interface
1300
+ */
1301
+ export declare interface IWorksheetEvent {
1302
+ type: WorksheetEventType;
1303
+ worksheet: IWorksheet;
1304
+ data?: Record<string, unknown>;
1305
+ timestamp: Date;
1306
+ }
1307
+
1308
+ /**
1309
+ * Worksheet statistics
1310
+ */
1311
+ export declare interface IWorksheetStats {
1312
+ /** Total number of cells */
1313
+ totalCells: number;
1314
+ /** Number of header cells */
1315
+ headerCells: number;
1316
+ /** Number of data cells */
1317
+ dataCells: number;
1318
+ /** Number of footer cells */
1319
+ footerCells: number;
1320
+ /** Number of tables */
1321
+ tables: number;
1322
+ /** Used range */
1323
+ usedRange: ICellRange;
1324
+ /** Memory usage in bytes */
1325
+ memoryUsage: number;
1326
+ }
1327
+
1328
+ /**
1329
+ * Worksheet validation result
1330
+ */
1331
+ export declare interface IWorksheetValidationResult {
1332
+ /** Whether the worksheet is valid */
1333
+ isValid: boolean;
1334
+ /** Validation errors */
1335
+ errors: string[];
1336
+ /** Validation warnings */
1337
+ warnings: string[];
1338
+ /** Cell validation results */
1339
+ cellResults: Map<string, boolean>;
1340
+ }
1341
+
1342
+ /**
1343
+ * Number format options
1344
+ */
1345
+ export declare enum NumberFormat {
1346
+ GENERAL = "General",
1347
+ NUMBER = "#,##0",
1348
+ NUMBER_DECIMALS = "#,##0.00",
1349
+ CURRENCY = "$#,##0.00",
1350
+ CURRENCY_INTEGER = "$#,##0",
1351
+ PERCENTAGE = "0%",
1352
+ PERCENTAGE_DECIMALS = "0.00%",
1353
+ DATE = "dd/mm/yyyy",
1354
+ DATE_TIME = "dd/mm/yyyy hh:mm",
1355
+ TIME = "hh:mm:ss",
1356
+ CUSTOM = "custom"
1357
+ }
1358
+
1359
+ /**
1360
+ * Result union type
1361
+ */
1362
+ export declare type Result<T = unknown> = ISuccessResult<T> | IErrorResult;
1363
+
1364
+ /**
1365
+ * StyleBuilder class providing a fluent API for creating Excel styles
1366
+ */
1367
+ export declare class StyleBuilder implements IStyleBuilder {
1368
+ private style;
1369
+ /**
1370
+ * Create a new StyleBuilder instance
1371
+ */
1372
+ static create(): StyleBuilder;
1373
+ /**
1374
+ * Set font name
1375
+ */
1376
+ fontName(name: string): StyleBuilder;
1377
+ /**
1378
+ * Set font size
1379
+ */
1380
+ fontSize(size: number): StyleBuilder;
1381
+ /**
1382
+ * Set font style
1383
+ */
1384
+ fontStyle(style: FontStyle): StyleBuilder;
1385
+ /**
1386
+ * Set font color
1387
+ */
1388
+ fontColor(color: Color): StyleBuilder;
1389
+ /**
1390
+ * Make font bold
1391
+ */
1392
+ fontBold(): StyleBuilder;
1393
+ /**
1394
+ * Make font italic
1395
+ */
1396
+ fontItalic(): StyleBuilder;
1397
+ /**
1398
+ * Make font underlined
1399
+ */
1400
+ fontUnderline(): StyleBuilder;
1401
+ /**
1402
+ * Set border on all sides
1403
+ */
1404
+ border(style: BorderStyle, color?: Color): StyleBuilder;
1405
+ /**
1406
+ * Set top border
1407
+ */
1408
+ borderTop(style: BorderStyle, color?: Color): StyleBuilder;
1409
+ /**
1410
+ * Set left border
1411
+ */
1412
+ borderLeft(style: BorderStyle, color?: Color): StyleBuilder;
1413
+ /**
1414
+ * Set bottom border
1415
+ */
1416
+ borderBottom(style: BorderStyle, color?: Color): StyleBuilder;
1417
+ /**
1418
+ * Set right border
1419
+ */
1420
+ borderRight(style: BorderStyle, color?: Color): StyleBuilder;
1421
+ /**
1422
+ * Set background color
1423
+ */
1424
+ backgroundColor(color: Color): StyleBuilder;
1425
+ /**
1426
+ * Set horizontal alignment
1427
+ */
1428
+ horizontalAlign(alignment: HorizontalAlignment): StyleBuilder;
1429
+ /**
1430
+ * Set vertical alignment
1431
+ */
1432
+ verticalAlign(alignment: VerticalAlignment): StyleBuilder;
1433
+ /**
1434
+ * Center align text
1435
+ */
1436
+ centerAlign(): StyleBuilder;
1437
+ /**
1438
+ * Left align text
1439
+ */
1440
+ leftAlign(): StyleBuilder;
1441
+ /**
1442
+ * Right align text
1443
+ */
1444
+ rightAlign(): StyleBuilder;
1445
+ /**
1446
+ * Wrap text
1447
+ */
1448
+ wrapText(): StyleBuilder;
1449
+ /**
1450
+ * Set number format
1451
+ */
1452
+ numberFormat(format: string): StyleBuilder;
1453
+ /**
1454
+ * Set striped rows
1455
+ */
1456
+ striped(): StyleBuilder;
1457
+ /**
1458
+ * Add conditional formatting
1459
+ */
1460
+ conditionalFormat(format: IConditionalFormat): StyleBuilder;
1461
+ /**
1462
+ * Build the final style
1463
+ */
1464
+ build(): IStyle;
1465
+ /**
1466
+ * Reset the builder
1467
+ */
1468
+ reset(): StyleBuilder;
1469
+ /**
1470
+ * Clone the current style
1471
+ */
1472
+ clone(): StyleBuilder;
1473
+ }
1474
+
1475
+ /**
1476
+ * Style preset types
1477
+ */
1478
+ export declare enum StylePreset {
1479
+ HEADER = "header",
1480
+ SUBHEADER = "subheader",
1481
+ DATA = "data",
1482
+ FOOTER = "footer",
1483
+ TOTAL = "total",
1484
+ HIGHLIGHT = "highlight",
1485
+ WARNING = "warning",
1486
+ ERROR = "error",
1487
+ SUCCESS = "success",
1488
+ INFO = "info"
1489
+ }
1490
+
1491
+ /**
1492
+ * Vertical alignment options
1493
+ */
1494
+ export declare enum VerticalAlignment {
1495
+ TOP = "top",
1496
+ MIDDLE = "middle",
1497
+ BOTTOM = "bottom",
1498
+ DISTRIBUTED = "distributed",
1499
+ JUSTIFY = "justify"
1500
+ }
1501
+
1502
+ /**
1503
+ * Worksheet - Representa una hoja de cálculo dentro del builder
1504
+ *
1505
+ * Soporta headers, subheaders, rows, footers, children y estilos por celda.
1506
+ */
1507
+ export declare class Worksheet implements IWorksheet {
1508
+ config: IWorksheetConfig;
1509
+ tables: ITable[];
1510
+ currentRow: number;
1511
+ currentCol: number;
1512
+ headerPointers: Map<string, any>;
1513
+ isBuilt: boolean;
1514
+ private headers;
1515
+ private subHeaders;
1516
+ private body;
1517
+ private footers;
1518
+ constructor(config: IWorksheetConfig);
1519
+ /**
1520
+ * Agrega un header principal
1521
+ */
1522
+ addHeader(header: IHeaderCell): this;
1523
+ /**
1524
+ * Agrega subheaders
1525
+ */
1526
+ addSubHeaders(subHeaders: IHeaderCell[]): this;
1527
+ /**
1528
+ * Agrega una fila de datos (puede ser jerárquica con childrens)
1529
+ */
1530
+ addRow(row: IDataCell[] | IDataCell): this;
1531
+ /**
1532
+ * Agrega un footer o varios
1533
+ */
1534
+ addFooter(footer: IFooterCell[] | IFooterCell): this;
1535
+ /**
1536
+ * Construye la hoja en el workbook de ExcelJS
1537
+ */
1538
+ build(workbook: default_2.Workbook, _options?: IBuildOptions): Promise<void>;
1539
+ /**
1540
+ * Valida la hoja
1541
+ */
1542
+ validate(): Result<boolean>;
1543
+ /**
1544
+ * Agrega una fila de datos y sus children recursivamente
1545
+ * @returns el siguiente rowPointer disponible
1546
+ */
1547
+ private addDataRowRecursive;
1548
+ /**
1549
+ * Convierte el estilo personalizado a formato compatible con ExcelJS
1550
+ */
1551
+ private convertStyle;
1552
+ }
1553
+
1554
+ /**
1555
+ * Worksheet event types
1556
+ */
1557
+ export declare enum WorksheetEventType {
1558
+ CREATED = "created",
1559
+ UPDATED = "updated",
1560
+ DELETED = "deleted",
1561
+ TABLE_ADDED = "tableAdded",
1562
+ TABLE_REMOVED = "tableRemoved",
1563
+ CELL_ADDED = "cellAdded",
1564
+ CELL_UPDATED = "cellUpdated",
1565
+ CELL_DELETED = "cellDeleted"
1566
+ }
1567
+
1568
+ export { }