@office-kit/xlsx 0.12.0 → 0.14.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/dist/io/save.d.ts +15 -3
- package/dist/io.mjs +2 -2
- package/dist/iterparse-zWV-5vc6.mjs +164 -0
- package/dist/iterparse-zWV-5vc6.mjs.map +1 -0
- package/dist/{load-CJdGh50R.mjs → load-B16H5A3S.mjs} +3 -3
- package/dist/{load-CJdGh50R.mjs.map → load-B16H5A3S.mjs.map} +1 -1
- package/dist/node.mjs +8 -4
- package/dist/node.mjs.map +1 -1
- package/dist/{reader-BNaUTVCy.mjs → reader-DHMxLBQV.mjs} +81 -26
- package/dist/reader-DHMxLBQV.mjs.map +1 -0
- package/dist/{save-a0InIbtJ.mjs → save-I6GjvO1k.mjs} +85 -45
- package/dist/save-I6GjvO1k.mjs.map +1 -0
- package/dist/streaming/write-only.d.ts +11 -1
- package/dist/streaming.mjs +158 -64
- package/dist/streaming.mjs.map +1 -1
- package/dist/{stylesheet-writer-D7Uug85X.mjs → stylesheet-writer-BCS6PzWU.mjs} +66 -62
- package/dist/stylesheet-writer-BCS6PzWU.mjs.map +1 -0
- package/dist/utf8-OAkCDG5g.mjs +21 -0
- package/dist/utf8-OAkCDG5g.mjs.map +1 -0
- package/dist/worksheet/writer.d.ts +23 -4
- package/dist/{writer-IyFccCRJ.mjs → writer-C38RBZCy.mjs} +61 -9
- package/dist/writer-C38RBZCy.mjs.map +1 -0
- package/dist/xml.mjs +2 -1
- package/dist/xml.mjs.map +1 -1
- package/dist/zip/decompression-guard.d.ts +22 -6
- package/dist/zip/index.d.ts +1 -1
- package/dist/zip/inflate-cache.d.ts +22 -0
- package/dist/zip/reader.d.ts +11 -6
- package/dist/zip/writer.d.ts +26 -3
- package/dist/zip.mjs +2 -2
- package/package.json +1 -1
- package/dist/reader-BNaUTVCy.mjs.map +0 -1
- package/dist/save-a0InIbtJ.mjs.map +0 -1
- package/dist/stylesheet-writer-D7Uug85X.mjs.map +0 -1
- package/dist/utf8-Tn3nzyik.mjs +0 -143
- package/dist/utf8-Tn3nzyik.mjs.map +0 -1
- package/dist/writer-IyFccCRJ.mjs.map +0 -1
|
@@ -6450,28 +6450,33 @@ const maybeRecordRowDimension = (ws, node, rowIdx) => {
|
|
|
6450
6450
|
const HYPERLINK_REL_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink";
|
|
6451
6451
|
const XML_HEADER$4 = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>";
|
|
6452
6452
|
/**
|
|
6453
|
-
* Serialise a worksheet
|
|
6454
|
-
*
|
|
6455
|
-
*
|
|
6456
|
-
*
|
|
6453
|
+
* Serialise a worksheet into `emit`, one XML fragment at a time.
|
|
6454
|
+
*
|
|
6455
|
+
* Emitting rather than returning is what lets `saveWorkbook` push a sheet
|
|
6456
|
+
* through the ZIP deflate stream as it is built: a sheet with a million cells
|
|
6457
|
+
* would otherwise hold a million-entry fragment array, the joined string and
|
|
6458
|
+
* the encoded bytes live at once, all to produce a part that deflates to a few
|
|
6459
|
+
* MB. `worksheetToBytes` keeps the collect-and-join behaviour for callers that
|
|
6460
|
+
* genuinely want the whole part in hand.
|
|
6461
|
+
*
|
|
6462
|
+
* Mutates `ctx.sharedStrings`: every plain-string cell adds (or dedupes) into
|
|
6463
|
+
* the table, so the caller must emit the resulting sst after the last sheet.
|
|
6457
6464
|
*/
|
|
6458
|
-
function
|
|
6459
|
-
return new TextEncoder().encode(serializeWorksheet(ws, ctx));
|
|
6460
|
-
}
|
|
6461
|
-
function serializeWorksheet(ws, ctx) {
|
|
6465
|
+
function writeWorksheetXml(ws, ctx, emit) {
|
|
6462
6466
|
const x14Decl = ws.oleObjects.length > 0 || ws.controls.length > 0 ? ` xmlns:mc="${MARKUP_COMPAT_NS}" xmlns:x14="${X14_NS}"` : "";
|
|
6463
|
-
|
|
6467
|
+
emit(XML_HEADER$4);
|
|
6468
|
+
emit(`<worksheet xmlns="${SHEET_MAIN_NS}" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"${x14Decl}>`);
|
|
6464
6469
|
if (ws.sheetProperties) {
|
|
6465
6470
|
const sp = serializeSheetProperties(ws.sheetProperties);
|
|
6466
|
-
if (sp)
|
|
6471
|
+
if (sp) emit(sp);
|
|
6467
6472
|
}
|
|
6468
|
-
if (ws.bodyExtras?.beforeSheetData) for (const node of ws.bodyExtras.beforeSheetData)
|
|
6469
|
-
|
|
6470
|
-
if (ws.views.length > 0)
|
|
6473
|
+
if (ws.bodyExtras?.beforeSheetData) for (const node of ws.bodyExtras.beforeSheetData) emit(serializeBodyExtraNode(node));
|
|
6474
|
+
emit(serializeDimension(ws));
|
|
6475
|
+
if (ws.views.length > 0) emit(serializeSheetViews(ws.views));
|
|
6471
6476
|
const sheetFormatPr = serializeSheetFormatPr(ws);
|
|
6472
|
-
if (sheetFormatPr)
|
|
6473
|
-
if (ws.columnDimensions.size > 0)
|
|
6474
|
-
|
|
6477
|
+
if (sheetFormatPr) emit(sheetFormatPr);
|
|
6478
|
+
if (ws.columnDimensions.size > 0) emit(serializeCols(ws.columnDimensions));
|
|
6479
|
+
emit("<sheetData>");
|
|
6475
6480
|
const rowKeys = [...ws.rows.keys()].sort((a, b) => a - b);
|
|
6476
6481
|
const rowKeyUnion = new Set(rowKeys);
|
|
6477
6482
|
for (const k of ws.rowDimensions.keys()) rowKeyUnion.add(k);
|
|
@@ -6482,91 +6487,90 @@ function serializeWorksheet(ws, ctx) {
|
|
|
6482
6487
|
if ((!row || row.size === 0) && !dim) continue;
|
|
6483
6488
|
const dimAttrs = dim ? serializeRowDimensionAttrs(dim) : "";
|
|
6484
6489
|
if (!row || row.size === 0) {
|
|
6485
|
-
|
|
6490
|
+
emit(`<row r="${rowIdx}"${dimAttrs}/>`);
|
|
6486
6491
|
continue;
|
|
6487
6492
|
}
|
|
6488
6493
|
const colKeys = [...row.keys()].sort((a, b) => a - b);
|
|
6489
|
-
|
|
6494
|
+
emit(`<row r="${rowIdx}"${dimAttrs}>`);
|
|
6490
6495
|
for (const colIdx of colKeys) {
|
|
6491
6496
|
const cell = row.get(colIdx);
|
|
6492
6497
|
if (!cell) continue;
|
|
6493
6498
|
if (cell.styleId !== 0 && (!Number.isInteger(cell.styleId) || cell.styleId < 0 || cell.styleId >= ctx.styles.cellXfs.length)) throw unknownStyleId(cell, ws.title, ctx.styles.cellXfs.length);
|
|
6494
|
-
|
|
6499
|
+
emit(serializeCell(cell, ctx));
|
|
6495
6500
|
}
|
|
6496
|
-
|
|
6501
|
+
emit("</row>");
|
|
6497
6502
|
}
|
|
6498
|
-
|
|
6503
|
+
emit("</sheetData>");
|
|
6499
6504
|
if (ws.sheetProtection) {
|
|
6500
6505
|
const sp = serializeSheetProtection$1(ws.sheetProtection);
|
|
6501
|
-
if (sp)
|
|
6506
|
+
if (sp) emit(sp);
|
|
6502
6507
|
}
|
|
6503
|
-
if (ws.protectedRanges.length > 0)
|
|
6508
|
+
if (ws.protectedRanges.length > 0) emit(serializeProtectedRanges(ws.protectedRanges));
|
|
6504
6509
|
if (ws.scenarios) {
|
|
6505
6510
|
const sc = serializeScenarioList(ws.scenarios);
|
|
6506
|
-
if (sc)
|
|
6511
|
+
if (sc) emit(sc);
|
|
6507
6512
|
}
|
|
6508
|
-
if (ws.autoFilter)
|
|
6509
|
-
if (ws.sortState)
|
|
6513
|
+
if (ws.autoFilter) emit(serializeAutoFilter(ws.autoFilter));
|
|
6514
|
+
if (ws.sortState) emit(serializeSortState(ws.sortState));
|
|
6510
6515
|
if (ws.dataConsolidate) {
|
|
6511
6516
|
const dc = serializeDataConsolidate(ws.dataConsolidate);
|
|
6512
|
-
if (dc)
|
|
6517
|
+
if (dc) emit(dc);
|
|
6513
6518
|
}
|
|
6514
6519
|
if (ws.mergedCells.length > 0) {
|
|
6515
|
-
|
|
6516
|
-
for (const range of ws.mergedCells)
|
|
6517
|
-
|
|
6520
|
+
emit(`<mergeCells count="${ws.mergedCells.length}">`);
|
|
6521
|
+
for (const range of ws.mergedCells) emit(`<mergeCell ref="${rangeToString(range)}"/>`);
|
|
6522
|
+
emit("</mergeCells>");
|
|
6518
6523
|
}
|
|
6519
|
-
if (ws.customSheetViews.length > 0)
|
|
6524
|
+
if (ws.customSheetViews.length > 0) emit(serializeCustomSheetViews(ws.customSheetViews));
|
|
6520
6525
|
if (ws.phoneticPr) {
|
|
6521
6526
|
const pp = serializePhoneticPr(ws.phoneticPr);
|
|
6522
|
-
if (pp)
|
|
6527
|
+
if (pp) emit(pp);
|
|
6523
6528
|
}
|
|
6524
|
-
for (const cf of ws.conditionalFormatting)
|
|
6525
|
-
if (ws.dataValidations.length > 0)
|
|
6526
|
-
if (ws.hyperlinks.length > 0)
|
|
6529
|
+
for (const cf of ws.conditionalFormatting) emit(serializeConditionalFormatting(cf));
|
|
6530
|
+
if (ws.dataValidations.length > 0) emit(serializeDataValidations(ws.dataValidations));
|
|
6531
|
+
if (ws.hyperlinks.length > 0) emit(serializeHyperlinks(ws.hyperlinks, ctx.rels));
|
|
6527
6532
|
if (ws.printOptions) {
|
|
6528
6533
|
const po = serializePrintOptions(ws.printOptions);
|
|
6529
|
-
if (po)
|
|
6534
|
+
if (po) emit(po);
|
|
6530
6535
|
}
|
|
6531
|
-
if (ws.pageMargins)
|
|
6536
|
+
if (ws.pageMargins) emit(serializePageMargins(ws.pageMargins));
|
|
6532
6537
|
if (ws.pageSetup) {
|
|
6533
6538
|
const ps = serializePageSetup(ws.pageSetup);
|
|
6534
|
-
if (ps)
|
|
6539
|
+
if (ps) emit(ps);
|
|
6535
6540
|
}
|
|
6536
6541
|
if (ws.headerFooter) {
|
|
6537
6542
|
const hf = serializeHeaderFooter(ws.headerFooter);
|
|
6538
|
-
if (hf)
|
|
6539
|
-
}
|
|
6540
|
-
if (ws.rowBreaks.length > 0)
|
|
6541
|
-
if (ws.colBreaks.length > 0)
|
|
6542
|
-
if (ws.customProperties.length > 0)
|
|
6543
|
-
if (ws.bodyExtras?.afterSheetData) for (const node of ws.bodyExtras.afterSheetData)
|
|
6544
|
-
if (ws.cellWatches.length > 0)
|
|
6545
|
-
if (ws.ignoredErrors.length > 0)
|
|
6546
|
-
if (ws.smartTags.length > 0)
|
|
6543
|
+
if (hf) emit(hf);
|
|
6544
|
+
}
|
|
6545
|
+
if (ws.rowBreaks.length > 0) emit(serializePageBreaks(ws.rowBreaks, "rowBreaks"));
|
|
6546
|
+
if (ws.colBreaks.length > 0) emit(serializePageBreaks(ws.colBreaks, "colBreaks"));
|
|
6547
|
+
if (ws.customProperties.length > 0) emit(serializeWorksheetCustomProperties(ws.customProperties));
|
|
6548
|
+
if (ws.bodyExtras?.afterSheetData) for (const node of ws.bodyExtras.afterSheetData) emit(serializeBodyExtraNode(node));
|
|
6549
|
+
if (ws.cellWatches.length > 0) emit(serializeCellWatches(ws.cellWatches));
|
|
6550
|
+
if (ws.ignoredErrors.length > 0) emit(serializeIgnoredErrors(ws.ignoredErrors));
|
|
6551
|
+
if (ws.smartTags.length > 0) emit(serializeSmartTags(ws.smartTags));
|
|
6547
6552
|
if (ws.drawing && ctx.registerDrawing) {
|
|
6548
6553
|
const { rId } = ctx.registerDrawing(ws.drawing);
|
|
6549
|
-
|
|
6554
|
+
emit(`<drawing r:id="${escapeXmlAttr(rId)}"/>`);
|
|
6550
6555
|
}
|
|
6551
6556
|
if (ws.legacyComments.length > 0 && ctx.registerComments) {
|
|
6552
6557
|
const { vmlRelId } = ctx.registerComments(ws.legacyComments);
|
|
6553
|
-
|
|
6554
|
-
} else if (ws.legacyDrawingRId !== void 0)
|
|
6555
|
-
if (ws.legacyDrawingHFRId !== void 0)
|
|
6556
|
-
if (ws.oleObjects.length > 0)
|
|
6557
|
-
if (ws.controls.length > 0)
|
|
6558
|
-
if (ws.backgroundPictureRId !== void 0)
|
|
6559
|
-
if (ws.webPublishItems.length > 0)
|
|
6558
|
+
emit(`<legacyDrawing r:id="${escapeXmlAttr(vmlRelId)}"/>`);
|
|
6559
|
+
} else if (ws.legacyDrawingRId !== void 0) emit(`<legacyDrawing r:id="${escapeXmlAttr(ws.legacyDrawingRId)}"/>`);
|
|
6560
|
+
if (ws.legacyDrawingHFRId !== void 0) emit(`<legacyDrawingHF r:id="${escapeXmlAttr(ws.legacyDrawingHFRId)}"/>`);
|
|
6561
|
+
if (ws.oleObjects.length > 0) emit(wrapInX14Choice(serializeOleObjects(ws.oleObjects)));
|
|
6562
|
+
if (ws.controls.length > 0) emit(wrapInX14Choice(serializeControls(ws.controls)));
|
|
6563
|
+
if (ws.backgroundPictureRId !== void 0) emit(`<picture r:id="${escapeXmlAttr(ws.backgroundPictureRId)}"/>`);
|
|
6564
|
+
if (ws.webPublishItems.length > 0) emit(serializeWebPublishItems(ws.webPublishItems));
|
|
6560
6565
|
if (ws.tables.length > 0 && ctx.registerTable) {
|
|
6561
|
-
|
|
6566
|
+
emit(`<tableParts count="${ws.tables.length}">`);
|
|
6562
6567
|
for (const t of ws.tables) {
|
|
6563
6568
|
const { rId } = ctx.registerTable(t);
|
|
6564
|
-
|
|
6569
|
+
emit(`<tablePart r:id="${escapeXmlAttr(rId)}"/>`);
|
|
6565
6570
|
}
|
|
6566
|
-
|
|
6571
|
+
emit("</tableParts>");
|
|
6567
6572
|
}
|
|
6568
|
-
|
|
6569
|
-
return parts.join("");
|
|
6573
|
+
emit("</worksheet>");
|
|
6570
6574
|
}
|
|
6571
6575
|
const escapeXmlText = escapeXmlText$1;
|
|
6572
6576
|
const escapeXmlAttr = escapeXmlAttr$1;
|
|
@@ -8720,6 +8724,6 @@ const cellXfToTree = (xf) => {
|
|
|
8720
8724
|
return node;
|
|
8721
8725
|
};
|
|
8722
8726
|
//#endregion
|
|
8723
|
-
export { chartExToBytes as C, findUserShapesRId as D, chartToBytes as E, parseChartXml as O, userShapesToBytes as S, parseChartExXml as T, parseChartsheetXml as _, parseCommentsXml as a, parseWorksheetXml as b, NumberFormatSchema as c, BorderSchema as d, AlignmentSchema as f, chartsheetToBytes as g, parseDrawingXml as h, commentsToBytes as i, FontSchema as l, drawingToBytes as m, parseTableXml as n, placeholderVmlDrawing as o, collectRawRelIds as p, tableToBytes as r, ProtectionSchema as s, stylesheetToBytes as t, fillFromTree as u, serializeCell as v, isChartExBytes as w, parseUserShapesXml as x,
|
|
8727
|
+
export { chartExToBytes as C, findUserShapesRId as D, chartToBytes as E, parseChartXml as O, userShapesToBytes as S, parseChartExXml as T, parseChartsheetXml as _, parseCommentsXml as a, parseWorksheetXml as b, NumberFormatSchema as c, BorderSchema as d, AlignmentSchema as f, chartsheetToBytes as g, parseDrawingXml as h, commentsToBytes as i, FontSchema as l, drawingToBytes as m, parseTableXml as n, placeholderVmlDrawing as o, collectRawRelIds as p, tableToBytes as r, ProtectionSchema as s, stylesheetToBytes as t, fillFromTree as u, serializeCell as v, isChartExBytes as w, parseUserShapesXml as x, writeWorksheetXml as y };
|
|
8724
8728
|
|
|
8725
|
-
//# sourceMappingURL=stylesheet-writer-
|
|
8729
|
+
//# sourceMappingURL=stylesheet-writer-BCS6PzWU.mjs.map
|