@office-open/xlsx 0.9.6 → 0.9.8
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/README.md +9 -9
- package/dist/{context-D-5KiTi9.mjs → context-D6f14vKV.mjs} +19 -23
- package/dist/context-D6f14vKV.mjs.map +1 -0
- package/dist/{file-DQTBkYzl.d.mts → file-DDaqjg-B.d.mts} +58 -29
- package/dist/file-DDaqjg-B.d.mts.map +1 -0
- package/dist/{generate-n38Ig71o.mjs → generate-DS-qtz9W.mjs} +3 -3
- package/dist/generate-DS-qtz9W.mjs.map +1 -0
- package/dist/generate.d.mts +1 -1
- package/dist/generate.mjs +1 -1
- package/dist/index.d.mts +14 -14
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/parse.d.mts +1 -1
- package/dist/parse.mjs +1 -1
- package/package.json +3 -3
- package/dist/context-D-5KiTi9.mjs.map +0 -1
- package/dist/file-DQTBkYzl.d.mts.map +0 -1
- package/dist/generate-n38Ig71o.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -71,36 +71,36 @@ Check the [demo folder](./demo) for working examples covering every feature.
|
|
|
71
71
|
|
|
72
72
|
Performance comparison against [hucre](https://github.com/nicolo-ribaudo/hucre) (higher ops/s is better, Windows 11 / Node 24).
|
|
73
73
|
|
|
74
|
-
**Default** = XML DEFLATE level 1 (SuperFast, matching MS Office)
|
|
74
|
+
**Default** = XML DEFLATE level 1 (SuperFast); media is split by type, matching MS Office Excel — already-compressed formats (PNG/JPEG/GIF) are STOREd, the rest (EMF/WMF/BMP/TIFF/…) use DEFLATE level 1 (verified on a real MS Office file). **All STORE** = no compression (`{ compression: { xml: 0, media: 0 } }`). **hucre** (async only) uses `CompressionStream("deflate-raw")` when available, falls back to STORE per-entry when compression doesn't reduce size.
|
|
75
75
|
|
|
76
76
|
```typescript
|
|
77
77
|
// Default (matches MS Office)
|
|
78
78
|
await generateWorkbook(options);
|
|
79
79
|
// All STORE (no compression)
|
|
80
|
-
await generateWorkbook(options, { compression: { xml: 0 } });
|
|
80
|
+
await generateWorkbook(options, { compression: { xml: 0, media: 0 } });
|
|
81
81
|
```
|
|
82
82
|
|
|
83
83
|
**Create + toBuffer (end-to-end)**
|
|
84
84
|
|
|
85
85
|
| Scenario | Default sync | Default async | All STORE sync | All STORE async | hucre |
|
|
86
86
|
| ---------------- | -----------: | ------------: | -------------: | --------------: | ----------: |
|
|
87
|
-
| Simple (3 rows) | 2,
|
|
88
|
-
| Styled rows (20) | 2,
|
|
89
|
-
| Table (10x5) | 2,
|
|
87
|
+
| Simple (3 rows) | 2,416 ops/s | 1,160 ops/s | 14,593 ops/s | 17,853 ops/s | 1,062 ops/s |
|
|
88
|
+
| Styled rows (20) | 2,446 ops/s | 1,128 ops/s | 15,780 ops/s | 15,544 ops/s | 1,075 ops/s |
|
|
89
|
+
| Table (10x5) | 2,361 ops/s | 1,195 ops/s | 16,784 ops/s | 16,723 ops/s | 907 ops/s |
|
|
90
90
|
|
|
91
91
|
**Large Files — Create + toBuffer**
|
|
92
92
|
|
|
93
93
|
| Scenario | Default sync | Default async | All STORE sync | All STORE async | hucre |
|
|
94
94
|
| ----------------------------- | -----------: | ------------: | -------------: | --------------: | --------: |
|
|
95
|
-
| 2000 rows + 10 images |
|
|
96
|
-
| 200x10 table |
|
|
97
|
-
| 20 sheets × 100 rows + 20 img |
|
|
95
|
+
| 2000 rows + 10 images | 110 ops/s | 92 ops/s | 86 ops/s | 91 ops/s | 44 ops/s |
|
|
96
|
+
| 200x10 table | 853 ops/s | 614 ops/s | 1,142 ops/s | 1,122 ops/s | 258 ops/s |
|
|
97
|
+
| 20 sheets × 100 rows + 20 img | 72 ops/s | 50 ops/s | 63 ops/s | 62 ops/s | 25 ops/s |
|
|
98
98
|
|
|
99
99
|
**Large Data — 100,000 rows × 20 columns (2M cells)**
|
|
100
100
|
|
|
101
101
|
| Scenario | Default sync | Default async | All STORE sync | All STORE async | hucre |
|
|
102
102
|
| --------- | -----------: | ------------: | -------------: | --------------: | ---------: |
|
|
103
|
-
| 100k × 20 | 0.
|
|
103
|
+
| 100k × 20 | 0.87 ops/s | 0.81 ops/s | 1.02 ops/s | 0.96 ops/s | 0.39 ops/s |
|
|
104
104
|
|
|
105
105
|
## License
|
|
106
106
|
|
|
@@ -642,10 +642,10 @@ const stylesDesc = {
|
|
|
642
642
|
const fillId = attrNum(xf, "fillId");
|
|
643
643
|
const borderId = attrNum(xf, "borderId");
|
|
644
644
|
const numFmtId = attrNum(xf, "numFmtId");
|
|
645
|
-
if (fontId !== void 0) style.
|
|
646
|
-
if (fillId !== void 0) style.
|
|
647
|
-
if (borderId !== void 0) style.
|
|
648
|
-
if (numFmtId !== void 0) style.
|
|
645
|
+
if (fontId !== void 0) style.fontId = fontId;
|
|
646
|
+
if (fillId !== void 0) style.fillId = fillId;
|
|
647
|
+
if (borderId !== void 0) style.borderId = borderId;
|
|
648
|
+
if (numFmtId !== void 0) style.numFmtId = numFmtId;
|
|
649
649
|
xfs.push(style);
|
|
650
650
|
}
|
|
651
651
|
result.cellStyleXfs = xfs;
|
|
@@ -664,10 +664,10 @@ const stylesDesc = {
|
|
|
664
664
|
const protectionEl = findChild(xf, "protection");
|
|
665
665
|
const protection = protectionEl ? parseProtection(protectionEl) : void 0;
|
|
666
666
|
const style = {};
|
|
667
|
-
if (fontId > 0) style.
|
|
668
|
-
if (fillId > 0) style.
|
|
669
|
-
if (borderId > 0) style.
|
|
670
|
-
if (numFmtId > 0) style.
|
|
667
|
+
if (fontId > 0) style.fontId = fontId;
|
|
668
|
+
if (fillId > 0) style.fillId = fillId;
|
|
669
|
+
if (borderId > 0) style.borderId = borderId;
|
|
670
|
+
if (numFmtId > 0) style.numFmtId = numFmtId;
|
|
671
671
|
if (alignment) style.alignment = alignment;
|
|
672
672
|
if (protection) style.protection = protection;
|
|
673
673
|
if (attr(xf, "quotePrefix") === "1") style.quotePrefix = true;
|
|
@@ -5081,23 +5081,19 @@ var XlsxReadContext = class {
|
|
|
5081
5081
|
resolveStyle(styleIndex) {
|
|
5082
5082
|
const ps = this.parsedStyles;
|
|
5083
5083
|
if (!ps) return void 0;
|
|
5084
|
-
const cellXfs = ps
|
|
5084
|
+
const { cellXfs, fonts, fills, borders, customNumFmts } = ps;
|
|
5085
5085
|
if (!cellXfs || styleIndex >= cellXfs.length) return void 0;
|
|
5086
5086
|
const xf = cellXfs[styleIndex];
|
|
5087
5087
|
const result = {};
|
|
5088
|
-
const
|
|
5089
|
-
|
|
5090
|
-
const
|
|
5091
|
-
|
|
5092
|
-
const
|
|
5093
|
-
if (
|
|
5094
|
-
const
|
|
5095
|
-
if (
|
|
5096
|
-
|
|
5097
|
-
if (borderIdx !== void 0 && borders && borderIdx < borders.length) result.border = borders[borderIdx];
|
|
5098
|
-
const numFmtIdx = xf.numFmtIdx;
|
|
5099
|
-
if (numFmtIdx !== void 0 && customNumFmts) {
|
|
5100
|
-
for (const [code, id] of Object.entries(customNumFmts)) if (id === numFmtIdx) {
|
|
5088
|
+
const fontId = xf.fontId;
|
|
5089
|
+
if (fontId !== void 0 && fonts && fontId < fonts.length) result.font = fonts[fontId];
|
|
5090
|
+
const fillId = xf.fillId;
|
|
5091
|
+
if (fillId !== void 0 && fills && fillId < fills.length) result.fill = fills[fillId];
|
|
5092
|
+
const borderId = xf.borderId;
|
|
5093
|
+
if (borderId !== void 0 && borders && borderId < borders.length) result.border = borders[borderId];
|
|
5094
|
+
const numFmtId = xf.numFmtId;
|
|
5095
|
+
if (numFmtId !== void 0 && customNumFmts) {
|
|
5096
|
+
for (const [code, id] of Object.entries(customNumFmts)) if (id === numFmtId) {
|
|
5101
5097
|
result.numFmt = code;
|
|
5102
5098
|
break;
|
|
5103
5099
|
}
|
|
@@ -5127,4 +5123,4 @@ function resolveWsTarget(wsPath, target) {
|
|
|
5127
5123
|
//#endregion
|
|
5128
5124
|
export { Styles as C, sharedStringsDesc as E, worksheetDesc as S, SharedStrings as T, commentsDesc as _, workbookDesc as a, calcChainDesc as b, tableDesc as c, pivotTableDesc as d, PivotFilterType as f, drawingDesc as g, externalLinkDesc as h, buildTablePartsXml as i, pivotCacheDefDesc as l, collectUniqueValues as m, XlsxWriteContext as n, TableType as o, aggregate as p, buildExternalReferencesXml as r, TotalsRowFunction as s, XlsxReadContext as t, pivotCacheRecordsDesc as u, vmlNotesDesc as v, stylesDesc as w, stringifyWorksheet as x, chartsheetDesc as y };
|
|
5129
5125
|
|
|
5130
|
-
//# sourceMappingURL=context-
|
|
5126
|
+
//# sourceMappingURL=context-D6f14vKV.mjs.map
|