@rowsncolumns/toolkit 24.4.2 → 24.4.4
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/cjs/excel-parser/cfb-decryptor.d.ts +6 -0
- package/dist/cjs/excel-parser/cfb-decryptor.d.ts.map +1 -1
- package/dist/cjs/excel-parser/cfb-decryptor.js +6 -0
- package/dist/cjs/excel-parser/helpers.d.ts +9 -1
- package/dist/cjs/excel-parser/helpers.d.ts.map +1 -1
- package/dist/cjs/excel-parser/helpers.js +37 -0
- package/dist/cjs/excel-parser/interface.d.ts +15 -2
- package/dist/cjs/excel-parser/interface.d.ts.map +1 -1
- package/dist/cjs/excel-parser/plugins/base/index.d.ts +2 -0
- package/dist/cjs/excel-parser/plugins/base/index.d.ts.map +1 -1
- package/dist/cjs/excel-parser/plugins/base/index.js +3 -0
- package/dist/cjs/excel-parser/plugins/ods/index.d.ts +19 -0
- package/dist/cjs/excel-parser/plugins/ods/index.d.ts.map +1 -1
- package/dist/cjs/excel-parser/plugins/ods/index.js +676 -304
- package/dist/cjs/excel-parser/plugins/ods/styles.d.ts +43 -1
- package/dist/cjs/excel-parser/plugins/ods/styles.d.ts.map +1 -1
- package/dist/cjs/excel-parser/plugins/ods/styles.js +343 -45
- package/dist/cjs/excel-parser/plugins/xls/index.d.ts +55 -1
- package/dist/cjs/excel-parser/plugins/xls/index.d.ts.map +1 -1
- package/dist/cjs/excel-parser/plugins/xls/index.js +518 -6
- package/dist/cjs/excel-parser/plugins/xlsb/index.d.ts +4 -0
- package/dist/cjs/excel-parser/plugins/xlsb/index.d.ts.map +1 -1
- package/dist/cjs/excel-parser/plugins/xlsb/index.js +33 -14
- package/dist/cjs/excel-parser/plugins/xlsx/chartex.d.ts +37 -0
- package/dist/cjs/excel-parser/plugins/xlsx/chartex.d.ts.map +1 -0
- package/dist/cjs/excel-parser/plugins/xlsx/chartex.js +244 -0
- package/dist/cjs/excel-parser/plugins/xlsx/charts.d.ts +10 -0
- package/dist/cjs/excel-parser/plugins/xlsx/charts.d.ts.map +1 -1
- package/dist/cjs/excel-parser/plugins/xlsx/charts.js +68 -9
- package/dist/cjs/excel-parser/plugins/xlsx/drawing.d.ts +28 -1
- package/dist/cjs/excel-parser/plugins/xlsx/drawing.d.ts.map +1 -1
- package/dist/cjs/excel-parser/plugins/xlsx/drawing.js +155 -20
- package/dist/cjs/excel-parser/plugins/xlsx/form-controls.d.ts +70 -0
- package/dist/cjs/excel-parser/plugins/xlsx/form-controls.d.ts.map +1 -0
- package/dist/cjs/excel-parser/plugins/xlsx/form-controls.js +295 -0
- package/dist/cjs/excel-parser/plugins/xlsx/index.d.ts +35 -2
- package/dist/cjs/excel-parser/plugins/xlsx/index.d.ts.map +1 -1
- package/dist/cjs/excel-parser/plugins/xlsx/index.js +737 -257
- package/dist/cjs/excel-parser/plugins/xlsx/pivots.d.ts.map +1 -1
- package/dist/cjs/excel-parser/plugins/xlsx/pivots.js +125 -37
- package/dist/cjs/excel-parser/plugins/xlsx/sheet-views.d.ts +3 -0
- package/dist/cjs/excel-parser/plugins/xlsx/sheet-views.d.ts.map +1 -1
- package/dist/cjs/excel-parser/plugins/xlsx/sheet-views.js +4 -1
- package/dist/cjs/excel-parser/plugins/xlsx/styles.d.ts +15 -1
- package/dist/cjs/excel-parser/plugins/xlsx/styles.d.ts.map +1 -1
- package/dist/cjs/excel-parser/plugins/xlsx/styles.js +102 -6
- package/dist/cjs/excel-parser/registry.d.ts +7 -0
- package/dist/cjs/excel-parser/registry.d.ts.map +1 -1
- package/dist/cjs/excel-parser/registry.js +29 -0
- package/dist/cjs/excel-parser/types.d.ts +17 -2
- package/dist/cjs/excel-parser/types.d.ts.map +1 -1
- package/dist/cjs/excel-parser/workbook.d.ts +3 -0
- package/dist/cjs/excel-parser/workbook.d.ts.map +1 -1
- package/dist/cjs/excel-parser/workbook.js +24 -14
- package/dist/cjs/excel-parser/worker.js +131 -131
- package/dist/cjs/exporter/ods/ods-export.d.ts.map +1 -1
- package/dist/cjs/exporter/ods/ods-export.js +432 -175
- package/dist/cjs/exporter/xlsx/chart-builder.d.ts.map +1 -1
- package/dist/cjs/exporter/xlsx/chart-builder.js +215 -39
- package/dist/cjs/exporter/xlsx/chartex-builder.d.ts +36 -0
- package/dist/cjs/exporter/xlsx/chartex-builder.d.ts.map +1 -0
- package/dist/cjs/exporter/xlsx/chartex-builder.js +109 -0
- package/dist/cjs/exporter/xlsx/form-controls-builder.d.ts +61 -0
- package/dist/cjs/exporter/xlsx/form-controls-builder.d.ts.map +1 -0
- package/dist/cjs/exporter/xlsx/form-controls-builder.js +197 -0
- package/dist/cjs/exporter/xlsx/pivot-builder.d.ts +8 -0
- package/dist/cjs/exporter/xlsx/pivot-builder.d.ts.map +1 -1
- package/dist/cjs/exporter/xlsx/pivot-builder.js +141 -42
- package/dist/cjs/exporter/xlsx/style-builder.js +9 -3
- package/dist/cjs/exporter/xlsx/threaded-comments-builder.d.ts +7 -1
- package/dist/cjs/exporter/xlsx/threaded-comments-builder.d.ts.map +1 -1
- package/dist/cjs/exporter/xlsx/threaded-comments-builder.js +15 -3
- package/dist/cjs/exporter/xlsx/xlsx-export.d.ts +11 -2
- package/dist/cjs/exporter/xlsx/xlsx-export.d.ts.map +1 -1
- package/dist/cjs/exporter/xlsx/xlsx-export.js +991 -297
- package/dist/cjs/helpers/implicit-intersection.d.ts +16 -0
- package/dist/cjs/helpers/implicit-intersection.d.ts.map +1 -0
- package/dist/cjs/helpers/implicit-intersection.js +197 -0
- package/dist/cjs/print-settings.d.ts +105 -0
- package/dist/cjs/print-settings.d.ts.map +1 -0
- package/dist/cjs/print-settings.js +494 -0
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/esm/excel-parser/cfb-decryptor.d.ts +6 -0
- package/dist/esm/excel-parser/cfb-decryptor.d.ts.map +1 -1
- package/dist/esm/excel-parser/cfb-decryptor.js +6 -0
- package/dist/esm/excel-parser/helpers.d.ts +9 -1
- package/dist/esm/excel-parser/helpers.d.ts.map +1 -1
- package/dist/esm/excel-parser/helpers.js +34 -0
- package/dist/esm/excel-parser/interface.d.ts +15 -2
- package/dist/esm/excel-parser/interface.d.ts.map +1 -1
- package/dist/esm/excel-parser/plugins/base/index.d.ts +2 -0
- package/dist/esm/excel-parser/plugins/base/index.d.ts.map +1 -1
- package/dist/esm/excel-parser/plugins/base/index.js +3 -0
- package/dist/esm/excel-parser/plugins/ods/index.d.ts +19 -0
- package/dist/esm/excel-parser/plugins/ods/index.d.ts.map +1 -1
- package/dist/esm/excel-parser/plugins/ods/index.js +347 -33
- package/dist/esm/excel-parser/plugins/ods/styles.d.ts +43 -1
- package/dist/esm/excel-parser/plugins/ods/styles.d.ts.map +1 -1
- package/dist/esm/excel-parser/plugins/ods/styles.js +276 -2
- package/dist/esm/excel-parser/plugins/xls/index.d.ts +55 -1
- package/dist/esm/excel-parser/plugins/xls/index.d.ts.map +1 -1
- package/dist/esm/excel-parser/plugins/xls/index.js +441 -3
- package/dist/esm/excel-parser/plugins/xlsb/index.d.ts +4 -0
- package/dist/esm/excel-parser/plugins/xlsb/index.d.ts.map +1 -1
- package/dist/esm/excel-parser/plugins/xlsb/index.js +30 -9
- package/dist/esm/excel-parser/plugins/xlsx/chartex.d.ts +37 -0
- package/dist/esm/excel-parser/plugins/xlsx/chartex.d.ts.map +1 -0
- package/dist/esm/excel-parser/plugins/xlsx/chartex.js +199 -0
- package/dist/esm/excel-parser/plugins/xlsx/charts.d.ts +10 -0
- package/dist/esm/excel-parser/plugins/xlsx/charts.d.ts.map +1 -1
- package/dist/esm/excel-parser/plugins/xlsx/charts.js +69 -6
- package/dist/esm/excel-parser/plugins/xlsx/drawing.d.ts +28 -1
- package/dist/esm/excel-parser/plugins/xlsx/drawing.d.ts.map +1 -1
- package/dist/esm/excel-parser/plugins/xlsx/drawing.js +99 -0
- package/dist/esm/excel-parser/plugins/xlsx/form-controls.d.ts +70 -0
- package/dist/esm/excel-parser/plugins/xlsx/form-controls.d.ts.map +1 -0
- package/dist/esm/excel-parser/plugins/xlsx/form-controls.js +246 -0
- package/dist/esm/excel-parser/plugins/xlsx/index.d.ts +35 -2
- package/dist/esm/excel-parser/plugins/xlsx/index.d.ts.map +1 -1
- package/dist/esm/excel-parser/plugins/xlsx/index.js +454 -32
- package/dist/esm/excel-parser/plugins/xlsx/pivots.d.ts.map +1 -1
- package/dist/esm/excel-parser/plugins/xlsx/pivots.js +86 -6
- package/dist/esm/excel-parser/plugins/xlsx/sheet-views.d.ts +3 -0
- package/dist/esm/excel-parser/plugins/xlsx/sheet-views.d.ts.map +1 -1
- package/dist/esm/excel-parser/plugins/xlsx/sheet-views.js +2 -0
- package/dist/esm/excel-parser/plugins/xlsx/styles.d.ts +15 -1
- package/dist/esm/excel-parser/plugins/xlsx/styles.d.ts.map +1 -1
- package/dist/esm/excel-parser/plugins/xlsx/styles.js +92 -2
- package/dist/esm/excel-parser/registry.d.ts +7 -0
- package/dist/esm/excel-parser/registry.d.ts.map +1 -1
- package/dist/esm/excel-parser/registry.js +19 -0
- package/dist/esm/excel-parser/types.d.ts +17 -2
- package/dist/esm/excel-parser/types.d.ts.map +1 -1
- package/dist/esm/excel-parser/workbook.d.ts +3 -0
- package/dist/esm/excel-parser/workbook.d.ts.map +1 -1
- package/dist/esm/excel-parser/workbook.js +19 -10
- package/dist/esm/excel-parser/worker.js +12 -18
- package/dist/esm/exporter/ods/ods-export.d.ts.map +1 -1
- package/dist/esm/exporter/ods/ods-export.js +306 -35
- package/dist/esm/exporter/xlsx/chart-builder.d.ts.map +1 -1
- package/dist/esm/exporter/xlsx/chart-builder.js +161 -28
- package/dist/esm/exporter/xlsx/chartex-builder.d.ts +36 -0
- package/dist/esm/exporter/xlsx/chartex-builder.d.ts.map +1 -0
- package/dist/esm/exporter/xlsx/chartex-builder.js +97 -0
- package/dist/esm/exporter/xlsx/form-controls-builder.d.ts +61 -0
- package/dist/esm/exporter/xlsx/form-controls-builder.d.ts.map +1 -0
- package/dist/esm/exporter/xlsx/form-controls-builder.js +173 -0
- package/dist/esm/exporter/xlsx/pivot-builder.d.ts +8 -0
- package/dist/esm/exporter/xlsx/pivot-builder.d.ts.map +1 -1
- package/dist/esm/exporter/xlsx/pivot-builder.js +104 -19
- package/dist/esm/exporter/xlsx/style-builder.js +9 -3
- package/dist/esm/exporter/xlsx/threaded-comments-builder.d.ts +7 -1
- package/dist/esm/exporter/xlsx/threaded-comments-builder.d.ts.map +1 -1
- package/dist/esm/exporter/xlsx/threaded-comments-builder.js +15 -3
- package/dist/esm/exporter/xlsx/xlsx-export.d.ts +11 -2
- package/dist/esm/exporter/xlsx/xlsx-export.d.ts.map +1 -1
- package/dist/esm/exporter/xlsx/xlsx-export.js +675 -64
- package/dist/esm/helpers/implicit-intersection.d.ts +16 -0
- package/dist/esm/helpers/implicit-intersection.d.ts.map +1 -0
- package/dist/esm/helpers/implicit-intersection.js +184 -0
- package/dist/esm/print-settings.d.ts +105 -0
- package/dist/esm/print-settings.d.ts.map +1 -0
- package/dist/esm/print-settings.js +422 -0
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/xlsx.d.ts +14 -0
|
@@ -1,3 +1,62 @@
|
|
|
1
|
+
const attr = (node, name) => {
|
|
2
|
+
const v = node?.a$?.[name] ?? node?.[`@_${name}`];
|
|
3
|
+
return v === undefined || v === null ? undefined : String(v);
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* `dataField@showDataAs` (ECMA-376) + the `x14:dataField@pivotShowAs`
|
|
7
|
+
* extension Excel uses for the newer modes → `PivotValue.showAs`.
|
|
8
|
+
* Modes without an engine equivalent (difference, % of parent, index…)
|
|
9
|
+
* degrade to the plain aggregate.
|
|
10
|
+
*/
|
|
11
|
+
const readShowAs = (dataField) => {
|
|
12
|
+
const extLst = dataField?.extLst ?? dataField?.["x:extLst"];
|
|
13
|
+
const exts = asArray(extLst?.ext ?? extLst?.["x:ext"]);
|
|
14
|
+
for (const ext of exts) {
|
|
15
|
+
const x14 = ext?.["x14:dataField"];
|
|
16
|
+
const pivotShowAs = attr(x14, "pivotShowAs");
|
|
17
|
+
if (pivotShowAs === "rankAscending")
|
|
18
|
+
return "rank_asc";
|
|
19
|
+
if (pivotShowAs === "rankDescending")
|
|
20
|
+
return "rank_desc";
|
|
21
|
+
}
|
|
22
|
+
switch (attr(dataField, "showDataAs")) {
|
|
23
|
+
case "percentOfTotal":
|
|
24
|
+
return "pct_of_total";
|
|
25
|
+
case "percentOfRow":
|
|
26
|
+
return "pct_of_row";
|
|
27
|
+
case "percentOfCol":
|
|
28
|
+
return "pct_of_column";
|
|
29
|
+
case "runTotal":
|
|
30
|
+
return "running_total";
|
|
31
|
+
default:
|
|
32
|
+
return undefined;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
const readStyleInfo = (pt) => {
|
|
36
|
+
const node = pt?.pivotTableStyleInfo ?? pt?.["x:pivotTableStyleInfo"];
|
|
37
|
+
if (!node)
|
|
38
|
+
return undefined;
|
|
39
|
+
const flag = (name) => {
|
|
40
|
+
const v = attr(node, name);
|
|
41
|
+
return v === undefined ? undefined : v !== "0" && v !== "false";
|
|
42
|
+
};
|
|
43
|
+
const info = {};
|
|
44
|
+
const name = attr(node, "name");
|
|
45
|
+
if (name)
|
|
46
|
+
info.name = name;
|
|
47
|
+
for (const key of [
|
|
48
|
+
"showRowHeaders",
|
|
49
|
+
"showColHeaders",
|
|
50
|
+
"showRowStripes",
|
|
51
|
+
"showColStripes",
|
|
52
|
+
"showLastColumn",
|
|
53
|
+
]) {
|
|
54
|
+
const v = flag(key);
|
|
55
|
+
if (v !== undefined)
|
|
56
|
+
info[key] = v;
|
|
57
|
+
}
|
|
58
|
+
return Object.keys(info).length ? info : undefined;
|
|
59
|
+
};
|
|
1
60
|
const asArray = (value) => {
|
|
2
61
|
if (value === undefined || value === null)
|
|
3
62
|
return [];
|
|
@@ -69,6 +128,9 @@ const parsePivotCacheDefinition = (cacheXml) => {
|
|
|
69
128
|
const cacheSource = cacheDef.cacheSource ?? cacheDef["x:cacheSource"];
|
|
70
129
|
const wsSource = cacheSource?.worksheetSource ?? cacheSource?.["x:worksheetSource"];
|
|
71
130
|
const sourceRef = wsSource?.a$?.ref || wsSource?.["@_ref"];
|
|
131
|
+
// Excel writes the source sheet as `worksheetSource@sheet` (the ref is
|
|
132
|
+
// then sheet-less); a `Sheet!A1:D9` prefix on the ref also occurs.
|
|
133
|
+
const sourceSheet = attr(wsSource, "sheet");
|
|
72
134
|
const cacheFields = cacheDef.cacheFields ?? cacheDef["x:cacheFields"];
|
|
73
135
|
const rawFieldList = asArray(cacheFields?.cacheField ?? cacheFields?.["x:cacheField"]);
|
|
74
136
|
const fields = rawFieldList.map((cf) => {
|
|
@@ -86,9 +148,14 @@ const parsePivotCacheDefinition = (cacheXml) => {
|
|
|
86
148
|
items.push(null);
|
|
87
149
|
}
|
|
88
150
|
}
|
|
89
|
-
|
|
151
|
+
const formula = attr(cf, "formula");
|
|
152
|
+
return {
|
|
153
|
+
name,
|
|
154
|
+
sharedItems: items.length > 0 ? items : undefined,
|
|
155
|
+
...(formula !== undefined ? { formula } : {}),
|
|
156
|
+
};
|
|
90
157
|
});
|
|
91
|
-
return { sourceRef, fields };
|
|
158
|
+
return { sourceRef, sourceSheet, fields };
|
|
92
159
|
};
|
|
93
160
|
/**
|
|
94
161
|
* Parse a single pivotTable.xml into a PivotTable record. Needs the
|
|
@@ -124,7 +191,8 @@ const parsePivotTableXml = (pivotXml, cacheDef, getSheetId, defaultSheetId, pivo
|
|
|
124
191
|
// Source range from cacheDef
|
|
125
192
|
let source;
|
|
126
193
|
if (cacheDef.sourceRef) {
|
|
127
|
-
const { sheet, a1 } = stripSheetPrefix(cacheDef.sourceRef);
|
|
194
|
+
const { sheet: prefixSheet, a1 } = stripSheetPrefix(cacheDef.sourceRef);
|
|
195
|
+
const sheet = prefixSheet ?? cacheDef.sourceSheet;
|
|
128
196
|
const sourceRange = parseA1Range(a1);
|
|
129
197
|
if (sourceRange) {
|
|
130
198
|
const resolved = sheet ? getSheetId(sheet) : undefined;
|
|
@@ -169,11 +237,19 @@ const parsePivotTableXml = (pivotXml, cacheDef, getSheetId, defaultSheetId, pivo
|
|
|
169
237
|
const field = fieldNameAt(idx);
|
|
170
238
|
if (!field)
|
|
171
239
|
return null;
|
|
172
|
-
|
|
240
|
+
// Excel always summarizes a calculated field with Sum.
|
|
241
|
+
const aggFunc = cacheDef.fields[idx]?.formula !== undefined
|
|
242
|
+
? "sum"
|
|
243
|
+
: normalizeAggFunc(d.a$?.subtotal || d["@_subtotal"]);
|
|
173
244
|
const displayName = d.a$?.name || d["@_name"] || `${aggFunc} of ${field}`;
|
|
174
|
-
|
|
245
|
+
const showAs = readShowAs(d);
|
|
246
|
+
return { field, displayName, aggFunc, ...(showAs ? { showAs } : {}) };
|
|
175
247
|
})
|
|
176
248
|
.filter((v) => v !== null);
|
|
249
|
+
const calculatedFields = cacheDef.fields
|
|
250
|
+
.filter((f) => f.formula !== undefined && f.name !== "")
|
|
251
|
+
.map((f) => ({ name: f.name, formula: f.formula }));
|
|
252
|
+
const styleInfo = readStyleInfo(pt);
|
|
177
253
|
// Display toggles (Phase A1 — round-trip these so the editor
|
|
178
254
|
// checkboxes pick up the imported values).
|
|
179
255
|
// XLSX: rowGrandTotals / colGrandTotals default to "1" (true).
|
|
@@ -192,6 +268,8 @@ const parsePivotTableXml = (pivotXml, cacheDef, getSheetId, defaultSheetId, pivo
|
|
|
192
268
|
showColumnGrandTotals: showColGT,
|
|
193
269
|
// Subtotal default on individual fields → leave true.
|
|
194
270
|
showSubtotals: true,
|
|
271
|
+
...(calculatedFields.length ? { calculatedFields } : {}),
|
|
272
|
+
...(styleInfo ? { styleInfo } : {}),
|
|
195
273
|
};
|
|
196
274
|
};
|
|
197
275
|
/**
|
|
@@ -219,7 +297,9 @@ export const parsePivotTablesForSheet = async (options) => {
|
|
|
219
297
|
const fileName = pivotTablePath.split("/").pop();
|
|
220
298
|
const pivotRelsPath = `${pivotDir}/_rels/${fileName}.rels`;
|
|
221
299
|
const pivotRelsText = await zipParser.getText(pivotRelsPath);
|
|
222
|
-
let cacheDef = {
|
|
300
|
+
let cacheDef = {
|
|
301
|
+
fields: [],
|
|
302
|
+
};
|
|
223
303
|
if (pivotRelsText) {
|
|
224
304
|
const pivotRels = xmlParser.parse(pivotRelsText);
|
|
225
305
|
const relList = asArray(pivotRels?.Relationships?.Relationship);
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* - showRowColHeaders (row/column header visibility)
|
|
6
6
|
* - showZeros (whether zero values render in cells)
|
|
7
7
|
* - zoomScale (integer percent, 10-400; undefined = use Excel default 100)
|
|
8
|
+
* - rightToLeft (the sheet displays right-to-left; only surfaced when set)
|
|
8
9
|
*
|
|
9
10
|
* Works with both single sheet view and multiple sheet views.
|
|
10
11
|
*
|
|
@@ -21,6 +22,8 @@ export type SheetViewProperties = {
|
|
|
21
22
|
showRowColHeaders: boolean;
|
|
22
23
|
showZeros: boolean;
|
|
23
24
|
zoomScale?: number;
|
|
25
|
+
/** `<sheetView rightToLeft="1">` — column A on the right. Absent = LTR. */
|
|
26
|
+
rightToLeft?: true;
|
|
24
27
|
};
|
|
25
28
|
export declare function extractSheetViewProperties(sheetViewData: any): SheetViewProperties;
|
|
26
29
|
//# sourceMappingURL=sheet-views.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sheet-views.d.ts","sourceRoot":"","sources":["../../../../../excel-parser/plugins/xlsx/sheet-views.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"sheet-views.d.ts","sourceRoot":"","sources":["../../../../../excel-parser/plugins/xlsx/sheet-views.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,yEAAyE;IACzE,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,OAAO,CAAC;IACvB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2EAA2E;IAC3E,WAAW,CAAC,EAAE,IAAI,CAAC;CACpB,CAAC;AAQF,wBAAgB,0BAA0B,CACxC,aAAa,EAAE,GAAG,GACjB,mBAAmB,CAsErB"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const isFalseAttr = (val) => val === "0" || val === "false" || val === false;
|
|
2
|
+
const isTrueAttr = (val) => val === "1" || val === "true" || val === true;
|
|
2
3
|
export function extractSheetViewProperties(sheetViewData) {
|
|
3
4
|
const defaults = {
|
|
4
5
|
frozenRowCount: 0,
|
|
@@ -60,5 +61,6 @@ export function extractSheetViewProperties(sheetViewData) {
|
|
|
60
61
|
showRowColHeaders: !isFalseAttr(viewAttrs.showRowColHeaders),
|
|
61
62
|
showZeros: !isFalseAttr(viewAttrs.showZeros),
|
|
62
63
|
...(zoomScale !== undefined ? { zoomScale } : {}),
|
|
64
|
+
...(isTrueAttr(viewAttrs.rightToLeft) ? { rightToLeft: true } : {}),
|
|
63
65
|
};
|
|
64
66
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { GridRange } from "@rowsncolumns/common-types";
|
|
1
|
+
import type { GridRange, NamedCellStyle } from "@rowsncolumns/common-types";
|
|
2
2
|
import type { CellData, Color, ExtendedValue, TextFormat } from "@rowsncolumns/spreadsheet";
|
|
3
3
|
import type { WorkBook } from "../../workbook";
|
|
4
4
|
import type { WorkbookStyles } from "./index";
|
|
@@ -12,6 +12,13 @@ type MergeCellContext = {
|
|
|
12
12
|
* @param {WorkBook} workbook - The workbook object containing shared strings
|
|
13
13
|
* @returns {Object} Object containing value and cellFormat properties
|
|
14
14
|
*/
|
|
15
|
+
/** Days between the 1900 and 1904 date systems' serial 0. */
|
|
16
|
+
export declare const DATE_1904_OFFSET_DAYS = 1462;
|
|
17
|
+
/**
|
|
18
|
+
* Number formats whose serials move with the workbook's date system. Pure
|
|
19
|
+
* time-of-day values (`TIME`) are the same fraction in both systems.
|
|
20
|
+
*/
|
|
21
|
+
export declare const isEpochShiftedFormat: (type: string | undefined) => boolean;
|
|
15
22
|
export declare function getCellValueAndFormat(cell: any, workbook: WorkBook, enableCellXfsRegistry?: boolean, enableSharedStrings?: boolean, activeSheetName?: string, mergeContext?: MergeCellContext): CellData | null;
|
|
16
23
|
/**
|
|
17
24
|
* Build a format-only CellData for a style index that a cell inherits from
|
|
@@ -31,6 +38,13 @@ export declare function extractCellProtection(cell: any, workbookStyles: Workboo
|
|
|
31
38
|
locked?: boolean;
|
|
32
39
|
hidden?: boolean;
|
|
33
40
|
} | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* Resolve the workbook's named cell styles (`<cellStyles>`) to cell formats
|
|
43
|
+
* by reading each entry's `cellStyleXfs[xfId]` — the same extraction a cell
|
|
44
|
+
* xf goes through, minus merge-anchor border merging. Powers the toolbar's
|
|
45
|
+
* "Workbook styles" gallery; entries whose xf is missing keep no `format`.
|
|
46
|
+
*/
|
|
47
|
+
export declare function resolveNamedCellStyles(workbookStyles: WorkbookStyles | undefined | null): NamedCellStyle[];
|
|
34
48
|
/**
|
|
35
49
|
* Parse a raw styles.xml `<font>` node into a TextFormat. Also used for the
|
|
36
50
|
* workbook default font (fonts[0]) so the exporter can round-trip it.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../../excel-parser/plugins/xlsx/styles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../../excel-parser/plugins/xlsx/styles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EAET,cAAc,EACf,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAGV,QAAQ,EAER,KAAK,EA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CAClC,IAAI,EAAE,GAAG,EACT,cAAc,EAAE,cAAc,GAC7B,UAAU,GAAG,IAAI,CAwFnB;AAED;;GAEG;AACH,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,GAAG,EACb,aAAa,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC,GACxC,KAAK,GAAG,SAAS,GAAG,IAAI,CA8C1B"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { formulaToRelativeReference } from "@rowsncolumns/calculator";
|
|
2
2
|
import { IndexedColors } from "@rowsncolumns/utils";
|
|
3
3
|
import { addressToCell, ssfFormat } from "@rowsncolumns/utils";
|
|
4
|
+
import { decodeImplicitIntersection } from "../../../helpers/implicit-intersection";
|
|
4
5
|
import { standardExcelFormatCodeById } from "./numfmt";
|
|
5
6
|
import { detectValueTypeAndPattern } from "./value-type-detection";
|
|
6
7
|
const getNode = (node, ...keys) => {
|
|
@@ -59,6 +60,13 @@ const getInlineStringValue = (cell) => {
|
|
|
59
60
|
* @param {WorkBook} workbook - The workbook object containing shared strings
|
|
60
61
|
* @returns {Object} Object containing value and cellFormat properties
|
|
61
62
|
*/
|
|
63
|
+
/** Days between the 1900 and 1904 date systems' serial 0. */
|
|
64
|
+
export const DATE_1904_OFFSET_DAYS = 1462;
|
|
65
|
+
/**
|
|
66
|
+
* Number formats whose serials move with the workbook's date system. Pure
|
|
67
|
+
* time-of-day values (`TIME`) are the same fraction in both systems.
|
|
68
|
+
*/
|
|
69
|
+
export const isEpochShiftedFormat = (type) => type === "DATE" || type === "DATE_TIME";
|
|
62
70
|
export function getCellValueAndFormat(cell, workbook, enableCellXfsRegistry = false, enableSharedStrings = false, activeSheetName, mergeContext) {
|
|
63
71
|
if (!cell) {
|
|
64
72
|
return null;
|
|
@@ -115,6 +123,16 @@ export function getCellValueAndFormat(cell, workbook, enableCellXfsRegistry = fa
|
|
|
115
123
|
const styleId = workbook.registerFormat(cellFormat);
|
|
116
124
|
ef = { sid: styleId };
|
|
117
125
|
}
|
|
126
|
+
// A 1904-system workbook stores its date serials 1462 days below the 1900
|
|
127
|
+
// system the calculation engine, the formatter and the exporter run on.
|
|
128
|
+
// Date / datetime-formatted numbers (literals and cached formula results)
|
|
129
|
+
// are converted here, as `rnc-import` does, so they display and compute as
|
|
130
|
+
// the same calendar dates; time-of-day serials are epoch-independent.
|
|
131
|
+
if (typeof rawValue === "number" &&
|
|
132
|
+
isEpochShiftedFormat(cellFormat.numberFormat?.type) &&
|
|
133
|
+
workbook.getUse1904Epoch()) {
|
|
134
|
+
rawValue += DATE_1904_OFFSET_DAYS;
|
|
135
|
+
}
|
|
118
136
|
// User entered value
|
|
119
137
|
let ue;
|
|
120
138
|
let ev;
|
|
@@ -309,7 +327,9 @@ function extractCellValue(cell, workbook, activeSheetName) {
|
|
|
309
327
|
}
|
|
310
328
|
}
|
|
311
329
|
if (formulaValue) {
|
|
312
|
-
|
|
330
|
+
// Excel 365 persists the implicit-intersection operator `@` as
|
|
331
|
+
// `_xlfn.SINGLE(...)`; show it the way Excel does.
|
|
332
|
+
formulaValue = decodeImplicitIntersection(normalizeFormulaSheetNames(formulaValue));
|
|
313
333
|
}
|
|
314
334
|
switch (cellType) {
|
|
315
335
|
case "s": {
|
|
@@ -520,6 +540,69 @@ function extractCellFormat(cell, workbookStyles, mergeContext) {
|
|
|
520
540
|
const xfId = xfIdStr !== undefined ? parseInt(xfIdStr) : 0;
|
|
521
541
|
const parentXf = xfId > 0 ? workbookStyles.getCellStyleXf(xfId) : null;
|
|
522
542
|
const xf = buildEffectiveXf(cellXf, parentXf);
|
|
543
|
+
return extractCellFormatFromXf(xf, workbookStyles, cell, mergeContext);
|
|
544
|
+
}
|
|
545
|
+
/**
|
|
546
|
+
* Resolve the workbook's named cell styles (`<cellStyles>`) to cell formats
|
|
547
|
+
* by reading each entry's `cellStyleXfs[xfId]` — the same extraction a cell
|
|
548
|
+
* xf goes through, minus merge-anchor border merging. Powers the toolbar's
|
|
549
|
+
* "Workbook styles" gallery; entries whose xf is missing keep no `format`.
|
|
550
|
+
*/
|
|
551
|
+
export function resolveNamedCellStyles(workbookStyles) {
|
|
552
|
+
if (!workbookStyles)
|
|
553
|
+
return [];
|
|
554
|
+
return workbookStyles.namedCellStyles.map((entry) => {
|
|
555
|
+
const xf = workbookStyles.getCellStyleXf(entry.xfId);
|
|
556
|
+
if (!xf)
|
|
557
|
+
return { ...entry };
|
|
558
|
+
// Drop empty slots and the default General number format — a style that
|
|
559
|
+
// carries nothing else is format-less as far as the gallery is concerned.
|
|
560
|
+
const format = Object.fromEntries(Object.entries(extractCellFormatFromXf(maskCellStyleXf(xf), workbookStyles)).filter(([key, value]) => value != null &&
|
|
561
|
+
!(key === "numberFormat" &&
|
|
562
|
+
value.type === "GENERAL" &&
|
|
563
|
+
(!value.pattern ||
|
|
564
|
+
value.pattern === "General"))));
|
|
565
|
+
return Object.keys(format).length ? { ...entry, format } : { ...entry };
|
|
566
|
+
});
|
|
567
|
+
}
|
|
568
|
+
const isApplyFlagOff = (value) => value === "0" || value === "false";
|
|
569
|
+
/**
|
|
570
|
+
* A `cellStyleXfs` entry only *includes* an attribute when its `applyX` flag
|
|
571
|
+
* is not off (OOXML §18.8.45): Excel writes `applyFont="0" applyFill="0"
|
|
572
|
+
* applyBorder="0" applyAlignment="0"` on `Percent` / `Comma` / `Currency`,
|
|
573
|
+
* whose Style dialog has only "Number" ticked, so applying them must change
|
|
574
|
+
* the number format alone — extracting their `fontId="0"` as a real font
|
|
575
|
+
* would reset the cell's font family / size and un-bold it. Strip the
|
|
576
|
+
* excluded attributes before extraction. (Cell `cellXfs` entries follow the
|
|
577
|
+
* inverse rule and go through `buildEffectiveXf` instead.)
|
|
578
|
+
*/
|
|
579
|
+
function maskCellStyleXf(xf) {
|
|
580
|
+
const attrs = xf?.a$ ?? {};
|
|
581
|
+
const masked = { ...xf, a$: { ...attrs } };
|
|
582
|
+
if (isApplyFlagOff(attrs.applyNumberFormat))
|
|
583
|
+
delete masked.a$.numFmtId;
|
|
584
|
+
if (isApplyFlagOff(attrs.applyFont))
|
|
585
|
+
delete masked.a$.fontId;
|
|
586
|
+
if (isApplyFlagOff(attrs.applyFill))
|
|
587
|
+
delete masked.a$.fillId;
|
|
588
|
+
if (isApplyFlagOff(attrs.applyBorder))
|
|
589
|
+
delete masked.a$.borderId;
|
|
590
|
+
if (isApplyFlagOff(attrs.applyAlignment)) {
|
|
591
|
+
delete masked.alignment;
|
|
592
|
+
delete masked["x:alignment"];
|
|
593
|
+
}
|
|
594
|
+
if (isApplyFlagOff(attrs.applyProtection)) {
|
|
595
|
+
delete masked.protection;
|
|
596
|
+
delete masked["x:protection"];
|
|
597
|
+
}
|
|
598
|
+
return masked;
|
|
599
|
+
}
|
|
600
|
+
/**
|
|
601
|
+
* Extract a cell format from a resolved `<xf>` node. `cell` / `mergeContext`
|
|
602
|
+
* only matter for merge-anchor border merging and may be omitted.
|
|
603
|
+
*/
|
|
604
|
+
function extractCellFormatFromXf(xf, workbookStyles, cell, mergeContext) {
|
|
605
|
+
const cellFormat = {};
|
|
523
606
|
// Extract number format
|
|
524
607
|
const numberFormat = extractNumberFormat(xf, workbookStyles);
|
|
525
608
|
if (!(numberFormat?.type === "GENERAL" && !numberFormat.pattern)) {
|
|
@@ -564,7 +647,14 @@ function extractCellFormat(cell, workbookStyles, mergeContext) {
|
|
|
564
647
|
cellFormat.relativeIndent = relativeIndent;
|
|
565
648
|
if (alignment.textRotation) {
|
|
566
649
|
const rotation = parseInt(alignment.textRotation);
|
|
567
|
-
|
|
650
|
+
// Excel encodes clockwise rotation as 90 + degrees (91–180); the engine
|
|
651
|
+
// keeps signed counter-clockwise degrees (-90…90) like the renderer.
|
|
652
|
+
cellFormat.textRotation =
|
|
653
|
+
rotation === 255
|
|
654
|
+
? "vertical"
|
|
655
|
+
: rotation > 90
|
|
656
|
+
? 90 - rotation
|
|
657
|
+
: rotation;
|
|
568
658
|
}
|
|
569
659
|
if (alignment.shrinkToFit === "1" || alignment.shrinkToFit === "true") {
|
|
570
660
|
cellFormat.shrinkToFit = true;
|
|
@@ -2,4 +2,11 @@ import type { IWorkbookPlugin } from "./interface";
|
|
|
2
2
|
export type PluginFactory = () => IWorkbookPlugin;
|
|
3
3
|
export declare const PARSER_REGISTRY: Record<string, PluginFactory>;
|
|
4
4
|
export declare function getPluginForFile(file: File | string): IWorkbookPlugin;
|
|
5
|
+
/**
|
|
6
|
+
* Content-aware plugin resolution. The extension picks the parser, except:
|
|
7
|
+
* an OOXML zip saved with a `.xls` name opens through the xlsx parser (Excel
|
|
8
|
+
* opens those too), and a BIFF (CFB) container opens through the `.xls`
|
|
9
|
+
* reader whatever its name says.
|
|
10
|
+
*/
|
|
11
|
+
export declare function resolvePluginForBuffer(file: File | string, buffer: ArrayBuffer | File): Promise<IWorkbookPlugin>;
|
|
5
12
|
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../excel-parser/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../excel-parser/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAanD,MAAM,MAAM,aAAa,GAAG,MAAM,eAAe,CAAC;AAElD,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAMzD,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,GAAG,eAAe,CAWrE;AAED;;;;;GAKG;AACH,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,IAAI,GAAG,MAAM,EACnB,MAAM,EAAE,WAAW,GAAG,IAAI,GACzB,OAAO,CAAC,eAAe,CAAC,CAU1B"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { OdsPlugin } from "./plugins/ods/index";
|
|
2
|
+
import { CFB_SIGNATURE, readHeader, startsWith, XlsPlugin, ZIP_SIGNATURE, } from "./plugins/xls/index";
|
|
2
3
|
import { XlsbPlugin } from "./plugins/xlsb/index";
|
|
3
4
|
import { XlsmPlugin } from "./plugins/xlsm/index";
|
|
4
5
|
import { XlsxPlugin } from "./plugins/xlsx/index";
|
|
@@ -6,6 +7,7 @@ export const PARSER_REGISTRY = {
|
|
|
6
7
|
xlsx: () => new XlsxPlugin(),
|
|
7
8
|
xlsm: () => new XlsmPlugin(),
|
|
8
9
|
xlsb: () => new XlsbPlugin(),
|
|
10
|
+
xls: () => new XlsPlugin(),
|
|
9
11
|
ods: () => new OdsPlugin(),
|
|
10
12
|
};
|
|
11
13
|
export function getPluginForFile(file) {
|
|
@@ -18,3 +20,20 @@ export function getPluginForFile(file) {
|
|
|
18
20
|
// Current behavior assumes everything is xlsx-like
|
|
19
21
|
return new XlsxPlugin();
|
|
20
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* Content-aware plugin resolution. The extension picks the parser, except:
|
|
25
|
+
* an OOXML zip saved with a `.xls` name opens through the xlsx parser (Excel
|
|
26
|
+
* opens those too), and a BIFF (CFB) container opens through the `.xls`
|
|
27
|
+
* reader whatever its name says.
|
|
28
|
+
*/
|
|
29
|
+
export async function resolvePluginForBuffer(file, buffer) {
|
|
30
|
+
const header = await readHeader(buffer, CFB_SIGNATURE.length);
|
|
31
|
+
if (startsWith(header, CFB_SIGNATURE)) {
|
|
32
|
+
return new XlsPlugin();
|
|
33
|
+
}
|
|
34
|
+
const plugin = getPluginForFile(file);
|
|
35
|
+
if (plugin instanceof XlsPlugin && startsWith(header, ZIP_SIGNATURE)) {
|
|
36
|
+
return new XlsxPlugin();
|
|
37
|
+
}
|
|
38
|
+
return plugin;
|
|
39
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { CellData, ConditionalFormatRule, DataValidationRuleRecord, EmbeddedChart, NamedRange, Slicer, SpreadsheetTheme, TableView } from "@rowsncolumns/spreadsheet";
|
|
2
|
-
import type { CommentThread, IterativeCalculationOptions } from "@rowsncolumns/common-types";
|
|
1
|
+
import type { CellData, ConditionalFormatRule, DataValidationRuleRecord, EmbeddedChart, NamedRange, ProtectedRange, Slicer, SpreadsheetTheme, TableView } from "@rowsncolumns/spreadsheet";
|
|
2
|
+
import type { CommentThread, IterativeCalculationOptions, NamedCellStyle } from "@rowsncolumns/common-types";
|
|
3
3
|
import type { EmbeddedObject } from "@rowsncolumns/spreadsheet";
|
|
4
4
|
import { type Sheet } from "@rowsncolumns/spreadsheet";
|
|
5
5
|
import type { RowData, RowDataWithValue } from "@rowsncolumns/common-types";
|
|
@@ -211,6 +211,12 @@ export type WorkerResponse = {
|
|
|
211
211
|
error?: string;
|
|
212
212
|
requiresRecalc?: boolean;
|
|
213
213
|
iterativeCalculationOptions?: IterativeCalculationOptions;
|
|
214
|
+
/**
|
|
215
|
+
* The source workbook declared the 1904 date system. The emitted cell
|
|
216
|
+
* data is already converted to the 1900 system (date-formatted
|
|
217
|
+
* serials shifted by 1462 days) — do not feed this into
|
|
218
|
+
* `SheetCell.setUse1904` or `createExcelFile({ use1904 })`.
|
|
219
|
+
*/
|
|
214
220
|
use1904?: boolean;
|
|
215
221
|
} | {
|
|
216
222
|
responseType: ResponseType.GET_SHEETS_SUCCESS;
|
|
@@ -266,6 +272,8 @@ export type WorkerResponse = {
|
|
|
266
272
|
} | {
|
|
267
273
|
responseType: ResponseType.GET_THEME_SUCCESS;
|
|
268
274
|
theme?: SpreadsheetTheme;
|
|
275
|
+
/** `<cellStyles>` resolved to formats — the "Workbook styles" gallery. */
|
|
276
|
+
namedCellStyles?: NamedCellStyle[];
|
|
269
277
|
} | {
|
|
270
278
|
responseType: ResponseType.PARSE_EXCEL_COMPLETE;
|
|
271
279
|
} | {
|
|
@@ -333,6 +341,7 @@ export type WorkerResponse = {
|
|
|
333
341
|
namedRanges: NamedRange[];
|
|
334
342
|
requiresRecalc?: boolean;
|
|
335
343
|
iterativeCalculationOptions?: IterativeCalculationOptions;
|
|
344
|
+
/** Source workbook was 1904-system; chunk data is 1900-system (see `PARSE_EXCEL_SUCCESS`). */
|
|
336
345
|
use1904?: boolean;
|
|
337
346
|
} | ({
|
|
338
347
|
responseType: ResponseType.SHEET_CHUNK;
|
|
@@ -360,6 +369,12 @@ export type WorkerResponse = {
|
|
|
360
369
|
* their `CellData` in the SHEET_CHUNK rows.
|
|
361
370
|
*/
|
|
362
371
|
commentThreads: CommentThread[];
|
|
372
|
+
/**
|
|
373
|
+
* This sheet's allow-edit protected ranges (`<protectedRanges>`), each
|
|
374
|
+
* carrying its `sheetId`; sheet-level `<sheetProtection>` rides
|
|
375
|
+
* `sheet.sheetProtection`.
|
|
376
|
+
*/
|
|
377
|
+
protectedRanges: ProtectedRange[];
|
|
363
378
|
cellXfs: CellXfs;
|
|
364
379
|
};
|
|
365
380
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../excel-parser/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ,EACR,qBAAqB,EACrB,wBAAwB,EACxB,aAAa,EACb,UAAU,EACV,MAAM,EACN,gBAAgB,EAChB,SAAS,EACV,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EACV,aAAa,EACb,2BAA2B,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../excel-parser/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ,EACR,qBAAqB,EACrB,wBAAwB,EACxB,aAAa,EACb,UAAU,EACV,cAAc,EACd,MAAM,EACN,gBAAgB,EAChB,SAAS,EACV,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EACV,aAAa,EACb,2BAA2B,EAC3B,cAAc,EACf,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,cAAc,EAA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AAe,EAAE,cAAc,EAAE,CAAC;IAClC,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC"}
|
|
@@ -17,6 +17,8 @@ export declare class WorkBook implements IWorkbookPlugin {
|
|
|
17
17
|
getSheetCatalog(): Promise<SheetCatalogEntry[]>;
|
|
18
18
|
getSheet(sheetId: number, minRowCount?: number, minColumnCount?: number): Promise<[Sheet, TableView[]]>;
|
|
19
19
|
getTheme(): import("@rowsncolumns/spreadsheet").SpreadsheetTheme;
|
|
20
|
+
/** Named cell styles resolved to formats; empty for formats without them. */
|
|
21
|
+
getNamedCellStyles(): import("@rowsncolumns/common-types").NamedCellStyle[];
|
|
20
22
|
/** Workbook default font (styles.xml fonts[0]); null when unavailable. */
|
|
21
23
|
getDefaultFont(): import("@rowsncolumns/common-types").TextFormat | null;
|
|
22
24
|
getFonts(): string[];
|
|
@@ -38,6 +40,7 @@ export declare class WorkBook implements IWorkbookPlugin {
|
|
|
38
40
|
getConditionalFormatting(sheetId?: number): Promise<import("@rowsncolumns/spreadsheet").ConditionalFormatRule[]>;
|
|
39
41
|
getDataValidations(sheetId?: number): Promise<import("@rowsncolumns/common-types").DataValidationRuleRecord[]>;
|
|
40
42
|
getNamedRanges(): import("@rowsncolumns/spreadsheet").NamedRange[];
|
|
43
|
+
getProtectedRanges(sheetId?: number): import("@rowsncolumns/spreadsheet").ProtectedRange[];
|
|
41
44
|
getCommentThreads(sheetId?: number): Promise<import("@rowsncolumns/common-types").CommentThread[]>;
|
|
42
45
|
getSlicers(): Promise<import("@rowsncolumns/spreadsheet").Slicer[]>;
|
|
43
46
|
getPivotTables(): Promise<import("@rowsncolumns/common-types").PivotTable[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workbook.d.ts","sourceRoot":"","sources":["../../../excel-parser/workbook.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"workb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AE,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,KAAK,IAAI;IAUxD,wBAAwB,CAAC,OAAO,EAAE,+BAA+B;IAmBjE,kBAAkB,CAAC,OAAO,EAAE,MAAM;IAIlC,WAAW;IAIX,SAAS;IAIT,wBAAwB,CAAC,OAAO,CAAC,EAAE,MAAM;IAgBzC,kBAAkB,CAAC,OAAO,CAAC,EAAE,MAAM;IAgBnC,cAAc;IAId,kBAAkB,CAAC,OAAO,CAAC,EAAE,MAAM;IAInC,iBAAiB,CAAC,OAAO,CAAC,EAAE,MAAM;IAIlC,UAAU;IAIV,cAAc;IAId,aAAa;IAIb,gBAAgB;IAIV,aAAa;IAInB,cAAc,CAAC,MAAM,EAAE,GAAG;CAM3B;AAED,eAAO,MAAM,2BAA2B,qCAA+B,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { CFBDecryptor, detectCfbContainerKind
|
|
1
|
+
import { CFBDecryptor, detectCfbContainerKind } from "./cfb-decryptor";
|
|
2
2
|
import { getChartReferenceFromAnchor as _getChartReferenceFromAnchor, WorkbookStyles, } from "./plugins/xlsx/index";
|
|
3
|
-
import {
|
|
3
|
+
import { resolvePluginForBuffer } from "./registry";
|
|
4
4
|
const CFB_SIGNATURE = [0xd0, 0xcf, 0x11, 0xe0, 0xa1, 0xb1, 0x1a, 0xe1];
|
|
5
5
|
const isCFBFile = async (source) => {
|
|
6
6
|
let header;
|
|
@@ -23,16 +23,18 @@ export class WorkBook {
|
|
|
23
23
|
constructor() { }
|
|
24
24
|
async load(buffer, fileName, password) {
|
|
25
25
|
if (await isCFBFile(buffer)) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
if (
|
|
30
|
-
|
|
26
|
+
// A CFB container is either an Office-encrypted OOXML package (decrypt,
|
|
27
|
+
// then parse the zip) or a legacy BIFF `.xls` workbook (the `.xls`
|
|
28
|
+
// reader takes the container as-is — no password prompt).
|
|
29
|
+
if ((await detectCfbContainerKind(buffer)) !== "legacy-xls") {
|
|
30
|
+
if (!password) {
|
|
31
|
+
throw new Error("PASSWORD_REQUIRED");
|
|
32
|
+
}
|
|
33
|
+
const decryptedBuffer = await CFBDecryptor.decrypt(buffer, password);
|
|
34
|
+
buffer = decryptedBuffer;
|
|
31
35
|
}
|
|
32
|
-
const decryptedBuffer = await CFBDecryptor.decrypt(buffer, password);
|
|
33
|
-
buffer = decryptedBuffer;
|
|
34
36
|
}
|
|
35
|
-
this.plugin =
|
|
37
|
+
this.plugin = await resolvePluginForBuffer(fileName || "unknown.xlsx", buffer);
|
|
36
38
|
await this.plugin.load(buffer, password);
|
|
37
39
|
}
|
|
38
40
|
dispose() {
|
|
@@ -76,6 +78,10 @@ export class WorkBook {
|
|
|
76
78
|
getTheme() {
|
|
77
79
|
return this.plugin.getTheme();
|
|
78
80
|
}
|
|
81
|
+
/** Named cell styles resolved to formats; empty for formats without them. */
|
|
82
|
+
getNamedCellStyles() {
|
|
83
|
+
return this.plugin.getNamedCellStyles?.() ?? [];
|
|
84
|
+
}
|
|
79
85
|
/** Workbook default font (styles.xml fonts[0]); null when unavailable. */
|
|
80
86
|
getDefaultFont() {
|
|
81
87
|
return this.plugin.getDefaultFont?.() ?? null;
|
|
@@ -163,6 +169,9 @@ export class WorkBook {
|
|
|
163
169
|
getNamedRanges() {
|
|
164
170
|
return this.plugin.getNamedRanges();
|
|
165
171
|
}
|
|
172
|
+
getProtectedRanges(sheetId) {
|
|
173
|
+
return this.plugin.getProtectedRanges?.(sheetId) ?? [];
|
|
174
|
+
}
|
|
166
175
|
getCommentThreads(sheetId) {
|
|
167
176
|
return this.plugin.getCommentThreads?.(sheetId) ?? Promise.resolve([]);
|
|
168
177
|
}
|