@office-open/xlsx 0.12.2 → 0.13.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/README.md +45 -8
- package/dist/index.d.mts +88 -94
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +82 -82
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -4
package/dist/index.mjs
CHANGED
|
@@ -2042,7 +2042,7 @@ const worksheetDesc = {
|
|
|
2042
2042
|
if (attr(pageSetUpPr, "autoPageBreaks") !== void 0) psup.autoPageBreaks = parseOnOff(attr(pageSetUpPr, "autoPageBreaks")) ?? true;
|
|
2043
2043
|
if (Object.keys(psup).length > 0) pageSetUpPrCache = psup;
|
|
2044
2044
|
}
|
|
2045
|
-
if (Object.keys(sp).length > 0) result.
|
|
2045
|
+
if (Object.keys(sp).length > 0) result.properties = sp;
|
|
2046
2046
|
const tabColorEl = findChild(sheetPrEl, "tabColor");
|
|
2047
2047
|
if (tabColorEl) {
|
|
2048
2048
|
const tc = {};
|
|
@@ -2164,7 +2164,7 @@ const worksheetDesc = {
|
|
|
2164
2164
|
if (olr !== void 0) sfp.outlineLevelRow = olr;
|
|
2165
2165
|
const olc = attrNum(sfpEl, "outlineLevelCol");
|
|
2166
2166
|
if (olc !== void 0) sfp.outlineLevelCol = olc;
|
|
2167
|
-
result.
|
|
2167
|
+
result.sheetFormat = sfp;
|
|
2168
2168
|
}
|
|
2169
2169
|
const dimensionEl = findChild(el, "dimension");
|
|
2170
2170
|
if (dimensionEl) {
|
|
@@ -2447,13 +2447,13 @@ const worksheetDesc = {
|
|
|
2447
2447
|
if (ppType) pp.type = ppType;
|
|
2448
2448
|
const ppAlign = attr(ppEl, "alignment");
|
|
2449
2449
|
if (ppAlign) pp.alignment = ppAlign;
|
|
2450
|
-
result.
|
|
2450
|
+
result.phonetic = pp;
|
|
2451
2451
|
}
|
|
2452
2452
|
const scEl = findChild(el, "sheetCalcPr");
|
|
2453
2453
|
if (scEl) {
|
|
2454
2454
|
const sc = {};
|
|
2455
2455
|
if (parseOnOff(attr(scEl, "fullCalcOnLoad"))) sc.fullCalcOnLoad = true;
|
|
2456
|
-
result.
|
|
2456
|
+
result.calculation = sc;
|
|
2457
2457
|
}
|
|
2458
2458
|
const sheetDataEl = findChild(el, "sheetData");
|
|
2459
2459
|
if (sheetDataEl) {
|
|
@@ -2698,7 +2698,7 @@ const worksheetDesc = {
|
|
|
2698
2698
|
const anchor = readEmbeddedAnchor(anchorEl);
|
|
2699
2699
|
if (anchor) opr.anchor = anchor;
|
|
2700
2700
|
}
|
|
2701
|
-
if (Object.keys(opr).length > 0) oo.
|
|
2701
|
+
if (Object.keys(opr).length > 0) oo.properties = opr;
|
|
2702
2702
|
}
|
|
2703
2703
|
oleObjects.push(oo);
|
|
2704
2704
|
}
|
|
@@ -3639,7 +3639,7 @@ function stringifyWorksheet(opts, ctx) {
|
|
|
3639
3639
|
const p = ["<worksheet xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" mc:Ignorable=\"x14ac xr xr2 xr3\" xmlns:x14ac=\"http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac\" xmlns:xr=\"http://schemas.microsoft.com/office/spreadsheetml/2014/revision\" xmlns:xr2=\"http://schemas.microsoft.com/office/spreadsheetml/2015/revision2\" xmlns:xr3=\"http://schemas.microsoft.com/office/spreadsheetml/2016/revision3\">"];
|
|
3640
3640
|
const hasTabColor = !!opts.tabColor;
|
|
3641
3641
|
const hasOutline = columns.some((c) => c.outlineLevel !== void 0);
|
|
3642
|
-
const sp = opts.
|
|
3642
|
+
const sp = opts.properties;
|
|
3643
3643
|
const hasSheetPrAttrs = sp && (sp.codeName || sp.syncHorizontal || sp.syncVertical || sp.syncRef || sp.transitionEvaluation || sp.transitionEntry || sp.published !== void 0 || sp.filterMode || sp.enableFormatConditionsCalculation !== void 0);
|
|
3644
3644
|
const hasPageSetUpPr = !!opts.pageSetup?.fitToWidth || !!opts.pageSetup?.fitToHeight || opts.pageSetup?.fitToPage !== void 0 || opts.pageSetup?.autoPageBreaks !== void 0;
|
|
3645
3645
|
if (hasTabColor || hasOutline || hasSheetPrAttrs || hasPageSetUpPr) {
|
|
@@ -3709,8 +3709,8 @@ function stringifyWorksheet(opts, ctx) {
|
|
|
3709
3709
|
if (innerXml) p.push(`<sheetViews><sheetView${svAttrs}>${innerXml}</sheetView></sheetViews>`);
|
|
3710
3710
|
else p.push(`<sheetViews><sheetView${svAttrs}/></sheetViews>`);
|
|
3711
3711
|
}
|
|
3712
|
-
if (opts.
|
|
3713
|
-
const sfp = opts.
|
|
3712
|
+
if (opts.sheetFormat) {
|
|
3713
|
+
const sfp = opts.sheetFormat;
|
|
3714
3714
|
const sfpAttrs = {};
|
|
3715
3715
|
if (sfp.baseColWidth !== void 0) sfpAttrs.baseColWidth = sfp.baseColWidth;
|
|
3716
3716
|
if (sfp.defaultColWidth !== void 0) sfpAttrs.defaultColWidth = sfp.defaultColWidth;
|
|
@@ -3746,9 +3746,9 @@ function stringifyWorksheet(opts, ctx) {
|
|
|
3746
3746
|
p.push("<sheetData>");
|
|
3747
3747
|
appendSheetDataRows(rows, p, sharedStrings, styles);
|
|
3748
3748
|
p.push("</sheetData>");
|
|
3749
|
-
if (opts.
|
|
3749
|
+
if (opts.calculation) {
|
|
3750
3750
|
const scAttrs = [];
|
|
3751
|
-
if (opts.
|
|
3751
|
+
if (opts.calculation.fullCalcOnLoad) scAttrs.push("fullCalcOnLoad=\"1\"");
|
|
3752
3752
|
p.push(`<sheetCalcPr${scAttrs.length ? " " + scAttrs.join(" ") : ""}/>`);
|
|
3753
3753
|
}
|
|
3754
3754
|
if (opts.protection) p.push(stringifySheetProtectionXml(opts.protection));
|
|
@@ -3847,8 +3847,8 @@ function stringifyWorksheet(opts, ctx) {
|
|
|
3847
3847
|
for (const mc of mergeCells) p.push(selfCloseElement("mergeCell", attrs({ ref: mc.ref })));
|
|
3848
3848
|
p.push("</mergeCells>");
|
|
3849
3849
|
}
|
|
3850
|
-
if (opts.
|
|
3851
|
-
const pp = opts.
|
|
3850
|
+
if (opts.phonetic) {
|
|
3851
|
+
const pp = opts.phonetic;
|
|
3852
3852
|
const ppAttrs = { fontId: pp.fontId };
|
|
3853
3853
|
if (pp.type && pp.type !== "fullwidthKatakana") ppAttrs.type = pp.type;
|
|
3854
3854
|
if (pp.alignment && pp.alignment !== "left") ppAttrs.alignment = pp.alignment;
|
|
@@ -4078,8 +4078,8 @@ function stringifyWorksheet(opts, ctx) {
|
|
|
4078
4078
|
if (ole.autoLoad) oleAttrs.push("autoLoad=\"1\"");
|
|
4079
4079
|
if (ole.rId) oleAttrs.push(`r:id="${escapeXml(ole.rId)}"`);
|
|
4080
4080
|
let innerXml;
|
|
4081
|
-
if (ole.
|
|
4082
|
-
const opr = ole.
|
|
4081
|
+
if (ole.properties) {
|
|
4082
|
+
const opr = ole.properties;
|
|
4083
4083
|
const oprAttrs = [];
|
|
4084
4084
|
if (opr.locked === false) oprAttrs.push("locked=\"0\"");
|
|
4085
4085
|
if (opr.defaultSize === false) oprAttrs.push("defaultSize=\"0\"");
|
|
@@ -4711,7 +4711,7 @@ const commentsDesc = {
|
|
|
4711
4711
|
author: authors[authorId] ?? "",
|
|
4712
4712
|
text
|
|
4713
4713
|
};
|
|
4714
|
-
if (commentPrEl) comment.
|
|
4714
|
+
if (commentPrEl) comment.properties = parseCommentPr(commentPrEl);
|
|
4715
4715
|
comments.push(comment);
|
|
4716
4716
|
}
|
|
4717
4717
|
return { comments };
|
|
@@ -5105,7 +5105,7 @@ function parseImageAnchor(anchor, pic, name, ctx) {
|
|
|
5105
5105
|
if (srcRect) result.sourceRectangle = sourceRectangleDesc.parse(srcRect, ctx);
|
|
5106
5106
|
const spPrEl = findXdr(pic, "spPr");
|
|
5107
5107
|
if (spPrEl) {
|
|
5108
|
-
result.
|
|
5108
|
+
result.properties = shapePropertiesDesc.parse(spPrEl, ctx);
|
|
5109
5109
|
const bwMode = spPrEl.attributes?.["bwMode"];
|
|
5110
5110
|
if (bwMode !== void 0) result.blackWhiteMode = bwMode;
|
|
5111
5111
|
}
|
|
@@ -5189,7 +5189,7 @@ function parseShapeAnchor(anchor, sp, name, ctx) {
|
|
|
5189
5189
|
const result = {
|
|
5190
5190
|
col: 1,
|
|
5191
5191
|
row: 1,
|
|
5192
|
-
|
|
5192
|
+
properties: {}
|
|
5193
5193
|
};
|
|
5194
5194
|
readAnchorFields(anchor, name, result);
|
|
5195
5195
|
Object.assign(result, readCNvPr(sp, "nvSpPr", ctx));
|
|
@@ -5199,7 +5199,7 @@ function parseShapeAnchor(anchor, sp, name, ctx) {
|
|
|
5199
5199
|
const spLocks = cNvSpPr ? findChild(cNvSpPr, "a:spLocks") : void 0;
|
|
5200
5200
|
if (spLocks) result.locking = shapeLockingDesc.parse(spLocks, ctx);
|
|
5201
5201
|
const spPr = findXdr(sp, "spPr");
|
|
5202
|
-
if (spPr) result.
|
|
5202
|
+
if (spPr) result.properties = shapePropertiesDesc.parse(spPr, ctx);
|
|
5203
5203
|
const styleEl = findXdr(sp, "style");
|
|
5204
5204
|
if (styleEl) {
|
|
5205
5205
|
const style = parseShapeStyle(styleEl, ctx);
|
|
@@ -5237,12 +5237,12 @@ function parseConnectorAnchor(anchor, cxnSp, name, ctx) {
|
|
|
5237
5237
|
const result = {
|
|
5238
5238
|
col: 1,
|
|
5239
5239
|
row: 1,
|
|
5240
|
-
|
|
5240
|
+
properties: {}
|
|
5241
5241
|
};
|
|
5242
5242
|
readAnchorFields(anchor, name, result);
|
|
5243
5243
|
Object.assign(result, readCNvPr(cxnSp, "nvCxnSpPr", ctx));
|
|
5244
5244
|
const spPr = findXdr(cxnSp, "spPr");
|
|
5245
|
-
if (spPr) result.
|
|
5245
|
+
if (spPr) result.properties = shapePropertiesDesc.parse(spPr, ctx);
|
|
5246
5246
|
if (cxnSp.attributes?.["macro"] !== void 0) result.macro = String(cxnSp.attributes["macro"]);
|
|
5247
5247
|
readConnectorNonVisual(result, cxnSp, ctx);
|
|
5248
5248
|
const topConnStyle = findXdr(cxnSp, "style");
|
|
@@ -5256,19 +5256,19 @@ function parseGroupAnchor(anchor, grpSp, name, ctx) {
|
|
|
5256
5256
|
const result = {
|
|
5257
5257
|
col: 1,
|
|
5258
5258
|
row: 1,
|
|
5259
|
-
|
|
5259
|
+
properties: {}
|
|
5260
5260
|
};
|
|
5261
5261
|
readAnchorFields(anchor, name, result);
|
|
5262
5262
|
Object.assign(result, readCNvPr(grpSp, "nvGrpSpPr", ctx));
|
|
5263
5263
|
const grpSpPrEl = findXdr(grpSp, "grpSpPr");
|
|
5264
|
-
if (grpSpPrEl) result.
|
|
5264
|
+
if (grpSpPrEl) result.properties = groupShapePropertiesDesc.parse(grpSpPrEl, ctx);
|
|
5265
5265
|
const shapes = [];
|
|
5266
5266
|
const childConnectors = [];
|
|
5267
5267
|
for (const child of grpSp.elements ?? []) {
|
|
5268
5268
|
const local = child.name?.startsWith("xdr:") ? child.name.slice(4) : child.name;
|
|
5269
5269
|
if (local === "sp") {
|
|
5270
5270
|
const spPr = findXdr(child, "spPr");
|
|
5271
|
-
const childShape = {
|
|
5271
|
+
const childShape = { properties: spPr ? shapePropertiesDesc.parse(spPr, ctx) : {} };
|
|
5272
5272
|
Object.assign(childShape, readCNvPr(child, "nvSpPr", ctx));
|
|
5273
5273
|
const childNvSpPr = findXdr(child, "nvSpPr");
|
|
5274
5274
|
const childCnVSpPr = childNvSpPr ? findXdr(childNvSpPr, "cNvSpPr") : void 0;
|
|
@@ -5287,7 +5287,7 @@ function parseGroupAnchor(anchor, grpSp, name, ctx) {
|
|
|
5287
5287
|
shapes.push(childShape);
|
|
5288
5288
|
} else if (local === "cxnSp") {
|
|
5289
5289
|
const spPr = findXdr(child, "spPr");
|
|
5290
|
-
const childConn = {
|
|
5290
|
+
const childConn = { properties: spPr ? shapePropertiesDesc.parse(spPr, ctx) : {} };
|
|
5291
5291
|
Object.assign(childConn, readCNvPr(child, "nvCxnSpPr", ctx));
|
|
5292
5292
|
if (child.attributes?.["macro"] !== void 0) childConn.macro = String(child.attributes["macro"]);
|
|
5293
5293
|
readConnectorNonVisual(childConn, child, ctx);
|
|
@@ -5348,7 +5348,7 @@ function wrapAnchor(opts, inner) {
|
|
|
5348
5348
|
return `<xdr:twoCellAnchor${opts.editAs === void 0 ? "" : ` editAs="${opts.editAs}"`}><xdr:from>${from}</xdr:from><xdr:to>${markerXml(opts.toCol ?? opts.col + 1, opts.toColOffset ?? 0, opts.toRow ?? opts.row + 1, opts.toRowOffset ?? 0)}</xdr:to>${inner}</xdr:twoCellAnchor>`;
|
|
5349
5349
|
}
|
|
5350
5350
|
function picXml(img, id, cx, cy, ctx) {
|
|
5351
|
-
const spPr = (img.
|
|
5351
|
+
const spPr = (img.properties ? shapePropertiesDesc.stringify(img.properties, ctx) : shapePropertiesDesc.stringify({
|
|
5352
5352
|
x: 0,
|
|
5353
5353
|
y: 0,
|
|
5354
5354
|
width: cx,
|
|
@@ -5447,25 +5447,25 @@ function buildConnectorContent(cNvPr, id, fallbackName, spPr, ctx, attrs = "", c
|
|
|
5447
5447
|
return `<xdr:cxnSp${attrs}><xdr:nvCxnSpPr>${stringifyNonVisualDrawingProperties("xdr:cNvPr", id, cNvPr, fallbackName, hlinkClickXml(cNvPr?.hyperlink, ctx))}${cNvCxnSpPr}</xdr:nvCxnSpPr><xdr:spPr>${spPrXml}</xdr:spPr>${styleXml}</xdr:cxnSp>`;
|
|
5448
5448
|
}
|
|
5449
5449
|
function stringifyShape(shape, id, ctx) {
|
|
5450
|
-
return wrapAnchor(shape, `${buildShapeContent(shape, id, `Shape ${id}`, shape.
|
|
5450
|
+
return wrapAnchor(shape, `${buildShapeContent(shape, id, `Shape ${id}`, shape.properties, shape.textBody, ctx, macroTextlinkAttrs(shape), shape.style)}${clientDataXml(shape)}`);
|
|
5451
5451
|
}
|
|
5452
5452
|
function stringifyConnector(conn, id, ctx) {
|
|
5453
|
-
return wrapAnchor(conn, `${buildConnectorContent(conn, id, `Connector ${id}`, conn.
|
|
5453
|
+
return wrapAnchor(conn, `${buildConnectorContent(conn, id, `Connector ${id}`, conn.properties, ctx, macroTextlinkAttrs(conn), conn)}${clientDataXml(conn)}`);
|
|
5454
5454
|
}
|
|
5455
5455
|
function stringifyContentPart(cp) {
|
|
5456
5456
|
return wrapAnchor(cp, `<xdr:contentPart r:id="${cp.rId}"/>${clientDataXml(cp)}`);
|
|
5457
5457
|
}
|
|
5458
5458
|
/** Build xdr:grpSp content and return the next available cNvPr id. */
|
|
5459
5459
|
function buildGroup(grp, id, ctx) {
|
|
5460
|
-
const grpSpPrXml = groupShapePropertiesDesc.stringify(grp.
|
|
5460
|
+
const grpSpPrXml = groupShapePropertiesDesc.stringify(grp.properties, ctx) ?? "";
|
|
5461
5461
|
let childId = id + 1;
|
|
5462
5462
|
const children = [];
|
|
5463
5463
|
for (const childShape of grp.shapes ?? []) {
|
|
5464
|
-
children.push(buildShapeContent(childShape, childId, `Shape ${childId}`, childShape.
|
|
5464
|
+
children.push(buildShapeContent(childShape, childId, `Shape ${childId}`, childShape.properties, childShape.textBody, ctx, macroTextlinkAttrs(childShape), childShape.style));
|
|
5465
5465
|
childId++;
|
|
5466
5466
|
}
|
|
5467
5467
|
for (const childConn of grp.connectors ?? []) {
|
|
5468
|
-
children.push(buildConnectorContent(childConn, childId, `Connector ${childId}`, childConn.
|
|
5468
|
+
children.push(buildConnectorContent(childConn, childId, `Connector ${childId}`, childConn.properties, ctx, macroTextlinkAttrs(childConn), childConn));
|
|
5469
5469
|
childId++;
|
|
5470
5470
|
}
|
|
5471
5471
|
return {
|
|
@@ -5881,16 +5881,16 @@ const connectionsDesc = {
|
|
|
5881
5881
|
if (c.credentials !== void 0 && CRED_METHODS.has(c.credentials)) cAttrs.push(`credentials="${c.credentials}"`);
|
|
5882
5882
|
if (c.singleSignOnId !== void 0) cAttrs.push(`singleSignOnId="${escapeXml(c.singleSignOnId)}"`);
|
|
5883
5883
|
const inner = [];
|
|
5884
|
-
if (c.
|
|
5885
|
-
const dAttrs = [`connection="${escapeXml(c.
|
|
5886
|
-
if (c.
|
|
5887
|
-
if (c.
|
|
5888
|
-
if (c.
|
|
5884
|
+
if (c.database) {
|
|
5885
|
+
const dAttrs = [`connection="${escapeXml(c.database.connection)}"`];
|
|
5886
|
+
if (c.database.command !== void 0) dAttrs.push(`command="${escapeXml(c.database.command)}"`);
|
|
5887
|
+
if (c.database.serverCommand !== void 0) dAttrs.push(`serverCommand="${escapeXml(c.database.serverCommand)}"`);
|
|
5888
|
+
if (c.database.commandType !== void 0) dAttrs.push(`commandType="${c.database.commandType}"`);
|
|
5889
5889
|
inner.push(`<dbPr ${dAttrs.join(" ")}/>`);
|
|
5890
5890
|
}
|
|
5891
|
-
if (c.
|
|
5892
|
-
if (c.
|
|
5893
|
-
const w = c.
|
|
5891
|
+
if (c.olap) inner.push(stringifyOlapPr(c.olap));
|
|
5892
|
+
if (c.web) {
|
|
5893
|
+
const w = c.web;
|
|
5894
5894
|
const wAttrs = [];
|
|
5895
5895
|
if (w.xml) wAttrs.push("xml=\"1\"");
|
|
5896
5896
|
if (w.sourceData) wAttrs.push("sourceData=\"1\"");
|
|
@@ -5909,8 +5909,8 @@ const connectionsDesc = {
|
|
|
5909
5909
|
if (tablesXml) inner.push(`<webPr ${wAttrs.join(" ")}>${tablesXml}</webPr>`);
|
|
5910
5910
|
else inner.push(`<webPr ${wAttrs.join(" ")}/>`);
|
|
5911
5911
|
}
|
|
5912
|
-
if (c.
|
|
5913
|
-
const t = c.
|
|
5912
|
+
if (c.text) {
|
|
5913
|
+
const t = c.text;
|
|
5914
5914
|
const tAttrs = [];
|
|
5915
5915
|
if (t.prompt === false) tAttrs.push("prompt=\"0\"");
|
|
5916
5916
|
if (t.fileType !== void 0) tAttrs.push(`fileType="${t.fileType}"`);
|
|
@@ -5992,7 +5992,7 @@ const connectionsDesc = {
|
|
|
5992
5992
|
if (attr(cEl, "credentials") !== void 0) c.credentials = attr(cEl, "credentials");
|
|
5993
5993
|
if (attr(cEl, "singleSignOnId") !== void 0) c.singleSignOnId = attr(cEl, "singleSignOnId");
|
|
5994
5994
|
const dbEl = findChild(cEl, "dbPr");
|
|
5995
|
-
if (dbEl) c.
|
|
5995
|
+
if (dbEl) c.database = {
|
|
5996
5996
|
connection: attr(dbEl, "connection") ?? "",
|
|
5997
5997
|
command: attr(dbEl, "command"),
|
|
5998
5998
|
serverCommand: attr(dbEl, "serverCommand"),
|
|
@@ -6001,7 +6001,7 @@ const connectionsDesc = {
|
|
|
6001
6001
|
const olapEl = findChild(cEl, "olapPr");
|
|
6002
6002
|
if (olapEl) {
|
|
6003
6003
|
const ol = parseOlapPr(olapEl);
|
|
6004
|
-
if (ol) c.
|
|
6004
|
+
if (ol) c.olap = ol;
|
|
6005
6005
|
}
|
|
6006
6006
|
const webEl = findChild(cEl, "webPr");
|
|
6007
6007
|
if (webEl) {
|
|
@@ -6027,7 +6027,7 @@ const connectionsDesc = {
|
|
|
6027
6027
|
else if (tEl.name === "x") tables.push(attrNum(tEl, "v") ?? 0);
|
|
6028
6028
|
if (tables.length > 0) w.tables = tables;
|
|
6029
6029
|
}
|
|
6030
|
-
c.
|
|
6030
|
+
c.web = w;
|
|
6031
6031
|
}
|
|
6032
6032
|
const textEl = findChild(cEl, "textPr");
|
|
6033
6033
|
if (textEl) {
|
|
@@ -6065,7 +6065,7 @@ const connectionsDesc = {
|
|
|
6065
6065
|
}
|
|
6066
6066
|
if (fields.length > 0) t.textFields = fields;
|
|
6067
6067
|
}
|
|
6068
|
-
c.
|
|
6068
|
+
c.text = t;
|
|
6069
6069
|
}
|
|
6070
6070
|
const paramsEl = findChild(cEl, "parameters");
|
|
6071
6071
|
if (paramsEl) {
|
|
@@ -7043,8 +7043,8 @@ function stringifyPivotCacheDef(sourceRef, sourceSheet, sourceData, recordsRid,
|
|
|
7043
7043
|
if (fg.parent !== void 0) fgParts.push(` par="${fg.parent}"`);
|
|
7044
7044
|
if (fg.base !== void 0) fgParts.push(` base="${fg.base}"`);
|
|
7045
7045
|
fgParts.push(">");
|
|
7046
|
-
if (fg.
|
|
7047
|
-
const rp = fg.
|
|
7046
|
+
if (fg.range) {
|
|
7047
|
+
const rp = fg.range;
|
|
7048
7048
|
const rpAttrs = [];
|
|
7049
7049
|
if (rp.autoStart === false) rpAttrs.push("autoStart=\"0\"");
|
|
7050
7050
|
if (rp.autoEnd === false) rpAttrs.push("autoEnd=\"0\"");
|
|
@@ -7056,9 +7056,9 @@ function stringifyPivotCacheDef(sourceRef, sourceSheet, sourceData, recordsRid,
|
|
|
7056
7056
|
if (rp.groupInterval !== void 0) rpAttrs.push(`groupInterval="${rp.groupInterval}"`);
|
|
7057
7057
|
fgParts.push(`<rangePr${rpAttrs.length ? " " + rpAttrs.join(" ") : ""}/>`);
|
|
7058
7058
|
}
|
|
7059
|
-
if (fg.
|
|
7060
|
-
fgParts.push(`<discretePr count="${fg.
|
|
7061
|
-
for (const idx of fg.
|
|
7059
|
+
if (fg.discrete && fg.discrete.length > 0) {
|
|
7060
|
+
fgParts.push(`<discretePr count="${fg.discrete.length}">`);
|
|
7061
|
+
for (const idx of fg.discrete) fgParts.push(`<x v="${idx}"/>`);
|
|
7062
7062
|
fgParts.push("</discretePr>");
|
|
7063
7063
|
}
|
|
7064
7064
|
if (fg.groupItems && fg.groupItems.length > 0) {
|
|
@@ -7074,7 +7074,7 @@ function stringifyPivotCacheDef(sourceRef, sourceSheet, sourceData, recordsRid,
|
|
|
7074
7074
|
}
|
|
7075
7075
|
p.push("</cacheFields>");
|
|
7076
7076
|
if (cacheDefOpts?.mpMaps) for (const mp of cacheDefOpts.mpMaps) p.push(`<mpMap x="${mp.x}"/>`);
|
|
7077
|
-
const olapPrXml = cacheDefOpts?.
|
|
7077
|
+
const olapPrXml = cacheDefOpts?.olap ? stringifyOlapPr(cacheDefOpts.olap) : "";
|
|
7078
7078
|
if (olapPrXml) p.push(olapPrXml);
|
|
7079
7079
|
if (cacheDefOpts?.cacheHierarchies && cacheDefOpts.cacheHierarchies.length > 0) {
|
|
7080
7080
|
const chs = cacheDefOpts.cacheHierarchies;
|
|
@@ -7365,8 +7365,8 @@ const tableDesc = {
|
|
|
7365
7365
|
if (col.headerRowCellStyle) colAttrs.headerRowCellStyle = col.headerRowCellStyle;
|
|
7366
7366
|
if (col.dataCellStyle) colAttrs.dataCellStyle = col.dataCellStyle;
|
|
7367
7367
|
if (col.totalsRowCellStyle) colAttrs.totalsRowCellStyle = col.totalsRowCellStyle;
|
|
7368
|
-
if (col.
|
|
7369
|
-
const xp = col.
|
|
7368
|
+
if (col.mapping && typeof col.mapping.mapId === "number") {
|
|
7369
|
+
const xp = col.mapping;
|
|
7370
7370
|
const xpAttrs = [`mapId="${xp.mapId}"`, `xpath="${escapeXml(xp.xpath)}"`];
|
|
7371
7371
|
if (xp.denormalized) xpAttrs.push("denormalized=\"1\"");
|
|
7372
7372
|
xpAttrs.push(`xmlDataType="${escapeXml(xp.xmlDataType)}"`);
|
|
@@ -7450,12 +7450,12 @@ const tableDesc = {
|
|
|
7450
7450
|
if (attr(colEl, "totalsRowCellStyle")) col.totalsRowCellStyle = attr(colEl, "totalsRowCellStyle");
|
|
7451
7451
|
const xcpEl = findChild(colEl, "xmlColumnPr");
|
|
7452
7452
|
if (xcpEl) {
|
|
7453
|
-
col.
|
|
7453
|
+
col.mapping = {
|
|
7454
7454
|
mapId: attrNum(xcpEl, "mapId") ?? 0,
|
|
7455
7455
|
xpath: attr(xcpEl, "xpath") ?? "",
|
|
7456
7456
|
xmlDataType: attr(xcpEl, "xmlDataType") ?? ""
|
|
7457
7457
|
};
|
|
7458
|
-
if (parseOnOff(attr(xcpEl, "denormalized"))) col.
|
|
7458
|
+
if (parseOnOff(attr(xcpEl, "denormalized"))) col.mapping.denormalized = true;
|
|
7459
7459
|
}
|
|
7460
7460
|
columns.push(col);
|
|
7461
7461
|
}
|
|
@@ -7543,8 +7543,8 @@ function stringifyWorkbook(opts) {
|
|
|
7543
7543
|
if (fs.spinCount !== void 0) fsAttrs.push(`spinCount="${fs.spinCount}"`);
|
|
7544
7544
|
if (fsAttrs.length > 0) parts.push(`<fileSharing ${fsAttrs.join(" ")}/>`);
|
|
7545
7545
|
}
|
|
7546
|
-
if (opts.
|
|
7547
|
-
const wbPr = opts.
|
|
7546
|
+
if (opts.properties) {
|
|
7547
|
+
const wbPr = opts.properties;
|
|
7548
7548
|
const wbPrAttrs = [];
|
|
7549
7549
|
if (wbPr.date1904) wbPrAttrs.push("date1904=\"1\"");
|
|
7550
7550
|
if (wbPr.defaultThemeVersion !== void 0) wbPrAttrs.push(`defaultThemeVersion="${wbPr.defaultThemeVersion}"`);
|
|
@@ -7673,8 +7673,8 @@ function stringifyWorkbook(opts) {
|
|
|
7673
7673
|
dnParts.push("</definedNames>");
|
|
7674
7674
|
parts.push(dnParts.join(""));
|
|
7675
7675
|
}
|
|
7676
|
-
if (opts.
|
|
7677
|
-
const cp = opts.
|
|
7676
|
+
if (opts.calculation) {
|
|
7677
|
+
const cp = opts.calculation;
|
|
7678
7678
|
const cpAttrs = [];
|
|
7679
7679
|
cpAttrs.push(`calcId="${cp.calcId ?? 191029}"`);
|
|
7680
7680
|
if (cp.calcMode) cpAttrs.push(`calcMode="${escapeXml(cp.calcMode)}"`);
|
|
@@ -7731,8 +7731,8 @@ function stringifyWorkbook(opts) {
|
|
|
7731
7731
|
for (const pc of pivotCaches) parts.push(`<pivotCache cacheId="${pc.cacheId}" r:id="${pc.rId}"/>`);
|
|
7732
7732
|
parts.push("</pivotCaches>");
|
|
7733
7733
|
}
|
|
7734
|
-
if (opts.
|
|
7735
|
-
const stp = opts.
|
|
7734
|
+
if (opts.smartTag) {
|
|
7735
|
+
const stp = opts.smartTag;
|
|
7736
7736
|
const stpAttrs = [];
|
|
7737
7737
|
if (stp.embed) stpAttrs.push("embed=\"1\"");
|
|
7738
7738
|
if (stp.show && stp.show !== "all") stpAttrs.push(`show="${stp.show}"`);
|
|
@@ -7764,8 +7764,8 @@ function stringifyWorkbook(opts) {
|
|
|
7764
7764
|
if (wp.characterSet) wpAttrs.push(`characterSet="${escapeXml(wp.characterSet)}"`);
|
|
7765
7765
|
parts.push(`<webPublishing ${wpAttrs.join(" ")}/>`);
|
|
7766
7766
|
}
|
|
7767
|
-
if (opts.
|
|
7768
|
-
const frp = opts.
|
|
7767
|
+
if (opts.fileRecovery) {
|
|
7768
|
+
const frp = opts.fileRecovery;
|
|
7769
7769
|
const frpAttrs = [];
|
|
7770
7770
|
if (frp.autoRecover === false) frpAttrs.push("autoRecover=\"0\"");
|
|
7771
7771
|
if (frp.crashSave) frpAttrs.push("crashSave=\"1\"");
|
|
@@ -7938,7 +7938,7 @@ const workbookDesc = {
|
|
|
7938
7938
|
if (id !== void 0) calc.iterateDelta = id;
|
|
7939
7939
|
if (String(attr(calcPrEl, "fullPrecision")) === "0") calc.fullPrecision = false;
|
|
7940
7940
|
if (parseOnOff(attr(calcPrEl, "calcCompleted"))) calc.calcCompleted = true;
|
|
7941
|
-
result.
|
|
7941
|
+
result.calculation = calc;
|
|
7942
7942
|
}
|
|
7943
7943
|
const oleSizeEl = findChild(el, "oleSize");
|
|
7944
7944
|
if (oleSizeEl) {
|
|
@@ -8022,7 +8022,7 @@ const workbookDesc = {
|
|
|
8022
8022
|
if (parseOnOff(attr(fileRecoveryEl, "crashSave"))) frp.crashSave = true;
|
|
8023
8023
|
if (parseOnOff(attr(fileRecoveryEl, "dataExtractLoad"))) frp.dataExtractLoad = true;
|
|
8024
8024
|
if (parseOnOff(attr(fileRecoveryEl, "repairLoad"))) frp.repairLoad = true;
|
|
8025
|
-
result.
|
|
8025
|
+
result.fileRecovery = frp;
|
|
8026
8026
|
}
|
|
8027
8027
|
const wbPrEl = findChild(el, "workbookPr");
|
|
8028
8028
|
if (wbPrEl?.attributes) {
|
|
@@ -8046,7 +8046,7 @@ const workbookDesc = {
|
|
|
8046
8046
|
if (parseOnOff(attr(wbPrEl, "checkCompatibility"))) wbPr.checkCompatibility = true;
|
|
8047
8047
|
if (String(attr(wbPrEl, "autoCompressPictures")) === "0") wbPr.autoCompressPictures = false;
|
|
8048
8048
|
if (parseOnOff(attr(wbPrEl, "refreshAllConnections"))) wbPr.refreshAllConnections = true;
|
|
8049
|
-
result.
|
|
8049
|
+
result.properties = wbPr;
|
|
8050
8050
|
}
|
|
8051
8051
|
const acEl = findChild(el, "mc:AlternateContent");
|
|
8052
8052
|
if (acEl) {
|
|
@@ -8149,7 +8149,7 @@ const workbookDesc = {
|
|
|
8149
8149
|
if (parseOnOff(attr(smartTagPrEl, "embed"))) stp.embed = true;
|
|
8150
8150
|
const show = attr(smartTagPrEl, "show");
|
|
8151
8151
|
if (show && show !== "all") stp.show = show;
|
|
8152
|
-
result.
|
|
8152
|
+
result.smartTag = stp;
|
|
8153
8153
|
}
|
|
8154
8154
|
const smartTagTypesEl = findChild(el, "smartTagTypes");
|
|
8155
8155
|
if (smartTagTypesEl) {
|
|
@@ -8373,11 +8373,11 @@ const singleXmlCellsDesc = {
|
|
|
8373
8373
|
stringify(opts, _ctx) {
|
|
8374
8374
|
const p = ["<singleXmlCells xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\">"];
|
|
8375
8375
|
for (const c of opts.cells) {
|
|
8376
|
-
const pr = c.
|
|
8376
|
+
const pr = c.properties;
|
|
8377
8377
|
const prAttrs = [`id="${pr.id}"`];
|
|
8378
8378
|
if (pr.uniqueName !== void 0) prAttrs.push(`uniqueName="${escapeXml(pr.uniqueName)}"`);
|
|
8379
|
-
if (typeof pr.
|
|
8380
|
-
p.push(`<singleXmlCell id="${c.id}" r="${escapeXml(c.reference)}" connectionId="${c.connectionId}"><xmlCellPr ${prAttrs.join(" ")}><xmlPr mapId="${pr.
|
|
8379
|
+
if (typeof pr.mapping.mapId !== "number") continue;
|
|
8380
|
+
p.push(`<singleXmlCell id="${c.id}" r="${escapeXml(c.reference)}" connectionId="${c.connectionId}"><xmlCellPr ${prAttrs.join(" ")}><xmlPr mapId="${pr.mapping.mapId}" xpath="${escapeXml(pr.mapping.xpath)}" xmlDataType="${escapeXml(pr.mapping.xmlDataType)}"/></xmlCellPr></singleXmlCell>`);
|
|
8381
8381
|
}
|
|
8382
8382
|
p.push("</singleXmlCells>");
|
|
8383
8383
|
return p.join("");
|
|
@@ -8392,7 +8392,7 @@ const singleXmlCellsDesc = {
|
|
|
8392
8392
|
if (!xmlPrEl) continue;
|
|
8393
8393
|
const pr = { id: attrNum(prEl, "id") ?? 0 };
|
|
8394
8394
|
if (attr(prEl, "uniqueName") !== void 0) pr.uniqueName = attr(prEl, "uniqueName");
|
|
8395
|
-
pr.
|
|
8395
|
+
pr.mapping = {
|
|
8396
8396
|
mapId: attrNum(xmlPrEl, "mapId") ?? 0,
|
|
8397
8397
|
xpath: attr(xmlPrEl, "xpath") ?? "",
|
|
8398
8398
|
xmlDataType: attr(xmlPrEl, "xmlDataType") ?? ""
|
|
@@ -8401,7 +8401,7 @@ const singleXmlCellsDesc = {
|
|
|
8401
8401
|
id: attrNum(cEl, "id") ?? 0,
|
|
8402
8402
|
reference: attr(cEl, "r") ?? "",
|
|
8403
8403
|
connectionId: attrNum(cEl, "connectionId") ?? 0,
|
|
8404
|
-
|
|
8404
|
+
properties: pr
|
|
8405
8405
|
});
|
|
8406
8406
|
}
|
|
8407
8407
|
return { cells };
|
|
@@ -9478,14 +9478,14 @@ function parseWorkbook(data) {
|
|
|
9478
9478
|
}
|
|
9479
9479
|
if (wbData.protection) opts.workbookProtection = wbData.protection;
|
|
9480
9480
|
if (wbData.bookView) opts.bookView = wbData.bookView;
|
|
9481
|
-
if (wbData.
|
|
9481
|
+
if (wbData.calculation) opts.calculation = wbData.calculation;
|
|
9482
9482
|
if (wbData.oleSize) opts.oleSize = wbData.oleSize;
|
|
9483
9483
|
if (wbData.customViews) opts.customWorkbookViews = wbData.customViews;
|
|
9484
|
-
if (wbData.
|
|
9484
|
+
if (wbData.fileRecovery) opts.fileRecovery = wbData.fileRecovery;
|
|
9485
9485
|
if (wbData.functionGroups) opts.functionGroups = wbData.functionGroups;
|
|
9486
9486
|
if (wbData.webPublishing) opts.webPublishing = wbData.webPublishing;
|
|
9487
9487
|
if (wbData.fileSharing) opts.fileSharing = wbData.fileSharing;
|
|
9488
|
-
if (wbData.
|
|
9488
|
+
if (wbData.properties) opts.properties = wbData.properties;
|
|
9489
9489
|
if (wbData.webPublishObjects) opts.webPublishObjects = wbData.webPublishObjects;
|
|
9490
9490
|
if (wbData.definedNames) opts.definedNames = wbData.definedNames;
|
|
9491
9491
|
if (wbData.absPath !== void 0) opts.absPath = wbData.absPath;
|
|
@@ -9562,7 +9562,7 @@ function parseWorkbook(data) {
|
|
|
9562
9562
|
description: image.description,
|
|
9563
9563
|
title: image.title,
|
|
9564
9564
|
hidden: image.hidden,
|
|
9565
|
-
...image.
|
|
9565
|
+
...image.properties ? { properties: image.properties } : {},
|
|
9566
9566
|
...image.blackWhiteMode ? { blackWhiteMode: image.blackWhiteMode } : {},
|
|
9567
9567
|
...image.sourceRectangle ? { sourceRectangle: image.sourceRectangle } : {},
|
|
9568
9568
|
...image.preferRelativeResize !== void 0 ? { preferRelativeResize: image.preferRelativeResize } : {},
|
|
@@ -9587,7 +9587,7 @@ function parseWorkbook(data) {
|
|
|
9587
9587
|
description: image.description,
|
|
9588
9588
|
title: image.title,
|
|
9589
9589
|
hidden: image.hidden,
|
|
9590
|
-
...image.
|
|
9590
|
+
...image.properties ? { properties: image.properties } : {},
|
|
9591
9591
|
...image.blackWhiteMode ? { blackWhiteMode: image.blackWhiteMode } : {},
|
|
9592
9592
|
...image.sourceRectangle ? { sourceRectangle: image.sourceRectangle } : {},
|
|
9593
9593
|
...image.preferRelativeResize !== void 0 ? { preferRelativeResize: image.preferRelativeResize } : {},
|
|
@@ -10544,14 +10544,14 @@ function compileWorkbook(options, overrides = [], mediaLevel = 0) {
|
|
|
10544
10544
|
pivotCaches: ctx.pivotCacheRefs.length > 0 ? ctx.pivotCacheRefs : rtPivotRefs ?? [],
|
|
10545
10545
|
protection: options.workbookProtection,
|
|
10546
10546
|
customViews: options.customWorkbookViews,
|
|
10547
|
-
|
|
10547
|
+
fileRecovery: options.fileRecovery,
|
|
10548
10548
|
functionGroups: options.functionGroups,
|
|
10549
10549
|
webPublishing: options.webPublishing,
|
|
10550
10550
|
fileSharing: options.fileSharing,
|
|
10551
10551
|
webPublishObjects: options.webPublishObjects,
|
|
10552
10552
|
definedNames: options.definedNames,
|
|
10553
|
-
|
|
10554
|
-
|
|
10553
|
+
properties: options.properties,
|
|
10554
|
+
calculation: options.calculation,
|
|
10555
10555
|
oleSize: options.oleSize,
|
|
10556
10556
|
bookView: options.bookView,
|
|
10557
10557
|
...options.absPath !== void 0 ? { absPath: options.absPath } : {},
|
|
@@ -10811,7 +10811,7 @@ function compileWorksheetPart(wsOpts, i, worksheetConfigs, ctx, mapping, wsConte
|
|
|
10811
10811
|
rId: embedRid ?? "",
|
|
10812
10812
|
...linkRid ? { linkRId: linkRid } : {},
|
|
10813
10813
|
...pickNonVisualDrawingProperties(img),
|
|
10814
|
-
...img.
|
|
10814
|
+
...img.properties ? { properties: img.properties } : {},
|
|
10815
10815
|
...img.blackWhiteMode ? { blackWhiteMode: img.blackWhiteMode } : {},
|
|
10816
10816
|
...img.sourceRectangle ? { sourceRectangle: img.sourceRectangle } : {},
|
|
10817
10817
|
...img.preferRelativeResize !== void 0 ? { preferRelativeResize: img.preferRelativeResize } : {},
|
|
@@ -11543,7 +11543,7 @@ const WORKBOOK_KEYS = /* @__PURE__ */ new Set([
|
|
|
11543
11543
|
"customProperties",
|
|
11544
11544
|
"workbookProtection",
|
|
11545
11545
|
"definedNames",
|
|
11546
|
-
"
|
|
11546
|
+
"fileRecovery",
|
|
11547
11547
|
"functionGroups",
|
|
11548
11548
|
"webPublishing",
|
|
11549
11549
|
"fileSharing",
|
|
@@ -11616,7 +11616,7 @@ function streamWorkbook(options, ondata, compression = {}) {
|
|
|
11616
11616
|
sheets,
|
|
11617
11617
|
protection: options.workbookProtection,
|
|
11618
11618
|
definedNames: options.definedNames,
|
|
11619
|
-
|
|
11619
|
+
fileRecovery: options.fileRecovery,
|
|
11620
11620
|
functionGroups: options.functionGroups,
|
|
11621
11621
|
webPublishing: options.webPublishing,
|
|
11622
11622
|
fileSharing: options.fileSharing
|