@nazarkalytiuk/rusc-xlsx 2.0.0 → 2.2.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 +117 -22
  3. package/index.js +217 -82
  4. package/package.json +44 -17
  5. package/wrapper.d.ts +149 -532
  6. package/wrapper.js +1227 -1423
package/wrapper.js CHANGED
@@ -1,1425 +1,1229 @@
1
- // JavaScript wrappers for rusc-xlsx
2
- const nativeBinding = require('./index.js');
3
-
4
- // JavaScript wrapper for Format with fluent API
5
- class Format {
6
- constructor() {
7
- this._native = new nativeBinding.RuscFormat()
8
- }
9
-
10
- setBold() {
11
- this._native.setBold()
12
- return this
13
- }
14
-
15
- setItalic() {
16
- this._native.setItalic()
17
- return this
18
- }
19
-
20
- setFontSize(size) {
21
- this._native.setFontSize(size)
22
- return this
23
- }
24
-
25
- setFontColor(color) {
26
- this._native.setFontColor(color)
27
- return this
28
- }
29
-
30
- setBackgroundColor(color) {
31
- this._native.setBackgroundColor(color)
32
- return this
33
- }
34
-
35
- setAlign(align) {
36
- this._native.setAlign(align)
37
- return this
38
- }
39
-
40
- setVerticalAlign(align) {
41
- this._native.setVerticalAlign(align)
42
- return this
43
- }
44
-
45
- setBorder(border) {
46
- this._native.setBorder(border)
47
- return this
48
- }
49
-
50
- setNumFormat(format) {
51
- this._native.setNumFormat(format)
52
- return this
53
- }
54
-
55
- setFontName(fontName) {
56
- this._native.setFontName(fontName)
57
- return this
58
- }
59
-
60
- setFontScheme(scheme) {
61
- this._native.setFontScheme(scheme)
62
- return this
63
- }
64
-
65
- setUnderline(underline) {
66
- this._native.setUnderline(underline)
67
- return this
68
- }
69
-
70
- setStrikethrough() {
71
- this._native.setStrikethrough()
72
- return this
73
- }
74
-
75
- setForegroundColor(color) {
76
- this._native.setForegroundColor(color)
77
- return this
78
- }
79
-
80
- setPattern(pattern) {
81
- this._native.setPattern(pattern)
82
- return this
83
- }
84
-
85
- setTextWrap() {
86
- this._native.setTextWrap()
87
- return this
88
- }
89
-
90
- setIndent(indent) {
91
- this._native.setIndent(indent)
92
- return this
93
- }
94
-
95
- setRotation(rotation) {
96
- this._native.setRotation(rotation)
97
- return this
98
- }
99
-
100
- setShrink() {
101
- this._native.setShrink()
102
- return this
103
- }
104
-
105
- setBorderTop(border) {
106
- this._native.setBorderTop(border)
107
- return this
108
- }
109
-
110
- setBorderBottom(border) {
111
- this._native.setBorderBottom(border)
112
- return this
113
- }
114
-
115
- setBorderLeft(border) {
116
- this._native.setBorderLeft(border)
117
- return this
118
- }
119
-
120
- setBorderRight(border) {
121
- this._native.setBorderRight(border)
122
- return this
123
- }
124
-
125
- setBorderColor(color) {
126
- this._native.setBorderColor(color)
127
- return this
128
- }
129
-
130
- setBorderTopColor(color) {
131
- this._native.setBorderTopColor(color)
132
- return this
133
- }
134
-
135
- setBorderBottomColor(color) {
136
- this._native.setBorderBottomColor(color)
137
- return this
138
- }
139
-
140
- setBorderLeftColor(color) {
141
- this._native.setBorderLeftColor(color)
142
- return this
143
- }
144
-
145
- setBorderRightColor(color) {
146
- this._native.setBorderRightColor(color)
147
- return this
148
- }
149
-
150
- setUnlocked() {
151
- this._native.setUnlocked()
152
- return this
153
- }
154
-
155
- setLocked() {
156
- this._native.setLocked()
157
- return this
158
- }
159
-
160
- setHidden() {
161
- this._native.setHidden()
162
- return this
163
- }
164
-
165
- setFontScript(script) {
166
- this._native.setFontScript(script)
167
- return this
168
- }
169
-
170
- setBorderDiagonal(border) {
171
- this._native.setBorderDiagonal(border)
172
- return this
173
- }
174
-
175
- setBorderDiagonalColor(color) {
176
- this._native.setBorderDiagonalColor(color)
177
- return this
178
- }
179
-
180
- setBorderDiagonalType(type) {
181
- this._native.setBorderDiagonalType(type)
182
- return this
183
- }
184
-
185
- setReadingDirection(direction) {
186
- this._native.setReadingDirection(direction)
187
- return this
188
- }
189
-
190
- setQuotePrefix() {
191
- this._native.setQuotePrefix()
192
- return this
193
- }
1
+ // \0rolldown/runtime.js
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
+ key = keys[i];
11
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
+ get: ((k) => from[k]).bind(null, key),
13
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
+ });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
19
+ value: mod,
20
+ enumerable: true
21
+ }) : target, mod));
22
+ let node_crypto = require("node:crypto");
23
+ let node_fs = require("node:fs");
24
+ node_fs = __toESM(node_fs);
25
+ let node_os = require("node:os");
26
+ node_os = __toESM(node_os);
27
+ let node_path = require("node:path");
28
+ let node_stream_promises = require("node:stream/promises");
29
+ let index_js = require("./index.js");
30
+ // wrapper.ts
31
+ function isErrnoException(error) {
32
+ return error instanceof Error && "code" in error;
194
33
  }
