@nazarkalytiuk/rusc-xlsx 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/wrapper.d.ts ADDED
@@ -0,0 +1,2283 @@
1
+ // TypeScript definitions for wrapper.js
2
+ // These provide the fluent API with method chaining
3
+
4
+ /** Color value - can be a named color or hex code */
5
+ export type Color =
6
+ | 'black' | 'blue' | 'brown' | 'cyan' | 'gray' | 'green'
7
+ | 'lime' | 'magenta' | 'navy' | 'orange' | 'pink' | 'purple'
8
+ | 'red' | 'silver' | 'white' | 'yellow'
9
+ | `#${string}`; // Hex colors like #FF0000
10
+
11
+ /** Horizontal alignment options */
12
+ export type HorizontalAlign = 'left' | 'center' | 'right' | 'fill' | 'justify' | 'centerAcross' | 'distributed';
13
+
14
+ /** Vertical alignment options */
15
+ export type VerticalAlign = 'top' | 'center' | 'bottom' | 'justify' | 'distributed';
16
+
17
+ /** Border style options */
18
+ export type BorderStyle =
19
+ | 'thin' | 'medium' | 'thick' | 'double' | 'dotted' | 'dashed'
20
+ | 'dashDot' | 'dashDotDot' | 'slantDashDot'
21
+ | 'mediumDashed' | 'mediumDashDot' | 'mediumDashDotDot';
22
+
23
+ /** Underline style options */
24
+ export type UnderlineStyle = 'single' | 'double' | 'singleAccounting' | 'doubleAccounting';
25
+
26
+ /** Fill pattern options */
27
+ export type FillPattern =
28
+ | 'solid' | 'mediumGray' | 'darkGray' | 'lightGray'
29
+ | 'darkHorizontal' | 'darkVertical' | 'darkDown' | 'darkUp'
30
+ | 'darkGrid' | 'darkTrellis' | 'lightHorizontal' | 'lightVertical'
31
+ | 'lightDown' | 'lightUp' | 'lightGrid' | 'lightTrellis'
32
+ | 'gray125' | 'gray0625';
33
+
34
+ /** Data validation rule type */
35
+ export type ValidationRule = 'equal' | 'notEqual' | 'greaterThan' | 'lessThan' | 'greaterThanOrEqual' | 'lessThanOrEqual';
36
+
37
+ /** Data validation error style */
38
+ export type ValidationErrorStyle = 'stop' | 'warning' | 'information';
39
+
40
+ /**
41
+ * Format class for cell styling with fluent API
42
+ * All methods return `this` for method chaining
43
+ *
44
+ * @example
45
+ * const format = new Format()
46
+ * .setBold()
47
+ * .setFontColor('red')
48
+ * .setAlign('center');
49
+ */
50
+ export declare class Format {
51
+ /** Internal native binding */
52
+ _native: any;
53
+
54
+ /** Create a new format */
55
+ constructor();
56
+
57
+ // Font styling methods (return this for chaining)
58
+ /** Set bold text */
59
+ setBold(): this;
60
+ /** Set italic text */
61
+ setItalic(): this;
62
+ /** Set font size in points */
63
+ setFontSize(size: number): this;
64
+ /** Set font name (e.g., 'Arial', 'Calibri', 'Times New Roman') */
65
+ setFontName(fontName: string): this;
66
+ /** Set font color using named color or hex code */
67
+ setFontColor(color: Color): this;
68
+ /** Set text underline style */
69
+ setUnderline(underline: UnderlineStyle): this;
70
+ /** Set strikethrough text */
71
+ setStrikethrough(): this;
72
+
73
+ // Fill and background methods
74
+ /** Set background color using named color or hex code */
75
+ setBackgroundColor(color: Color): this;
76
+ /** Set foreground color (for patterns) using named color or hex code */
77
+ setForegroundColor(color: Color): this;
78
+ /** Set fill pattern */
79
+ setPattern(pattern: FillPattern): this;
80
+
81
+ // Alignment and text formatting methods
82
+ /** Set horizontal alignment */
83
+ setAlign(align: HorizontalAlign): this;
84
+ /** Set vertical alignment */
85
+ setVerticalAlign(align: VerticalAlign): this;
86
+ /** Enable text wrapping in the cell */
87
+ setTextWrap(): this;
88
+ /** Set text indentation level (0-15) */
89
+ setIndent(indent: number): this;
90
+ /** Set text rotation in degrees (-90 to 90, or 270 for vertical text) */
91
+ setRotation(rotation: number): this;
92
+ /** Shrink text to fit cell */
93
+ setShrink(): this;
94
+
95
+ // Border methods
96
+ /** Set border style for all borders */
97
+ setBorder(border: BorderStyle): this;
98
+ /** Set top border style */
99
+ setBorderTop(border: BorderStyle): this;
100
+ /** Set bottom border style */
101
+ setBorderBottom(border: BorderStyle): this;
102
+ /** Set left border style */
103
+ setBorderLeft(border: BorderStyle): this;
104
+ /** Set right border style */
105
+ setBorderRight(border: BorderStyle): this;
106
+ /** Set color for all borders */
107
+ setBorderColor(color: Color): this;
108
+ /** Set top border color */
109
+ setBorderTopColor(color: Color): this;
110
+ /** Set bottom border color */
111
+ setBorderBottomColor(color: Color): this;
112
+ /** Set left border color */
113
+ setBorderLeftColor(color: Color): this;
114
+ /** Set right border color */
115
+ setBorderRightColor(color: Color): this;
116
+
117
+ // Number format
118
+ /**
119
+ * Set number format using Excel format strings
120
+ * @example
121
+ * format.setNumFormat('#,##0.00'); // Thousands separator
122
+ * format.setNumFormat('$#,##0.00'); // Currency
123
+ * format.setNumFormat('0.00%'); // Percentage
124
+ * format.setNumFormat('yyyy-mm-dd'); // Date
125
+ */
126
+ setNumFormat(format: string): this;
127
+
128
+ // Cell protection
129
+ /** Unlock cell (for use with worksheet protection) */
130
+ setUnlocked(): this;
131
+ /** Lock cell (cell will be protected when worksheet is protected) */
132
+ setLocked(): this;
133
+ /** Hide formulas in cell (for use with worksheet protection) */
134
+ setHidden(): this;
135
+
136
+ /**
137
+ * Set font script (superscript or subscript)
138
+ * @param script - 'superscript' for X² or 'subscript' for H₂O
139
+ * @example
140
+ * format.setFontScript('superscript'); // X²
141
+ * format.setFontScript('subscript'); // H₂O
142
+ */
143
+ setFontScript(script: 'superscript' | 'subscript'): this;
144
+
145
+ /**
146
+ * Set diagonal border style
147
+ * @param border - Border style
148
+ * @example
149
+ * format.setBorderDiagonal('thin');
150
+ */
151
+ setBorderDiagonal(border: BorderStyle): this;
152
+
153
+ /**
154
+ * Set diagonal border color
155
+ * @param color - Color for diagonal border
156
+ */
157
+ setBorderDiagonalColor(color: Color): this;
158
+
159
+ /**
160
+ * Set diagonal border type
161
+ * @param type - 'up' for / border, 'down' for \ border, 'both' for X
162
+ * @example
163
+ * format.setBorderDiagonalType('up'); // /
164
+ * format.setBorderDiagonalType('down'); // \
165
+ * format.setBorderDiagonalType('both'); // X
166
+ */
167
+ setBorderDiagonalType(type: 'up' | 'down' | 'both'): this;
168
+
169
+ /**
170
+ * Set reading direction for RTL languages
171
+ * @param direction - 0=context, 1=left-to-right, 2=right-to-left
172
+ * @example
173
+ * format.setReadingDirection(2); // Right-to-left (Arabic, Hebrew)
174
+ */
175
+ setReadingDirection(direction: 0 | 1 | 2): this;
176
+
177
+ /**
178
+ * Force string interpretation with leading apostrophe
179
+ * Useful for numbers that should be treated as text
180
+ * @example
181
+ * format.setQuotePrefix(); // '00123 will display as 00123
182
+ */
183
+ setQuotePrefix(): this;
184
+ }
185
+
186
+ /**
187
+ * Note class for Excel cell notes (comments) with fluent API
188
+ * All methods return `this` for method chaining
189
+ *
190
+ * Notes are post-it style comments that appear when hovering over a cell.
191
+ * They show as a small red triangle in the cell corner.
192
+ *
193
+ * @example
194
+ * const note = new Note('Important: Review this data')
195
+ * .setAuthor('John Doe')
196
+ * .setWidth(200)
197
+ * .setBackgroundColor('#FFFFE1');
198
+ */
199
+ export declare class Note {
200
+ /** Internal native binding */
201
+ _native: any;
202
+
203
+ /**
204
+ * Create a new note with text
205
+ * @param text - The text content of the note
206
+ */
207
+ constructor(text: string);
208
+
209
+ /**
210
+ * Set the author name for the note (max 52 characters)
211
+ * @param name - Author name
212
+ */
213
+ setAuthor(name: string): this;
214
+
215
+ /**
216
+ * Set the width of the note in pixels
217
+ * @param width - Width in pixels
218
+ */
219
+ setWidth(width: number): this;
220
+
221
+ /**
222
+ * Set the height of the note in pixels
223
+ * @param height - Height in pixels
224
+ */
225
+ setHeight(height: number): this;
226
+
227
+ /**
228
+ * Set the background color of the note
229
+ * @param color - Color name or hex code
230
+ */
231
+ setBackgroundColor(color: Color): this;
232
+
233
+ /**
234
+ * Make the note visible by default (normally hidden until hover)
235
+ * @param visible - True to show by default, false to show on hover
236
+ */
237
+ setVisible(visible: boolean): this;
238
+
239
+ /**
240
+ * Set alt text for accessibility
241
+ * @param altText - Accessibility description
242
+ */
243
+ setAltText(altText: string): this;
244
+ }
245
+
246
+ /**
247
+ * Formula class for Excel formulas with fluent API
248
+ *
249
+ * @example
250
+ * const formula = new Formula('=SUM(A1:A10)');
251
+ * const formulaWithResult = new Formula('=2+2').setResult('4');
252
+ */
253
+ export declare class Formula {
254
+ /** Internal native binding */
255
+ _native: any;
256
+
257
+ /**
258
+ * Create a new formula
259
+ * @param formula - Excel formula string (e.g., '=SUM(A1:A10)')
260
+ */
261
+ constructor(formula: string);
262
+
263
+ /**
264
+ * Set the result value for applications that don't auto-calculate formulas
265
+ * @param result - The calculated result as a string
266
+ */
267
+ setResult(result: string): this;
268
+ }
269
+
270
+ /**
271
+ * DataValidation class for restricting cell input with fluent API
272
+ *
273
+ * Allows you to create dropdown lists, number ranges, date validation, etc.
274
+ *
275
+ * @example
276
+ * // Dropdown list
277
+ * const validation = new DataValidation()
278
+ * .allowListStrings(['Option 1', 'Option 2', 'Option 3'])
279
+ * .setInputTitle('Select an option')
280
+ * .setInputMessage('Choose from the dropdown');
281
+ *
282
+ * @example
283
+ * // Number range
284
+ * const validation = new DataValidation()
285
+ * .allowWholeNumberBetween(1, 100)
286
+ * .setErrorTitle('Invalid number')
287
+ * .setErrorMessage('Please enter a number between 1 and 100');
288
+ */
289
+ export declare class DataValidation {
290
+ /** Internal native binding */
291
+ _native: any;
292
+
293
+ /** Create a new data validation */
294
+ constructor();
295
+
296
+ /**
297
+ * Allow whole number validation with a rule
298
+ * @param rule - Validation rule type
299
+ * @param value - Comparison value
300
+ */
301
+ allowWholeNumber(rule: ValidationRule, value: number): this;
302
+
303
+ /**
304
+ * Allow whole number validation between min and max
305
+ * @param min - Minimum value (inclusive)
306
+ * @param max - Maximum value (inclusive)
307
+ */
308
+ allowWholeNumberBetween(min: number, max: number): this;
309
+
310
+ /**
311
+ * Allow decimal number validation with a rule
312
+ * @param rule - Validation rule type
313
+ * @param value - Comparison value
314
+ */
315
+ allowDecimalNumber(rule: ValidationRule, value: number): this;
316
+
317
+ /**
318
+ * Allow decimal number validation between min and max
319
+ * @param min - Minimum value (inclusive)
320
+ * @param max - Maximum value (inclusive)
321
+ */
322
+ allowDecimalNumberBetween(min: number, max: number): this;
323
+
324
+ /**
325
+ * Allow list validation with an array of strings (creates dropdown)
326
+ * @param list - Array of allowed values (max 255 chars total)
327
+ */
328
+ allowListStrings(list: string[]): this;
329
+
330
+ /**
331
+ * Allow list validation from a cell range formula
332
+ * @param formula - Cell range formula (e.g., '=$A$1:$A$10')
333
+ */
334
+ allowListFormula(formula: string): this;
335
+
336
+ /**
337
+ * Allow custom formula validation
338
+ * @param formula - Excel formula that returns true/false
339
+ */
340
+ allowCustom(formula: string): this;
341
+
342
+ /**
343
+ * Allow any value (mainly used for displaying input messages)
344
+ */
345
+ allowAnyValue(): this;
346
+
347
+ /**
348
+ * Set whether to ignore blank cells
349
+ * @param enable - True to allow blank cells (default: true)
350
+ */
351
+ ignoreBlank(enable: boolean): this;
352
+
353
+ /**
354
+ * Set whether to show dropdown arrow for list validations
355
+ * @param enable - True to show dropdown (default: true)
356
+ */
357
+ showDropdown(enable: boolean): this;
358
+
359
+ /**
360
+ * Set whether to show input message when cell is selected
361
+ * @param enable - True to show message (default: true)
362
+ */
363
+ showInputMessage(enable: boolean): this;
364
+
365
+ /**
366
+ * Set whether to show error message on invalid input
367
+ * @param enable - True to show message (default: true)
368
+ */
369
+ showErrorMessage(enable: boolean): this;
370
+
371
+ /**
372
+ * Set the input message title (shown when cell is selected)
373
+ * @param title - Title text (max 32 characters)
374
+ */
375
+ setInputTitle(title: string): this;
376
+
377
+ /**
378
+ * Set the input message text (shown when cell is selected)
379
+ * @param message - Message text (max 255 characters)
380
+ */
381
+ setInputMessage(message: string): this;
382
+
383
+ /**
384
+ * Set the error message title (shown on invalid input)
385
+ * @param title - Title text (max 32 characters)
386
+ */
387
+ setErrorTitle(title: string): this;
388
+
389
+ /**
390
+ * Set the error message text (shown on invalid input)
391
+ * @param message - Message text (max 255 characters)
392
+ */
393
+ setErrorMessage(message: string): this;
394
+
395
+ /**
396
+ * Set the error dialog style
397
+ * @param style - Error style: 'stop' (red X), 'warning' (yellow !), or 'information' (blue i)
398
+ */
399
+ setErrorStyle(style: ValidationErrorStyle): this;
400
+ }
401
+
402
+ /**
403
+ * Protection Options for worksheet protection
404
+ * Configure granular permissions for protected worksheets
405
+ *
406
+ * @example
407
+ * const options = new ProtectionOptions()
408
+ * .setInsertRows(true)
409
+ * .setInsertColumns(true)
410
+ * .setFormatCells(false);
411
+ * worksheet.protectWithOptions(options);
412
+ */
413
+ export declare class ProtectionOptions {
414
+ /** Internal native binding */
415
+ _native: any;
416
+
417
+ /** Create a new ProtectionOptions with default settings */
418
+ constructor();
419
+
420
+ /**
421
+ * Allow or prevent selecting locked cells (default: true)
422
+ * @param allow - true to allow, false to prevent
423
+ */
424
+ setSelectLockedCells(allow: boolean): this;
425
+
426
+ /**
427
+ * Allow or prevent selecting unlocked cells (default: true)
428
+ * @param allow - true to allow, false to prevent
429
+ */
430
+ setSelectUnlockedCells(allow: boolean): this;
431
+
432
+ /**
433
+ * Allow or prevent formatting cells (default: false)
434
+ * @param allow - true to allow, false to prevent
435
+ */
436
+ setFormatCells(allow: boolean): this;
437
+
438
+ /**
439
+ * Allow or prevent formatting columns (default: false)
440
+ * @param allow - true to allow, false to prevent
441
+ */
442
+ setFormatColumns(allow: boolean): this;
443
+
444
+ /**
445
+ * Allow or prevent formatting rows (default: false)
446
+ * @param allow - true to allow, false to prevent
447
+ */
448
+ setFormatRows(allow: boolean): this;
449
+
450
+ /**
451
+ * Allow or prevent inserting columns (default: false)
452
+ * @param allow - true to allow, false to prevent
453
+ */
454
+ setInsertColumns(allow: boolean): this;
455
+
456
+ /**
457
+ * Allow or prevent inserting rows (default: false)
458
+ * @param allow - true to allow, false to prevent
459
+ */
460
+ setInsertRows(allow: boolean): this;
461
+
462
+ /**
463
+ * Allow or prevent inserting hyperlinks (default: false)
464
+ * @param allow - true to allow, false to prevent
465
+ */
466
+ setInsertLinks(allow: boolean): this;
467
+
468
+ /**
469
+ * Allow or prevent deleting columns (default: false)
470
+ * @param allow - true to allow, false to prevent
471
+ */
472
+ setDeleteColumns(allow: boolean): this;
473
+
474
+ /**
475
+ * Allow or prevent deleting rows (default: false)
476
+ * @param allow - true to allow, false to prevent
477
+ */
478
+ setDeleteRows(allow: boolean): this;
479
+
480
+ /**
481
+ * Allow or prevent sorting data (default: false)
482
+ * @param allow - true to allow, false to prevent
483
+ */
484
+ setSort(allow: boolean): this;
485
+
486
+ /**
487
+ * Allow or prevent using autofilters (default: false)
488
+ * @param allow - true to allow, false to prevent
489
+ */
490
+ setUseAutofilter(allow: boolean): this;
491
+
492
+ /**
493
+ * Allow or prevent using pivot tables (default: false)
494
+ * @param allow - true to allow, false to prevent
495
+ */
496
+ setUsePivotTables(allow: boolean): this;
497
+
498
+ /**
499
+ * Allow or prevent editing scenarios (default: false)
500
+ * @param allow - true to allow, false to prevent
501
+ */
502
+ setEditScenarios(allow: boolean): this;
503
+
504
+ /**
505
+ * Allow or prevent editing objects like images (default: false)
506
+ * @param allow - true to allow, false to prevent
507
+ */
508
+ setEditObjects(allow: boolean): this;
509
+
510
+ /**
511
+ * Allow or prevent editing contents in chartsheets (default: true)
512
+ * @param allow - true to allow, false to prevent
513
+ */
514
+ setContents(allow: boolean): this;
515
+ }
516
+
517
+ /**
518
+ * Image for inserting images into worksheets
519
+ * Supports PNG, JPG, GIF, and BMP formats
520
+ *
521
+ * @example
522
+ * const image = new Image('logo.png');
523
+ * image.setWidth(200).setHeight(100);
524
+ * worksheet.insertImage(0, 0, image);
525
+ */
526
+ export declare class Image {
527
+ /** Internal native binding */
528
+ _native: any;
529
+
530
+ /**
531
+ * Create a new Image from a file path
532
+ * @param path - Path to the image file (PNG, JPG, GIF, or BMP)
533
+ * @throws Error if file cannot be read or format is unsupported
534
+ */
535
+ constructor(path: string);
536
+
537
+ /**
538
+ * Create an Image from a buffer
539
+ * @param buffer - Buffer containing image data
540
+ * @returns Image instance
541
+ * @example
542
+ * const buffer = fs.readFileSync('logo.png');
543
+ * const image = Image.fromBuffer(buffer);
544
+ */
545
+ static fromBuffer(buffer: Buffer): Image;
546
+
547
+ /**
548
+ * Set the width of the image in pixels
549
+ * @param width - Width in pixels
550
+ * @returns this for method chaining
551
+ */
552
+ setWidth(width: number): this;
553
+
554
+ /**
555
+ * Set the height of the image in pixels
556
+ * @param height - Height in pixels
557
+ * @returns this for method chaining
558
+ */
559
+ setHeight(height: number): this;
560
+
561
+ /**
562
+ * Scale the width of the image as a percentage
563
+ * @param scale - Scale percentage (e.g., 1.5 for 150%)
564
+ * @returns this for method chaining
565
+ */
566
+ setScaleWidth(scale: number): this;
567
+
568
+ /**
569
+ * Scale the height of the image as a percentage
570
+ * @param scale - Scale percentage (e.g., 0.5 for 50%)
571
+ * @returns this for method chaining
572
+ */
573
+ setScaleHeight(scale: number): this;
574
+
575
+ /**
576
+ * Scale the image to a specific size
577
+ * @param width - Target width
578
+ * @param height - Target height
579
+ * @param keepAspectRatio - Whether to maintain aspect ratio (default: true)
580
+ * @returns this for method chaining
581
+ * @example
582
+ * image.setScaleToSize(300, 200, true);
583
+ */
584
+ setScaleToSize(width: number, height: number, keepAspectRatio?: boolean): this;
585
+
586
+ /**
587
+ * Set alt text for the image (for accessibility)
588
+ * @param altText - Descriptive text for the image
589
+ * @returns this for method chaining
590
+ */
591
+ setAltText(altText: string): this;
592
+
593
+ /**
594
+ * Mark the image as decorative (no alt text required)
595
+ * @param enable - true to mark as decorative
596
+ * @returns this for method chaining
597
+ */
598
+ setDecorative(enable: boolean): this;
599
+
600
+ /**
601
+ * Set how the image moves and sizes with cells
602
+ * @param option - 'moveAndSize' | 'moveOnly' | 'none' | 'moveAndSizeAfter'
603
+ * @returns this for method chaining
604
+ * @example
605
+ * image.setObjectMovement('moveOnly'); // Image moves but doesn't resize with cells
606
+ */
607
+ setObjectMovement(option: 'moveAndSize' | 'moveOnly' | 'none' | 'moveAndSizeAfter'): this;
608
+
609
+ /**
610
+ * Add a URL link to the image
611
+ * @param url - URL to link to
612
+ * @returns this for method chaining
613
+ * @example
614
+ * image.setUrl('https://example.com');
615
+ */
616
+ setUrl(url: string): this;
617
+ }
618
+
619
+ /**
620
+ * Rich Text for multi-format text in a single cell
621
+ *
622
+ * @example
623
+ * const richText = new RichText()
624
+ * .addSegment('This is ', defaultFormat)
625
+ * .addSegment('bold', boldFormat)
626
+ * .addSegment(' and this is ', defaultFormat)
627
+ * .addSegment('italic', italicFormat);
628
+ * worksheet.writeRichString(0, 0, richText);
629
+ */
630
+ export declare class RichText {
631
+ /** Internal native binding */
632
+ _native: any;
633
+
634
+ /** Create a new empty rich text string */
635
+ constructor();
636
+
637
+ /**
638
+ * Add a text segment with formatting
639
+ * @param text - The text content
640
+ * @param format - Optional format to apply to this segment
641
+ * @returns this for method chaining
642
+ * @example
643
+ * richText.addSegment('Hello ', normalFormat)
644
+ * .addSegment('World', boldFormat);
645
+ */
646
+ addSegment(text: string, format?: Format): this;
647
+ }
648
+
649
+ /**
650
+ * Worksheet class for Excel sheet manipulation
651
+ *
652
+ * @example
653
+ * const worksheet = workbook.addWorksheet('Data');
654
+ * worksheet.write(0, 0, 'Name');
655
+ * worksheet.write(0, 1, 'Age');
656
+ * worksheet.setColumnWidth(0, 20);
657
+ */
658
+ export declare class Worksheet {
659
+ /** Internal native binding */
660
+ _native: any;
661
+
662
+ /** @internal */
663
+ constructor(nativeWorksheet: any);
664
+
665
+ /**
666
+ * Write a value to a cell (auto-detects type)
667
+ * @param row - Row number (0-indexed)
668
+ * @param col - Column number (0-indexed)
669
+ * @param value - Value to write (string, number, or boolean)
670
+ * @param format - Optional format to apply
671
+ */
672
+ write(row: number, col: number, value: string | number | boolean, format?: Format): void;
673
+
674
+ /**
675
+ * Write a string to a cell
676
+ * @param row - Row number (0-indexed)
677
+ * @param col - Column number (0-indexed)
678
+ * @param value - String value to write
679
+ */
680
+ writeString(row: number, col: number, value: string): void;
681
+
682
+ /**
683
+ * Write a number to a cell
684
+ * @param row - Row number (0-indexed)
685
+ * @param col - Column number (0-indexed)
686
+ * @param value - Number value to write
687
+ */
688
+ writeNumber(row: number, col: number, value: number): void;
689
+
690
+ /**
691
+ * Write a boolean to a cell
692
+ * @param row - Row number (0-indexed)
693
+ * @param col - Column number (0-indexed)
694
+ * @param value - Boolean value to write
695
+ */
696
+ writeBoolean(row: number, col: number, value: boolean): void;
697
+
698
+ /**
699
+ * Write a blank cell with formatting
700
+ * Useful for creating styled empty cells or clearing cells while keeping formatting
701
+ * @param row - Row number (0-indexed)
702
+ * @param col - Column number (0-indexed)
703
+ * @param format - Format to apply to the blank cell
704
+ * @example
705
+ * const grayFormat = new Format().setBackgroundColor('gray');
706
+ * worksheet.writeBlank(0, 0, grayFormat); // Gray empty cell
707
+ */
708
+ writeBlank(row: number, col: number, format: Format): void;
709
+
710
+ /**
711
+ * Write a datetime from a Unix timestamp (seconds since 1970-01-01 UTC)
712
+ * @param row - Row number (0-indexed)
713
+ * @param col - Column number (0-indexed)
714
+ * @param timestamp - Unix timestamp in seconds
715
+ * @param format - Optional format (should include date/time number format)
716
+ * @example
717
+ * const dateFormat = new Format().setNumFormat('yyyy-mm-dd hh:mm');
718
+ * worksheet.writeDatetimeFromTimestamp(0, 0, 1706184600, dateFormat);
719
+ */
720
+ writeDatetimeFromTimestamp(row: number, col: number, timestamp: number, format?: Format): void;
721
+
722
+ /**
723
+ * Write a datetime from year, month, day components
724
+ * @param row - Row number (0-indexed)
725
+ * @param col - Column number (0-indexed)
726
+ * @param year - Year (1900-9999)
727
+ * @param month - Month (1-12)
728
+ * @param day - Day (1-31)
729
+ * @param format - Optional format (should include date number format)
730
+ * @example
731
+ * const dateFormat = new Format().setNumFormat('yyyy-mm-dd');
732
+ * worksheet.writeDatetimeFromYmd(0, 0, 2023, 1, 25, dateFormat);
733
+ */
734
+ writeDatetimeFromYmd(row: number, col: number, year: number, month: number, day: number, format?: Format): void;
735
+
736
+ /**
737
+ * Write a datetime from year, month, day, hour, minute, second components
738
+ * @param row - Row number (0-indexed)
739
+ * @param col - Column number (0-indexed)
740
+ * @param year - Year (1900-9999)
741
+ * @param month - Month (1-12)
742
+ * @param day - Day (1-31)
743
+ * @param hour - Hour (0-23)
744
+ * @param min - Minute (0-59)
745
+ * @param sec - Second (0-59.999...)
746
+ * @param format - Optional format (should include date/time number format)
747
+ * @example
748
+ * const datetimeFormat = new Format().setNumFormat('yyyy-mm-dd hh:mm:ss');
749
+ * worksheet.writeDatetimeFromYmdHms(0, 0, 2023, 1, 25, 12, 30, 45.5, datetimeFormat);
750
+ */
751
+ writeDatetimeFromYmdHms(row: number, col: number, year: number, month: number, day: number, hour: number, min: number, sec: number, format?: Format): void;
752
+
753
+ /**
754
+ * Write a datetime from an ISO 8601 string
755
+ * @param row - Row number (0-indexed)
756
+ * @param col - Column number (0-indexed)
757
+ * @param datetimeStr - ISO 8601 date/time string (e.g., "2023-01-25T12:30:00" or "2023-01-25")
758
+ * @param format - Optional format (should include date/time number format)
759
+ * @example
760
+ * const datetimeFormat = new Format().setNumFormat('yyyy-mm-dd hh:mm');
761
+ * worksheet.writeDatetimeFromString(0, 0, '2023-01-25T12:30:00', datetimeFormat);
762
+ */
763
+ writeDatetimeFromString(row: number, col: number, datetimeStr: string, format?: Format): void;
764
+
765
+ /**
766
+ * Write a datetime (convenience method that auto-detects input type)
767
+ * Accepts: Date object, Unix timestamp (number), ISO string, or object with date components
768
+ * @param row - Row number (0-indexed)
769
+ * @param col - Column number (0-indexed)
770
+ * @param datetime - Date/time value in various formats
771
+ * @param format - Optional format (should include date/time number format)
772
+ * @example
773
+ * // Using JavaScript Date
774
+ * const dateFormat = new Format().setNumFormat('yyyy-mm-dd hh:mm');
775
+ * worksheet.writeDatetime(0, 0, new Date(), dateFormat);
776
+ *
777
+ * @example
778
+ * // Using timestamp
779
+ * worksheet.writeDatetime(1, 0, 1706184600, dateFormat);
780
+ *
781
+ * @example
782
+ * // Using ISO string
783
+ * worksheet.writeDatetime(2, 0, '2023-01-25T12:30:00', dateFormat);
784
+ *
785
+ * @example
786
+ * // Using object
787
+ * worksheet.writeDatetime(3, 0, { year: 2023, month: 1, day: 25, hour: 12, min: 30 }, dateFormat);
788
+ */
789
+ writeDatetime(row: number, col: number, datetime: Date | number | string | { year: number, month: number, day: number, hour?: number, min?: number, sec?: number }, format?: Format): void;
790
+
791
+ /**
792
+ * Write a value with formatting to a cell
793
+ * @param row - Row number (0-indexed)
794
+ * @param col - Column number (0-indexed)
795
+ * @param value - Value to write (string, number, or boolean)
796
+ * @param format - Format to apply
797
+ */
798
+ writeWithFormat(row: number, col: number, value: string | number | boolean, format: Format): void;
799
+
800
+ /**
801
+ * Set the width of a column
802
+ * @param col - Column number (0-indexed)
803
+ * @param width - Width in Excel units (approximately character width)
804
+ */
805
+ setColumnWidth(col: number, width: number): void;
806
+
807
+ /**
808
+ * Set the height of a row
809
+ * @param row - Row number (0-indexed)
810
+ * @param height - Height in points
811
+ */
812
+ setRowHeight(row: number, height: number): void;
813
+
814
+ /**
815
+ * Set the worksheet name
816
+ * @param name - Worksheet name
817
+ */
818
+ setName(name: string): void;
819
+
820
+ /**
821
+ * Merge a range of cells and write a value to it
822
+ * @param firstRow - First row of range (0-indexed)
823
+ * @param firstCol - First column of range (0-indexed)
824
+ * @param lastRow - Last row of range (0-indexed)
825
+ * @param lastCol - Last column of range (0-indexed)
826
+ * @param value - Value to write to merged cell
827
+ * @param format - Optional format to apply
828
+ */
829
+ mergeRange(
830
+ firstRow: number,
831
+ firstCol: number,
832
+ lastRow: number,
833
+ lastCol: number,
834
+ value: string,
835
+ format?: Format
836
+ ): void;
837
+
838
+ /**
839
+ * Merge a range of cells with formatting
840
+ * @param firstRow - First row of range (0-indexed)
841
+ * @param firstCol - First column of range (0-indexed)
842
+ * @param lastRow - Last row of range (0-indexed)
843
+ * @param lastCol - Last column of range (0-indexed)
844
+ * @param value - Value to write to merged cell
845
+ * @param format - Format to apply
846
+ */
847
+ mergeRangeWithFormat(
848
+ firstRow: number,
849
+ firstCol: number,
850
+ lastRow: number,
851
+ lastCol: number,
852
+ value: string,
853
+ format: Format
854
+ ): void;
855
+
856
+ /**
857
+ * Insert a note (post-it style comment) to a cell
858
+ * @param row - Row number (0-indexed)
859
+ * @param col - Column number (0-indexed)
860
+ * @param note - Note object to insert
861
+ */
862
+ insertNote(row: number, col: number, note: Note): void;
863
+
864
+ /**
865
+ * Set the default author name for all notes in the worksheet
866
+ * @param name - Author name (max 52 characters)
867
+ */
868
+ setDefaultNoteAuthor(name: string): void;
869
+
870
+ /**
871
+ * Write a formula to a cell
872
+ * @param row - Row number (0-indexed)
873
+ * @param col - Column number (0-indexed)
874
+ * @param formula - Formula object
875
+ * @param format - Optional format to apply
876
+ */
877
+ writeFormula(row: number, col: number, formula: Formula, format?: Format): void;
878
+
879
+ /**
880
+ * Write a dynamic array formula to a cell (Excel 365+)
881
+ * Dynamic arrays automatically spill into adjacent cells
882
+ * @param row - Row number (0-indexed)
883
+ * @param col - Column number (0-indexed)
884
+ * @param formula - Formula object with dynamic array function (FILTER, SORT, UNIQUE, etc.)
885
+ * @param format - Optional format to apply
886
+ */
887
+ writeDynamicFormula(row: number, col: number, formula: Formula, format?: Format): void;
888
+
889
+ /**
890
+ * Write an array formula to a range of cells
891
+ * @param firstRow - First row of range (0-indexed)
892
+ * @param firstCol - First column of range (0-indexed)
893
+ * @param lastRow - Last row of range (0-indexed)
894
+ * @param lastCol - Last column of range (0-indexed)
895
+ * @param formula - Formula object
896
+ * @param format - Optional format to apply
897
+ */
898
+ writeArrayFormula(
899
+ firstRow: number,
900
+ firstCol: number,
901
+ lastRow: number,
902
+ lastCol: number,
903
+ formula: Formula,
904
+ format?: Format
905
+ ): void;
906
+
907
+ /**
908
+ * Add data validation to a cell or range
909
+ * @param firstRow - First row of range (0-indexed)
910
+ * @param firstCol - First column of range (0-indexed)
911
+ * @param lastRow - Last row of range (0-indexed)
912
+ * @param lastCol - Last column of range (0-indexed)
913
+ * @param validation - DataValidation object with rules
914
+ */
915
+ addDataValidation(
916
+ firstRow: number,
917
+ firstCol: number,
918
+ lastRow: number,
919
+ lastCol: number,
920
+ validation: DataValidation
921
+ ): void;
922
+
923
+ /**
924
+ * Write a URL/hyperlink to a cell
925
+ * @param row - Row number (0-indexed)
926
+ * @param col - Column number (0-indexed)
927
+ * @param url - URL string (http://, https://, file://, or internal:Sheet1!A1)
928
+ * @param format - Optional format to apply
929
+ */
930
+ writeUrl(row: number, col: number, url: string, format?: Format): void;
931
+
932
+ /**
933
+ * Write a URL/hyperlink to a cell with custom display text
934
+ * @param row - Row number (0-indexed)
935
+ * @param col - Column number (0-indexed)
936
+ * @param url - URL string
937
+ * @param text - Display text for the link
938
+ * @param format - Optional format to apply
939
+ */
940
+ writeUrlWithText(row: number, col: number, url: string, text: string, format?: Format): void;
941
+
942
+ /**
943
+ * Add autofilter dropdown buttons to a range
944
+ * @param firstRow - First row of range (0-indexed, typically header row)
945
+ * @param firstCol - First column of range (0-indexed)
946
+ * @param lastRow - Last row of range (0-indexed)
947
+ * @param lastCol - Last column of range (0-indexed)
948
+ */
949
+ autofilter(firstRow: number, firstCol: number, lastRow: number, lastCol: number): void;
950
+
951
+ /**
952
+ * Freeze panes at the specified row and column
953
+ * @param row - Row to freeze above (0 = no horizontal freeze)
954
+ * @param col - Column to freeze left of (0 = no vertical freeze)
955
+ * @example
956
+ * worksheet.setFreezePanes(1, 0); // Freeze top row
957
+ * worksheet.setFreezePanes(0, 1); // Freeze first column
958
+ * worksheet.setFreezePanes(1, 1); // Freeze both top row and first column
959
+ */
960
+ setFreezePanes(row: number, col: number): void;
961
+
962
+ /**
963
+ * Add 2-color scale conditional formatting (gradient between two colors)
964
+ * @param firstRow - First row of range (0-indexed)
965
+ * @param firstCol - First column of range (0-indexed)
966
+ * @param lastRow - Last row of range (0-indexed)
967
+ * @param lastCol - Last column of range (0-indexed)
968
+ * @param minColor - Color for minimum value
969
+ * @param maxColor - Color for maximum value
970
+ */
971
+ addConditionalFormat2ColorScale(
972
+ firstRow: number,
973
+ firstCol: number,
974
+ lastRow: number,
975
+ lastCol: number,
976
+ minColor: Color,
977
+ maxColor: Color
978
+ ): void;
979
+
980
+ /**
981
+ * Add 3-color scale conditional formatting (gradient across three colors)
982
+ * @param firstRow - First row of range (0-indexed)
983
+ * @param firstCol - First column of range (0-indexed)
984
+ * @param lastRow - Last row of range (0-indexed)
985
+ * @param lastCol - Last column of range (0-indexed)
986
+ * @param minColor - Color for minimum value
987
+ * @param midColor - Color for middle value
988
+ * @param maxColor - Color for maximum value
989
+ */
990
+ addConditionalFormat3ColorScale(
991
+ firstRow: number,
992
+ firstCol: number,
993
+ lastRow: number,
994
+ lastCol: number,
995
+ minColor: Color,
996
+ midColor: Color,
997
+ maxColor: Color
998
+ ): void;
999
+
1000
+ /**
1001
+ * Add data bar conditional formatting (horizontal bar visualization in cells)
1002
+ * @param firstRow - First row of range (0-indexed)
1003
+ * @param firstCol - First column of range (0-indexed)
1004
+ * @param lastRow - Last row of range (0-indexed)
1005
+ * @param lastCol - Last column of range (0-indexed)
1006
+ * @param barColor - Color for the data bars
1007
+ */
1008
+ addConditionalFormatDataBar(
1009
+ firstRow: number,
1010
+ firstCol: number,
1011
+ lastRow: number,
1012
+ lastCol: number,
1013
+ barColor: Color
1014
+ ): void;
1015
+
1016
+ /**
1017
+ * Add cell-based conditional formatting (highlight cells based on value)
1018
+ * @param firstRow - First row of range (0-indexed)
1019
+ * @param firstCol - First column of range (0-indexed)
1020
+ * @param lastRow - Last row of range (0-indexed)
1021
+ * @param lastCol - Last column of range (0-indexed)
1022
+ * @param rule - Comparison rule ('greaterThan', 'lessThan', 'equal', 'notEqual', 'greaterThanOrEqual', 'lessThanOrEqual')
1023
+ * @param value - Comparison value
1024
+ * @param format - Format to apply to matching cells
1025
+ */
1026
+ addConditionalFormatCell(
1027
+ firstRow: number,
1028
+ firstCol: number,
1029
+ lastRow: number,
1030
+ lastCol: number,
1031
+ rule: 'greaterThan' | 'lessThan' | 'equal' | 'notEqual' | 'greaterThanOrEqual' | 'lessThanOrEqual',
1032
+ value: number,
1033
+ format: Format
1034
+ ): void;
1035
+
1036
+ /**
1037
+ * Add text-based conditional formatting (highlight cells based on text content)
1038
+ * @param firstRow - First row of range (0-indexed)
1039
+ * @param firstCol - First column of range (0-indexed)
1040
+ * @param lastRow - Last row of range (0-indexed)
1041
+ * @param lastCol - Last column of range (0-indexed)
1042
+ * @param rule - Text matching rule ('contains', 'notContains', 'beginsWith', 'endsWith')
1043
+ * @param text - Text to match
1044
+ * @param format - Format to apply to matching cells
1045
+ */
1046
+ addConditionalFormatText(
1047
+ firstRow: number,
1048
+ firstCol: number,
1049
+ lastRow: number,
1050
+ lastCol: number,
1051
+ rule: 'contains' | 'notContains' | 'beginsWith' | 'endsWith',
1052
+ text: string,
1053
+ format: Format
1054
+ ): void;
1055
+
1056
+ /**
1057
+ * Add average/standard deviation conditional formatting
1058
+ * @param firstRow - First row of range (0-indexed)
1059
+ * @param firstCol - First column of range (0-indexed)
1060
+ * @param lastRow - Last row of range (0-indexed)
1061
+ * @param lastCol - Last column of range (0-indexed)
1062
+ * @param rule - Average rule ('aboveAverage', 'belowAverage', 'equalOrAboveAverage', 'equalOrBelowAverage')
1063
+ * @param format - Format to apply to matching cells
1064
+ */
1065
+ addConditionalFormatAverage(
1066
+ firstRow: number,
1067
+ firstCol: number,
1068
+ lastRow: number,
1069
+ lastCol: number,
1070
+ rule: 'aboveAverage' | 'belowAverage' | 'equalOrAboveAverage' | 'equalOrBelowAverage',
1071
+ format: Format
1072
+ ): void;
1073
+
1074
+ /**
1075
+ * Add top/bottom N values conditional formatting
1076
+ * @param firstRow - First row of range (0-indexed)
1077
+ * @param firstCol - First column of range (0-indexed)
1078
+ * @param lastRow - Last row of range (0-indexed)
1079
+ * @param lastCol - Last column of range (0-indexed)
1080
+ * @param rule - Top/bottom rule ('top', 'bottom', 'topPercent', 'bottomPercent')
1081
+ * @param value - Number of items or percentage
1082
+ * @param format - Format to apply to matching cells
1083
+ */
1084
+ addConditionalFormatTop(
1085
+ firstRow: number,
1086
+ firstCol: number,
1087
+ lastRow: number,
1088
+ lastCol: number,
1089
+ rule: 'top' | 'bottom' | 'topPercent' | 'bottomPercent',
1090
+ value: number,
1091
+ format: Format
1092
+ ): void;
1093
+
1094
+ /**
1095
+ * Add duplicate/unique values conditional formatting
1096
+ * @param firstRow - First row of range (0-indexed)
1097
+ * @param firstCol - First column of range (0-indexed)
1098
+ * @param lastRow - Last row of range (0-indexed)
1099
+ * @param lastCol - Last column of range (0-indexed)
1100
+ * @param invert - If true, highlight unique values instead of duplicates
1101
+ * @param format - Format to apply to matching cells
1102
+ */
1103
+ addConditionalFormatDuplicate(
1104
+ firstRow: number,
1105
+ firstCol: number,
1106
+ lastRow: number,
1107
+ lastCol: number,
1108
+ invert: boolean,
1109
+ format: Format
1110
+ ): void;
1111
+
1112
+ /**
1113
+ * Add blank/non-blank cells conditional formatting
1114
+ * @param firstRow - First row of range (0-indexed)
1115
+ * @param firstCol - First column of range (0-indexed)
1116
+ * @param lastRow - Last row of range (0-indexed)
1117
+ * @param lastCol - Last column of range (0-indexed)
1118
+ * @param invert - If true, highlight non-blank cells instead of blank
1119
+ * @param format - Format to apply to matching cells
1120
+ */
1121
+ addConditionalFormatBlank(
1122
+ firstRow: number,
1123
+ firstCol: number,
1124
+ lastRow: number,
1125
+ lastCol: number,
1126
+ invert: boolean,
1127
+ format: Format
1128
+ ): void;
1129
+
1130
+ /**
1131
+ * Add error/non-error cells conditional formatting
1132
+ * @param firstRow - First row of range (0-indexed)
1133
+ * @param firstCol - First column of range (0-indexed)
1134
+ * @param lastRow - Last row of range (0-indexed)
1135
+ * @param lastCol - Last column of range (0-indexed)
1136
+ * @param invert - If true, highlight non-error cells instead of errors
1137
+ * @param format - Format to apply to matching cells
1138
+ */
1139
+ addConditionalFormatError(
1140
+ firstRow: number,
1141
+ firstCol: number,
1142
+ lastRow: number,
1143
+ lastCol: number,
1144
+ invert: boolean,
1145
+ format: Format
1146
+ ): void;
1147
+
1148
+ /**
1149
+ * Add date-based conditional formatting
1150
+ * @param firstRow - First row of range (0-indexed)
1151
+ * @param firstCol - First column of range (0-indexed)
1152
+ * @param lastRow - Last row of range (0-indexed)
1153
+ * @param lastCol - Last column of range (0-indexed)
1154
+ * @param rule - Date rule ('yesterday', 'today', 'tomorrow', 'last7Days', 'lastWeek', 'thisWeek', 'nextWeek', 'lastMonth', 'thisMonth', 'nextMonth')
1155
+ * @param format - Format to apply to matching cells
1156
+ */
1157
+ addConditionalFormatDate(
1158
+ firstRow: number,
1159
+ firstCol: number,
1160
+ lastRow: number,
1161
+ lastCol: number,
1162
+ rule: 'yesterday' | 'today' | 'tomorrow' | 'last7Days' | 'lastWeek' | 'thisWeek' | 'nextWeek' | 'lastMonth' | 'thisMonth' | 'nextMonth',
1163
+ format: Format
1164
+ ): void;
1165
+
1166
+ /**
1167
+ * Add formula-based conditional formatting
1168
+ * @param firstRow - First row of range (0-indexed)
1169
+ * @param firstCol - First column of range (0-indexed)
1170
+ * @param lastRow - Last row of range (0-indexed)
1171
+ * @param lastCol - Last column of range (0-indexed)
1172
+ * @param formula - Excel formula (e.g., '=MOD(ROW(),2)=0' for even rows)
1173
+ * @param format - Format to apply when formula returns true
1174
+ */
1175
+ addConditionalFormatFormula(
1176
+ firstRow: number,
1177
+ firstCol: number,
1178
+ lastRow: number,
1179
+ lastCol: number,
1180
+ formula: string,
1181
+ format: Format
1182
+ ): void;
1183
+
1184
+ /**
1185
+ * Add icon set conditional formatting
1186
+ * @param firstRow - First row of range (0-indexed)
1187
+ * @param firstCol - First column of range (0-indexed)
1188
+ * @param lastRow - Last row of range (0-indexed)
1189
+ * @param lastCol - Last column of range (0-indexed)
1190
+ * @param iconType - Icon set type (e.g., 'threeArrows', 'threeTrafficLights', 'fiveStars', etc.)
1191
+ */
1192
+ addConditionalFormatIconSet(
1193
+ firstRow: number,
1194
+ firstCol: number,
1195
+ lastRow: number,
1196
+ lastCol: number,
1197
+ iconType: 'threeArrows' | 'threeArrowsGray' | 'threeFlags' | 'threeTrafficLights' | 'threeTrafficLightsWithRim' |
1198
+ 'threeSigns' | 'threeSymbols' | 'threeSymbolsCircled' | 'threeStars' | 'threeTriangles' |
1199
+ 'fourArrows' | 'fourArrowsGray' | 'fourRedToBlack' | 'fourHistograms' | 'fourTrafficLights' |
1200
+ 'fiveArrows' | 'fiveArrowsGray' | 'fiveHistograms' | 'fiveQuadrants' | 'fiveBoxes'
1201
+ ): void;
1202
+
1203
+ /**
1204
+ * Set page margins for printing (in inches)
1205
+ * @param left - Left margin
1206
+ * @param right - Right margin
1207
+ * @param top - Top margin
1208
+ * @param bottom - Bottom margin
1209
+ * @param header - Header margin
1210
+ * @param footer - Footer margin
1211
+ */
1212
+ setMargins(left: number, right: number, top: number, bottom: number, header: number, footer: number): void;
1213
+
1214
+ /**
1215
+ * Set page orientation to portrait
1216
+ */
1217
+ setPortrait(): void;
1218
+
1219
+ /**
1220
+ * Set page orientation to landscape
1221
+ */
1222
+ setLandscape(): void;
1223
+
1224
+ /**
1225
+ * Set paper size for printing
1226
+ * @param paperSize - Paper size code (1=Letter, 5=Legal, 9=A4, 11=A5, etc.)
1227
+ */
1228
+ setPaperSize(paperSize: number): void;
1229
+
1230
+ /**
1231
+ * Set header text for printing
1232
+ * @param header - Header text (use &L, &C, &R for left/center/right, &P for page number, &D for date)
1233
+ * @example
1234
+ * worksheet.setHeader('&CReport Title'); // Centered header
1235
+ * worksheet.setHeader('&LCompany&CTitle&RPage &P'); // Left, center, and right
1236
+ */
1237
+ setHeader(header: string): void;
1238
+
1239
+ /**
1240
+ * Set footer text for printing
1241
+ * @param footer - Footer text (use &L, &C, &R for left/center/right, &P for page number, &D for date)
1242
+ * @example
1243
+ * worksheet.setFooter('&CPage &P of &N'); // Centered page number
1244
+ * worksheet.setFooter('&L&D&RPage &P'); // Date left, page right
1245
+ */
1246
+ setFooter(footer: string): void;
1247
+
1248
+ /**
1249
+ * Set print area (only this range will be printed)
1250
+ * @param firstRow - First row of print area (0-indexed)
1251
+ * @param firstCol - First column of print area (0-indexed)
1252
+ * @param lastRow - Last row of print area (0-indexed)
1253
+ * @param lastCol - Last column of print area (0-indexed)
1254
+ */
1255
+ setPrintArea(firstRow: number, firstCol: number, lastRow: number, lastCol: number): void;
1256
+
1257
+ /**
1258
+ * Show or hide gridlines when printing
1259
+ * @param enable - True to show gridlines, false to hide
1260
+ */
1261
+ setPrintGridlines(enable: boolean): void;
1262
+
1263
+ /**
1264
+ * Center worksheet horizontally on the page when printing
1265
+ * @param enable - True to center horizontally
1266
+ */
1267
+ setPrintCenterHorizontally(enable: boolean): void;
1268
+
1269
+ /**
1270
+ * Center worksheet vertically on the page when printing
1271
+ * @param enable - True to center vertically
1272
+ */
1273
+ setPrintCenterVertically(enable: boolean): void;
1274
+
1275
+ /**
1276
+ * Fit worksheet to N pages wide by M pages tall when printing
1277
+ * @param width - Number of pages wide (0 = no limit)
1278
+ * @param height - Number of pages tall (0 = no limit)
1279
+ * @example
1280
+ * worksheet.setPrintFitToPages(1, 0); // Fit to 1 page wide, unlimited height
1281
+ */
1282
+ setPrintFitToPages(width: number, height: number): void;
1283
+
1284
+ /**
1285
+ * Set print scale as a percentage
1286
+ * @param scale - Scale percentage (10-400)
1287
+ * @example
1288
+ * worksheet.setPrintScale(75); // Print at 75% scale
1289
+ */
1290
+ setPrintScale(scale: number): void;
1291
+
1292
+ /**
1293
+ * Set the first page number for printing
1294
+ * @param pageNumber - Starting page number
1295
+ */
1296
+ setPrintFirstPageNumber(pageNumber: number): void;
1297
+
1298
+ /**
1299
+ * Enable/disable black and white printing
1300
+ * @param enable - True to print in black and white
1301
+ */
1302
+ setPrintBlackAndWhite(enable: boolean): void;
1303
+
1304
+ /**
1305
+ * Enable/disable draft quality printing
1306
+ * @param enable - True for draft quality
1307
+ */
1308
+ setPrintDraft(enable: boolean): void;
1309
+
1310
+ /**
1311
+ * Enable/disable printing of row and column headings
1312
+ * @param enable - True to print headings
1313
+ */
1314
+ setPrintHeadings(enable: boolean): void;
1315
+
1316
+ /**
1317
+ * Repeat rows at the top of each printed page
1318
+ * @param firstRow - First row to repeat (0-indexed)
1319
+ * @param lastRow - Last row to repeat (0-indexed)
1320
+ * @example
1321
+ * worksheet.setRepeatRows(0, 0); // Repeat first row on each page
1322
+ * worksheet.setRepeatRows(0, 2); // Repeat first 3 rows on each page
1323
+ */
1324
+ setRepeatRows(firstRow: number, lastRow: number): void;
1325
+
1326
+ /**
1327
+ * Repeat columns at the left of each printed page
1328
+ * @param firstCol - First column to repeat (0-indexed)
1329
+ * @param lastCol - Last column to repeat (0-indexed)
1330
+ * @example
1331
+ * worksheet.setRepeatColumns(0, 0); // Repeat first column on each page
1332
+ * worksheet.setRepeatColumns(0, 1); // Repeat first 2 columns on each page
1333
+ */
1334
+ setRepeatColumns(firstCol: number, lastCol: number): void;
1335
+
1336
+ /**
1337
+ * Scale header and footer with document
1338
+ * @param enable - True to scale with document
1339
+ */
1340
+ setHeaderFooterScaleWithDoc(enable: boolean): void;
1341
+
1342
+ /**
1343
+ * Align header and footer with page margins
1344
+ * @param enable - True to align with page margins
1345
+ */
1346
+ setHeaderFooterAlignWithPage(enable: boolean): void;
1347
+
1348
+ /**
1349
+ * Insert a chart at the specified cell position
1350
+ * @param row - Row number (0-indexed)
1351
+ * @param col - Column number (0-indexed)
1352
+ * @param chart - Chart object to insert
1353
+ * @example
1354
+ * const chart = new Chart('column');
1355
+ * chart.addSeries({ values: 'Sheet1!$B$2:$B$7', categories: 'Sheet1!$A$2:$A$7' });
1356
+ * worksheet.insertChart(1, 3, chart);
1357
+ */
1358
+ insertChart(row: number, col: number, chart: Chart): void;
1359
+
1360
+ /**
1361
+ * Insert a chart at the specified cell position with pixel offsets
1362
+ * @param row - Row number (0-indexed)
1363
+ * @param col - Column number (0-indexed)
1364
+ * @param chart - Chart object to insert
1365
+ * @param xOffset - Horizontal offset in pixels
1366
+ * @param yOffset - Vertical offset in pixels
1367
+ * @example
1368
+ * const chart = new Chart('line');
1369
+ * chart.addSeries({ values: 'Sheet1!$B$2:$B$7' });
1370
+ * worksheet.insertChartWithOffset(1, 3, chart, 25, 10);
1371
+ */
1372
+ insertChartWithOffset(row: number, col: number, chart: Chart, xOffset: number, yOffset: number): void;
1373
+
1374
+ /**
1375
+ * Insert an image at the specified cell position
1376
+ * @param row - Row number (0-indexed)
1377
+ * @param col - Column number (0-indexed)
1378
+ * @param image - Image instance
1379
+ * @example
1380
+ * const image = new Image('logo.png');
1381
+ * worksheet.insertImage(0, 0, image);
1382
+ */
1383
+ insertImage(row: number, col: number, image: Image): void;
1384
+
1385
+ /**
1386
+ * Insert an image at the specified cell position with pixel offsets
1387
+ * @param row - Row number (0-indexed)
1388
+ * @param col - Column number (0-indexed)
1389
+ * @param image - Image instance
1390
+ * @param xOffset - Horizontal offset in pixels
1391
+ * @param yOffset - Vertical offset in pixels
1392
+ * @example
1393
+ * const image = new Image('logo.png');
1394
+ * worksheet.insertImageWithOffset(1, 2, image, 10, 20);
1395
+ */
1396
+ insertImageWithOffset(row: number, col: number, image: Image, xOffset: number, yOffset: number): void;
1397
+
1398
+ /**
1399
+ * Insert an image that fits to a cell
1400
+ * @param row - Row number (0-indexed)
1401
+ * @param col - Column number (0-indexed)
1402
+ * @param image - Image instance
1403
+ * @param keepAspectRatio - Whether to maintain aspect ratio (default: true)
1404
+ * @example
1405
+ * const image = new Image('photo.jpg');
1406
+ * worksheet.insertImageFitToCell(0, 0, image, true);
1407
+ */
1408
+ insertImageFitToCell(row: number, col: number, image: Image, keepAspectRatio?: boolean): void;
1409
+
1410
+ /**
1411
+ * Add a table to the worksheet
1412
+ * @param firstRow - First row of the table (0-indexed)
1413
+ * @param firstCol - First column of the table (0-indexed)
1414
+ * @param lastRow - Last row of the table (0-indexed)
1415
+ * @param lastCol - Last column of the table (0-indexed)
1416
+ * @param table - Table instance
1417
+ * @example
1418
+ * const table = new Table();
1419
+ * table.setName('Sales').setStyle(9);
1420
+ * worksheet.addTable(0, 0, 10, 4, table);
1421
+ */
1422
+ addTable(firstRow: number, firstCol: number, lastRow: number, lastCol: number, table: Table): void;
1423
+
1424
+ /**
1425
+ * Add a sparkline to a single cell
1426
+ * @param row - Row number (0-indexed)
1427
+ * @param col - Column number (0-indexed)
1428
+ * @param sparkline - Sparkline instance
1429
+ * @example
1430
+ * const sparkline = new Sparkline();
1431
+ * sparkline.setRange('A1:E1').setType('column');
1432
+ * worksheet.addSparkline(0, 5, sparkline);
1433
+ */
1434
+ addSparkline(row: number, col: number, sparkline: Sparkline): void;
1435
+
1436
+ /**
1437
+ * Add a sparkline group to a range of cells
1438
+ * @param firstRow - First row of the sparkline range (0-indexed)
1439
+ * @param firstCol - First column of the sparkline range (0-indexed)
1440
+ * @param lastRow - Last row of the sparkline range (0-indexed)
1441
+ * @param lastCol - Last column of the sparkline range (0-indexed)
1442
+ * @param sparkline - Sparkline instance
1443
+ * @example
1444
+ * const sparkline = new Sparkline();
1445
+ * sparkline.setRange('A1:E3').setType('line');
1446
+ * worksheet.addSparklineGroup(0, 5, 2, 5, sparkline);
1447
+ */
1448
+ addSparklineGroup(firstRow: number, firstCol: number, lastRow: number, lastCol: number, sparkline: Sparkline): void;
1449
+
1450
+ /**
1451
+ * Set the worksheet tab color
1452
+ * @param color - Color name or hex code
1453
+ * @example
1454
+ * worksheet.setTabColor('red');
1455
+ * worksheet.setTabColor('#FF0000');
1456
+ */
1457
+ setTabColor(color: Color): void;
1458
+
1459
+ /**
1460
+ * Hide or show the worksheet
1461
+ * @param enable - True to hide worksheet, false to show
1462
+ * @example
1463
+ * worksheet.setHidden(true); // Hide worksheet
1464
+ */
1465
+ setHidden(enable: boolean): void;
1466
+
1467
+ /**
1468
+ * Set the worksheet zoom level
1469
+ * @param zoom - Zoom percentage (10-400)
1470
+ * @example
1471
+ * worksheet.setZoom(150); // 150% zoom
1472
+ */
1473
+ setZoom(zoom: number): void;
1474
+
1475
+ /**
1476
+ * Set the default cell selection when opening the worksheet
1477
+ * @param firstRow - First row of selection (0-indexed)
1478
+ * @param firstCol - First column of selection (0-indexed)
1479
+ * @param lastRow - Last row of selection (0-indexed)
1480
+ * @param lastCol - Last column of selection (0-indexed)
1481
+ * @example
1482
+ * worksheet.setSelection(0, 0, 5, 5); // Select A1:F6
1483
+ */
1484
+ setSelection(firstRow: number, firstCol: number, lastRow: number, lastCol: number): void;
1485
+
1486
+ /**
1487
+ * Set which cell appears in the top-left corner when opening the worksheet
1488
+ * @param row - Row number (0-indexed)
1489
+ * @param col - Column number (0-indexed)
1490
+ * @example
1491
+ * worksheet.setTopLeftCell(10, 0); // Start view at row 11
1492
+ */
1493
+ setTopLeftCell(row: number, col: number): void;
1494
+
1495
+ /**
1496
+ * Protect the worksheet from editing
1497
+ * Cells must be unlocked via format.setUnlocked() to remain editable
1498
+ * @example
1499
+ * worksheet.protect(); // Protect all cells
1500
+ */
1501
+ protect(): void;
1502
+
1503
+ /**
1504
+ * Protect the worksheet with a password
1505
+ * @param password - Password to protect worksheet
1506
+ * @example
1507
+ * worksheet.protectWithPassword('secret123');
1508
+ */
1509
+ protectWithPassword(password: string): void;
1510
+
1511
+ /**
1512
+ * Protect the worksheet with granular protection options
1513
+ * @param options - ProtectionOptions instance with desired settings
1514
+ * @example
1515
+ * const options = new ProtectionOptions()
1516
+ * .setInsertRows(true)
1517
+ * .setInsertColumns(true);
1518
+ * worksheet.protectWithOptions(options);
1519
+ */
1520
+ protectWithOptions(options: ProtectionOptions): void;
1521
+
1522
+ /**
1523
+ * Protect the worksheet with a password and granular protection options
1524
+ * @param password - Password to protect worksheet
1525
+ * @param options - ProtectionOptions instance with desired settings
1526
+ * @example
1527
+ * const options = new ProtectionOptions()
1528
+ * .setInsertRows(true);
1529
+ * worksheet.protectWithPasswordAndOptions('secret123', options);
1530
+ */
1531
+ protectWithPasswordAndOptions(password: string, options: ProtectionOptions): void;
1532
+
1533
+ /**
1534
+ * Write a rich text string (multi-format text) to a cell
1535
+ * @param row - Row number (0-indexed)
1536
+ * @param col - Column number (0-indexed)
1537
+ * @param richText - RichText instance with formatted segments
1538
+ * @example
1539
+ * const richText = new RichText()
1540
+ * .addSegment('This is ', normal)
1541
+ * .addSegment('bold', bold);
1542
+ * worksheet.writeRichString(0, 0, richText);
1543
+ */
1544
+ writeRichString(row: number, col: number, richText: RichText): void;
1545
+
1546
+ /**
1547
+ * Write a rich text string with an additional cell format
1548
+ * @param row - Row number (0-indexed)
1549
+ * @param col - Column number (0-indexed)
1550
+ * @param richText - RichText instance with formatted segments
1551
+ * @param cellFormat - Format to apply to the entire cell
1552
+ * @example
1553
+ * const richText = new RichText()
1554
+ * .addSegment('Hello ', normal)
1555
+ * .addSegment('World', bold);
1556
+ * const cellFormat = new Format().setAlign('center');
1557
+ * worksheet.writeRichStringWithFormat(0, 0, richText, cellFormat);
1558
+ */
1559
+ writeRichStringWithFormat(row: number, col: number, richText: RichText, cellFormat: Format): void;
1560
+
1561
+ /**
1562
+ * Insert a button at the specified cell position
1563
+ * @param row - Row number (0-indexed)
1564
+ * @param col - Column number (0-indexed)
1565
+ * @param button - Button instance
1566
+ * @example
1567
+ * const button = new Button();
1568
+ * button.setCaption('Run Macro').setMacro('MyMacro');
1569
+ * worksheet.insertButton(0, 0, button);
1570
+ */
1571
+ insertButton(row: number, col: number, button: Button): void;
1572
+
1573
+ /**
1574
+ * Insert a button at the specified cell position with pixel offsets
1575
+ * @param row - Row number (0-indexed)
1576
+ * @param col - Column number (0-indexed)
1577
+ * @param button - Button instance
1578
+ * @param xOffset - Horizontal offset in pixels
1579
+ * @param yOffset - Vertical offset in pixels
1580
+ * @example
1581
+ * const button = new Button();
1582
+ * button.setCaption('Click Me');
1583
+ * worksheet.insertButtonWithOffset(0, 0, button, 10, 5);
1584
+ */
1585
+ insertButtonWithOffset(row: number, col: number, button: Button, xOffset: number, yOffset: number): void;
1586
+
1587
+ /**
1588
+ * Insert a shape at the specified cell position
1589
+ * @param row - Row number (0-indexed)
1590
+ * @param col - Column number (0-indexed)
1591
+ * @param shape - Shape instance
1592
+ * @example
1593
+ * const shape = Shape.textbox();
1594
+ * shape.setText('Important: Read carefully');
1595
+ * worksheet.insertShape(0, 0, shape);
1596
+ */
1597
+ insertShape(row: number, col: number, shape: Shape): void;
1598
+
1599
+ /**
1600
+ * Insert a shape at the specified cell position with pixel offsets
1601
+ * @param row - Row number (0-indexed)
1602
+ * @param col - Column number (0-indexed)
1603
+ * @param shape - Shape instance
1604
+ * @param xOffset - Horizontal offset in pixels
1605
+ * @param yOffset - Vertical offset in pixels
1606
+ * @example
1607
+ * const shape = Shape.textbox();
1608
+ * shape.setText('Note');
1609
+ * worksheet.insertShapeWithOffset(1, 1, shape, 15, 10);
1610
+ */
1611
+ insertShapeWithOffset(row: number, col: number, shape: Shape, xOffset: number, yOffset: number): void;
1612
+ }
1613
+
1614
+ /** Chart type options */
1615
+ export type ChartType =
1616
+ | 'area' | 'areaStacked' | 'area_stacked' | 'areaPercentStacked' | 'area_percent_stacked'
1617
+ | 'bar' | 'barStacked' | 'bar_stacked' | 'barPercentStacked' | 'bar_percent_stacked'
1618
+ | 'column' | 'columnStacked' | 'column_stacked' | 'columnPercentStacked' | 'column_percent_stacked'
1619
+ | 'doughnut'
1620
+ | 'line' | 'lineStacked' | 'line_stacked' | 'linePercentStacked' | 'line_percent_stacked'
1621
+ | 'pie'
1622
+ | 'radar' | 'radarWithMarkers' | 'radar_with_markers' | 'radarFilled' | 'radar_filled'
1623
+ | 'scatter' | 'scatterStraight' | 'scatter_straight'
1624
+ | 'scatterStraightWithMarkers' | 'scatter_straight_with_markers'
1625
+ | 'scatterSmooth' | 'scatter_smooth'
1626
+ | 'scatterSmoothWithMarkers' | 'scatter_smooth_with_markers'
1627
+ | 'stock';
1628
+
1629
+ /** Chart series configuration options */
1630
+ export interface ChartSeriesOptions {
1631
+ /** Data values range (e.g., 'Sheet1!$B$2:$B$7') */
1632
+ values: string;
1633
+ /** Category labels range (optional, e.g., 'Sheet1!$A$2:$A$7') */
1634
+ categories?: string;
1635
+ /** Series name (optional, e.g., 'Sales Q1' or 'Sheet1!$B$1') */
1636
+ name?: string;
1637
+ }
1638
+
1639
+ /**
1640
+ * Chart class for creating Excel charts
1641
+ *
1642
+ * @example
1643
+ * const chart = new Chart('column');
1644
+ * chart.addSeries({
1645
+ * categories: 'Sheet1!$A$2:$A$7',
1646
+ * values: 'Sheet1!$B$2:$B$7',
1647
+ * name: 'Q1 Sales'
1648
+ * });
1649
+ * chart.setTitle('Sales Report');
1650
+ * chart.setXAxisName('Month');
1651
+ * chart.setYAxisName('Revenue');
1652
+ * chart.setStyle(11);
1653
+ * worksheet.insertChart(0, 2, chart);
1654
+ */
1655
+ export declare class Chart {
1656
+ /** Internal native binding */
1657
+ _native: any;
1658
+
1659
+ /**
1660
+ * Create a new chart
1661
+ * @param chartType - Type of chart to create
1662
+ * @example
1663
+ * const chart = new Chart('column');
1664
+ * const pieChart = new Chart('pie');
1665
+ * const lineChart = new Chart('line');
1666
+ */
1667
+ constructor(chartType: ChartType);
1668
+
1669
+ /**
1670
+ * Add a data series to the chart
1671
+ * @param options - Series configuration options
1672
+ * @example
1673
+ * chart.addSeries({
1674
+ * categories: 'Sheet1!$A$2:$A$7',
1675
+ * values: 'Sheet1!$B$2:$B$7',
1676
+ * name: 'Sales'
1677
+ * });
1678
+ */
1679
+ addSeries(options: ChartSeriesOptions): void;
1680
+
1681
+ /**
1682
+ * Set the chart title
1683
+ * @param title - Chart title text
1684
+ * @example
1685
+ * chart.setTitle('Q1 Sales Results');
1686
+ */
1687
+ setTitle(title: string): this;
1688
+
1689
+ /**
1690
+ * Set the X-axis label
1691
+ * @param name - X-axis label text
1692
+ * @example
1693
+ * chart.setXAxisName('Month');
1694
+ */
1695
+ setXAxisName(name: string): this;
1696
+
1697
+ /**
1698
+ * Set the Y-axis label
1699
+ * @param name - Y-axis label text
1700
+ * @example
1701
+ * chart.setYAxisName('Revenue ($)');
1702
+ */
1703
+ setYAxisName(name: string): this;
1704
+
1705
+ /**
1706
+ * Set the chart style (1-48)
1707
+ * @param style - Excel chart style number (1-48)
1708
+ * @example
1709
+ * chart.setStyle(11); // Apply Excel style 11
1710
+ */
1711
+ setStyle(style: number): this;
1712
+
1713
+ /**
1714
+ * Hide the chart legend
1715
+ * @example
1716
+ * chart.setLegendHidden();
1717
+ */
1718
+ setLegendHidden(): this;
1719
+ }
1720
+
1721
+ /**
1722
+ * Table class for creating Excel tables
1723
+ *
1724
+ * @example
1725
+ * const table = new Table();
1726
+ * table.setName('SalesData')
1727
+ * .setStyle(9)
1728
+ * .setTotalRow(true);
1729
+ * worksheet.addTable(0, 0, 10, 4, table);
1730
+ */
1731
+ export declare class Table {
1732
+ /** Internal native binding */
1733
+ _native: any;
1734
+
1735
+ /** Create a new table */
1736
+ constructor();
1737
+
1738
+ /**
1739
+ * Set whether the table has a header row
1740
+ * @param show - Show header row (default: true)
1741
+ */
1742
+ setHeaderRow(show: boolean): this;
1743
+
1744
+ /**
1745
+ * Set whether the table has a total row
1746
+ * @param show - Show total row (default: false)
1747
+ */
1748
+ setTotalRow(show: boolean): this;
1749
+
1750
+ /**
1751
+ * Set whether the table has banded rows
1752
+ * @param show - Show banded rows (default: true)
1753
+ */
1754
+ setBandedRows(show: boolean): this;
1755
+
1756
+ /**
1757
+ * Set whether the table has banded columns
1758
+ * @param show - Show banded columns (default: false)
1759
+ */
1760
+ setBandedColumns(show: boolean): this;
1761
+
1762
+ /**
1763
+ * Set whether the first column is formatted
1764
+ * @param show - Format first column (default: false)
1765
+ */
1766
+ setFirstColumn(show: boolean): this;
1767
+
1768
+ /**
1769
+ * Set whether the last column is formatted
1770
+ * @param show - Format last column (default: false)
1771
+ */
1772
+ setLastColumn(show: boolean): this;
1773
+
1774
+ /**
1775
+ * Set the name of the table
1776
+ * @param name - Table name (must be unique)
1777
+ */
1778
+ setName(name: string): this;
1779
+
1780
+ /**
1781
+ * Set the style of the table
1782
+ * @param styleId - Table style ID (1-21: light, 22-49: medium, 50-60: dark)
1783
+ * @example
1784
+ * table.setStyle(9); // Medium style 9 (default)
1785
+ */
1786
+ setStyle(styleId: number): this;
1787
+
1788
+ /**
1789
+ * Set columns for the table
1790
+ * @param columns - Array of TableColumn objects
1791
+ */
1792
+ setColumns(columns: TableColumn[]): this;
1793
+ }
1794
+
1795
+ /**
1796
+ * TableColumn class for configuring table columns
1797
+ *
1798
+ * @example
1799
+ * const col = new TableColumn();
1800
+ * col.setHeader('Sales')
1801
+ * .setTotalFunction('sum');
1802
+ */
1803
+ export declare class TableColumn {
1804
+ /** Internal native binding */
1805
+ _native: any;
1806
+
1807
+ /** Create a new table column */
1808
+ constructor();
1809
+
1810
+ /**
1811
+ * Set the header name for the column
1812
+ * @param header - Column header text
1813
+ */
1814
+ setHeader(header: string): this;
1815
+
1816
+ /**
1817
+ * Set the total function for the column
1818
+ * @param func - Function: 'average', 'count', 'countNumbers', 'max', 'min', 'stdDev', 'sum', 'var'
1819
+ */
1820
+ setTotalFunction(func: 'average' | 'count' | 'countNumbers' | 'max' | 'min' | 'stdDev' | 'sum' | 'var'): this;
1821
+
1822
+ /**
1823
+ * Set a custom total label for the column
1824
+ * @param label - Total row label text
1825
+ */
1826
+ setTotalLabel(label: string): this;
1827
+
1828
+ /**
1829
+ * Set a custom formula for the column
1830
+ * @param formula - Excel formula (without '=')
1831
+ */
1832
+ setFormula(formula: string): this;
1833
+ }
1834
+
1835
+ /**
1836
+ * Sparkline class for creating Excel sparklines
1837
+ *
1838
+ * @example
1839
+ * const sparkline = new Sparkline();
1840
+ * sparkline.setRange('Sheet1!A1:E1')
1841
+ * .setType('column')
1842
+ * .setStyle(12);
1843
+ * worksheet.addSparkline(0, 5, sparkline);
1844
+ */
1845
+ export declare class Sparkline {
1846
+ /** Internal native binding */
1847
+ _native: any;
1848
+
1849
+ /** Create a new sparkline */
1850
+ constructor();
1851
+
1852
+ /**
1853
+ * Set the data range for the sparkline
1854
+ * @param range - Range string (e.g., 'Sheet1!A1:E1' or 'A1:E1')
1855
+ */
1856
+ setRange(range: string): this;
1857
+
1858
+ /**
1859
+ * Set the type of sparkline
1860
+ * @param type - Sparkline type: 'line', 'column', or 'winLose'
1861
+ */
1862
+ setType(type: 'line' | 'column' | 'winLose'): this;
1863
+
1864
+ /**
1865
+ * Show markers for the highest point
1866
+ * @param enable - Enable high point marker
1867
+ */
1868
+ showHighPoint(enable: boolean): this;
1869
+
1870
+ /**
1871
+ * Show markers for the lowest point
1872
+ * @param enable - Enable low point marker
1873
+ */
1874
+ showLowPoint(enable: boolean): this;
1875
+
1876
+ /**
1877
+ * Show markers for the first point
1878
+ * @param enable - Enable first point marker
1879
+ */
1880
+ showFirstPoint(enable: boolean): this;
1881
+
1882
+ /**
1883
+ * Show markers for the last point
1884
+ * @param enable - Enable last point marker
1885
+ */
1886
+ showLastPoint(enable: boolean): this;
1887
+
1888
+ /**
1889
+ * Show markers for negative points
1890
+ * @param enable - Enable negative point markers
1891
+ */
1892
+ showNegativePoints(enable: boolean): this;
1893
+
1894
+ /**
1895
+ * Show markers for all points
1896
+ * @param enable - Enable all point markers
1897
+ */
1898
+ showMarkers(enable: boolean): this;
1899
+
1900
+ /**
1901
+ * Show the horizontal axis
1902
+ * @param enable - Enable axis display
1903
+ */
1904
+ showAxis(enable: boolean): this;
1905
+
1906
+ /**
1907
+ * Show data from hidden rows/columns
1908
+ * @param enable - Enable hidden data display
1909
+ */
1910
+ showHiddenData(enable: boolean): this;
1911
+
1912
+ /**
1913
+ * Display sparkline right to left
1914
+ * @param enable - Enable right-to-left direction
1915
+ */
1916
+ setRightToLeft(enable: boolean): this;
1917
+
1918
+ /**
1919
+ * Set the color of the sparkline
1920
+ * @param color - Hex color (e.g., '#FF0000')
1921
+ */
1922
+ setSparklineColor(color: string): this;
1923
+
1924
+ /**
1925
+ * Set the color of the high point marker
1926
+ * @param color - Hex color (e.g., '#00FF00')
1927
+ */
1928
+ setHighPointColor(color: string): this;
1929
+
1930
+ /**
1931
+ * Set the color of the low point marker
1932
+ * @param color - Hex color (e.g., '#FF0000')
1933
+ */
1934
+ setLowPointColor(color: string): this;
1935
+
1936
+ /**
1937
+ * Set the color of the first point marker
1938
+ * @param color - Hex color (e.g., '#0000FF')
1939
+ */
1940
+ setFirstPointColor(color: string): this;
1941
+
1942
+ /**
1943
+ * Set the color of the last point marker
1944
+ * @param color - Hex color (e.g., '#0000FF')
1945
+ */
1946
+ setLastPointColor(color: string): this;
1947
+
1948
+ /**
1949
+ * Set the color of negative point markers
1950
+ * @param color - Hex color (e.g., '#FFA500')
1951
+ */
1952
+ setNegativePointsColor(color: string): this;
1953
+
1954
+ /**
1955
+ * Set the color of all point markers
1956
+ * @param color - Hex color (e.g., '#000000')
1957
+ */
1958
+ setMarkersColor(color: string): this;
1959
+
1960
+ /**
1961
+ * Set the line weight/width
1962
+ * @param weight - Line weight (default: 0.75)
1963
+ */
1964
+ setLineWeight(weight: number): this;
1965
+
1966
+ /**
1967
+ * Set the custom maximum value for vertical axis
1968
+ * @param max - Maximum value
1969
+ */
1970
+ setCustomMax(max: number): this;
1971
+
1972
+ /**
1973
+ * Set the custom minimum value for vertical axis
1974
+ * @param min - Minimum value
1975
+ */
1976
+ setCustomMin(min: number): this;
1977
+
1978
+ /**
1979
+ * Set maximum value based on group maximum
1980
+ * @param enable - Use group maximum
1981
+ */
1982
+ setGroupMax(enable: boolean): this;
1983
+
1984
+ /**
1985
+ * Set minimum value based on group minimum
1986
+ * @param enable - Use group minimum
1987
+ */
1988
+ setGroupMin(enable: boolean): this;
1989
+
1990
+ /**
1991
+ * Set a predefined style
1992
+ * @param style - Style number (1-36)
1993
+ */
1994
+ setStyle(style: number): this;
1995
+
1996
+ /**
1997
+ * Set how empty cells are displayed
1998
+ * @param option - Display option: 'gaps', 'zero', or 'connected'
1999
+ */
2000
+ showEmptyCellsAs(option: 'gaps' | 'zero' | 'connected'): this;
2001
+ }
2002
+
2003
+ /**
2004
+ * DocProperties class for setting document metadata
2005
+ *
2006
+ * @example
2007
+ * const props = new DocProperties();
2008
+ * props.setAuthor('John Doe')
2009
+ * .setTitle('Sales Report')
2010
+ * .setCompany('ACME Corp');
2011
+ * workbook.setProperties(props);
2012
+ */
2013
+ export declare class DocProperties {
2014
+ /** Internal native binding */
2015
+ _native: any;
2016
+
2017
+ /** Create a new DocProperties instance */
2018
+ constructor();
2019
+
2020
+ /**
2021
+ * Set the document author
2022
+ * @param author - Author name
2023
+ */
2024
+ setAuthor(author: string): this;
2025
+
2026
+ /**
2027
+ * Set the document title
2028
+ * @param title - Document title
2029
+ */
2030
+ setTitle(title: string): this;
2031
+
2032
+ /**
2033
+ * Set the document subject
2034
+ * @param subject - Document subject
2035
+ */
2036
+ setSubject(subject: string): this;
2037
+
2038
+ /**
2039
+ * Set the document comment/description
2040
+ * @param comment - Document comment
2041
+ */
2042
+ setComment(comment: string): this;
2043
+
2044
+ /**
2045
+ * Set the company name
2046
+ * @param company - Company name
2047
+ */
2048
+ setCompany(company: string): this;
2049
+
2050
+ /**
2051
+ * Set the manager name
2052
+ * @param manager - Manager name
2053
+ */
2054
+ setManager(manager: string): this;
2055
+
2056
+ /**
2057
+ * Set the document status
2058
+ * @param status - Document status (e.g., 'Draft', 'Final')
2059
+ */
2060
+ setStatus(status: string): this;
2061
+
2062
+ /**
2063
+ * Set the document category
2064
+ * @param category - Document category
2065
+ */
2066
+ setCategory(category: string): this;
2067
+
2068
+ /**
2069
+ * Set document keywords for searching
2070
+ * @param keywords - Comma-separated keywords
2071
+ */
2072
+ setKeywords(keywords: string): this;
2073
+
2074
+ /**
2075
+ * Set the hyperlink base URL
2076
+ * @param base - Base URL for relative hyperlinks
2077
+ */
2078
+ setHyperlinkBase(base: string): this;
2079
+ }
2080
+
2081
+ /**
2082
+ * Button class for Excel form control buttons
2083
+ *
2084
+ * @example
2085
+ * const button = new Button();
2086
+ * button.setCaption('Click Me')
2087
+ * .setMacro('MyMacro')
2088
+ * .setWidth(100)
2089
+ * .setHeight(30);
2090
+ * worksheet.insertButton(0, 0, button);
2091
+ */
2092
+ export declare class Button {
2093
+ /** Internal native binding */
2094
+ _native: any;
2095
+
2096
+ /** Create a new button */
2097
+ constructor();
2098
+
2099
+ /**
2100
+ * Set the button caption/text
2101
+ * @param caption - Text displayed on the button
2102
+ */
2103
+ setCaption(caption: string): this;
2104
+
2105
+ /**
2106
+ * Set the VBA macro to run when button is clicked
2107
+ * @param macroName - Name of the VBA macro
2108
+ */
2109
+ setMacro(macroName: string): this;
2110
+
2111
+ /**
2112
+ * Set the button width in pixels
2113
+ * @param width - Width in pixels
2114
+ */
2115
+ setWidth(width: number): this;
2116
+
2117
+ /**
2118
+ * Set the button height in pixels
2119
+ * @param height - Height in pixels
2120
+ */
2121
+ setHeight(height: number): this;
2122
+
2123
+ /**
2124
+ * Set alt text for accessibility
2125
+ * @param altText - Accessibility description
2126
+ */
2127
+ setAltText(altText: string): this;
2128
+
2129
+ /**
2130
+ * Set how the button moves and sizes with cells
2131
+ * @param option - Movement option: 'moveAndSize', 'moveOnly', 'none', or 'moveAndSizeAfter'
2132
+ */
2133
+ setObjectMovement(option: 'moveAndSize' | 'moveOnly' | 'none' | 'moveAndSizeAfter'): this;
2134
+ }
2135
+
2136
+ /**
2137
+ * Shape class for Excel shapes (textboxes)
2138
+ *
2139
+ * @example
2140
+ * const shape = Shape.textbox();
2141
+ * shape.setText('Important Note')
2142
+ * .setWidth(200)
2143
+ * .setHeight(100);
2144
+ * worksheet.insertShape(0, 0, shape);
2145
+ */
2146
+ export declare class Shape {
2147
+ /** Internal native binding */
2148
+ _native: any;
2149
+
2150
+ /**
2151
+ * Create a new textbox shape
2152
+ * @returns Shape instance configured as a textbox
2153
+ */
2154
+ static textbox(): Shape;
2155
+
2156
+ /**
2157
+ * Set the text content of the textbox
2158
+ * @param text - Text content
2159
+ */
2160
+ setText(text: string): this;
2161
+
2162
+ /**
2163
+ * Set the shape width in pixels
2164
+ * @param width - Width in pixels
2165
+ */
2166
+ setWidth(width: number): this;
2167
+
2168
+ /**
2169
+ * Set the shape height in pixels
2170
+ * @param height - Height in pixels
2171
+ */
2172
+ setHeight(height: number): this;
2173
+
2174
+ /**
2175
+ * Set alt text for accessibility
2176
+ * @param altText - Accessibility description
2177
+ */
2178
+ setAltText(altText: string): this;
2179
+
2180
+ /**
2181
+ * Set how the shape moves and sizes with cells
2182
+ * @param option - Movement option: 'moveAndSize', 'moveOnly', 'none', or 'moveAndSizeAfter'
2183
+ */
2184
+ setObjectMovement(option: 'moveAndSize' | 'moveOnly' | 'none' | 'moveAndSizeAfter'): this;
2185
+ }
2186
+
2187
+ /**
2188
+ * Workbook class for Excel file creation
2189
+ *
2190
+ * @example
2191
+ * const workbook = new Workbook();
2192
+ * const worksheet = workbook.addWorksheet('Sheet1');
2193
+ * worksheet.write(0, 0, 'Hello World');
2194
+ * workbook.save('output.xlsx');
2195
+ */
2196
+ export declare class Workbook {
2197
+ /** Internal native binding */
2198
+ _native: any;
2199
+
2200
+ /** Create a new workbook */
2201
+ constructor();
2202
+
2203
+ /**
2204
+ * Add a new worksheet to the workbook
2205
+ * @param name - Optional worksheet name
2206
+ * @returns Worksheet instance
2207
+ */
2208
+ addWorksheet(name?: string): Worksheet;
2209
+
2210
+ /**
2211
+ * Add a new worksheet with constant memory mode (minimal memory footprint)
2212
+ * Sequential row writing only, limited merge support, no tables.
2213
+ * @param name - Optional worksheet name
2214
+ * @returns Worksheet instance in constant memory mode
2215
+ */
2216
+ addWorksheetWithConstantMemory(name?: string): Worksheet;
2217
+
2218
+ /**
2219
+ * Add a new worksheet with low memory mode (balanced optimization)
2220
+ * Good for large datasets with repeated strings.
2221
+ * @param name - Optional worksheet name
2222
+ * @returns Worksheet instance in low memory mode
2223
+ */
2224
+ addWorksheetWithLowMemory(name?: string): Worksheet;
2225
+
2226
+ /**
2227
+ * Set custom temporary directory for constant/low memory modes
2228
+ * Must be called BEFORE adding memory mode worksheets
2229
+ * @param dir - Directory path for temporary files
2230
+ */
2231
+ setTempdir(dir: string): void;
2232
+
2233
+ /**
2234
+ * Save the workbook to a file
2235
+ * @param filename - Path where the file should be saved
2236
+ */
2237
+ save(filename: string): void;
2238
+
2239
+ /**
2240
+ * Save the workbook to a Buffer
2241
+ * @returns Buffer containing the Excel file data
2242
+ */
2243
+ saveToBuffer(): Buffer;
2244
+
2245
+ /**
2246
+ * Define a named range or formula
2247
+ * @param name - Name for the range (e.g., 'Sales' or 'Sheet1!Sales' for local names)
2248
+ * @param formula - Formula or range (e.g., '=Sheet1!$A$1:$A$10' or '=SUM(A1:A10)')
2249
+ * @example
2250
+ * workbook.defineName('Sales', '=Sheet1!$A$1:$A$10');
2251
+ * workbook.defineName('Sheet1!LocalName', '=Sheet1!$B$1:$B$10');
2252
+ */
2253
+ defineName(name: string, formula: string): void;
2254
+
2255
+ /**
2256
+ * Set the workbook to be opened in read-only recommended mode
2257
+ * Users will be prompted to open as read-only but can choose to edit
2258
+ * @example
2259
+ * workbook.readOnlyRecommended();
2260
+ */
2261
+ readOnlyRecommended(): void;
2262
+
2263
+ /**
2264
+ * Add a VBA macro file to the workbook
2265
+ * @param path - Path to the vbaProject.bin file
2266
+ * @example
2267
+ * workbook.addVbaProject('./vbaProject.bin');
2268
+ */
2269
+ addVbaProject(path: string): void;
2270
+
2271
+ /**
2272
+ * Set document properties (metadata) for the workbook
2273
+ * @param properties - DocProperties instance with metadata
2274
+ * @example
2275
+ * const props = new DocProperties();
2276
+ * props.setAuthor('Jane Doe').setTitle('Report');
2277
+ * workbook.setProperties(props);
2278
+ */
2279
+ setProperties(properties: DocProperties): void;
2280
+ }
2281
+
2282
+ // Re-export native bindings for advanced use
2283
+ export { RuscFormat, RuscNote, RuscFormula, RuscDataValidation, RuscChart, RuscWorkbook, RuscWorksheet, RuscProtectionOptions, RuscRichText, RuscImage, RuscTable, RuscTableColumn, RuscSparkline, RuscDocProperties, RuscButton, RuscShape } from './index';