@nazarkalytiuk/rusc-xlsx 1.0.3

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