@justybase/spreadsheet-tasks 2.1.0 → 2.1.1
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/CHANGELOG.md +12 -0
- package/README.md +26 -0
- package/dist/cjs/index.d.ts +11 -1
- package/dist/cjs/index.js +282 -34
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +280 -34
- package/dist/esm/index.js.map +1 -1
- package/docs/API.md +51 -0
- package/package.json +3 -2
package/docs/API.md
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
- [XlsxReader](#xlsxreader)
|
|
9
9
|
- [XlsxUpdater](#xlsxupdater)
|
|
10
10
|
- [XlsbUpdater](#xlsbupdater)
|
|
11
|
+
- [Excel conversion](#excel-conversion)
|
|
11
12
|
- [ReaderFactory](#readerfactory)
|
|
12
13
|
- [Types](#types)
|
|
13
14
|
|
|
@@ -382,6 +383,56 @@ Returns the updated workbook as an in-memory ZIP buffer.
|
|
|
382
383
|
|
|
383
384
|
---
|
|
384
385
|
|
|
386
|
+
## Excel conversion
|
|
387
|
+
|
|
388
|
+
Excel conversion uses the installed desktop Microsoft Excel through COM. It is
|
|
389
|
+
available in the Node.js build on Windows only; the browser build does not
|
|
390
|
+
expose these functions.
|
|
391
|
+
|
|
392
|
+
### `ExcelConversionOptions`
|
|
393
|
+
|
|
394
|
+
```typescript
|
|
395
|
+
interface ExcelConversionOptions {
|
|
396
|
+
overwrite?: boolean;
|
|
397
|
+
}
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
`overwrite` defaults to `false`. Existing destination files are rejected unless
|
|
401
|
+
it is explicitly set to `true`.
|
|
402
|
+
|
|
403
|
+
### `convertXlsbToXlsx`
|
|
404
|
+
|
|
405
|
+
```typescript
|
|
406
|
+
convertXlsbToXlsx(
|
|
407
|
+
inputPath: string,
|
|
408
|
+
outputPath: string,
|
|
409
|
+
options?: ExcelConversionOptions
|
|
410
|
+
): Promise<void>
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
Converts an existing `.xlsb` file to `.xlsx` using Excel `SaveAs` format 51.
|
|
414
|
+
|
|
415
|
+
### `convertXlsxToXlsb`
|
|
416
|
+
|
|
417
|
+
```typescript
|
|
418
|
+
convertXlsxToXlsb(
|
|
419
|
+
inputPath: string,
|
|
420
|
+
outputPath: string,
|
|
421
|
+
options?: ExcelConversionOptions
|
|
422
|
+
): Promise<void>
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
Converts an existing `.xlsx` file to `.xlsb` using Excel `SaveAs` format 50.
|
|
426
|
+
|
|
427
|
+
Both functions reject invalid extensions, missing files, protected
|
|
428
|
+
destinations, unavailable COM automation, and Excel errors. The source is
|
|
429
|
+
opened read-only and the destination is first written to a temporary file.
|
|
430
|
+
|
|
431
|
+
```typescript
|
|
432
|
+
await convertXlsbToXlsx('report.xlsb', 'report.xlsx');
|
|
433
|
+
await convertXlsxToXlsb('report.xlsx', 'report.xlsb', { overwrite: true });
|
|
434
|
+
```
|
|
435
|
+
|
|
385
436
|
## ReaderFactory
|
|
386
437
|
|
|
387
438
|
Factory class for creating appropriate reader based on file extension.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@justybase/spreadsheet-tasks",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "High-performance TypeScript library for reading and writing Excel files in XLSB and XLSX formats. XLSB is 3.3x faster to write and 2.3x faster to read than XLSX.",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -29,9 +29,10 @@
|
|
|
29
29
|
"typecheck": "tsc --noEmit",
|
|
30
30
|
"test": "npm run typecheck && npm run test:smoke && npm run test:unit && npm run test:integration && npm run test:dist",
|
|
31
31
|
"test:smoke": "npx ts-node tests/smoke.test.ts",
|
|
32
|
-
"test:unit": "npx ts-node tests/unit/bigbuffer.test.ts && npx ts-node tests/unit/biff-reader-writer.test.ts && npx ts-node tests/unit/xlsb-writer.test.ts",
|
|
32
|
+
"test:unit": "npx ts-node tests/unit/bigbuffer.test.ts && npx ts-node tests/unit/biff-reader-writer.test.ts && npx ts-node tests/unit/xlsb-writer.test.ts && npx ts-node tests/unit/excel-converter.test.ts",
|
|
33
33
|
"test:integration": "npx ts-node tests/integration/xlsb-writer.test.ts && npx ts-node tests/integration/xlsx-writer.test.ts && npx ts-node tests/integration/xlsx-updater.test.ts && npx ts-node tests/integration/xlsb-updater.test.ts",
|
|
34
34
|
"test:dist": "npm run build && npx ts-node tests/dist-surface.test.ts",
|
|
35
|
+
"test:excel-conversion": "npm run build && npx ts-node tests/excel-compat/conversion.ts",
|
|
35
36
|
"test:xlsb": "npx ts-node tests/integration/xlsb-writer.test.ts && npx ts-node tests/integration/xlsb-updater.test.ts",
|
|
36
37
|
"test:xlsx": "npx ts-node tests/integration/xlsx-writer.test.ts",
|
|
37
38
|
"benchmark": "npm run build && npx ts-node benchmarks/performance.bench.ts",
|