@nazarkalytiuk/rusc-xlsx 2.1.0 → 2.3.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.
package/index.d.ts CHANGED
@@ -187,6 +187,13 @@ export declare class RuscFormat {
187
187
  setQuotePrefix(): void
188
188
  }
189
189
 
190
+ /**
191
+ * A formula for the native formula writers.
192
+ *
193
+ * @deprecated Pass a `RuscFormulaData` object instead. An instance keeps its Rust
194
+ * memory until its finalizer runs after the event loop turns, so instances
195
+ * created in a synchronous loop accumulate.
196
+ */
190
197
  export declare class RuscFormula {
191
198
  /** Create a new formula */
192
199
  constructor(formula: string)
@@ -281,7 +288,13 @@ export declare class RuscProtectionOptions {
281
288
  setContents(allow: boolean): this
282
289
  }
283
290
 
284
- /** Wrapper for rich text strings (multi-format text in a single cell) */
291
+ /**
292
+ * Wrapper for rich text strings (multi-format text in a single cell)
293
+ *
294
+ * @deprecated Pass `[text, format]` segments to `RuscWorksheet.writeRichString`
295
+ * instead. An instance keeps its Rust memory until its finalizer runs after the
296
+ * event loop turns, so instances created in a synchronous loop accumulate.
297
+ */
285
298
  export declare class RuscRichText {
286
299
  /** Create a new empty rich text string */
287
300
  constructor()
@@ -511,10 +524,22 @@ export declare class RuscWorksheet {
511
524
  writeBoolean(row: number, col: number, value: boolean): void
512
525
  /** Write a blank cell with formatting */
513
526
  writeBlank(row: number, col: number, format: RuscFormat): void
514
- /** Write a rich text string (multi-format text) to a cell */
515
- writeRichString(row: number, col: number, richText: RuscRichText): void
516
- /** Write a rich text string with an additional cell format */
517
- writeRichStringWithFormat(row: number, col: number, richText: RuscRichText, cellFormat: RuscFormat): void
527
+ /**
528
+ * Write a rich text string (multi-format text) to a cell.
529
+ *
530
+ * `richText` is `[text, format]` segments, or a deprecated `RuscRichText`; a
531
+ * segment without a format uses the default cell font. Segments are plain data,
532
+ * so nothing outlives the call. Empty segments are skipped, and a rich string
533
+ * whose segments are all empty leaves the cell untouched.
534
+ */
535
+ writeRichString(row: number, col: number, richText: RuscRichText | Array<[string, RuscFormat | undefined | null]>): void
536
+ /**
537
+ * Write a rich text string with an additional cell format.
538
+ *
539
+ * `richText` is as for `writeRichString`. A rich string whose segments are all
540
+ * empty writes a blank cell with the cell format.
541
+ */
542
+ writeRichStringWithFormat(row: number, col: number, richText: RuscRichText | Array<[string, RuscFormat | undefined | null]>, cellFormat: RuscFormat): void
518
543
  /** Write a datetime from a Unix timestamp (seconds since 1970-01-01 UTC) */
519
544
  writeDatetimeFromTimestamp(row: number, col: number, timestamp: number, format?: RuscFormat | undefined | null): void
520
545
  /** Write a datetime from year, month, day components */
@@ -551,11 +576,11 @@ export declare class RuscWorksheet {
551
576
  /** Set the default author name for all notes in the worksheet */
552
577
  setDefaultNoteAuthor(name: string): void
553
578
  /** Write a formula to a cell */
554
- writeFormula(row: number, col: number, formula: RuscFormula, format?: RuscFormat | undefined | null): void
579
+ writeFormula(row: number, col: number, formula: RuscFormula | RuscFormulaData, format?: RuscFormat | undefined | null): void
555
580
  /** Write a dynamic array formula to a cell (Excel 365) */
556
- writeDynamicFormula(row: number, col: number, formula: RuscFormula, format?: RuscFormat | undefined | null): void
581
+ writeDynamicFormula(row: number, col: number, formula: RuscFormula | RuscFormulaData, format?: RuscFormat | undefined | null): void
557
582
  /** Write an array formula to a range of cells */
558
- writeArrayFormula(firstRow: number, firstCol: number, lastRow: number, lastCol: number, formula: RuscFormula, format?: RuscFormat | undefined | null): void
583
+ writeArrayFormula(firstRow: number, firstCol: number, lastRow: number, lastCol: number, formula: RuscFormula | RuscFormulaData, format?: RuscFormat | undefined | null): void
559
584
  /** Add data validation to a cell or range */
560
585
  addDataValidation(firstRow: number, firstCol: number, lastRow: number, lastCol: number, validation: RuscDataValidation): void
561
586
  /** Write a URL to a cell */
@@ -683,6 +708,18 @@ export declare class RuscWorksheet {
683
708
  insertShapeWithOffset(row: number, col: number, shape: RuscShape, xOffset: number, yOffset: number): void
684
709
  }
685
710
 
711
+ /**
712
+ * The data of a JavaScript `Formula`: the formula text and, for applications
713
+ * that don't recalculate, its cached result.
714
+ *
715
+ * It is plain data rather than a class so that a formula written per row owns no
716
+ * Rust memory between writes.
717
+ */
718
+ export interface RuscFormulaData {
719
+ formula: string
720
+ result?: string
721
+ }
722
+
686
723
  /**
687
724
  * Resets peak memory tracking to the current allocation level.
688
725
  * Call before a section you want to measure.
package/index.js CHANGED
@@ -94,8 +94,8 @@ function requireNative() {
94
94
  try {
95
95
  const binding = require('@nazarkalytiuk/rusc-xlsx-android-arm64')
96
96
  const bindingPackageVersion = require('@nazarkalytiuk/rusc-xlsx-android-arm64/package.json').version
97
- if (bindingPackageVersion !== '2.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
98
- throw new Error(`Native binding package version mismatch, expected 2.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
97
+ if (bindingPackageVersion !== '2.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
98
+ throw new Error(`Native binding package version mismatch, expected 2.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
99
99
  }
100
100
  return binding
101
101
  } catch (e) {
@@ -110,8 +110,8 @@ function requireNative() {
110
110
  try {
111
111
  const binding = require('@nazarkalytiuk/rusc-xlsx-android-arm-eabi')
112
112
  const bindingPackageVersion = require('@nazarkalytiuk/rusc-xlsx-android-arm-eabi/package.json').version
113
- if (bindingPackageVersion !== '2.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
114
- throw new Error(`Native binding package version mismatch, expected 2.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
113
+ if (bindingPackageVersion !== '2.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
114
+ throw new Error(`Native binding package version mismatch, expected 2.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
115
115
  }
116
116
  return binding
117
117
  } catch (e) {
@@ -131,8 +131,8 @@ function requireNative() {
131
131
  try {
132
132
  const binding = require('@nazarkalytiuk/rusc-xlsx-win32-x64-gnu')
133
133
  const bindingPackageVersion = require('@nazarkalytiuk/rusc-xlsx-win32-x64-gnu/package.json').version
134
- if (bindingPackageVersion !== '2.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
135
- throw new Error(`Native binding package version mismatch, expected 2.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
134
+ if (bindingPackageVersion !== '2.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
135
+ throw new Error(`Native binding package version mismatch, expected 2.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
136
136
  }
137
137
  return binding
138
138
  } catch (e) {
@@ -147,8 +147,8 @@ function requireNative() {
147
147
  try {
148
148
  const binding = require('@nazarkalytiuk/rusc-xlsx-win32-x64-msvc')
149
149
  const bindingPackageVersion = require('@nazarkalytiuk/rusc-xlsx-win32-x64-msvc/package.json').version
150
- if (bindingPackageVersion !== '2.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
151
- throw new Error(`Native binding package version mismatch, expected 2.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
150
+ if (bindingPackageVersion !== '2.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
151
+ throw new Error(`Native binding package version mismatch, expected 2.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
152
152
  }
153
153
  return binding
154
154
  } catch (e) {
@@ -164,8 +164,8 @@ function requireNative() {
164
164
  try {
165
165
  const binding = require('@nazarkalytiuk/rusc-xlsx-win32-ia32-msvc')
166
166
  const bindingPackageVersion = require('@nazarkalytiuk/rusc-xlsx-win32-ia32-msvc/package.json').version
167
- if (bindingPackageVersion !== '2.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
168
- throw new Error(`Native binding package version mismatch, expected 2.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
167
+ if (bindingPackageVersion !== '2.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
168
+ throw new Error(`Native binding package version mismatch, expected 2.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
169
169
  }
170
170
  return binding
171
171
  } catch (e) {
@@ -180,8 +180,8 @@ function requireNative() {
180
180
  try {
181
181
  const binding = require('@nazarkalytiuk/rusc-xlsx-win32-arm64-msvc')
182
182
  const bindingPackageVersion = require('@nazarkalytiuk/rusc-xlsx-win32-arm64-msvc/package.json').version
183
- if (bindingPackageVersion !== '2.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
184
- throw new Error(`Native binding package version mismatch, expected 2.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
183
+ if (bindingPackageVersion !== '2.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
184
+ throw new Error(`Native binding package version mismatch, expected 2.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
185
185
  }
186
186
  return binding
187
187
  } catch (e) {
@@ -199,8 +199,8 @@ function requireNative() {
199
199
  try {
200
200
  const binding = require('@nazarkalytiuk/rusc-xlsx-darwin-universal')
201
201
  const bindingPackageVersion = require('@nazarkalytiuk/rusc-xlsx-darwin-universal/package.json').version
202
- if (bindingPackageVersion !== '2.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
203
- throw new Error(`Native binding package version mismatch, expected 2.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
202
+ if (bindingPackageVersion !== '2.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
203
+ throw new Error(`Native binding package version mismatch, expected 2.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
204
204
  }
205
205
  return binding
206
206
  } catch (e) {
@@ -215,8 +215,8 @@ function requireNative() {
215
215
  try {
216
216
  const binding = require('@nazarkalytiuk/rusc-xlsx-darwin-x64')
217
217
  const bindingPackageVersion = require('@nazarkalytiuk/rusc-xlsx-darwin-x64/package.json').version
218
- if (bindingPackageVersion !== '2.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
219
- throw new Error(`Native binding package version mismatch, expected 2.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
218
+ if (bindingPackageVersion !== '2.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
219
+ throw new Error(`Native binding package version mismatch, expected 2.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
220
220
  }
221
221
  return binding
222
222
  } catch (e) {
@@ -231,8 +231,8 @@ function requireNative() {
231
231
  try {
232
232
  const binding = require('@nazarkalytiuk/rusc-xlsx-darwin-arm64')
233
233
  const bindingPackageVersion = require('@nazarkalytiuk/rusc-xlsx-darwin-arm64/package.json').version
234
- if (bindingPackageVersion !== '2.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
235
- throw new Error(`Native binding package version mismatch, expected 2.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
234
+ if (bindingPackageVersion !== '2.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
235
+ throw new Error(`Native binding package version mismatch, expected 2.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
236
236
  }
237
237
  return binding
238
238
  } catch (e) {
@@ -251,8 +251,8 @@ function requireNative() {
251
251
  try {
252
252
  const binding = require('@nazarkalytiuk/rusc-xlsx-freebsd-x64')
253
253
  const bindingPackageVersion = require('@nazarkalytiuk/rusc-xlsx-freebsd-x64/package.json').version
254
- if (bindingPackageVersion !== '2.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
255
- throw new Error(`Native binding package version mismatch, expected 2.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
254
+ if (bindingPackageVersion !== '2.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
255
+ throw new Error(`Native binding package version mismatch, expected 2.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
256
256
  }
257
257
  return binding
258
258
  } catch (e) {
@@ -267,8 +267,8 @@ function requireNative() {
267
267
  try {
268
268
  const binding = require('@nazarkalytiuk/rusc-xlsx-freebsd-arm64')
269
269
  const bindingPackageVersion = require('@nazarkalytiuk/rusc-xlsx-freebsd-arm64/package.json').version
270
- if (bindingPackageVersion !== '2.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
271
- throw new Error(`Native binding package version mismatch, expected 2.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
270
+ if (bindingPackageVersion !== '2.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
271
+ throw new Error(`Native binding package version mismatch, expected 2.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
272
272
  }
273
273
  return binding
274
274
  } catch (e) {
@@ -283,8 +283,8 @@ function requireNative() {
283
283
  try {
284
284
  const binding = require('@nazarkalytiuk/rusc-xlsx-freebsd-ppc64')
285
285
  const bindingPackageVersion = require('@nazarkalytiuk/rusc-xlsx-freebsd-ppc64/package.json').version
286
- if (bindingPackageVersion !== '2.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
287
- throw new Error(`Native binding package version mismatch, expected 2.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
286
+ if (bindingPackageVersion !== '2.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
287
+ throw new Error(`Native binding package version mismatch, expected 2.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
288
288
  }
289
289
  return binding
290
290
  } catch (e) {
@@ -304,8 +304,8 @@ function requireNative() {
304
304
  try {
305
305
  const binding = require('@nazarkalytiuk/rusc-xlsx-linux-x64-musl')
306
306
  const bindingPackageVersion = require('@nazarkalytiuk/rusc-xlsx-linux-x64-musl/package.json').version
307
- if (bindingPackageVersion !== '2.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
308
- throw new Error(`Native binding package version mismatch, expected 2.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
307
+ if (bindingPackageVersion !== '2.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
308
+ throw new Error(`Native binding package version mismatch, expected 2.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
309
309
  }
310
310
  return binding
311
311
  } catch (e) {
@@ -320,8 +320,8 @@ function requireNative() {
320
320
  try {
321
321
  const binding = require('@nazarkalytiuk/rusc-xlsx-linux-x64-gnu')
322
322
  const bindingPackageVersion = require('@nazarkalytiuk/rusc-xlsx-linux-x64-gnu/package.json').version
323
- if (bindingPackageVersion !== '2.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
324
- throw new Error(`Native binding package version mismatch, expected 2.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
323
+ if (bindingPackageVersion !== '2.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
324
+ throw new Error(`Native binding package version mismatch, expected 2.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
325
325
  }
326
326
  return binding
327
327
  } catch (e) {
@@ -338,8 +338,8 @@ function requireNative() {
338
338
  try {
339
339
  const binding = require('@nazarkalytiuk/rusc-xlsx-linux-arm64-musl')
340
340
  const bindingPackageVersion = require('@nazarkalytiuk/rusc-xlsx-linux-arm64-musl/package.json').version
341
- if (bindingPackageVersion !== '2.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
342
- throw new Error(`Native binding package version mismatch, expected 2.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
341
+ if (bindingPackageVersion !== '2.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
342
+ throw new Error(`Native binding package version mismatch, expected 2.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
343
343
  }
344
344
  return binding
345
345
  } catch (e) {
@@ -354,8 +354,8 @@ function requireNative() {
354
354
  try {
355
355
  const binding = require('@nazarkalytiuk/rusc-xlsx-linux-arm64-gnu')
356
356
  const bindingPackageVersion = require('@nazarkalytiuk/rusc-xlsx-linux-arm64-gnu/package.json').version
357
- if (bindingPackageVersion !== '2.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
358
- throw new Error(`Native binding package version mismatch, expected 2.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
357
+ if (bindingPackageVersion !== '2.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
358
+ throw new Error(`Native binding package version mismatch, expected 2.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
359
359
  }
360
360
  return binding
361
361
  } catch (e) {
@@ -372,8 +372,8 @@ function requireNative() {
372
372
  try {
373
373
  const binding = require('@nazarkalytiuk/rusc-xlsx-linux-arm-musleabihf')
374
374
  const bindingPackageVersion = require('@nazarkalytiuk/rusc-xlsx-linux-arm-musleabihf/package.json').version
375
- if (bindingPackageVersion !== '2.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
376
- throw new Error(`Native binding package version mismatch, expected 2.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
375
+ if (bindingPackageVersion !== '2.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
376
+ throw new Error(`Native binding package version mismatch, expected 2.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
377
377
  }
378
378
  return binding
379
379
  } catch (e) {
@@ -388,8 +388,8 @@ function requireNative() {
388
388
  try {
389
389
  const binding = require('@nazarkalytiuk/rusc-xlsx-linux-arm-gnueabihf')
390
390
  const bindingPackageVersion = require('@nazarkalytiuk/rusc-xlsx-linux-arm-gnueabihf/package.json').version
391
- if (bindingPackageVersion !== '2.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
392
- throw new Error(`Native binding package version mismatch, expected 2.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
391
+ if (bindingPackageVersion !== '2.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
392
+ throw new Error(`Native binding package version mismatch, expected 2.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
393
393
  }
394
394
  return binding
395
395
  } catch (e) {
@@ -406,8 +406,8 @@ function requireNative() {
406
406
  try {
407
407
  const binding = require('@nazarkalytiuk/rusc-xlsx-linux-loong64-musl')
408
408
  const bindingPackageVersion = require('@nazarkalytiuk/rusc-xlsx-linux-loong64-musl/package.json').version
409
- if (bindingPackageVersion !== '2.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
410
- throw new Error(`Native binding package version mismatch, expected 2.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
409
+ if (bindingPackageVersion !== '2.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
410
+ throw new Error(`Native binding package version mismatch, expected 2.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
411
411
  }
412
412
  return binding
413
413
  } catch (e) {
@@ -422,8 +422,8 @@ function requireNative() {
422
422
  try {
423
423
  const binding = require('@nazarkalytiuk/rusc-xlsx-linux-loong64-gnu')
424
424
  const bindingPackageVersion = require('@nazarkalytiuk/rusc-xlsx-linux-loong64-gnu/package.json').version
425
- if (bindingPackageVersion !== '2.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
426
- throw new Error(`Native binding package version mismatch, expected 2.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
425
+ if (bindingPackageVersion !== '2.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
426
+ throw new Error(`Native binding package version mismatch, expected 2.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
427
427
  }
428
428
  return binding
429
429
  } catch (e) {
@@ -440,8 +440,8 @@ function requireNative() {
440
440
  try {
441
441
  const binding = require('@nazarkalytiuk/rusc-xlsx-linux-riscv64-musl')
442
442
  const bindingPackageVersion = require('@nazarkalytiuk/rusc-xlsx-linux-riscv64-musl/package.json').version
443
- if (bindingPackageVersion !== '2.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
444
- throw new Error(`Native binding package version mismatch, expected 2.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
443
+ if (bindingPackageVersion !== '2.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
444
+ throw new Error(`Native binding package version mismatch, expected 2.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
445
445
  }
446
446
  return binding
447
447
  } catch (e) {
@@ -456,8 +456,8 @@ function requireNative() {
456
456
  try {
457
457
  const binding = require('@nazarkalytiuk/rusc-xlsx-linux-riscv64-gnu')
458
458
  const bindingPackageVersion = require('@nazarkalytiuk/rusc-xlsx-linux-riscv64-gnu/package.json').version
459
- if (bindingPackageVersion !== '2.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
460
- throw new Error(`Native binding package version mismatch, expected 2.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
459
+ if (bindingPackageVersion !== '2.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
460
+ throw new Error(`Native binding package version mismatch, expected 2.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
461
461
  }
462
462
  return binding
463
463
  } catch (e) {
@@ -473,8 +473,8 @@ function requireNative() {
473
473
  try {
474
474
  const binding = require('@nazarkalytiuk/rusc-xlsx-linux-ppc64-gnu')
475
475
  const bindingPackageVersion = require('@nazarkalytiuk/rusc-xlsx-linux-ppc64-gnu/package.json').version
476
- if (bindingPackageVersion !== '2.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
477
- throw new Error(`Native binding package version mismatch, expected 2.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
476
+ if (bindingPackageVersion !== '2.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
477
+ throw new Error(`Native binding package version mismatch, expected 2.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
478
478
  }
479
479
  return binding
480
480
  } catch (e) {
@@ -489,8 +489,8 @@ function requireNative() {
489
489
  try {
490
490
  const binding = require('@nazarkalytiuk/rusc-xlsx-linux-s390x-gnu')
491
491
  const bindingPackageVersion = require('@nazarkalytiuk/rusc-xlsx-linux-s390x-gnu/package.json').version
492
- if (bindingPackageVersion !== '2.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
493
- throw new Error(`Native binding package version mismatch, expected 2.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
492
+ if (bindingPackageVersion !== '2.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
493
+ throw new Error(`Native binding package version mismatch, expected 2.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
494
494
  }
495
495
  return binding
496
496
  } catch (e) {
@@ -509,8 +509,8 @@ function requireNative() {
509
509
  try {
510
510
  const binding = require('@nazarkalytiuk/rusc-xlsx-openharmony-arm64')
511
511
  const bindingPackageVersion = require('@nazarkalytiuk/rusc-xlsx-openharmony-arm64/package.json').version
512
- if (bindingPackageVersion !== '2.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
513
- throw new Error(`Native binding package version mismatch, expected 2.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
512
+ if (bindingPackageVersion !== '2.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
513
+ throw new Error(`Native binding package version mismatch, expected 2.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
514
514
  }
515
515
  return binding
516
516
  } catch (e) {
@@ -525,8 +525,8 @@ function requireNative() {
525
525
  try {
526
526
  const binding = require('@nazarkalytiuk/rusc-xlsx-openharmony-x64')
527
527
  const bindingPackageVersion = require('@nazarkalytiuk/rusc-xlsx-openharmony-x64/package.json').version
528
- if (bindingPackageVersion !== '2.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
529
- throw new Error(`Native binding package version mismatch, expected 2.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
528
+ if (bindingPackageVersion !== '2.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
529
+ throw new Error(`Native binding package version mismatch, expected 2.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
530
530
  }
531
531
  return binding
532
532
  } catch (e) {
@@ -541,8 +541,8 @@ function requireNative() {
541
541
  try {
542
542
  const binding = require('@nazarkalytiuk/rusc-xlsx-openharmony-arm')
543
543
  const bindingPackageVersion = require('@nazarkalytiuk/rusc-xlsx-openharmony-arm/package.json').version
544
- if (bindingPackageVersion !== '2.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
545
- throw new Error(`Native binding package version mismatch, expected 2.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
544
+ if (bindingPackageVersion !== '2.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
545
+ throw new Error(`Native binding package version mismatch, expected 2.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
546
546
  }
547
547
  return binding
548
548
  } catch (e) {
@@ -683,8 +683,8 @@ if (!nativeBinding || forceWasi) {
683
683
  if (!candidateFailed) {
684
684
  if (process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
685
685
  const bindingPackageVersion = require('@nazarkalytiuk/rusc-xlsx-wasm32-wasi/package.json').version
686
- if (bindingPackageVersion !== '2.0.0') {
687
- throw new Error(`WASI binding package version mismatch, expected 2.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
686
+ if (bindingPackageVersion !== '2.3.0') {
687
+ throw new Error(`WASI binding package version mismatch, expected 2.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
688
688
  }
689
689
  }
690
690
  wasiBinding = require('@nazarkalytiuk/rusc-xlsx-wasm32-wasi')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nazarkalytiuk/rusc-xlsx",
3
- "version": "2.1.0",
3
+ "version": "2.3.0",
4
4
  "description": "Fast Excel XLSX library for Node.js powered by rust_xlsxwriter",
5
5
  "type": "commonjs",
6
6
  "main": "wrapper.js",
@@ -18,7 +18,8 @@
18
18
  "universal-apple-darwin",
19
19
  "x86_64-unknown-linux-gnu",
20
20
  "aarch64-unknown-linux-gnu",
21
- "x86_64-unknown-linux-musl"
21
+ "x86_64-unknown-linux-musl",
22
+ "aarch64-unknown-linux-musl"
22
23
  ],
23
24
  "darwin": {
24
25
  "universal": {
@@ -98,12 +99,13 @@
98
99
  "access": "public"
99
100
  },
100
101
  "optionalDependencies": {
101
- "@nazarkalytiuk/rusc-xlsx-win32-x64-msvc": "2.1.0",
102
- "@nazarkalytiuk/rusc-xlsx-win32-ia32-msvc": "2.1.0",
103
- "@nazarkalytiuk/rusc-xlsx-win32-arm64-msvc": "2.1.0",
104
- "@nazarkalytiuk/rusc-xlsx-darwin-universal": "2.1.0",
105
- "@nazarkalytiuk/rusc-xlsx-linux-x64-gnu": "2.1.0",
106
- "@nazarkalytiuk/rusc-xlsx-linux-arm64-gnu": "2.1.0",
107
- "@nazarkalytiuk/rusc-xlsx-linux-x64-musl": "2.1.0"
102
+ "@nazarkalytiuk/rusc-xlsx-win32-x64-msvc": "2.3.0",
103
+ "@nazarkalytiuk/rusc-xlsx-win32-ia32-msvc": "2.3.0",
104
+ "@nazarkalytiuk/rusc-xlsx-win32-arm64-msvc": "2.3.0",
105
+ "@nazarkalytiuk/rusc-xlsx-darwin-universal": "2.3.0",
106
+ "@nazarkalytiuk/rusc-xlsx-linux-x64-gnu": "2.3.0",
107
+ "@nazarkalytiuk/rusc-xlsx-linux-arm64-gnu": "2.3.0",
108
+ "@nazarkalytiuk/rusc-xlsx-linux-x64-musl": "2.3.0",
109
+ "@nazarkalytiuk/rusc-xlsx-linux-arm64-musl": "2.3.0"
108
110
  }
109
111
  }
package/wrapper.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Writable } from "node:stream";
2
- import { RuscButton, RuscChart, RuscDataValidation, RuscDocProperties, RuscFormat, RuscFormula, RuscImage, RuscNote, RuscProtectionOptions, RuscRichText, RuscShape, RuscSparkline, RuscTable, RuscTableColumn, RuscWorkbook, RuscWorksheet, rustMemoryResetPeak, rustMemoryStats } from "./index.js";
2
+ import { RuscButton, RuscChart, RuscDataValidation, RuscDocProperties, RuscFormat, RuscFormula, RuscFormulaData, RuscImage, RuscNote, RuscProtectionOptions, RuscRichText, RuscShape, RuscSparkline, RuscTable, RuscTableColumn, RuscWorkbook, RuscWorksheet, rustMemoryResetPeak, rustMemoryStats } from "./index.js";
3
3
  /** Color value - can be a named color or hex code */
4
4
  export type Color = "black" | "blue" | "brown" | "cyan" | "gray" | "green" | "lime" | "magenta" | "navy" | "orange" | "pink" | "purple" | "red" | "silver" | "white" | "yellow" | `#${string}`;
5
5
  /** Horizontal alignment options */
@@ -211,8 +211,11 @@ export declare class Note {
211
211
  * const formulaWithResult = new Formula('=2+2').setResult('4');
212
212
  */
213
213
  export declare class Formula {
214
- /** Internal native binding */
215
- _native: RuscFormula;
214
+ /**
215
+ * Internal formula data passed to the native writer. A `Formula` is plain
216
+ * JavaScript data, so creating one per row allocates no Rust memory.
217
+ */
218
+ readonly _data: RuscFormulaData;
216
219
  /**
217
220
  * Create a new formula
218
221
  * @param formula - Excel formula string (e.g., '=SUM(A1:A10)')
@@ -536,14 +539,18 @@ export declare class Image {
536
539
  * worksheet.writeRichString(0, 0, richText);
537
540
  */
538
541
  export declare class RichText {
539
- /** Internal native binding */
540
- _native: RuscRichText;
541
- /** Create a new empty rich text string */
542
- constructor();
543
542
  /**
544
- * Add a text segment with formatting
543
+ * Internal `[text, format]` segments passed to the native writer. A
544
+ * `RichText` is plain JavaScript data, so creating one per row allocates no
545
+ * Rust memory.
546
+ */
547
+ readonly _segments: [text: string, format: RuscFormat | undefined][];
548
+ /**
549
+ * Add a text segment with formatting. The format is read when the rich text
550
+ * is written, as the format of any other write is.
545
551
  * @param text - The text content
546
- * @param format - Optional format to apply to this segment
552
+ * @param format - Optional format to apply to this segment; without one the
553
+ * segment uses the default cell font
547
554
  * @returns this for method chaining
548
555
  * @example
549
556
  * richText.addSegment('Hello ', normalFormat)
@@ -808,29 +815,33 @@ export declare class Worksheet {
808
815
  * Write a formula to a cell
809
816
  * @param row - Row number (0-indexed)
810
817
  * @param col - Column number (0-indexed)
811
- * @param formula - Formula object
818
+ * @param formula - Formula object or formula string (e.g., '=SUM(A1:A10)')
812
819
  * @param format - Optional format to apply
820
+ * @example
821
+ * worksheet.writeFormula(0, 2, '=A1+B1');
822
+ * worksheet.writeFormula(1, 2, new Formula('=A2+B2').setResult('42'));
813
823
  */
814
- writeFormula(row: number, col: number, formula: Formula, format?: Format): void;
824
+ writeFormula(row: number, col: number, formula: Formula | string, format?: Format): void;
815
825
  /**
816
826
  * Write a dynamic array formula to a cell (Excel 365+)
817
827
  * Dynamic arrays automatically spill into adjacent cells
818
828
  * @param row - Row number (0-indexed)
819
829
  * @param col - Column number (0-indexed)
820
- * @param formula - Formula object with dynamic array function (FILTER, SORT, UNIQUE, etc.)
830
+ * @param formula - Formula object or formula string with a dynamic array
831
+ * function (FILTER, SORT, UNIQUE, etc.)
821
832
  * @param format - Optional format to apply
822
833
  */
823
- writeDynamicFormula(row: number, col: number, formula: Formula, format?: Format): void;
834
+ writeDynamicFormula(row: number, col: number, formula: Formula | string, format?: Format): void;
824
835
  /**
825
836
  * Write an array formula to a range of cells
826
837
  * @param firstRow - First row of range (0-indexed)
827
838
  * @param firstCol - First column of range (0-indexed)
828
839
  * @param lastRow - Last row of range (0-indexed)
829
840
  * @param lastCol - Last column of range (0-indexed)
830
- * @param formula - Formula object
841
+ * @param formula - Formula object or formula string
831
842
  * @param format - Optional format to apply
832
843
  */
833
- writeArrayFormula(firstRow: number, firstCol: number, lastRow: number, lastCol: number, formula: Formula, format?: Format): void;
844
+ writeArrayFormula(firstRow: number, firstCol: number, lastRow: number, lastCol: number, formula: Formula | string, format?: Format): void;
834
845
  /**
835
846
  * Add data validation to a cell or range
836
847
  * @param firstRow - First row of range (0-indexed)
@@ -2025,4 +2036,4 @@ export declare class Workbook {
2025
2036
  */
2026
2037
  setProperties(properties: DocProperties): void;
2027
2038
  }
2028
- export { RuscButton, RuscChart, RuscDataValidation, RuscDocProperties, RuscFormat, RuscFormula, RuscImage, RuscNote, RuscProtectionOptions, RuscRichText, RuscShape, RuscSparkline, RuscTable, RuscTableColumn, RuscWorkbook, RuscWorksheet, rustMemoryResetPeak, rustMemoryStats };
2039
+ export { RuscButton, RuscChart, RuscDataValidation, RuscDocProperties, RuscFormat, RuscFormula, type RuscFormulaData, RuscImage, RuscNote, RuscProtectionOptions, RuscRichText, RuscShape, RuscSparkline, RuscTable, RuscTableColumn, RuscWorkbook, RuscWorksheet, rustMemoryResetPeak, rustMemoryStats };
package/wrapper.js CHANGED
@@ -216,15 +216,18 @@ var Note = class {
216
216
  }
217
217
  };
218
218
  var Formula = class {
219
- _native;
219
+ _data;
220
220
  constructor(formula) {
221
- this._native = new index_js.RuscFormula(formula);
221
+ this._data = { formula };
222
222
  }
223
223
  setResult(result) {
224
- this._native.setResult(result);
224
+ this._data.result = result;
225
225
  return this;
226
226
  }
227
227
  };
228
+ function formulaData(formula) {
229
+ return typeof formula === "string" ? { formula } : formula._data;
230
+ }
228
231
  var DataValidation = class {
229
232
  _native;
230
233
  constructor() {
@@ -417,12 +420,9 @@ var Image = class Image {
417
420
  }
418
421
  };
419
422
  var RichText = class {
420
- _native;
421
- constructor() {
422
- this._native = new index_js.RuscRichText();
423
- }
423
+ _segments = [];
424
424
  addSegment(text, format) {
425
- this._native.addSegment(text, format ? format._native : null);
425
+ this._segments.push([text, format?._native]);
426
426
  return this;
427
427
  }
428
428
  };
@@ -518,13 +518,13 @@ var Worksheet = class {
518
518
  return this._native.setDefaultNoteAuthor(name);
519
519
  }
520
520
  writeFormula(row, col, formula, format) {
521
- return this._native.writeFormula(row, col, formula._native, format ? format._native : void 0);
521
+ return this._native.writeFormula(row, col, formulaData(formula), format ? format._native : void 0);
522
522
  }
523
523
  writeDynamicFormula(row, col, formula, format) {
524
- return this._native.writeDynamicFormula(row, col, formula._native, format ? format._native : void 0);
524
+ return this._native.writeDynamicFormula(row, col, formulaData(formula), format ? format._native : void 0);
525
525
  }
526
526
  writeArrayFormula(firstRow, firstCol, lastRow, lastCol, formula, format) {
527
- return this._native.writeArrayFormula(firstRow, firstCol, lastRow, lastCol, formula._native, format ? format._native : void 0);
527
+ return this._native.writeArrayFormula(firstRow, firstCol, lastRow, lastCol, formulaData(formula), format ? format._native : void 0);
528
528
  }
529
529
  addDataValidation(firstRow, firstCol, lastRow, lastCol, validation) {
530
530
  return this._native.addDataValidation(firstRow, firstCol, lastRow, lastCol, validation._native);
@@ -698,10 +698,10 @@ var Worksheet = class {
698
698
  return this._native.protectWithPasswordAndOptions(password, options._native);
699
699
  }
700
700
  writeRichString(row, col, richText) {
701
- return this._native.writeRichString(row, col, richText._native);
701
+ return this._native.writeRichString(row, col, richText._segments);
702
702
  }
703
703
  writeRichStringWithFormat(row, col, richText, cellFormat) {
704
- return this._native.writeRichStringWithFormat(row, col, richText._native, cellFormat._native);
704
+ return this._native.writeRichStringWithFormat(row, col, richText._segments, cellFormat._native);
705
705
  }
706
706
  insertButton(row, col, button) {
707
707
  return this._native.insertButton(row, col, button._native);