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