195
-
196
- // JavaScript wrapper for Note
197
- class Note {
198
- constructor(text) {
199
- this._native = new nativeBinding.RuscNote(text)
200
- }
201
-
202
- setAuthor(name) {
203
- this._native.setAuthor(name)
204
- return this
205
- }
206
-
207
- setWidth(width) {
208
- this._native.setWidth(width)
209
- return this
210
- }
211
-
212
- setHeight(height) {
213
- this._native.setHeight(height)
214
- return this
215
- }
216
-
217
- setBackgroundColor(color) {
218
- this._native.setBackgroundColor(color)
219
- return this
220
- }
221
-
222
- setVisible(visible) {
223
- this._native.setVisible(visible)
224
- return this
225
- }
226
-
227
- setAltText(altText) {
228
- this._native.setAltText(altText)
229
- return this
230
- }
231
- }
232
-
233
- // JavaScript wrapper for ProtectionOptions
234
- class ProtectionOptions {
235
- constructor() {
236
- this._native = new nativeBinding.RuscProtectionOptions()
237
- }
238
-
239
- setSelectLockedCells(allow) {
240
- this._native.setSelectLockedCells(allow)
241
- return this
242
- }
243
-
244
- setSelectUnlockedCells(allow) {
245
- this._native.setSelectUnlockedCells(allow)
246
- return this
247
- }
248
-
249
- setFormatCells(allow) {
250
- this._native.setFormatCells(allow)
251
- return this
252
- }
253
-
254
- setFormatColumns(allow) {
255
- this._native.setFormatColumns(allow)
256
- return this
257
- }
258
-
259
- setFormatRows(allow) {
260
- this._native.setFormatRows(allow)
261
- return this
262
- }
263
-
264
- setInsertColumns(allow) {
265
- this._native.setInsertColumns(allow)
266
- return this
267
- }
268
-
269
- setInsertRows(allow) {
270
- this._native.setInsertRows(allow)
271
- return this
272
- }
273
-
274
- setInsertLinks(allow) {
275
- this._native.setInsertLinks(allow)
276
- return this
277
- }
278
-
279
- setDeleteColumns(allow) {
280
- this._native.setDeleteColumns(allow)
281
- return this
282
- }
283
-
284
- setDeleteRows(allow) {
285
- this._native.setDeleteRows(allow)
286
- return this
287
- }
288
-
289
- setSort(allow) {
290
- this._native.setSort(allow)
291
- return this
292
- }
293
-
294
- setUseAutofilter(allow) {
295
- this._native.setUseAutofilter(allow)
296
- return this
297
- }
298
-
299
- setUsePivotTables(allow) {
300
- this._native.setUsePivotTables(allow)
301
- return this
302
- }
303
-
304
- setEditScenarios(allow) {
305
- this._native.setEditScenarios(allow)
306
- return this
307
- }
308
-
309
- setEditObjects(allow) {
310
- this._native.setEditObjects(allow)
311
- return this
312
- }
313
-
314
- setContents(allow) {
315
- this._native.setContents(allow)
316
- return this
317
- }
318
- }
319
-
320
- // JavaScript wrapper for RichText
321
- class RichText {
322
- constructor() {
323
- this._native = new nativeBinding.RuscRichText()
324
- }
325
-
326
- addSegment(text, format) {
327
- this._native.addSegment(text, format ? format._native : null)
328
- return this
329
- }
330
- }
331
-
332
- // JavaScript wrapper for Image
333
- class Image {
334
- constructor(path) {
335
- this._native = nativeBinding.RuscImage.new(path)
336
- }
337
-
338
- static fromBuffer(buffer) {
339
- const img = Object.create(Image.prototype)
340
- img._native = nativeBinding.RuscImage.newFromBuffer(buffer)
341
- return img
342
- }
343
-
344
- setWidth(width) {
345
- this._native.setWidth(width)
346
- return this
347
- }
348
-
349
- setHeight(height) {
350
- this._native.setHeight(height)
351
- return this
352
- }
353
-
354
- setScaleWidth(scale) {
355
- this._native.setScaleWidth(scale)
356
- return this
357
- }
358
-
359
- setScaleHeight(scale) {
360
- this._native.setScaleHeight(scale)
361
- return this
362
- }
363
-
364
- setScaleToSize(width, height, keepAspectRatio = true) {
365
- this._native.setScaleToSize(width, height, keepAspectRatio)
366
- return this
367
- }
368
-
369
- setAltText(altText) {
370
- this._native.setAltText(altText)
371
- return this
372
- }
373
-
374
- setDecorative(enable) {
375
- this._native.setDecorative(enable)
376
- return this
377
- }
378
-
379
- setObjectMovement(option) {
380
- this._native.setObjectMovement(option)
381
- return this
382
- }
383
-
384
- setUrl(url) {
385
- this._native.setUrl(url)
386
- return this
387
- }
388
- }
389
-
390
- // JavaScript wrapper for Formula
391
- class Formula {
392
- constructor(formula) {
393
- this._native = new nativeBinding.RuscFormula(formula)
394
- }
395
-
396
- setResult(result) {
397
- this._native.setResult(result)
398
- return this
399
- }
400
- }
401
-
402
- // JavaScript wrapper for DataValidation
403
- class DataValidation {
404
- constructor() {
405
- this._native = new nativeBinding.RuscDataValidation()
406
- }
407
-
408
- allowWholeNumber(rule, value) {
409
- this._native.allowWholeNumber(rule, value)
410
- return this
411
- }
412
-
413
- allowWholeNumberBetween(min, max) {
414
- this._native.allowWholeNumberBetween(min, max)
415
- return this
416
- }
417
-
418
- allowDecimalNumber(rule, value) {
419
- this._native.allowDecimalNumber(rule, value)
420
- return this
421
- }
422
-
423
- allowDecimalNumberBetween(min, max) {
424
- this._native.allowDecimalNumberBetween(min, max)
425
- return this
426
- }
427
-
428
- allowListStrings(list) {
429
- this._native.allowListStrings(list)
430
- return this
431
- }
432
-
433
- allowListFormula(formula) {
434
- this._native.allowListFormula(formula)
435
- return this
436
- }
437
-
438
- allowCustom(formula) {
439
- this._native.allowCustom(formula)
440
- return this
441
- }
442
-
443
- allowAnyValue() {
444
- this._native.allowAnyValue()
445
- return this
446
- }
447
-
448
- ignoreBlank(enable) {
449
- this._native.ignoreBlank(enable)
450
- return this
451
- }
452
-
453
- showDropdown(enable) {
454
- this._native.showDropdown(enable)
455
- return this
456
- }
457
-
458
- showInputMessage(enable) {
459
- this._native.showInputMessage(enable)
460
- return this
461
- }
462
-
463
- showErrorMessage(enable) {
464
- this._native.showErrorMessage(enable)
465
- return this
466
- }
467
-
468
- setInputTitle(title) {
469
- this._native.setInputTitle(title)
470
- return this
471
- }
472
-
473
- setInputMessage(message) {
474
- this._native.setInputMessage(message)
475
- return this
476
- }
477
-
478
- setErrorTitle(title) {
479
- this._native.setErrorTitle(title)
480
- return this
481
- }
482
-
483
- setErrorMessage(message) {
484
- this._native.setErrorMessage(message)
485
- return this
486
- }
487
-
488
- setErrorStyle(style) {
489
- this._native.setErrorStyle(style)
490
- return this
491
- }
492
- }
493
-
494
- // JavaScript wrapper for Worksheet
495
- class Worksheet {
496
- constructor(nativeWorksheet) {
497
- this._native = nativeWorksheet
498
- }
499
-
500
- write(row, col, value, format) {
501
- if (format) {
502
- return this._native.write(row, col, value, format._native)
503
- }
504
-
505
- switch (typeof value) {
506
- case 'string':
507
- return this._native.writeString(row, col, value)
508
- case 'number':
509
- return this._native.writeNumber(row, col, value)
510
- case 'boolean':
511
- return this._native.writeBoolean(row, col, value)
512
- default:
513
- return this._native.write(row, col, value)
514
- }
515
- }
516
-
517
- writeRow(row, startCol, values, format) {
518
- return this._native.writeRow(row, startCol, values, format ? format._native : undefined)
519
- }
520
-
521
- writeRows(startRow, startCol, rows, format) {
522
- return this._native.writeRows(startRow, startCol, rows, format ? format._native : undefined)
523
- }
524
-
525
- writeString(row, col, value) {
526
- return this._native.writeString(row, col, value)
527
- }
528
-
529
- writeNumber(row, col, value) {
530
- return this._native.writeNumber(row, col, value)
531
- }
532
-
533
- writeBoolean(row, col, value) {
534
- return this._native.writeBoolean(row, col, value)
535
- }
536
-
537
- writeBlank(row, col, format) {
538
- return this._native.writeBlank(row, col, format._native)
539
- }
540
-
541
- writeDatetimeFromTimestamp(row, col, timestamp, format) {
542
- return this._native.writeDatetimeFromTimestamp(row, col, timestamp, format ? format._native : undefined)
543
- }
544
-
545
- writeDatetimeFromYmd(row, col, year, month, day, format) {
546
- return this._native.writeDatetimeFromYmd(row, col, year, month, day, format ? format._native : undefined)
547
- }
548
-
549
- writeDatetimeFromYmdHms(row, col, year, month, day, hour, min, sec, format) {
550
- return this._native.writeDatetimeFromYmdHms(row, col, year, month, day, hour, min, sec, format ? format._native : undefined)
551
- }
552
-
553
- writeDatetimeFromString(row, col, datetimeStr, format) {
554
- return this._native.writeDatetimeFromString(row, col, datetimeStr, format ? format._native : undefined)
555
- }
556
-
557
- writeDatetime(row, col, datetime, format) {
558
- // Convenience method that handles multiple input types
559
- if (datetime instanceof Date) {
560
- // JavaScript Date object
561
- const timestamp = Math.floor(datetime.getTime() / 1000)
562
- return this.writeDatetimeFromTimestamp(row, col, timestamp, format)
563
- } else if (typeof datetime === 'number') {
564
- // Unix timestamp
565
- return this.writeDatetimeFromTimestamp(row, col, datetime, format)
566
- } else if (typeof datetime === 'string') {
567
- // ISO string
568
- return this.writeDatetimeFromString(row, col, datetime, format)
569
- } else if (typeof datetime === 'object') {
570
- // Object with year, month, day, etc.
571
- if (datetime.hour !== undefined || datetime.min !== undefined || datetime.sec !== undefined) {
572
- return this.writeDatetimeFromYmdHms(
573
- row, col,
574
- datetime.year, datetime.month, datetime.day,
575
- datetime.hour || 0, datetime.min || 0, datetime.sec || 0,
576
- format
577
- )
578
- } else {
579
- return this.writeDatetimeFromYmd(row, col, datetime.year, datetime.month, datetime.day, format)
580
- }
581
- } else {
582
- throw new Error('Invalid datetime input: must be Date, number (timestamp), string (ISO), or object')
583
- }
584
- }
585
-
586
- writeWithFormat(row, col, value, format) {
587
- return this._native.writeWithFormat(row, col, value, format._native)
588
- }
589
-
590
- setColumnWidth(col, width) {
591
- return this._native.setColumnWidth(col, width)
592
- }
593
-
594
- setRowHeight(row, height) {
595
- return this._native.setRowHeight(row, height)
596
- }
597
-
598
- setDefaultRowHeight(height) {
599
- return this._native.setDefaultRowHeight(height)
600
- }
601
-
602
- setAutofitMaxRow(maxRow) {
603
- return this._native.setAutofitMaxRow(maxRow)
604
- }
605
-
606
- setAutofitMaxWidth(maxWidth) {
607
- return this._native.setAutofitMaxWidth(maxWidth)
608
- }
609
-
610
- autofit() {
611
- return this._native.autofit()
612
- }
613
-
614
- setName(name) {
615
- return this._native.setName(name)
616
- }
617
-
618
- mergeRange(firstRow, firstCol, lastRow, lastCol, value, format) {
619
- return this._native.mergeRange(firstRow, firstCol, lastRow, lastCol, value, format ? format._native : undefined)
620
- }
621
-
622
- mergeRangeWithFormat(firstRow, firstCol, lastRow, lastCol, value, format) {
623
- return this._native.mergeRangeWithFormat(firstRow, firstCol, lastRow, lastCol, value, format._native)
624
- }
625
-
626
- insertNote(row, col, note) {
627
- return this._native.insertNote(row, col, note._native)
628
- }
629
-
630
- setDefaultNoteAuthor(name) {
631
- return this._native.setDefaultNoteAuthor(name)
632
- }
633
-
634
- writeFormula(row, col, formula, format) {
635
- return this._native.writeFormula(row, col, formula._native, format ? format._native : undefined)
636
- }
637
-
638
- writeDynamicFormula(row, col, formula, format) {
639
- return this._native.writeDynamicFormula(row, col, formula._native, format ? format._native : undefined)
640
- }
641
-
642
- writeArrayFormula(firstRow, firstCol, lastRow, lastCol, formula, format) {
643
- return this._native.writeArrayFormula(firstRow, firstCol, lastRow, lastCol, formula._native, format ? format._native : undefined)
644
- }
645
-
646
- addDataValidation(firstRow, firstCol, lastRow, lastCol, validation) {
647
- return this._native.addDataValidation(firstRow, firstCol, lastRow, lastCol, validation._native)
648
- }
649
-
650
- writeUrl(row, col, url, format) {
651
- return this._native.writeUrl(row, col, url, format ? format._native : undefined)
652
- }
653
-
654
- writeUrlWithText(row, col, url, text, format) {
655
- return this._native.writeUrlWithText(row, col, url, text, format ? format._native : undefined)
656
- }
657
-
658
- autofilter(firstRow, firstCol, lastRow, lastCol) {
659
- return this._native.autofilter(firstRow, firstCol, lastRow, lastCol)
660
- }
661
-
662
- setFreezePanes(row, col) {
663
- return this._native.setFreezePanes(row, col)
664
- }
665
-
666
- // Conditional Formatting
667
- addConditionalFormat2ColorScale(firstRow, firstCol, lastRow, lastCol, minColor, maxColor) {
668
- return this._native.addConditionalFormat2ColorScale(firstRow, firstCol, lastRow, lastCol, minColor, maxColor)
669
- }
670
-
671
- addConditionalFormat3ColorScale(firstRow, firstCol, lastRow, lastCol, minColor, midColor, maxColor) {
672
- return this._native.addConditionalFormat3ColorScale(firstRow, firstCol, lastRow, lastCol, minColor, midColor, maxColor)
673
- }
674
-
675
- addConditionalFormatDataBar(firstRow, firstCol, lastRow, lastCol, barColor) {
676
- return this._native.addConditionalFormatDataBar(firstRow, firstCol, lastRow, lastCol, barColor)
677
- }
678
-
679
- addConditionalFormatCell(firstRow, firstCol, lastRow, lastCol, rule, value, format) {
680
- return this._native.addConditionalFormatCell(firstRow, firstCol, lastRow, lastCol, rule, value, format._native)
681
- }
682
-
683
- addConditionalFormatText(firstRow, firstCol, lastRow, lastCol, rule, text, format) {
684
- return this._native.addConditionalFormatText(firstRow, firstCol, lastRow, lastCol, rule, text, format._native)
685
- }
686
-
687
- addConditionalFormatAverage(firstRow, firstCol, lastRow, lastCol, rule, format) {
688
- return this._native.addConditionalFormatAverage(firstRow, firstCol, lastRow, lastCol, rule, format._native)
689
- }
690
-
691
- addConditionalFormatTop(firstRow, firstCol, lastRow, lastCol, rule, value, format) {
692
- return this._native.addConditionalFormatTop(firstRow, firstCol, lastRow, lastCol, rule, value, format._native)
693
- }
694
-
695
- addConditionalFormatDuplicate(firstRow, firstCol, lastRow, lastCol, invert, format) {
696
- return this._native.addConditionalFormatDuplicate(firstRow, firstCol, lastRow, lastCol, invert, format._native)
697
- }
698
-
699
- addConditionalFormatBlank(firstRow, firstCol, lastRow, lastCol, invert, format) {
700
- return this._native.addConditionalFormatBlank(firstRow, firstCol, lastRow, lastCol, invert, format._native)
701
- }
702
-
703
- addConditionalFormatError(firstRow, firstCol, lastRow, lastCol, invert, format) {
704
- return this._native.addConditionalFormatError(firstRow, firstCol, lastRow, lastCol, invert, format._native)
705
- }
706
-
707
- addConditionalFormatDate(firstRow, firstCol, lastRow, lastCol, rule, format) {
708
- return this._native.addConditionalFormatDate(firstRow, firstCol, lastRow, lastCol, rule, format._native)
709
- }
710
-
711
- addConditionalFormatFormula(firstRow, firstCol, lastRow, lastCol, formula, format) {
712
- return this._native.addConditionalFormatFormula(firstRow, firstCol, lastRow, lastCol, formula, format._native)
713
- }
714
-
715
- addConditionalFormatIconSet(firstRow, firstCol, lastRow, lastCol, iconType) {
716
- return this._native.addConditionalFormatIconSet(firstRow, firstCol, lastRow, lastCol, iconType)
717
- }
718
-
719
- // Page Setup
720
- setMargins(left, right, top, bottom, header, footer) {
721
- return this._native.setMargins(left, right, top, bottom, header, footer)
722
- }
723
-
724
- setPortrait() {
725
- return this._native.setPortrait()
726
- }
727
-
728
- setLandscape() {
729
- return this._native.setLandscape()
730
- }
731
-
732
- setPaperSize(paperSize) {
733
- return this._native.setPaperSize(paperSize)
734
- }
735
-
736
- setHeader(header) {
737
- return this._native.setHeader(header)
738
- }
739
-
740
- setFooter(footer) {
741
- return this._native.setFooter(footer)
742
- }
743
-
744
- setPrintArea(firstRow, firstCol, lastRow, lastCol) {
745
- return this._native.setPrintArea(firstRow, firstCol, lastRow, lastCol)
746
- }
747
-
748
- setPrintGridlines(enable) {
749
- return this._native.setPrintGridlines(enable)
750
- }
751
-
752
- setPrintCenterHorizontally(enable) {
753
- return this._native.setPrintCenterHorizontally(enable)
754
- }
755
-
756
- setPrintCenterVertically(enable) {
757
- return this._native.setPrintCenterVertically(enable)
758
- }
759
-
760
- setPrintFitToPages(width, height) {
761
- return this._native.setPrintFitToPages(width, height)
762
- }
763
-
764
- setPrintScale(scale) {
765
- return this._native.setPrintScale(scale)
766
- }
767
-
768
- setPrintFirstPageNumber(pageNumber) {
769
- return this._native.setPrintFirstPageNumber(pageNumber)
770
- }
771
-
772
- setPrintBlackAndWhite(enable) {
773
- return this._native.setPrintBlackAndWhite(enable)
774
- }
775
-
776
- setPrintDraft(enable) {
777
- return this._native.setPrintDraft(enable)
778
- }
779
-
780
- setPrintHeadings(enable) {
781
- return this._native.setPrintHeadings(enable)
782
- }
783
-
784
- setRepeatRows(firstRow, lastRow) {
785
- return this._native.setRepeatRows(firstRow, lastRow)
786
- }
787
-
788
- setRepeatColumns(firstCol, lastCol) {
789
- return this._native.setRepeatColumns(firstCol, lastCol)
790
- }
791
-
792
- setHeaderFooterScaleWithDoc(enable) {
793
- return this._native.setHeaderFooterScaleWithDoc(enable)
794
- }
795
-
796
- setHeaderFooterAlignWithPage(enable) {
797
- return this._native.setHeaderFooterAlignWithPage(enable)
798
- }
799
-
800
- // Worksheet View & Display
801
- setTabColor(color) {
802
- return this._native.setTabColor(color)
803
- }
804
-
805
- setHidden(enable) {
806
- return this._native.setHidden(enable)
807
- }
808
-
809
- setZoom(zoom) {
810
- return this._native.setZoom(zoom)
811
- }
812
-
813
- setSelection(firstRow, firstCol, lastRow, lastCol) {
814
- return this._native.setSelection(firstRow, firstCol, lastRow, lastCol)
815
- }
816
-
817
- setTopLeftCell(row, col) {
818
- return this._native.setTopLeftCell(row, col)
819
- }
820
-
821
- // Worksheet Protection
822
- protect() {
823
- return this._native.protect()
824
- }
825
-
826
- protectWithPassword(password) {
827
- return this._native.protectWithPassword(password)
828
- }
829
-
830
- protectWithOptions(options) {
831
- return this._native.protectWithOptions(options._native)
832
- }
833
-
834
- protectWithPasswordAndOptions(password, options) {
835
- return this._native.protectWithPasswordAndOptions(password, options._native)
836
- }
837
-
838
- // Rich Text
839
- writeRichString(row, col, richText) {
840
- return this._native.writeRichString(row, col, richText._native)
841
- }
842
-
843
- writeRichStringWithFormat(row, col, richText, format) {
844
- return this._native.writeRichStringWithFormat(row, col, richText._native, format._native)
845
- }
846
-
847
- // Charts
848
- insertChart(row, col, chart) {
849
- return this._native.insertChart(row, col, chart._native)
850
- }
851
-
852
- insertChartWithOffset(row, col, chart, xOffset, yOffset) {
853
- return this._native.insertChartWithOffset(row, col, chart._native, xOffset, yOffset)
854
- }
855
-
856
- // Images
857
- insertImage(row, col, image) {
858
- return this._native.insertImage(row, col, image._native)
859
- }
860
-
861
- insertImageWithOffset(row, col, image, xOffset, yOffset) {
862
- return this._native.insertImageWithOffset(row, col, image._native, xOffset, yOffset)
863
- }
864
-
865
- insertImageFitToCell(row, col, image, keepAspectRatio = true) {
866
- return this._native.insertImageFitToCell(row, col, image._native, keepAspectRatio)
867
- }
868
-
869
- insertImageFitToCellCentered(row, col, image) {
870
- return this._native.insertImageFitToCellCentered(row, col, image._native)
871
- }
872
-
873
- addTable(firstRow, firstCol, lastRow, lastCol, table) {
874
- return this._native.addTable(firstRow, firstCol, lastRow, lastCol, table._native)
875
- }
876
-
877
- addSparkline(row, col, sparkline) {
878
- return this._native.addSparkline(row, col, sparkline._native)
879
- }
880
-
881
- addSparklineGroup(firstRow, firstCol, lastRow, lastCol, sparkline) {
882
- return this._native.addSparklineGroup(firstRow, firstCol, lastRow, lastCol, sparkline._native)
883
- }
884
-
885
- insertButton(row, col, button) {
886
- return this._native.insertButton(row, col, button._native)
887
- }
888
-
889
- insertButtonWithOffset(row, col, button, xOffset, yOffset) {
890
- return this._native.insertButtonWithOffset(row, col, button._native, xOffset, yOffset)
891
- }
892
-
893
- insertShape(row, col, shape) {
894
- return this._native.insertShape(row, col, shape._native)
895
- }
896
-
897
- insertShapeWithOffset(row, col, shape, xOffset, yOffset) {
898
- return this._native.insertShapeWithOffset(row, col, shape._native, xOffset, yOffset)
899
- }
900
- }
901
-
902
- // JavaScript wrapper for Chart
903
- class Chart {
904
- constructor(chartType) {
905
- this._native = new nativeBinding.RuscChart(chartType)
906
- }
907
-
908
- addSeries(options) {
909
- const {categories, values, name} = options
910
- return this._native.addSeries(categories || null, values, name || null)
911
- }
912
-
913
- setTitle(title) {
914
- this._native.setTitle(title)
915
- return this
916
- }
917
-
918
- setXAxisName(name) {
919
- this._native.setXAxisName(name)
920
- return this
921
- }
922
-
923
- setYAxisName(name) {
924
- this._native.setYAxisName(name)
925
- return this
926
- }
927
-
928
- setStyle(style) {
929
- this._native.setStyle(style)
930
- return this
931
- }
932
-
933
- setLegendHidden() {
934
- this._native.setLegendHidden()
935
- return this
936
- }
937
- }
938
-
939
- // JavaScript wrapper for Table
940
- class Table {
941
- constructor() {
942
- this._native = nativeBinding.RuscTable.new()
943
- }
944
-
945
- setHeaderRow(show) {
946
- this._native.setHeaderRow(show)
947
- return this
948
- }
949
-
950
- setTotalRow(show) {
951
- this._native.setTotalRow(show)
952
- return this
953
- }
954
-
955
- setBandedRows(show) {
956
- this._native.setBandedRows(show)
957
- return this
958
- }
959
-
960
- setBandedColumns(show) {
961
- this._native.setBandedColumns(show)
962
- return this
963
- }
964
-
965
- setFirstColumn(show) {
966
- this._native.setFirstColumn(show)
967
- return this
968
- }
969
-
970
- setLastColumn(show) {
971
- this._native.setLastColumn(show)
972
- return this
973
- }
974
-
975
- setName(name) {
976
- this._native.setName(name)
977
- return this
978
- }
979
-
980
- setAltText(altText) {
981
- this._native.setAltText(altText)
982
- return this
983
- }
984
-
985
- setAltTextTitle(title) {
986
- this._native.setAltTextTitle(title)
987
- return this
988
- }
989
-
990
- setStyle(styleId) {
991
- this._native.setStyle(styleId)
992
- return this
993
- }
994
-
995
- setColumns(columns) {
996
- const nativeColumns = columns.map(col => col._native)
997
- this._native.setColumns(nativeColumns)
998
- return this
999
- }
1000
- }
1001
-
1002
- // JavaScript wrapper for TableColumn
1003
- class TableColumn {
1004
- constructor() {
1005
- this._native = nativeBinding.RuscTableColumn.new()
1006
- }
1007
-
1008
- setHeader(header) {
1009
- this._native.setHeader(header)
1010
- return this
1011
- }
1012
-
1013
- setTotalFunction(func) {
1014
- this._native.setTotalFunction(func)
1015
- return this
1016
- }
1017
-
1018
- setTotalLabel(label) {
1019
- this._native.setTotalLabel(label)
1020
- return this
1021
- }
1022
-
1023
- setFormula(formula) {
1024
- this._native.setFormula(formula)
1025
- return this
1026
- }
1027
- }
1028
-
1029
- // JavaScript wrapper for Sparkline
1030
- class Sparkline {
1031
- constructor() {
1032
- this._native = nativeBinding.RuscSparkline.new()
1033
- }
1034
-
1035
- setRange(range) {
1036
- this._native.setRange(range)
1037
- return this
1038
- }
1039
-
1040
- setType(type) {
1041
- this._native.setType(type)
1042
- return this
1043
- }
1044
-
1045
- showHighPoint(enable) {
1046
- this._native.showHighPoint(enable)
1047
- return this
1048
- }
1049
-
1050
- showLowPoint(enable) {
1051
- this._native.showLowPoint(enable)
1052
- return this
1053
- }
1054
-
1055
- showFirstPoint(enable) {
1056
- this._native.showFirstPoint(enable)
1057
- return this
1058
- }
1059
-
1060
- showLastPoint(enable) {
1061
- this._native.showLastPoint(enable)
1062
- return this
1063
- }
1064
-
1065
- showNegativePoints(enable) {
1066
- this._native.showNegativePoints(enable)
1067
- return this
1068
- }
1069
-
1070
- showMarkers(enable) {
1071
- this._native.showMarkers(enable)
1072
- return this
1073
- }
1074
-
1075
- showAxis(enable) {
1076
- this._native.showAxis(enable)
1077
- return this
1078
- }
1079
-
1080
- showHiddenData(enable) {
1081
- this._native.showHiddenData(enable)
1082
- return this
1083
- }
1084
-
1085
- setRightToLeft(enable) {
1086
- this._native.setRightToLeft(enable)
1087
- return this
1088
- }
1089
-
1090
- setSparklineColor(color) {
1091
- this._native.setSparklineColor(color)
1092
- return this
1093
- }
1094
-
1095
- setHighPointColor(color) {
1096
- this._native.setHighPointColor(color)
1097
- return this
1098
- }
1099
-
1100
- setLowPointColor(color) {
1101
- this._native.setLowPointColor(color)
1102
- return this
1103
- }
1104
-
1105
- setFirstPointColor(color) {
1106
- this._native.setFirstPointColor(color)
1107
- return this
1108
- }
1109
-
1110
- setLastPointColor(color) {
1111
- this._native.setLastPointColor(color)
1112
- return this
1113
- }
1114
-
1115
- setNegativePointsColor(color) {
1116
- this._native.setNegativePointsColor(color)
1117
- return this
1118
- }
1119
-
1120
- setMarkersColor(color) {
1121
- this._native.setMarkersColor(color)
1122
- return this
1123
- }
1124
-
1125
- setLineWeight(weight) {
1126
- this._native.setLineWeight(weight)
1127
- return this
1128
- }
1129
-
1130
- setCustomMax(max) {
1131
- this._native.setCustomMax(max)
1132
- return this
1133
- }
1134
-
1135
- setCustomMin(min) {
1136
- this._native.setCustomMin(min)
1137
- return this
1138
- }
1139
-
1140
- setGroupMax(enable) {
1141
- this._native.setGroupMax(enable)
1142
- return this
1143
- }
1144
-
1145
- setGroupMin(enable) {
1146
- this._native.setGroupMin(enable)
1147
- return this
1148
- }
1149
-
1150
- setStyle(style) {
1151
- this._native.setStyle(style)
1152
- return this
1153
- }
1154
-
1155
- showEmptyCellsAs(option) {
1156
- this._native.showEmptyCellsAs(option)
1157
- return this
1158
- }
1159
- }
1160
-
1161
- // JavaScript wrapper for DocProperties
1162
- class DocProperties {
1163
- constructor() {
1164
- this._native = nativeBinding.RuscDocProperties.new()
1165
- }
1166
-
1167
- setAuthor(author) {
1168
- this._native.setAuthor(author)
1169
- return this
1170
- }
1171
-
1172
- setTitle(title) {
1173
- this._native.setTitle(title)
1174
- return this
1175
- }
1176
-
1177
- setSubject(subject) {
1178
- this._native.setSubject(subject)
1179
- return this
1180
- }
1181
-
1182
- setComment(comment) {
1183
- this._native.setComment(comment)
1184
- return this
1185
- }
1186
-
1187
- setCompany(company) {
1188
- this._native.setCompany(company)
1189
- return this
1190
- }
1191
-
1192
- setManager(manager) {
1193
- this._native.setManager(manager)
1194
- return this
1195
- }
1196
-
1197
- setStatus(status) {
1198
- this._native.setStatus(status)
1199
- return this
1200
- }
1201
-
1202
- setCategory(category) {
1203
- this._native.setCategory(category)
1204
- return this
1205
- }
1206
-
1207
- setKeywords(keywords) {
1208
- this._native.setKeywords(keywords)
1209
- return this
1210
- }
1211
-
1212
- setHyperlinkBase(base) {
1213
- this._native.setHyperlinkBase(base)
1214
- return this
1215
- }
1216
- }
1217
-
1218
- // JavaScript wrapper for Button
1219
- class Button {
1220
- constructor() {
1221
- this._native = nativeBinding.RuscButton.new()
1222
- }
1223
-
1224
- setCaption(caption) {
1225
- this._native.setCaption(caption)
1226
- return this
1227
- }
1228
-
1229
- setMacro(macroName) {
1230
- this._native.setMacro(macroName)
1231
- return this
1232
- }
1233
-
1234
- setWidth(width) {
1235
- this._native.setWidth(width)
1236
- return this
1237
- }
1238
-
1239
- setHeight(height) {
1240
- this._native.setHeight(height)
1241
- return this
1242
- }
1243
-
1244
- setAltText(altText) {
1245
- this._native.setAltText(altText)
1246
- return this
1247
- }
1248
-
1249
- setObjectMovement(option) {
1250
- this._native.setObjectMovement(option)
1251
- return this
1252
- }
1253
- }
1254
-
1255
- // JavaScript wrapper for Shape
1256
- class Shape {
1257
- static textbox() {
1258
- const shape = Object.create(Shape.prototype)
1259
- shape._native = nativeBinding.RuscShape.textbox()
1260
- return shape
1261
- }
1262
-
1263
- setText(text) {
1264
- this._native.setText(text)
1265
- return this
1266
- }
1267
-
1268
- setWidth(width) {
1269
- this._native.setWidth(width)
1270
- return this
1271
- }
1272
-
1273
- setHeight(height) {
1274
- this._native.setHeight(height)
1275
- return this
1276
- }
1277
-
1278
- setAltText(altText) {
1279
- this._native.setAltText(altText)
1280
- return this
1281
- }
1282
-
1283
- setObjectMovement(option) {
1284
- this._native.setObjectMovement(option)
1285
- return this
1286
- }
1287
- }
1288
-
1289
- // JavaScript wrapper for Workbook
1290
- class Workbook {
1291
- constructor() {
1292
- this._native = new nativeBinding.RuscWorkbook()
1293
- }
1294
-
1295
- addWorksheet(name) {
1296
- const nativeWorksheet = this._native.addWorksheet(name)
1297
- return new Worksheet(nativeWorksheet)
1298
- }
1299
-
1300
- addWorksheetWithConstantMemory(name) {
1301
- const nativeWorksheet = this._native.addWorksheetWithConstantMemory(name)
1302
- return new Worksheet(nativeWorksheet)
1303
- }
1304
-
1305
- addWorksheetWithLowMemory(name) {
1306
- const nativeWorksheet = this._native.addWorksheetWithLowMemory(name)
1307
- return new Worksheet(nativeWorksheet)
1308
- }
1309
-
1310
- setTempdir(dir) {
1311
- return this._native.setTempdir(dir)
1312
- }
1313
-
1314
- setDefaultFormat(format, rowHeight, columnWidth) {
1315
- return this._native.setDefaultFormat(format._native, rowHeight, columnWidth)
1316
- }
1317
-
1318
- useExcel2023Theme() {
1319
- return this._native.useExcel2023Theme()
1320
- }
1321
-
1322
- useCustomTheme(path) {
1323
- return this._native.useCustomTheme(path)
1324
- }
1325
-
1326
- save(filename) {
1327
- return this._native.save(filename)
1328
- }
1329
-
1330
- saveToBuffer() {
1331
- return this._native.saveToBuffer()
1332
- }
1333
-
1334
- async saveToStream(writable) {
1335
- const os = require('os')
1336
- const path = require('path')
1337
- const fs = require('fs')
1338
- const crypto = require('crypto')
1339
- const { pipeline } = require('stream/promises')
1340
-
1341
- const tmpFile = path.join(os.tmpdir(), `rusc-xlsx-${crypto.randomBytes(8).toString('hex')}.xlsx`)
1342
- let operationError
1343
-
1344
- try {
1345
- this._native.save(tmpFile)
1346
- await pipeline(fs.createReadStream(tmpFile), writable)
1347
- } catch (error) {
1348
- operationError = error
1349
- }
1350
-
1351
- try {
1352
- await fs.promises.unlink(tmpFile)
1353
- } catch (cleanupError) {
1354
- if (cleanupError.code !== 'ENOENT') {
1355
- if (operationError) {
1356
- throw new AggregateError(
1357
- [operationError, cleanupError],
1358
- 'Failed to save workbook to stream and remove the temporary file'
1359
- )
1360
- }
1361
- throw cleanupError
1362
- }
1363
- }
1364
-
1365
- if (operationError) {
1366
- throw operationError
1367
- }
1368
- }
1369
-
1370
- defineName(name, formula) {
1371
- return this._native.defineName(name, formula)
1372
- }
1373
-
1374
- readOnlyRecommended() {
1375
- return this._native.readOnlyRecommended()
1376
- }
1377
-
1378
- addVbaProject(path) {
1379
- return this._native.addVbaProject(path)
1380
- }
1381
-
1382
- setProperties(properties) {
1383
- return this._native.setProperties(properties._native)
1384
- }
1385
- }
1386
-
1387
- // Export wrapper classes
1388
- module.exports = {
1389
- Format,
1390
- Note,
1391
- Formula,
1392
- DataValidation,
1393
- Chart,
1394
- Workbook,
1395
- Worksheet,
1396
- ProtectionOptions,
1397
- RichText,
1398
- Image,
1399
- Table,
1400
- TableColumn,
1401
- Sparkline,
1402
- DocProperties,
1403
- Button,
1404
- Shape,
1405
- // Also export native bindings for advanced use
1406
- RuscFormat: nativeBinding.RuscFormat,
1407
- RuscNote: nativeBinding.RuscNote,
1408
- RuscFormula: nativeBinding.RuscFormula,
1409
- RuscDataValidation: nativeBinding.RuscDataValidation,
1410
- RuscChart: nativeBinding.RuscChart,
1411
- RuscWorkbook: nativeBinding.RuscWorkbook,
1412
- RuscWorksheet: nativeBinding.RuscWorksheet,
1413
- RuscProtectionOptions: nativeBinding.RuscProtectionOptions,
1414
- RuscRichText: nativeBinding.RuscRichText,
1415
- RuscImage: nativeBinding.RuscImage,
1416
- RuscTable: nativeBinding.RuscTable,
1417
- RuscTableColumn: nativeBinding.RuscTableColumn,
1418
- RuscSparkline: nativeBinding.RuscSparkline,
1419
- RuscDocProperties: nativeBinding.RuscDocProperties,
1420
- RuscButton: nativeBinding.RuscButton,
1421
- RuscShape: nativeBinding.RuscShape,
1422
- // Memory tracking
1423
- rustMemoryStats: nativeBinding.rustMemoryStats,
1424
- rustMemoryResetPeak: nativeBinding.rustMemoryResetPeak,
34
+ var Format = class {
35
+ _native;
36
+ constructor() {
37
+ this._native = new index_js.RuscFormat();
38
+ }
39
+ setBold() {
40
+ this._native.setBold();
41
+ return this;
42
+ }
43
+ setItalic() {
44
+ this._native.setItalic();
45
+ return this;
46
+ }
47
+ setFontSize(size) {
48
+ this._native.setFontSize(size);
49
+ return this;
50
+ }
51
+ setFontName(fontName) {
52
+ this._native.setFontName(fontName);
53
+ return this;
54
+ }
55
+ setFontScheme(scheme) {
56
+ this._native.setFontScheme(scheme);
57
+ return this;
58
+ }
59
+ setFontColor(color) {
60
+ this._native.setFontColor(color);
61
+ return this;
62
+ }
63
+ setUnderline(underline) {
64
+ this._native.setUnderline(underline);
65
+ return this;
66
+ }
67
+ setStrikethrough() {
68
+ this._native.setStrikethrough();
69
+ return this;
70
+ }
71
+ setBackgroundColor(color) {
72
+ this._native.setBackgroundColor(color);
73
+ return this;
74
+ }
75
+ setForegroundColor(color) {
76
+ this._native.setForegroundColor(color);
77
+ return this;
78
+ }
79
+ setPattern(pattern) {
80
+ this._native.setPattern(pattern);
81
+ return this;
82
+ }
83
+ setAlign(align) {
84
+ this._native.setAlign(align);
85
+ return this;
86
+ }
87
+ setVerticalAlign(align) {
88
+ this._native.setVerticalAlign(align);
89
+ return this;
90
+ }
91
+ setTextWrap() {
92
+ this._native.setTextWrap();
93
+ return this;
94
+ }
95
+ setIndent(indent) {
96
+ this._native.setIndent(indent);
97
+ return this;
98
+ }
99
+ setRotation(rotation) {
100
+ this._native.setRotation(rotation);
101
+ return this;
102
+ }
103
+ setShrink() {
104
+ this._native.setShrink();
105
+ return this;
106
+ }
107
+ setBorder(border) {
108
+ this._native.setBorder(border);
109
+ return this;
110
+ }
111
+ setBorderTop(border) {
112
+ this._native.setBorderTop(border);
113
+ return this;
114
+ }
115
+ setBorderBottom(border) {
116
+ this._native.setBorderBottom(border);
117
+ return this;
118
+ }
119
+ setBorderLeft(border) {
120
+ this._native.setBorderLeft(border);
121
+ return this;
122
+ }
123
+ setBorderRight(border) {
124
+ this._native.setBorderRight(border);
125
+ return this;
126
+ }
127
+ setBorderColor(color) {
128
+ this._native.setBorderColor(color);
129
+ return this;
130
+ }
131
+ setBorderTopColor(color) {
132
+ this._native.setBorderTopColor(color);
133
+ return this;
134
+ }
135
+ setBorderBottomColor(color) {
136
+ this._native.setBorderBottomColor(color);
137
+ return this;
138
+ }
139
+ setBorderLeftColor(color) {
140
+ this._native.setBorderLeftColor(color);
141
+ return this;
142
+ }
143
+ setBorderRightColor(color) {
144
+ this._native.setBorderRightColor(color);
145
+ return this;
146
+ }
147
+ setNumFormat(format) {
148
+ this._native.setNumFormat(format);
149
+ return this;
150
+ }
151
+ setUnlocked() {
152
+ this._native.setUnlocked();
153
+ return this;
154
+ }
155
+ setLocked() {
156
+ this._native.setLocked();
157
+ return this;
158
+ }
159
+ setHidden() {
160
+ this._native.setHidden();
161
+ return this;
162
+ }
163
+ setFontScript(script) {
164
+ this._native.setFontScript(script);
165
+ return this;
166
+ }
167
+ setBorderDiagonal(border) {
168
+ this._native.setBorderDiagonal(border);
169
+ return this;
170
+ }
171
+ setBorderDiagonalColor(color) {
172
+ this._native.setBorderDiagonalColor(color);
173
+ return this;
174
+ }
175
+ setBorderDiagonalType(type) {
176
+ this._native.setBorderDiagonalType(type);
177
+ return this;
178
+ }
179
+ setReadingDirection(direction) {
180
+ this._native.setReadingDirection(direction);
181
+ return this;
182
+ }
183
+ setQuotePrefix() {
184
+ this._native.setQuotePrefix();
185
+ return this;
186
+ }
187
+ };
188
+ var Note = class {
189
+ _native;
190
+ constructor(text) {
191
+ this._native = new index_js.RuscNote(text);
192
+ }
193
+ setAuthor(name) {
194
+ this._native.setAuthor(name);
195
+ return this;
196
+ }
197
+ setWidth(width) {
198
+ this._native.setWidth(width);
199
+ return this;
200
+ }
201
+ setHeight(height) {
202
+ this._native.setHeight(height);
203
+ return this;
204
+ }
205
+ setBackgroundColor(color) {
206
+ this._native.setBackgroundColor(color);
207
+ return this;
208
+ }
209
+ setVisible(visible) {
210
+ this._native.setVisible(visible);
211
+ return this;
212
+ }
213
+ setAltText(altText) {
214
+ this._native.setAltText(altText);
215
+ return this;
216
+ }
217
+ };
218
+ var Formula = class {
219
+ _data;
220
+ constructor(formula) {
221
+ this._data = { formula };
222
+ }
223
+ setResult(result) {
224
+ this._data.result = result;
225
+ return this;
226
+ }
227
+ };
228
+ function formulaData(formula) {
229
+ return typeof formula === "string" ? { formula } : formula._data;
1425
230
  }
231
+ var DataValidation = class {
232
+ _native;
233
+ constructor() {
234
+ this._native = new index_js.RuscDataValidation();
235
+ }
236
+ allowWholeNumber(rule, value) {
237
+ this._native.allowWholeNumber(rule, value);
238
+ return this;
239
+ }
240
+ allowWholeNumberBetween(min, max) {
241
+ this._native.allowWholeNumberBetween(min, max);
242
+ return this;
243
+ }
244
+ allowDecimalNumber(rule, value) {
245
+ this._native.allowDecimalNumber(rule, value);
246
+ return this;
247
+ }
248
+ allowDecimalNumberBetween(min, max) {
249
+ this._native.allowDecimalNumberBetween(min, max);
250
+ return this;
251
+ }
252
+ allowListStrings(list) {
253
+ this._native.allowListStrings(list);
254
+ return this;
255
+ }
256
+ allowListFormula(formula) {
257
+ this._native.allowListFormula(formula);
258
+ return this;
259
+ }
260
+ allowCustom(formula) {
261
+ this._native.allowCustom(formula);
262
+ return this;
263
+ }
264
+ allowAnyValue() {
265
+ this._native.allowAnyValue();
266
+ return this;
267
+ }
268
+ ignoreBlank(enable) {
269
+ this._native.ignoreBlank(enable);
270
+ return this;
271
+ }
272
+ showDropdown(enable) {
273
+ this._native.showDropdown(enable);
274
+ return this;
275
+ }
276
+ showInputMessage(enable) {
277
+ this._native.showInputMessage(enable);
278
+ return this;
279
+ }
280
+ showErrorMessage(enable) {
281
+ this._native.showErrorMessage(enable);
282
+ return this;
283
+ }
284
+ setInputTitle(title) {
285
+ this._native.setInputTitle(title);
286
+ return this;
287
+ }
288
+ setInputMessage(message) {
289
+ this._native.setInputMessage(message);
290
+ return this;
291
+ }
292
+ setErrorTitle(title) {
293
+ this._native.setErrorTitle(title);
294
+ return this;
295
+ }
296
+ setErrorMessage(message) {
297
+ this._native.setErrorMessage(message);
298
+ return this;
299
+ }
300
+ setErrorStyle(style) {
301
+ this._native.setErrorStyle(style);
302
+ return this;
303
+ }
304
+ };
305
+ var ProtectionOptions = class {
306
+ _native;
307
+ constructor() {
308
+ this._native = new index_js.RuscProtectionOptions();
309
+ }
310
+ setSelectLockedCells(allow) {
311
+ this._native.setSelectLockedCells(allow);
312
+ return this;
313
+ }
314
+ setSelectUnlockedCells(allow) {
315
+ this._native.setSelectUnlockedCells(allow);
316
+ return this;
317
+ }
318
+ setFormatCells(allow) {
319
+ this._native.setFormatCells(allow);
320
+ return this;
321
+ }
322
+ setFormatColumns(allow) {
323
+ this._native.setFormatColumns(allow);
324
+ return this;
325
+ }
326
+ setFormatRows(allow) {
327
+ this._native.setFormatRows(allow);
328
+ return this;
329
+ }
330
+ setInsertColumns(allow) {
331
+ this._native.setInsertColumns(allow);
332
+ return this;
333
+ }
334
+ setInsertRows(allow) {
335
+ this._native.setInsertRows(allow);
336
+ return this;
337
+ }
338
+ setInsertLinks(allow) {
339
+ this._native.setInsertLinks(allow);
340
+ return this;
341
+ }
342
+ setDeleteColumns(allow) {
343
+ this._native.setDeleteColumns(allow);
344
+ return this;
345
+ }
346
+ setDeleteRows(allow) {
347
+ this._native.setDeleteRows(allow);
348
+ return this;
349
+ }
350
+ setSort(allow) {
351
+ this._native.setSort(allow);
352
+ return this;
353
+ }
354
+ setUseAutofilter(allow) {
355
+ this._native.setUseAutofilter(allow);
356
+ return this;
357
+ }
358
+ setUsePivotTables(allow) {
359
+ this._native.setUsePivotTables(allow);
360
+ return this;
361
+ }
362
+ setEditScenarios(allow) {
363
+ this._native.setEditScenarios(allow);
364
+ return this;
365
+ }
366
+ setEditObjects(allow) {
367
+ this._native.setEditObjects(allow);
368
+ return this;
369
+ }
370
+ setContents(allow) {
371
+ this._native.setContents(allow);
372
+ return this;
373
+ }
374
+ };
375
+ var Image = class Image {
376
+ _native;
377
+ constructor(path) {
378
+ this._native = index_js.RuscImage.new(path);
379
+ }
380
+ static fromBuffer(buffer) {
381
+ const image = Object.create(Image.prototype);
382
+ image._native = index_js.RuscImage.newFromBuffer(buffer);
383
+ return image;
384
+ }
385
+ setWidth(width) {
386
+ this._native.setWidth(width);
387
+ return this;
388
+ }
389
+ setHeight(height) {
390
+ this._native.setHeight(height);
391
+ return this;
392
+ }
393
+ setScaleWidth(scale) {
394
+ this._native.setScaleWidth(scale);
395
+ return this;
396
+ }
397
+ setScaleHeight(scale) {
398
+ this._native.setScaleHeight(scale);
399
+ return this;
400
+ }
401
+ setScaleToSize(width, height, keepAspectRatio = true) {
402
+ this._native.setScaleToSize(width, height, keepAspectRatio);
403
+ return this;
404
+ }
405
+ setAltText(altText) {
406
+ this._native.setAltText(altText);
407
+ return this;
408
+ }
409
+ setDecorative(enable) {
410
+ this._native.setDecorative(enable);
411
+ return this;
412
+ }
413
+ setObjectMovement(option) {
414
+ this._native.setObjectMovement(option);
415
+ return this;
416
+ }
417
+ setUrl(url) {
418
+ this._native.setUrl(url);
419
+ return this;
420
+ }
421
+ };
422
+ var RichText = class {
423
+ _segments = [];
424
+ addSegment(text, format) {
425
+ this._segments.push([text, format?._native]);
426
+ return this;
427
+ }
428
+ };
429
+ var Worksheet = class {
430
+ _native;
431
+ constructor(nativeWorksheet) {
432
+ this._native = nativeWorksheet;
433
+ }
434
+ write(row, col, value, format) {
435
+ if (format) return this._native.write(row, col, value, format._native);
436
+ switch (typeof value) {
437
+ case "string": return this._native.writeString(row, col, value);
438
+ case "number": return this._native.writeNumber(row, col, value);
439
+ case "boolean": return this._native.writeBoolean(row, col, value);
440
+ default: return this._native.write(row, col, value);
441
+ }
442
+ }
443
+ writeRow(row, startCol, values, format) {
444
+ return this._native.writeRow(row, startCol, values, format ? format._native : void 0);
445
+ }
446
+ writeRows(startRow, startCol, rows, format) {
447
+ return this._native.writeRows(startRow, startCol, rows, format ? format._native : void 0);
448
+ }
449
+ writeString(row, col, value) {
450
+ return this._native.writeString(row, col, value);
451
+ }
452
+ writeNumber(row, col, value) {
453
+ return this._native.writeNumber(row, col, value);
454
+ }
455
+ writeBoolean(row, col, value) {
456
+ return this._native.writeBoolean(row, col, value);
457
+ }
458
+ writeBlank(row, col, format) {
459
+ return this._native.writeBlank(row, col, format._native);
460
+ }
461
+ writeDatetimeFromTimestamp(row, col, timestamp, format) {
462
+ return this._native.writeDatetimeFromTimestamp(row, col, timestamp, format ? format._native : void 0);
463
+ }
464
+ writeDatetimeFromYmd(row, col, year, month, day, format) {
465
+ return this._native.writeDatetimeFromYmd(row, col, year, month, day, format ? format._native : void 0);
466
+ }
467
+ writeDatetimeFromYmdHms(row, col, year, month, day, hour, min, sec, format) {
468
+ return this._native.writeDatetimeFromYmdHms(row, col, year, month, day, hour, min, sec, format ? format._native : void 0);
469
+ }
470
+ writeDatetimeFromString(row, col, datetimeStr, format) {
471
+ return this._native.writeDatetimeFromString(row, col, datetimeStr, format ? format._native : void 0);
472
+ }
473
+ writeDatetime(row, col, datetime, format) {
474
+ if (datetime instanceof Date) {
475
+ const timestamp = Math.floor(datetime.getTime() / 1e3);
476
+ return this.writeDatetimeFromTimestamp(row, col, timestamp, format);
477
+ } else if (typeof datetime === "number") return this.writeDatetimeFromTimestamp(row, col, datetime, format);
478
+ else if (typeof datetime === "string") return this.writeDatetimeFromString(row, col, datetime, format);
479
+ else if (typeof datetime === "object") {
480
+ if (datetime.hour !== void 0 || datetime.min !== void 0 || datetime.sec !== void 0) return this.writeDatetimeFromYmdHms(row, col, datetime.year, datetime.month, datetime.day, datetime.hour || 0, datetime.min || 0, datetime.sec || 0, format);
481
+ else return this.writeDatetimeFromYmd(row, col, datetime.year, datetime.month, datetime.day, format);
482
+ } else throw new Error("Invalid datetime input: must be Date, number (timestamp), string (ISO), or object");
483
+ }
484
+ writeWithFormat(row, col, value, format) {
485
+ return this._native.writeWithFormat(row, col, value, format._native);
486
+ }
487
+ setColumnWidth(col, width) {
488
+ return this._native.setColumnWidth(col, width);
489
+ }
490
+ setRowHeight(row, height) {
491
+ return this._native.setRowHeight(row, height);
492
+ }
493
+ setDefaultRowHeight(height) {
494
+ return this._native.setDefaultRowHeight(height);
495
+ }
496
+ setAutofitMaxRow(maxRow) {
497
+ return this._native.setAutofitMaxRow(maxRow);
498
+ }
499
+ setAutofitMaxWidth(maxWidth) {
500
+ return this._native.setAutofitMaxWidth(maxWidth);
501
+ }
502
+ autofit() {
503
+ return this._native.autofit();
504
+ }
505
+ setName(name) {
506
+ return this._native.setName(name);
507
+ }
508
+ mergeRange(firstRow, firstCol, lastRow, lastCol, value, format) {
509
+ return this._native.mergeRange(firstRow, firstCol, lastRow, lastCol, value, format ? format._native : void 0);
510
+ }
511
+ mergeRangeWithFormat(firstRow, firstCol, lastRow, lastCol, value, format) {
512
+ return this._native.mergeRangeWithFormat(firstRow, firstCol, lastRow, lastCol, value, format._native);
513
+ }
514
+ insertNote(row, col, note) {
515
+ return this._native.insertNote(row, col, note._native);
516
+ }
517
+ setDefaultNoteAuthor(name) {
518
+ return this._native.setDefaultNoteAuthor(name);
519
+ }
520
+ writeFormula(row, col, formula, format) {
521
+ return this._native.writeFormula(row, col, formulaData(formula), format ? format._native : void 0);
522
+ }
523
+ writeDynamicFormula(row, col, formula, format) {
524
+ return this._native.writeDynamicFormula(row, col, formulaData(formula), format ? format._native : void 0);
525
+ }
526
+ writeArrayFormula(firstRow, firstCol, lastRow, lastCol, formula, format) {
527
+ return this._native.writeArrayFormula(firstRow, firstCol, lastRow, lastCol, formulaData(formula), format ? format._native : void 0);
528
+ }
529
+ addDataValidation(firstRow, firstCol, lastRow, lastCol, validation) {
530
+ return this._native.addDataValidation(firstRow, firstCol, lastRow, lastCol, validation._native);
531
+ }
532
+ writeUrl(row, col, url, format) {
533
+ return this._native.writeUrl(row, col, url, format ? format._native : void 0);
534
+ }
535
+ writeUrlWithText(row, col, url, text, format) {
536
+ return this._native.writeUrlWithText(row, col, url, text, format ? format._native : void 0);
537
+ }
538
+ autofilter(firstRow, firstCol, lastRow, lastCol) {
539
+ return this._native.autofilter(firstRow, firstCol, lastRow, lastCol);
540
+ }
541
+ setFreezePanes(row, col) {
542
+ return this._native.setFreezePanes(row, col);
543
+ }
544
+ addConditionalFormat2ColorScale(firstRow, firstCol, lastRow, lastCol, minColor, maxColor) {
545
+ return this._native.addConditionalFormat2ColorScale(firstRow, firstCol, lastRow, lastCol, minColor, maxColor);
546
+ }
547
+ addConditionalFormat3ColorScale(firstRow, firstCol, lastRow, lastCol, minColor, midColor, maxColor) {
548
+ return this._native.addConditionalFormat3ColorScale(firstRow, firstCol, lastRow, lastCol, minColor, midColor, maxColor);
549
+ }
550
+ addConditionalFormatDataBar(firstRow, firstCol, lastRow, lastCol, barColor) {
551
+ return this._native.addConditionalFormatDataBar(firstRow, firstCol, lastRow, lastCol, barColor);
552
+ }
553
+ addConditionalFormatCell(firstRow, firstCol, lastRow, lastCol, rule, value, format) {
554
+ return this._native.addConditionalFormatCell(firstRow, firstCol, lastRow, lastCol, rule, value, format._native);
555
+ }
556
+ addConditionalFormatText(firstRow, firstCol, lastRow, lastCol, rule, text, format) {
557
+ return this._native.addConditionalFormatText(firstRow, firstCol, lastRow, lastCol, rule, text, format._native);
558
+ }
559
+ addConditionalFormatAverage(firstRow, firstCol, lastRow, lastCol, rule, format) {
560
+ return this._native.addConditionalFormatAverage(firstRow, firstCol, lastRow, lastCol, rule, format._native);
561
+ }
562
+ addConditionalFormatTop(firstRow, firstCol, lastRow, lastCol, rule, value, format) {
563
+ return this._native.addConditionalFormatTop(firstRow, firstCol, lastRow, lastCol, rule, value, format._native);
564
+ }
565
+ addConditionalFormatDuplicate(firstRow, firstCol, lastRow, lastCol, invert, format) {
566
+ return this._native.addConditionalFormatDuplicate(firstRow, firstCol, lastRow, lastCol, invert, format._native);
567
+ }
568
+ addConditionalFormatBlank(firstRow, firstCol, lastRow, lastCol, invert, format) {
569
+ return this._native.addConditionalFormatBlank(firstRow, firstCol, lastRow, lastCol, invert, format._native);
570
+ }
571
+ addConditionalFormatError(firstRow, firstCol, lastRow, lastCol, invert, format) {
572
+ return this._native.addConditionalFormatError(firstRow, firstCol, lastRow, lastCol, invert, format._native);
573
+ }
574
+ addConditionalFormatDate(firstRow, firstCol, lastRow, lastCol, rule, format) {
575
+ return this._native.addConditionalFormatDate(firstRow, firstCol, lastRow, lastCol, rule, format._native);
576
+ }
577
+ addConditionalFormatFormula(firstRow, firstCol, lastRow, lastCol, formula, format) {
578
+ return this._native.addConditionalFormatFormula(firstRow, firstCol, lastRow, lastCol, formula, format._native);
579
+ }
580
+ addConditionalFormatIconSet(firstRow, firstCol, lastRow, lastCol, iconType) {
581
+ return this._native.addConditionalFormatIconSet(firstRow, firstCol, lastRow, lastCol, iconType);
582
+ }
583
+ setMargins(left, right, top, bottom, header, footer) {
584
+ return this._native.setMargins(left, right, top, bottom, header, footer);
585
+ }
586
+ setPortrait() {
587
+ return this._native.setPortrait();
588
+ }
589
+ setLandscape() {
590
+ return this._native.setLandscape();
591
+ }
592
+ setPaperSize(paperSize) {
593
+ return this._native.setPaperSize(paperSize);
594
+ }
595
+ setHeader(header) {
596
+ return this._native.setHeader(header);
597
+ }
598
+ setFooter(footer) {
599
+ return this._native.setFooter(footer);
600
+ }
601
+ setPrintArea(firstRow, firstCol, lastRow, lastCol) {
602
+ return this._native.setPrintArea(firstRow, firstCol, lastRow, lastCol);
603
+ }
604
+ setPrintGridlines(enable) {
605
+ return this._native.setPrintGridlines(enable);
606
+ }
607
+ setPrintCenterHorizontally(enable) {
608
+ return this._native.setPrintCenterHorizontally(enable);
609
+ }
610
+ setPrintCenterVertically(enable) {
611
+ return this._native.setPrintCenterVertically(enable);
612
+ }
613
+ setPrintFitToPages(width, height) {
614
+ return this._native.setPrintFitToPages(width, height);
615
+ }
616
+ setPrintScale(scale) {
617
+ return this._native.setPrintScale(scale);
618
+ }
619
+ setPrintFirstPageNumber(pageNumber) {
620
+ return this._native.setPrintFirstPageNumber(pageNumber);
621
+ }
622
+ setPrintBlackAndWhite(enable) {
623
+ return this._native.setPrintBlackAndWhite(enable);
624
+ }
625
+ setPrintDraft(enable) {
626
+ return this._native.setPrintDraft(enable);
627
+ }
628
+ setPrintHeadings(enable) {
629
+ return this._native.setPrintHeadings(enable);
630
+ }
631
+ setRepeatRows(firstRow, lastRow) {
632
+ return this._native.setRepeatRows(firstRow, lastRow);
633
+ }
634
+ setRepeatColumns(firstCol, lastCol) {
635
+ return this._native.setRepeatColumns(firstCol, lastCol);
636
+ }
637
+ setHeaderFooterScaleWithDoc(enable) {
638
+ return this._native.setHeaderFooterScaleWithDoc(enable);
639
+ }
640
+ setHeaderFooterAlignWithPage(enable) {
641
+ return this._native.setHeaderFooterAlignWithPage(enable);
642
+ }
643
+ insertChart(row, col, chart) {
644
+ return this._native.insertChart(row, col, chart._native);
645
+ }
646
+ insertChartWithOffset(row, col, chart, xOffset, yOffset) {
647
+ return this._native.insertChartWithOffset(row, col, chart._native, xOffset, yOffset);
648
+ }
649
+ insertImage(row, col, image) {
650
+ return this._native.insertImage(row, col, image._native);
651
+ }
652
+ insertImageWithOffset(row, col, image, xOffset, yOffset) {
653
+ return this._native.insertImageWithOffset(row, col, image._native, xOffset, yOffset);
654
+ }
655
+ insertImageFitToCell(row, col, image, keepAspectRatio = true) {
656
+ return this._native.insertImageFitToCell(row, col, image._native, keepAspectRatio);
657
+ }
658
+ insertImageFitToCellCentered(row, col, image) {
659
+ return this._native.insertImageFitToCellCentered(row, col, image._native);
660
+ }
661
+ addTable(firstRow, firstCol, lastRow, lastCol, table) {
662
+ return this._native.addTable(firstRow, firstCol, lastRow, lastCol, table._native);
663
+ }
664
+ addSparkline(row, col, sparkline) {
665
+ return this._native.addSparkline(row, col, sparkline._native);
666
+ }
667
+ addSparklineGroup(firstRow, firstCol, lastRow, lastCol, sparkline) {
668
+ return this._native.addSparklineGroup(firstRow, firstCol, lastRow, lastCol, sparkline._native);
669
+ }
670
+ setTabColor(color) {
671
+ return this._native.setTabColor(color);
672
+ }
673
+ setHidden(enable) {
674
+ return this._native.setHidden(enable);
675
+ }
676
+ setZoom(zoom) {
677
+ return this._native.setZoom(zoom);
678
+ }
679
+ setHiddenZeroes(enable) {
680
+ return this._native.setHiddenZeroes(enable);
681
+ }
682
+ setSelection(firstRow, firstCol, lastRow, lastCol) {
683
+ return this._native.setSelection(firstRow, firstCol, lastRow, lastCol);
684
+ }
685
+ setTopLeftCell(row, col) {
686
+ return this._native.setTopLeftCell(row, col);
687
+ }
688
+ protect() {
689
+ return this._native.protect();
690
+ }
691
+ protectWithPassword(password) {
692
+ return this._native.protectWithPassword(password);
693
+ }
694
+ protectWithOptions(options) {
695
+ return this._native.protectWithOptions(options._native);
696
+ }
697
+ protectWithPasswordAndOptions(password, options) {
698
+ return this._native.protectWithPasswordAndOptions(password, options._native);
699
+ }
700
+ writeRichString(row, col, richText) {
701
+ return this._native.writeRichString(row, col, richText._segments);
702
+ }
703
+ writeRichStringWithFormat(row, col, richText, cellFormat) {
704
+ return this._native.writeRichStringWithFormat(row, col, richText._segments, cellFormat._native);
705
+ }
706
+ insertButton(row, col, button) {
707
+ return this._native.insertButton(row, col, button._native);
708
+ }
709
+ insertButtonWithOffset(row, col, button, xOffset, yOffset) {
710
+ return this._native.insertButtonWithOffset(row, col, button._native, xOffset, yOffset);
711
+ }
712
+ insertShape(row, col, shape) {
713
+ return this._native.insertShape(row, col, shape._native);
714
+ }
715
+ insertShapeWithOffset(row, col, shape, xOffset, yOffset) {
716
+ return this._native.insertShapeWithOffset(row, col, shape._native, xOffset, yOffset);
717
+ }
718
+ };
719
+ var Chart = class {
720
+ _native;
721
+ constructor(chartType) {
722
+ this._native = new index_js.RuscChart(chartType);
723
+ }
724
+ addSeries(options) {
725
+ const { categories, values, name } = options;
726
+ return this._native.addSeries(categories || null, values, name || null);
727
+ }
728
+ setTitle(title) {
729
+ this._native.setTitle(title);
730
+ return this;
731
+ }
732
+ setXAxisName(name) {
733
+ this._native.setXAxisName(name);
734
+ return this;
735
+ }
736
+ setYAxisName(name) {
737
+ this._native.setYAxisName(name);
738
+ return this;
739
+ }
740
+ setStyle(style) {
741
+ this._native.setStyle(style);
742
+ return this;
743
+ }
744
+ setLegendHidden() {
745
+ this._native.setLegendHidden();
746
+ return this;
747
+ }
748
+ };
749
+ var Table = class {
750
+ _native;
751
+ constructor() {
752
+ this._native = index_js.RuscTable.new();
753
+ }
754
+ setHeaderRow(show) {
755
+ this._native.setHeaderRow(show);
756
+ return this;
757
+ }
758
+ setTotalRow(show) {
759
+ this._native.setTotalRow(show);
760
+ return this;
761
+ }
762
+ setBandedRows(show) {
763
+ this._native.setBandedRows(show);
764
+ return this;
765
+ }
766
+ setBandedColumns(show) {
767
+ this._native.setBandedColumns(show);
768
+ return this;
769
+ }
770
+ setFirstColumn(show) {
771
+ this._native.setFirstColumn(show);
772
+ return this;
773
+ }
774
+ setLastColumn(show) {
775
+ this._native.setLastColumn(show);
776
+ return this;
777
+ }
778
+ setName(name) {
779
+ this._native.setName(name);
780
+ return this;
781
+ }
782
+ setAltText(altText) {
783
+ this._native.setAltText(altText);
784
+ return this;
785
+ }
786
+ setAltTextTitle(title) {
787
+ this._native.setAltTextTitle(title);
788
+ return this;
789
+ }
790
+ setStyle(styleId) {
791
+ this._native.setStyle(styleId);
792
+ return this;
793
+ }
794
+ setColumns(columns) {
795
+ const nativeColumns = columns.map((col) => col._native);
796
+ this._native.setColumns(nativeColumns);
797
+ return this;
798
+ }
799
+ };
800
+ var TableColumn = class {
801
+ _native;
802
+ constructor() {
803
+ this._native = index_js.RuscTableColumn.new();
804
+ }
805
+ setHeader(header) {
806
+ this._native.setHeader(header);
807
+ return this;
808
+ }
809
+ setTotalFunction(func) {
810
+ this._native.setTotalFunction(func);
811
+ return this;
812
+ }
813
+ setTotalLabel(label) {
814
+ this._native.setTotalLabel(label);
815
+ return this;
816
+ }
817
+ setFormula(formula) {
818
+ this._native.setFormula(formula);
819
+ return this;
820
+ }
821
+ };
822
+ var Sparkline = class {
823
+ _native;
824
+ constructor() {
825
+ this._native = index_js.RuscSparkline.new();
826
+ }
827
+ setRange(range) {
828
+ this._native.setRange(range);
829
+ return this;
830
+ }
831
+ setType(type) {
832
+ this._native.setType(type);
833
+ return this;
834
+ }
835
+ showHighPoint(enable) {
836
+ this._native.showHighPoint(enable);
837
+ return this;
838
+ }
839
+ showLowPoint(enable) {
840
+ this._native.showLowPoint(enable);
841
+ return this;
842
+ }
843
+ showFirstPoint(enable) {
844
+ this._native.showFirstPoint(enable);
845
+ return this;
846
+ }
847
+ showLastPoint(enable) {
848
+ this._native.showLastPoint(enable);
849
+ return this;
850
+ }
851
+ showNegativePoints(enable) {
852
+ this._native.showNegativePoints(enable);
853
+ return this;
854
+ }
855
+ showMarkers(enable) {
856
+ this._native.showMarkers(enable);
857
+ return this;
858
+ }
859
+ showAxis(enable) {
860
+ this._native.showAxis(enable);
861
+ return this;
862
+ }
863
+ showHiddenData(enable) {
864
+ this._native.showHiddenData(enable);
865
+ return this;
866
+ }
867
+ setRightToLeft(enable) {
868
+ this._native.setRightToLeft(enable);
869
+ return this;
870
+ }
871
+ setSparklineColor(color) {
872
+ this._native.setSparklineColor(color);
873
+ return this;
874
+ }
875
+ setHighPointColor(color) {
876
+ this._native.setHighPointColor(color);
877
+ return this;
878
+ }
879
+ setLowPointColor(color) {
880
+ this._native.setLowPointColor(color);
881
+ return this;
882
+ }
883
+ setFirstPointColor(color) {
884
+ this._native.setFirstPointColor(color);
885
+ return this;
886
+ }
887
+ setLastPointColor(color) {
888
+ this._native.setLastPointColor(color);
889
+ return this;
890
+ }
891
+ setNegativePointsColor(color) {
892
+ this._native.setNegativePointsColor(color);
893
+ return this;
894
+ }
895
+ setMarkersColor(color) {
896
+ this._native.setMarkersColor(color);
897
+ return this;
898
+ }
899
+ setLineWeight(weight) {
900
+ this._native.setLineWeight(weight);
901
+ return this;
902
+ }
903
+ setCustomMax(max) {
904
+ this._native.setCustomMax(max);
905
+ return this;
906
+ }
907
+ setCustomMin(min) {
908
+ this._native.setCustomMin(min);
909
+ return this;
910
+ }
911
+ setGroupMax(enable) {
912
+ this._native.setGroupMax(enable);
913
+ return this;
914
+ }
915
+ setGroupMin(enable) {
916
+ this._native.setGroupMin(enable);
917
+ return this;
918
+ }
919
+ setStyle(style) {
920
+ this._native.setStyle(style);
921
+ return this;
922
+ }
923
+ showEmptyCellsAs(option) {
924
+ this._native.showEmptyCellsAs(option);
925
+ return this;
926
+ }
927
+ };
928
+ var DocProperties = class {
929
+ _native;
930
+ constructor() {
931
+ this._native = index_js.RuscDocProperties.new();
932
+ }
933
+ setAuthor(author) {
934
+ this._native.setAuthor(author);
935
+ return this;
936
+ }
937
+ setTitle(title) {
938
+ this._native.setTitle(title);
939
+ return this;
940
+ }
941
+ setSubject(subject) {
942
+ this._native.setSubject(subject);
943
+ return this;
944
+ }
945
+ setComment(comment) {
946
+ this._native.setComment(comment);
947
+ return this;
948
+ }
949
+ setCompany(company) {
950
+ this._native.setCompany(company);
951
+ return this;
952
+ }
953
+ setManager(manager) {
954
+ this._native.setManager(manager);
955
+ return this;
956
+ }
957
+ setStatus(status) {
958
+ this._native.setStatus(status);
959
+ return this;
960
+ }
961
+ setCategory(category) {
962
+ this._native.setCategory(category);
963
+ return this;
964
+ }
965
+ setKeywords(keywords) {
966
+ this._native.setKeywords(keywords);
967
+ return this;
968
+ }
969
+ setHyperlinkBase(base) {
970
+ this._native.setHyperlinkBase(base);
971
+ return this;
972
+ }
973
+ };
974
+ var Button = class {
975
+ _native;
976
+ constructor() {
977
+ this._native = index_js.RuscButton.new();
978
+ }
979
+ setCaption(caption) {
980
+ this._native.setCaption(caption);
981
+ return this;
982
+ }
983
+ setMacro(macroName) {
984
+ this._native.setMacro(macroName);
985
+ return this;
986
+ }
987
+ setWidth(width) {
988
+ this._native.setWidth(width);
989
+ return this;
990
+ }
991
+ setHeight(height) {
992
+ this._native.setHeight(height);
993
+ return this;
994
+ }
995
+ setAltText(altText) {
996
+ this._native.setAltText(altText);
997
+ return this;
998
+ }
999
+ setObjectMovement(option) {
1000
+ this._native.setObjectMovement(option);
1001
+ return this;
1002
+ }
1003
+ };
1004
+ var Shape = class Shape {
1005
+ _native;
1006
+ constructor(native) {
1007
+ this._native = native;
1008
+ }
1009
+ static textbox() {
1010
+ return new Shape(index_js.RuscShape.textbox());
1011
+ }
1012
+ setText(text) {
1013
+ this._native.setText(text);
1014
+ return this;
1015
+ }
1016
+ setWidth(width) {
1017
+ this._native.setWidth(width);
1018
+ return this;
1019
+ }
1020
+ setHeight(height) {
1021
+ this._native.setHeight(height);
1022
+ return this;
1023
+ }
1024
+ setAltText(altText) {
1025
+ this._native.setAltText(altText);
1026
+ return this;
1027
+ }
1028
+ setObjectMovement(option) {
1029
+ this._native.setObjectMovement(option);
1030
+ return this;
1031
+ }
1032
+ };
1033
+ var Workbook = class {
1034
+ _native;
1035
+ constructor() {
1036
+ this._native = new index_js.RuscWorkbook();
1037
+ }
1038
+ addWorksheet(name) {
1039
+ return new Worksheet(this._native.addWorksheet(name));
1040
+ }
1041
+ addWorksheetWithConstantMemory(name) {
1042
+ return new Worksheet(this._native.addWorksheetWithConstantMemory(name));
1043
+ }
1044
+ addWorksheetWithLowMemory(name) {
1045
+ return new Worksheet(this._native.addWorksheetWithLowMemory(name));
1046
+ }
1047
+ setTempdir(dir) {
1048
+ return this._native.setTempdir(dir);
1049
+ }
1050
+ setDefaultFormat(format, rowHeight, columnWidth) {
1051
+ return this._native.setDefaultFormat(format._native, rowHeight, columnWidth);
1052
+ }
1053
+ useExcel2023Theme() {
1054
+ return this._native.useExcel2023Theme();
1055
+ }
1056
+ setZipCompressionLevel(level) {
1057
+ return this._native.setZipCompressionLevel(level);
1058
+ }
1059
+ setCalculationMode(mode) {
1060
+ return this._native.setCalculationMode(mode);
1061
+ }
1062
+ setTabRatio(ratio) {
1063
+ return this._native.setTabRatio(ratio);
1064
+ }
1065
+ useCustomTheme(path) {
1066
+ return this._native.useCustomTheme(path);
1067
+ }
1068
+ save(filename) {
1069
+ return this._native.save(filename);
1070
+ }
1071
+ saveToBuffer() {
1072
+ return this._native.saveToBuffer();
1073
+ }
1074
+ async saveToStream(writable) {
1075
+ const tmpFile = (0, node_path.join)(node_os.default.tmpdir(), `rusc-xlsx-${(0, node_crypto.randomBytes)(8).toString("hex")}.xlsx`);
1076
+ let operationError;
1077
+ try {
1078
+ this._native.save(tmpFile);
1079
+ await (0, node_stream_promises.pipeline)(node_fs.default.createReadStream(tmpFile), writable);
1080
+ } catch (error) {
1081
+ operationError = error;
1082
+ }
1083
+ try {
1084
+ await node_fs.default.promises.unlink(tmpFile);
1085
+ } catch (cleanupError) {
1086
+ if (!isErrnoException(cleanupError) || cleanupError.code !== "ENOENT") {
1087
+ if (operationError) throw new AggregateError([operationError, cleanupError], "Failed to save workbook to stream and remove the temporary file", { cause: cleanupError });
1088
+ throw cleanupError;
1089
+ }
1090
+ }
1091
+ if (operationError) throw operationError;
1092
+ }
1093
+ defineName(name, formula) {
1094
+ return this._native.defineName(name, formula);
1095
+ }
1096
+ readOnlyRecommended() {
1097
+ return this._native.readOnlyRecommended();
1098
+ }
1099
+ addVbaProject(path) {
1100
+ return this._native.addVbaProject(path);
1101
+ }
1102
+ setProperties(properties) {
1103
+ return this._native.setProperties(properties._native);
1104
+ }
1105
+ };
1106
+ exports.Button = Button;
1107
+ exports.Chart = Chart;
1108
+ exports.DataValidation = DataValidation;
1109
+ exports.DocProperties = DocProperties;
1110
+ exports.Format = Format;
1111
+ exports.Formula = Formula;
1112
+ exports.Image = Image;
1113
+ exports.Note = Note;
1114
+ exports.ProtectionOptions = ProtectionOptions;
1115
+ exports.RichText = RichText;
1116
+ Object.defineProperty(exports, "RuscButton", {
1117
+ enumerable: true,
1118
+ get: function() {
1119
+ return index_js.RuscButton;
1120
+ }
1121
+ });
1122
+ Object.defineProperty(exports, "RuscChart", {
1123
+ enumerable: true,
1124
+ get: function() {
1125
+ return index_js.RuscChart;
1126
+ }
1127
+ });
1128
+ Object.defineProperty(exports, "RuscDataValidation", {
1129
+ enumerable: true,
1130
+ get: function() {
1131
+ return index_js.RuscDataValidation;
1132
+ }
1133
+ });
1134
+ Object.defineProperty(exports, "RuscDocProperties", {
1135
+ enumerable: true,
1136
+ get: function() {
1137
+ return index_js.RuscDocProperties;
1138
+ }
1139
+ });
1140
+ Object.defineProperty(exports, "RuscFormat", {
1141
+ enumerable: true,
1142
+ get: function() {
1143
+ return index_js.RuscFormat;
1144
+ }
1145
+ });
1146
+ Object.defineProperty(exports, "RuscFormula", {
1147
+ enumerable: true,
1148
+ get: function() {
1149
+ return index_js.RuscFormula;
1150
+ }
1151
+ });
1152
+ Object.defineProperty(exports, "RuscImage", {
1153
+ enumerable: true,
1154
+ get: function() {
1155
+ return index_js.RuscImage;
1156
+ }
1157
+ });
1158
+ Object.defineProperty(exports, "RuscNote", {
1159
+ enumerable: true,
1160
+ get: function() {
1161
+ return index_js.RuscNote;
1162
+ }
1163
+ });
1164
+ Object.defineProperty(exports, "RuscProtectionOptions", {
1165
+ enumerable: true,
1166
+ get: function() {
1167
+ return index_js.RuscProtectionOptions;
1168
+ }
1169
+ });
1170
+ Object.defineProperty(exports, "RuscRichText", {
1171
+ enumerable: true,
1172
+ get: function() {
1173
+ return index_js.RuscRichText;
1174
+ }
1175
+ });
1176
+ Object.defineProperty(exports, "RuscShape", {
1177
+ enumerable: true,
1178
+ get: function() {
1179
+ return index_js.RuscShape;
1180
+ }
1181
+ });
1182
+ Object.defineProperty(exports, "RuscSparkline", {
1183
+ enumerable: true,
1184
+ get: function() {
1185
+ return index_js.RuscSparkline;
1186
+ }
1187
+ });
1188
+ Object.defineProperty(exports, "RuscTable", {
1189
+ enumerable: true,
1190
+ get: function() {
1191
+ return index_js.RuscTable;
1192
+ }
1193
+ });
1194
+ Object.defineProperty(exports, "RuscTableColumn", {
1195
+ enumerable: true,
1196
+ get: function() {
1197
+ return index_js.RuscTableColumn;
1198
+ }
1199
+ });
1200
+ Object.defineProperty(exports, "RuscWorkbook", {
1201
+ enumerable: true,
1202
+ get: function() {
1203
+ return index_js.RuscWorkbook;
1204
+ }
1205
+ });
1206
+ Object.defineProperty(exports, "RuscWorksheet", {
1207
+ enumerable: true,
1208
+ get: function() {
1209
+ return index_js.RuscWorksheet;
1210
+ }
1211
+ });
1212
+ exports.Shape = Shape;
1213
+ exports.Sparkline = Sparkline;
1214
+ exports.Table = Table;
1215
+ exports.TableColumn = TableColumn;
1216
+ exports.Workbook = Workbook;
1217
+ exports.Worksheet = Worksheet;
1218
+ Object.defineProperty(exports, "rustMemoryResetPeak", {
1219
+ enumerable: true,
1220
+ get: function() {
1221
+ return index_js.rustMemoryResetPeak;
1222
+ }
1223
+ });
1224
+ Object.defineProperty(exports, "rustMemoryStats", {
1225
+ enumerable: true,
1226
+ get: function() {
1227
+ return index_js.rustMemoryStats;
1228
+ }
1229
+ });