xls-codec 4.7.6 → 4.9.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 +11 -5
- package/dist/biff/cursor.cjs +12 -1
- package/dist/biff/cursor.d.cts +1 -1
- package/dist/biff/cursor.d.ts +1 -1
- package/dist/biff/cursor.js +12 -1
- package/dist/biff/ptg.cjs +16 -2
- package/dist/biff/ptg.d.cts +2 -2
- package/dist/biff/ptg.d.ts +2 -2
- package/dist/biff/ptg.js +16 -3
- package/dist/biff/record-types.cjs +25 -1
- package/dist/biff/record-types.d.cts +18 -2
- package/dist/biff/record-types.d.ts +18 -2
- package/dist/biff/record-types.js +18 -2
- package/dist/biff/strings.d.cts +1 -1
- package/dist/biff/strings.d.ts +1 -1
- package/dist/biff/substreams.cjs +7 -8
- package/dist/biff/substreams.d.cts +1 -1
- package/dist/biff/substreams.d.ts +1 -1
- package/dist/biff/substreams.js +7 -8
- package/dist/biff/xf-colors.d.cts +1 -1
- package/dist/biff/xf-colors.d.ts +1 -1
- package/dist/biff/xf-writer.d.cts +1 -1
- package/dist/biff/xf-writer.d.ts +1 -1
- package/dist/{conditional-format-12-D-X5g_O3.d.ts → conditional-format-12-C3nwy1f8.d.ts} +10 -5
- package/dist/{conditional-format-12-DBhe7Zo6.d.cts → conditional-format-12-D65-ruTq.d.cts} +10 -5
- package/dist/conditional-format-BRMUTRP1.d.ts +41 -0
- package/dist/conditional-format-Cth_afMy.d.cts +41 -0
- package/dist/content.cjs +50 -18
- package/dist/content.js +50 -18
- package/dist/{cursor-VMtw9uVP.d.cts → cursor-CnEuX5qE.d.cts} +3 -1
- package/dist/{cursor-VMtw9uVP.d.ts → cursor-CnEuX5qE.d.ts} +3 -1
- package/dist/{data-validation-DfpjUN-N.d.cts → data-validation-BgUt8CbE.d.cts} +2 -2
- package/dist/{data-validation-BXvIVU0e.d.ts → data-validation-Cq6iD8lB.d.ts} +2 -2
- package/dist/drawing/blips.cjs +83 -0
- package/dist/drawing/blips.d.cts +10 -0
- package/dist/drawing/blips.d.ts +10 -0
- package/dist/drawing/blips.js +82 -0
- package/dist/drawing/bytes.cjs +15 -0
- package/dist/drawing/bytes.d.cts +5 -0
- package/dist/drawing/bytes.d.ts +5 -0
- package/dist/drawing/bytes.js +14 -0
- package/dist/drawing/escher-constants.cjs +52 -0
- package/dist/drawing/escher-constants.d.cts +34 -0
- package/dist/drawing/escher-constants.d.ts +34 -0
- package/dist/drawing/escher-constants.js +34 -0
- package/dist/drawing/escher.cjs +84 -0
- package/dist/drawing/escher.d.cts +30 -0
- package/dist/drawing/escher.d.ts +30 -0
- package/dist/drawing/escher.js +80 -0
- package/dist/drawing/shapes.cjs +80 -0
- package/dist/drawing/shapes.d.cts +24 -0
- package/dist/drawing/shapes.d.ts +24 -0
- package/dist/drawing/shapes.js +79 -0
- package/dist/index.cjs +11 -1
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +4 -4
- package/dist/{print-names-CCwUHAoL.d.cts → print-names-B2OR0fvs.d.cts} +1 -1
- package/dist/{print-names-CxAbgcjB.d.ts → print-names-BXcmmwVi.d.ts} +1 -1
- package/dist/{ptg-CCBbJLZJ.d.cts → ptg-75v7MhaA.d.cts} +7 -1
- package/dist/{ptg-CCBbJLZJ.d.ts → ptg-75v7MhaA.d.ts} +7 -1
- package/dist/{substreams-Dp5cZoUo.d.ts → substreams-CgTHx5kX.d.ts} +1 -1
- package/dist/{substreams-CHv3oWmn.d.cts → substreams-XDNgDvRJ.d.cts} +1 -1
- package/dist/units.cjs +7 -0
- package/dist/units.d.cts +6 -1
- package/dist/units.d.ts +6 -1
- package/dist/units.js +6 -1
- package/dist/workbook/chart.cjs +230 -0
- package/dist/workbook/chart.d.cts +19 -0
- package/dist/workbook/chart.d.ts +19 -0
- package/dist/workbook/chart.js +229 -0
- package/dist/workbook/comments.cjs +2 -1
- package/dist/workbook/comments.d.cts +7 -2
- package/dist/workbook/comments.d.ts +7 -2
- package/dist/workbook/comments.js +2 -2
- package/dist/workbook/conditional-format-12.cjs +32 -1
- package/dist/workbook/conditional-format-12.d.cts +2 -2
- package/dist/workbook/conditional-format-12.d.ts +2 -2
- package/dist/workbook/conditional-format-12.js +33 -3
- package/dist/workbook/conditional-format-ex.cjs +53 -0
- package/dist/workbook/conditional-format-ex.d.cts +13 -0
- package/dist/workbook/conditional-format-ex.d.ts +13 -0
- package/dist/workbook/conditional-format-ex.js +52 -0
- package/dist/workbook/conditional-format.cjs +46 -23
- package/dist/workbook/conditional-format.d.cts +2 -2
- package/dist/workbook/conditional-format.d.ts +2 -2
- package/dist/workbook/conditional-format.js +46 -23
- package/dist/workbook/data-validation.d.cts +1 -1
- package/dist/workbook/data-validation.d.ts +1 -1
- package/dist/workbook/drawing.cjs +270 -0
- package/dist/workbook/drawing.d.cts +31 -0
- package/dist/workbook/drawing.d.ts +31 -0
- package/dist/workbook/drawing.js +268 -0
- package/dist/workbook/globals-writer.d.cts +2 -2
- package/dist/workbook/globals-writer.d.ts +2 -2
- package/dist/workbook/globals.d.cts +4 -4
- package/dist/workbook/globals.d.ts +4 -4
- package/dist/workbook/print-names.d.cts +1 -1
- package/dist/workbook/print-names.d.ts +1 -1
- package/dist/workbook/sheet-writer.cjs +1 -1
- package/dist/workbook/sheet-writer.js +1 -1
- package/dist/workbook/sheet.cjs +11 -0
- package/dist/workbook/sheet.d.cts +5 -5
- package/dist/workbook/sheet.d.ts +5 -5
- package/dist/workbook/sheet.js +12 -1
- package/dist/{xf-colors-mqerVt2O.d.cts → xf-colors-aeH9Ax3Q.d.cts} +1 -1
- package/dist/{xf-colors-d3OvRw76.d.ts → xf-colors-kdNsiNYt.d.ts} +1 -1
- package/package.json +1 -1
- package/dist/conditional-format-Czh2oTzQ.d.cts +0 -29
- package/dist/conditional-format-DOdazxWe.d.ts +0 -29
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "../biff/record-types.js";
|
|
2
2
|
import { BiffFormatError } from "../biff/records.js";
|
|
3
3
|
import { BlockCursor } from "../biff/cursor.js";
|
|
4
|
-
import { parseFormulaText } from "../biff/ptg.js";
|
|
4
|
+
import { extractFirstStringLiteral, parseFormulaText } from "../biff/ptg.js";
|
|
5
5
|
import { parseDxfStyle } from "./conditional-format.js";
|
|
6
6
|
//#region src/workbook/conditional-format-12.ts
|
|
7
7
|
const CFVO_TYPE_TO_VALUE_TYPE = /* @__PURE__ */ new Map([
|
|
@@ -149,6 +149,25 @@ function readCfMultistate(cursor, formulaSheets) {
|
|
|
149
149
|
showValue
|
|
150
150
|
};
|
|
151
151
|
}
|
|
152
|
+
const ICF_TEMPLATE_CONTAINS_TEXT = 8;
|
|
153
|
+
const CTP_TO_TEXT_KIND = /* @__PURE__ */ new Map([
|
|
154
|
+
[0, "containsText"],
|
|
155
|
+
[1, "notContainsText"],
|
|
156
|
+
[2, "beginsWith"],
|
|
157
|
+
[3, "endsWith"]
|
|
158
|
+
]);
|
|
159
|
+
function readCfTextFilterRule(icfTemplate, templateParams, rgce1, formulaSheets) {
|
|
160
|
+
if (icfTemplate !== ICF_TEMPLATE_CONTAINS_TEXT) return;
|
|
161
|
+
const ctp = new BlockCursor([templateParams]).u16();
|
|
162
|
+
const kind = CTP_TO_TEXT_KIND.get(ctp);
|
|
163
|
+
if (kind === void 0) return;
|
|
164
|
+
const text = extractFirstStringLiteral(rgce1, formulaSheets);
|
|
165
|
+
if (text === void 0) return;
|
|
166
|
+
return {
|
|
167
|
+
kind,
|
|
168
|
+
text
|
|
169
|
+
};
|
|
170
|
+
}
|
|
152
171
|
const ICF_TEMPLATE_TOP10 = 5;
|
|
153
172
|
const ICF_TEMPLATE_UNIQUE_VALUES = 7;
|
|
154
173
|
const ICF_TEMPLATE_CONTAINS_BLANKS = 9;
|
|
@@ -222,7 +241,7 @@ function readCf12(record, ranges, formulaSheets) {
|
|
|
222
241
|
const cce2 = cursor.u16();
|
|
223
242
|
const cbDxf = cursor.u32();
|
|
224
243
|
const dxfBytes = cursor.take(cbDxf);
|
|
225
|
-
cursor.
|
|
244
|
+
const rgce1 = cursor.take(cce1);
|
|
226
245
|
cursor.skip(cce2);
|
|
227
246
|
const cceActive = cursor.u16();
|
|
228
247
|
cursor.skip(cceActive);
|
|
@@ -272,6 +291,17 @@ function readCf12(record, ranges, formulaSheets) {
|
|
|
272
291
|
style
|
|
273
292
|
};
|
|
274
293
|
}
|
|
294
|
+
if (ct === 2) {
|
|
295
|
+
const textRule = readCfTextFilterRule(icfTemplate, templateParams, rgce1, formulaSheets);
|
|
296
|
+
if (textRule !== void 0) {
|
|
297
|
+
const style = parseDxfStyle(dxfBytes);
|
|
298
|
+
return {
|
|
299
|
+
...textRule,
|
|
300
|
+
...common,
|
|
301
|
+
style
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
}
|
|
275
305
|
return;
|
|
276
306
|
} catch (err) {
|
|
277
307
|
if (!(err instanceof BiffFormatError)) throw err;
|
|
@@ -327,4 +357,4 @@ function readCondFmt12Group(records, startIndex, formulaSheets) {
|
|
|
327
357
|
}
|
|
328
358
|
}
|
|
329
359
|
//#endregion
|
|
330
|
-
export { readCondFmt12Group };
|
|
360
|
+
export { readCfTextFilterRule, readCondFmt12Group };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_biff_records = require("../biff/records.cjs");
|
|
3
|
+
const require_biff_cursor = require("../biff/cursor.cjs");
|
|
4
|
+
const require_workbook_conditional_format = require("./conditional-format.cjs");
|
|
5
|
+
const require_workbook_conditional_format_12 = require("./conditional-format-12.cjs");
|
|
6
|
+
//#region src/workbook/conditional-format-ex.ts
|
|
7
|
+
function readCfEx(record, targetsByNID, formulaSheets) {
|
|
8
|
+
try {
|
|
9
|
+
const cursor = new require_biff_cursor.BlockCursor(record.blocks);
|
|
10
|
+
cursor.skip(12);
|
|
11
|
+
const fIsCF12 = cursor.u32();
|
|
12
|
+
const nID = cursor.u16();
|
|
13
|
+
if (fIsCF12 !== 0) return;
|
|
14
|
+
const target = targetsByNID.get(nID);
|
|
15
|
+
if (target === void 0) return;
|
|
16
|
+
const icf = cursor.u16();
|
|
17
|
+
cursor.skip(1);
|
|
18
|
+
const icfTemplate = cursor.u8();
|
|
19
|
+
const priority = cursor.u16();
|
|
20
|
+
const flags = cursor.u8();
|
|
21
|
+
const active = (flags & 1) !== 0;
|
|
22
|
+
const stopIfTrue = (flags >>> 1 & 1) !== 0;
|
|
23
|
+
const fHasDxf = cursor.u8();
|
|
24
|
+
let dxfBytes = /* @__PURE__ */ new Uint8Array(0);
|
|
25
|
+
if (fHasDxf !== 0) {
|
|
26
|
+
const cbDxf = cursor.u32();
|
|
27
|
+
dxfBytes = cursor.take(cbDxf);
|
|
28
|
+
}
|
|
29
|
+
cursor.skip(1);
|
|
30
|
+
const templateParams = cursor.take(16);
|
|
31
|
+
if (!active) return;
|
|
32
|
+
const cf = target.cfs[icf];
|
|
33
|
+
if (cf === void 0) return;
|
|
34
|
+
const textRule = require_workbook_conditional_format_12.readCfTextFilterRule(icfTemplate, templateParams, cf.rgce1, formulaSheets);
|
|
35
|
+
if (textRule === void 0) return;
|
|
36
|
+
const common = {
|
|
37
|
+
priority,
|
|
38
|
+
stopIfTrue,
|
|
39
|
+
ranges: target.ranges
|
|
40
|
+
};
|
|
41
|
+
const style = require_workbook_conditional_format.parseDxfStyle(dxfBytes);
|
|
42
|
+
return {
|
|
43
|
+
...textRule,
|
|
44
|
+
...common,
|
|
45
|
+
style
|
|
46
|
+
};
|
|
47
|
+
} catch (err) {
|
|
48
|
+
if (!(err instanceof require_biff_records.BiffFormatError)) throw err;
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
//#endregion
|
|
53
|
+
exports.readCfEx = readCfEx;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { r as FormulaSheetContext } from "../ptg-75v7MhaA.cjs";
|
|
2
|
+
import { t as RecordGroup } from "../substreams-XDNgDvRJ.cjs";
|
|
3
|
+
import { n as RawCfOperand } from "../conditional-format-Cth_afMy.cjs";
|
|
4
|
+
import { a as RawConditionalFormat12 } from "../conditional-format-12-D65-ruTq.cjs";
|
|
5
|
+
import { ContentSheetRange } from "document-schema.js";
|
|
6
|
+
//#region src/workbook/conditional-format-ex.d.ts
|
|
7
|
+
interface CfExTarget {
|
|
8
|
+
readonly ranges: ContentSheetRange[];
|
|
9
|
+
readonly cfs: readonly (RawCfOperand | undefined)[];
|
|
10
|
+
}
|
|
11
|
+
declare function readCfEx(record: RecordGroup, targetsByNID: ReadonlyMap<number, CfExTarget>, formulaSheets: FormulaSheetContext): RawConditionalFormat12 | undefined;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { CfExTarget, readCfEx };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { r as FormulaSheetContext } from "../ptg-75v7MhaA.js";
|
|
2
|
+
import { t as RecordGroup } from "../substreams-CgTHx5kX.js";
|
|
3
|
+
import { n as RawCfOperand } from "../conditional-format-BRMUTRP1.js";
|
|
4
|
+
import { a as RawConditionalFormat12 } from "../conditional-format-12-C3nwy1f8.js";
|
|
5
|
+
import { ContentSheetRange } from "document-schema.js";
|
|
6
|
+
//#region src/workbook/conditional-format-ex.d.ts
|
|
7
|
+
interface CfExTarget {
|
|
8
|
+
readonly ranges: ContentSheetRange[];
|
|
9
|
+
readonly cfs: readonly (RawCfOperand | undefined)[];
|
|
10
|
+
}
|
|
11
|
+
declare function readCfEx(record: RecordGroup, targetsByNID: ReadonlyMap<number, CfExTarget>, formulaSheets: FormulaSheetContext): RawConditionalFormat12 | undefined;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { CfExTarget, readCfEx };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { BiffFormatError } from "../biff/records.js";
|
|
2
|
+
import { BlockCursor } from "../biff/cursor.js";
|
|
3
|
+
import { parseDxfStyle } from "./conditional-format.js";
|
|
4
|
+
import { readCfTextFilterRule } from "./conditional-format-12.js";
|
|
5
|
+
//#region src/workbook/conditional-format-ex.ts
|
|
6
|
+
function readCfEx(record, targetsByNID, formulaSheets) {
|
|
7
|
+
try {
|
|
8
|
+
const cursor = new BlockCursor(record.blocks);
|
|
9
|
+
cursor.skip(12);
|
|
10
|
+
const fIsCF12 = cursor.u32();
|
|
11
|
+
const nID = cursor.u16();
|
|
12
|
+
if (fIsCF12 !== 0) return;
|
|
13
|
+
const target = targetsByNID.get(nID);
|
|
14
|
+
if (target === void 0) return;
|
|
15
|
+
const icf = cursor.u16();
|
|
16
|
+
cursor.skip(1);
|
|
17
|
+
const icfTemplate = cursor.u8();
|
|
18
|
+
const priority = cursor.u16();
|
|
19
|
+
const flags = cursor.u8();
|
|
20
|
+
const active = (flags & 1) !== 0;
|
|
21
|
+
const stopIfTrue = (flags >>> 1 & 1) !== 0;
|
|
22
|
+
const fHasDxf = cursor.u8();
|
|
23
|
+
let dxfBytes = /* @__PURE__ */ new Uint8Array(0);
|
|
24
|
+
if (fHasDxf !== 0) {
|
|
25
|
+
const cbDxf = cursor.u32();
|
|
26
|
+
dxfBytes = cursor.take(cbDxf);
|
|
27
|
+
}
|
|
28
|
+
cursor.skip(1);
|
|
29
|
+
const templateParams = cursor.take(16);
|
|
30
|
+
if (!active) return;
|
|
31
|
+
const cf = target.cfs[icf];
|
|
32
|
+
if (cf === void 0) return;
|
|
33
|
+
const textRule = readCfTextFilterRule(icfTemplate, templateParams, cf.rgce1, formulaSheets);
|
|
34
|
+
if (textRule === void 0) return;
|
|
35
|
+
const common = {
|
|
36
|
+
priority,
|
|
37
|
+
stopIfTrue,
|
|
38
|
+
ranges: target.ranges
|
|
39
|
+
};
|
|
40
|
+
const style = parseDxfStyle(dxfBytes);
|
|
41
|
+
return {
|
|
42
|
+
...textRule,
|
|
43
|
+
...common,
|
|
44
|
+
style
|
|
45
|
+
};
|
|
46
|
+
} catch (err) {
|
|
47
|
+
if (!(err instanceof BiffFormatError)) throw err;
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
//#endregion
|
|
52
|
+
export { readCfEx };
|
|
@@ -61,27 +61,42 @@ function parseDxfStyle(dxfBytes) {
|
|
|
61
61
|
return;
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
|
-
|
|
64
|
+
/** The shared byte-layout parse both readCf and conditional-format.ts's own readCondFmtGroup need: ct/cp/cce1/cce2, the dxf trailer's own bytes (its length inferred from the record's total size the same way this file always has, since [MS-XLS] never states it directly), and the two formula operands. Returns undefined for a truncated/malformed record rather than throwing, so a caller can fold this into its own try/catch or call it standalone. */
|
|
65
|
+
function parseCfBytes(record) {
|
|
65
66
|
try {
|
|
66
67
|
const cursor = new require_biff_cursor.BlockCursor(record.blocks);
|
|
67
68
|
const ct = cursor.u8();
|
|
68
69
|
const cp = cursor.u8();
|
|
69
70
|
const cce1 = cursor.u16();
|
|
70
71
|
const cce2 = cursor.u16();
|
|
71
|
-
if (ct === 2) return;
|
|
72
|
-
const operator = CP_TO_OPERATOR.get(cp);
|
|
73
|
-
if (operator === void 0) return;
|
|
74
72
|
const dxfLength = require_biff_substreams.recordByteLength(record) - 6 - cce1 - cce2;
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
73
|
+
return {
|
|
74
|
+
ct,
|
|
75
|
+
cp,
|
|
76
|
+
dxfBytes: cursor.take(dxfLength),
|
|
77
|
+
rgce1: cursor.take(cce1),
|
|
78
|
+
rgce2: cursor.take(cce2)
|
|
79
|
+
};
|
|
80
|
+
} catch (err) {
|
|
81
|
+
if (!(err instanceof require_biff_records.BiffFormatError)) throw err;
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
function readCf(record, ranges, formulaSheets) {
|
|
86
|
+
const parsed = parseCfBytes(record);
|
|
87
|
+
if (parsed === void 0) return;
|
|
88
|
+
const { ct, cp, dxfBytes, rgce1, rgce2 } = parsed;
|
|
89
|
+
if (ct === 2) return;
|
|
90
|
+
const operator = CP_TO_OPERATOR.get(cp);
|
|
91
|
+
if (operator === void 0) return;
|
|
92
|
+
if (rgce1.length === 0) return;
|
|
93
|
+
try {
|
|
79
94
|
const formula1 = require_biff_ptg.parseFormulaText(rgce1, formulaSheets);
|
|
80
95
|
if (formula1 === void 0) return;
|
|
81
96
|
return {
|
|
82
97
|
operator,
|
|
83
98
|
formula1,
|
|
84
|
-
formula2:
|
|
99
|
+
formula2: rgce2.length > 0 ? require_biff_ptg.parseFormulaText(rgce2, formulaSheets) : void 0,
|
|
85
100
|
style: parseDxfStyle(dxfBytes),
|
|
86
101
|
ranges
|
|
87
102
|
};
|
|
@@ -90,16 +105,20 @@ function readCf(record, ranges, formulaSheets) {
|
|
|
90
105
|
return;
|
|
91
106
|
}
|
|
92
107
|
}
|
|
108
|
+
const DEGRADED_CONDFMT_GROUP = {
|
|
109
|
+
formats: [],
|
|
110
|
+
recordsConsumed: 1,
|
|
111
|
+
nID: 0,
|
|
112
|
+
ranges: [],
|
|
113
|
+
rawCfs: []
|
|
114
|
+
};
|
|
93
115
|
function readCondFmtGroup(records, startIndex, formulaSheets) {
|
|
94
116
|
const condFmt = records[startIndex];
|
|
95
|
-
if (condFmt === void 0) return
|
|
96
|
-
formats: [],
|
|
97
|
-
recordsConsumed: 1
|
|
98
|
-
};
|
|
117
|
+
if (condFmt === void 0) return DEGRADED_CONDFMT_GROUP;
|
|
99
118
|
try {
|
|
100
119
|
const cursor = new require_biff_cursor.BlockCursor(condFmt.blocks);
|
|
101
120
|
const ccf = cursor.u16();
|
|
102
|
-
cursor.
|
|
121
|
+
const nID = cursor.u16() >>> 1 & 32767;
|
|
103
122
|
cursor.skip(8);
|
|
104
123
|
const crefCount = cursor.u16();
|
|
105
124
|
const ranges = [];
|
|
@@ -116,25 +135,29 @@ function readCondFmtGroup(records, startIndex, formulaSheets) {
|
|
|
116
135
|
});
|
|
117
136
|
}
|
|
118
137
|
const formats = [];
|
|
138
|
+
const rawCfs = [];
|
|
119
139
|
for (let offset = 1; offset <= ccf; offset += 1) {
|
|
120
140
|
const cfRecord = records[startIndex + offset];
|
|
121
|
-
if (cfRecord?.type !== 433) return
|
|
122
|
-
formats: [],
|
|
123
|
-
recordsConsumed: 1
|
|
124
|
-
};
|
|
141
|
+
if (cfRecord?.type !== 433) return DEGRADED_CONDFMT_GROUP;
|
|
125
142
|
const format = readCf(cfRecord, ranges, formulaSheets);
|
|
126
143
|
if (format !== void 0) formats.push(format);
|
|
144
|
+
const parsed = parseCfBytes(cfRecord);
|
|
145
|
+
rawCfs.push(parsed === void 0 ? void 0 : {
|
|
146
|
+
ct: parsed.ct,
|
|
147
|
+
cp: parsed.cp,
|
|
148
|
+
rgce1: parsed.rgce1
|
|
149
|
+
});
|
|
127
150
|
}
|
|
128
151
|
return {
|
|
129
152
|
formats,
|
|
130
|
-
recordsConsumed: 1 + ccf
|
|
153
|
+
recordsConsumed: 1 + ccf,
|
|
154
|
+
nID,
|
|
155
|
+
ranges,
|
|
156
|
+
rawCfs
|
|
131
157
|
};
|
|
132
158
|
} catch (err) {
|
|
133
159
|
if (!(err instanceof require_biff_records.BiffFormatError)) throw err;
|
|
134
|
-
return
|
|
135
|
-
formats: [],
|
|
136
|
-
recordsConsumed: 1
|
|
137
|
-
};
|
|
160
|
+
return DEGRADED_CONDFMT_GROUP;
|
|
138
161
|
}
|
|
139
162
|
}
|
|
140
163
|
//#endregion
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
export { CondFmtGroupResult, RawConditionalFormat, RawConditionalFormatFill, RawConditionalFormatStyle, parseDxfStyle, readCondFmtGroup };
|
|
1
|
+
import { a as RawConditionalFormatStyle, i as RawConditionalFormatFill, n as RawCfOperand, o as parseDxfStyle, r as RawConditionalFormat, s as readCondFmtGroup, t as CondFmtGroupResult } from "../conditional-format-Cth_afMy.cjs";
|
|
2
|
+
export { CondFmtGroupResult, RawCfOperand, RawConditionalFormat, RawConditionalFormatFill, RawConditionalFormatStyle, parseDxfStyle, readCondFmtGroup };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
export { CondFmtGroupResult, RawConditionalFormat, RawConditionalFormatFill, RawConditionalFormatStyle, parseDxfStyle, readCondFmtGroup };
|
|
1
|
+
import { a as RawConditionalFormatStyle, i as RawConditionalFormatFill, n as RawCfOperand, o as parseDxfStyle, r as RawConditionalFormat, s as readCondFmtGroup, t as CondFmtGroupResult } from "../conditional-format-BRMUTRP1.js";
|
|
2
|
+
export { CondFmtGroupResult, RawCfOperand, RawConditionalFormat, RawConditionalFormatFill, RawConditionalFormatStyle, parseDxfStyle, readCondFmtGroup };
|
|
@@ -60,27 +60,42 @@ function parseDxfStyle(dxfBytes) {
|
|
|
60
60
|
return;
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
-
|
|
63
|
+
/** The shared byte-layout parse both readCf and conditional-format.ts's own readCondFmtGroup need: ct/cp/cce1/cce2, the dxf trailer's own bytes (its length inferred from the record's total size the same way this file always has, since [MS-XLS] never states it directly), and the two formula operands. Returns undefined for a truncated/malformed record rather than throwing, so a caller can fold this into its own try/catch or call it standalone. */
|
|
64
|
+
function parseCfBytes(record) {
|
|
64
65
|
try {
|
|
65
66
|
const cursor = new BlockCursor(record.blocks);
|
|
66
67
|
const ct = cursor.u8();
|
|
67
68
|
const cp = cursor.u8();
|
|
68
69
|
const cce1 = cursor.u16();
|
|
69
70
|
const cce2 = cursor.u16();
|
|
70
|
-
if (ct === 2) return;
|
|
71
|
-
const operator = CP_TO_OPERATOR.get(cp);
|
|
72
|
-
if (operator === void 0) return;
|
|
73
71
|
const dxfLength = recordByteLength(record) - 6 - cce1 - cce2;
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
72
|
+
return {
|
|
73
|
+
ct,
|
|
74
|
+
cp,
|
|
75
|
+
dxfBytes: cursor.take(dxfLength),
|
|
76
|
+
rgce1: cursor.take(cce1),
|
|
77
|
+
rgce2: cursor.take(cce2)
|
|
78
|
+
};
|
|
79
|
+
} catch (err) {
|
|
80
|
+
if (!(err instanceof BiffFormatError)) throw err;
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
function readCf(record, ranges, formulaSheets) {
|
|
85
|
+
const parsed = parseCfBytes(record);
|
|
86
|
+
if (parsed === void 0) return;
|
|
87
|
+
const { ct, cp, dxfBytes, rgce1, rgce2 } = parsed;
|
|
88
|
+
if (ct === 2) return;
|
|
89
|
+
const operator = CP_TO_OPERATOR.get(cp);
|
|
90
|
+
if (operator === void 0) return;
|
|
91
|
+
if (rgce1.length === 0) return;
|
|
92
|
+
try {
|
|
78
93
|
const formula1 = parseFormulaText(rgce1, formulaSheets);
|
|
79
94
|
if (formula1 === void 0) return;
|
|
80
95
|
return {
|
|
81
96
|
operator,
|
|
82
97
|
formula1,
|
|
83
|
-
formula2:
|
|
98
|
+
formula2: rgce2.length > 0 ? parseFormulaText(rgce2, formulaSheets) : void 0,
|
|
84
99
|
style: parseDxfStyle(dxfBytes),
|
|
85
100
|
ranges
|
|
86
101
|
};
|
|
@@ -89,16 +104,20 @@ function readCf(record, ranges, formulaSheets) {
|
|
|
89
104
|
return;
|
|
90
105
|
}
|
|
91
106
|
}
|
|
107
|
+
const DEGRADED_CONDFMT_GROUP = {
|
|
108
|
+
formats: [],
|
|
109
|
+
recordsConsumed: 1,
|
|
110
|
+
nID: 0,
|
|
111
|
+
ranges: [],
|
|
112
|
+
rawCfs: []
|
|
113
|
+
};
|
|
92
114
|
function readCondFmtGroup(records, startIndex, formulaSheets) {
|
|
93
115
|
const condFmt = records[startIndex];
|
|
94
|
-
if (condFmt === void 0) return
|
|
95
|
-
formats: [],
|
|
96
|
-
recordsConsumed: 1
|
|
97
|
-
};
|
|
116
|
+
if (condFmt === void 0) return DEGRADED_CONDFMT_GROUP;
|
|
98
117
|
try {
|
|
99
118
|
const cursor = new BlockCursor(condFmt.blocks);
|
|
100
119
|
const ccf = cursor.u16();
|
|
101
|
-
cursor.
|
|
120
|
+
const nID = cursor.u16() >>> 1 & 32767;
|
|
102
121
|
cursor.skip(8);
|
|
103
122
|
const crefCount = cursor.u16();
|
|
104
123
|
const ranges = [];
|
|
@@ -115,25 +134,29 @@ function readCondFmtGroup(records, startIndex, formulaSheets) {
|
|
|
115
134
|
});
|
|
116
135
|
}
|
|
117
136
|
const formats = [];
|
|
137
|
+
const rawCfs = [];
|
|
118
138
|
for (let offset = 1; offset <= ccf; offset += 1) {
|
|
119
139
|
const cfRecord = records[startIndex + offset];
|
|
120
|
-
if (cfRecord?.type !== 433) return
|
|
121
|
-
formats: [],
|
|
122
|
-
recordsConsumed: 1
|
|
123
|
-
};
|
|
140
|
+
if (cfRecord?.type !== 433) return DEGRADED_CONDFMT_GROUP;
|
|
124
141
|
const format = readCf(cfRecord, ranges, formulaSheets);
|
|
125
142
|
if (format !== void 0) formats.push(format);
|
|
143
|
+
const parsed = parseCfBytes(cfRecord);
|
|
144
|
+
rawCfs.push(parsed === void 0 ? void 0 : {
|
|
145
|
+
ct: parsed.ct,
|
|
146
|
+
cp: parsed.cp,
|
|
147
|
+
rgce1: parsed.rgce1
|
|
148
|
+
});
|
|
126
149
|
}
|
|
127
150
|
return {
|
|
128
151
|
formats,
|
|
129
|
-
recordsConsumed: 1 + ccf
|
|
152
|
+
recordsConsumed: 1 + ccf,
|
|
153
|
+
nID,
|
|
154
|
+
ranges,
|
|
155
|
+
rawCfs
|
|
130
156
|
};
|
|
131
157
|
} catch (err) {
|
|
132
158
|
if (!(err instanceof BiffFormatError)) throw err;
|
|
133
|
-
return
|
|
134
|
-
formats: [],
|
|
135
|
-
recordsConsumed: 1
|
|
136
|
-
};
|
|
159
|
+
return DEGRADED_CONDFMT_GROUP;
|
|
137
160
|
}
|
|
138
161
|
}
|
|
139
162
|
//#endregion
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as readDv, t as RawDataValidation } from "../data-validation-
|
|
1
|
+
import { n as readDv, t as RawDataValidation } from "../data-validation-BgUt8CbE.cjs";
|
|
2
2
|
export { RawDataValidation, readDv };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as readDv, t as RawDataValidation } from "../data-validation-
|
|
1
|
+
import { n as readDv, t as RawDataValidation } from "../data-validation-Cq6iD8lB.js";
|
|
2
2
|
export { RawDataValidation, readDv };
|