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