xls-codec 2.0.2 → 4.0.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.
Files changed (50) hide show
  1. package/README.md +12 -10
  2. package/dist/biff/ptg.cjs +160 -7
  3. package/dist/biff/ptg.d.cts +2 -2
  4. package/dist/biff/ptg.d.ts +2 -2
  5. package/dist/biff/ptg.js +161 -9
  6. package/dist/biff/strings.cjs +6 -0
  7. package/dist/biff/strings.d.cts +3 -1
  8. package/dist/biff/strings.d.ts +3 -1
  9. package/dist/biff/strings.js +6 -1
  10. package/dist/biff/substreams.cjs +5 -0
  11. package/dist/biff/substreams.d.cts +2 -2
  12. package/dist/biff/substreams.d.ts +2 -2
  13. package/dist/biff/substreams.js +5 -1
  14. package/dist/biff/xf-colors.cjs +59 -8
  15. package/dist/biff/xf-colors.d.cts +2 -2
  16. package/dist/biff/xf-colors.d.ts +2 -2
  17. package/dist/biff/xf-colors.js +59 -9
  18. package/dist/biff/xf-writer.d.cts +1 -1
  19. package/dist/biff/xf-writer.d.ts +1 -1
  20. package/dist/content.cjs +3 -3
  21. package/dist/content.js +3 -3
  22. package/dist/index.cjs +2 -0
  23. package/dist/index.d.cts +3 -3
  24. package/dist/index.d.ts +3 -3
  25. package/dist/index.js +3 -3
  26. package/dist/{print-names-DUlpVE00.d.ts → print-names-C-PQ2vAy.d.ts} +1 -1
  27. package/dist/{print-names-D-njuzVw.d.cts → print-names-DyYloloV.d.cts} +1 -1
  28. package/dist/ptg-CCBbJLZJ.d.cts +49 -0
  29. package/dist/ptg-CCBbJLZJ.d.ts +49 -0
  30. package/dist/{substreams-D7dQiJbp.d.ts → substreams-CmyZMtuM.d.ts} +3 -1
  31. package/dist/{substreams-Ddtvn_Vr.d.cts → substreams-Cpy5Fi3d.d.cts} +3 -1
  32. package/dist/workbook/globals-writer.d.cts +2 -2
  33. package/dist/workbook/globals-writer.d.ts +2 -2
  34. package/dist/workbook/globals.cjs +137 -14
  35. package/dist/workbook/globals.d.cts +7 -7
  36. package/dist/workbook/globals.d.ts +7 -7
  37. package/dist/workbook/globals.js +138 -15
  38. package/dist/workbook/print-names.d.cts +1 -1
  39. package/dist/workbook/print-names.d.ts +1 -1
  40. package/dist/workbook/sheet.cjs +109 -6
  41. package/dist/workbook/sheet.d.cts +3 -3
  42. package/dist/workbook/sheet.d.ts +3 -3
  43. package/dist/workbook/sheet.js +110 -7
  44. package/dist/write.cjs +37 -4
  45. package/dist/write.js +39 -6
  46. package/dist/{xf-colors-CpykR3B9.d.ts → xf-colors--5oxSeI1.d.ts} +13 -6
  47. package/dist/{xf-colors-CehHZtBy.d.cts → xf-colors-BB5MKq6R.d.cts} +13 -6
  48. package/package.json +4 -4
  49. package/dist/ptg-B2K8t3js.d.cts +0 -21
  50. package/dist/ptg-B2K8t3js.d.ts +0 -21
@@ -2,6 +2,8 @@ import { t as BlockCursor } from "../cursor-VMtw9uVP.js";
2
2
  //#region src/biff/strings.d.ts
3
3
  /** An XLUnicodeString ([MS-XLS] 2.5.294): a two-byte character count, a flags byte, then the characters. Continuable, since the String record ([MS-XLS] 2.4.268) carrying a formula's string result is one of these and its own production admits trailing Continues. */
4
4
  declare function readXLUnicodeString(cursor: BlockCursor): string;
5
+ /** An XLUnicodeStringNoCch ([MS-XLS] 2.5.296): a flags byte then the characters, with no character-count field of its own -- the containing structure states the count separately (SupBook's own `cch`, for its `virtPath` field), so the caller supplies it here rather than this function reading a fresh prefix. */
6
+ declare function readXLUnicodeStringNoCch(cursor: BlockCursor, count: number): string;
5
7
  /** A ShortXLUnicodeString ([MS-XLS] 2.5.240): as above, with a one-byte character count. */
6
8
  declare function readShortXLUnicodeString(cursor: BlockCursor): string;
7
9
  /**
@@ -11,4 +13,4 @@ declare function readShortXLUnicodeString(cursor: BlockCursor): string;
11
13
  */
12
14
  declare function readRichExtendedString(cursor: BlockCursor): string;
13
15
  //#endregion
14
- export { readRichExtendedString, readShortXLUnicodeString, readXLUnicodeString };
16
+ export { readRichExtendedString, readShortXLUnicodeString, readXLUnicodeString, readXLUnicodeStringNoCch };
@@ -36,6 +36,11 @@ function readXLUnicodeString(cursor) {
36
36
  const startBlock = cursor.blockPosition();
37
37
  return readCharacters(cursor, cursor.u16(), (cursor.u8() & FLAG_HIGH_BYTE) !== 0, startBlock);
38
38
  }
39
+ /** An XLUnicodeStringNoCch ([MS-XLS] 2.5.296): a flags byte then the characters, with no character-count field of its own -- the containing structure states the count separately (SupBook's own `cch`, for its `virtPath` field), so the caller supplies it here rather than this function reading a fresh prefix. */
40
+ function readXLUnicodeStringNoCch(cursor, count) {
41
+ const startBlock = cursor.blockPosition();
42
+ return readCharacters(cursor, count, (cursor.u8() & FLAG_HIGH_BYTE) !== 0, startBlock);
43
+ }
39
44
  /** A ShortXLUnicodeString ([MS-XLS] 2.5.240): as above, with a one-byte character count. */
40
45
  function readShortXLUnicodeString(cursor) {
41
46
  const startBlock = cursor.blockPosition();
@@ -60,4 +65,4 @@ function readRichExtendedString(cursor) {
60
65
  return text;
61
66
  }
62
67
  //#endregion
63
- export { readRichExtendedString, readShortXLUnicodeString, readXLUnicodeString };
68
+ export { readRichExtendedString, readShortXLUnicodeString, readXLUnicodeString, readXLUnicodeStringNoCch };
@@ -2,6 +2,10 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  require("./record-types.cjs");
3
3
  const require_biff_records = require("./records.cjs");
4
4
  //#region src/biff/substreams.ts
5
+ /** The total byte length of a record's data across every block (the base record's and any Continues that followed it) -- what a reader needs whenever a trailing field's own length is implied by "whatever is left" rather than stated by a preceding count (a Mul record's entry count, an SST's own bounds check, a formula's RgbExtra trailer). */
6
+ function recordByteLength(record) {
7
+ return record.blocks.reduce((sum, block) => sum + block.length, 0);
8
+ }
5
9
  /** Joins each record to the Continue records following it, keeping the blocks separate. */
6
10
  function groupRecords(records) {
7
11
  const groups = [];
@@ -68,4 +72,5 @@ function readBofDocumentType(group) {
68
72
  }
69
73
  //#endregion
70
74
  exports.groupRecords = groupRecords;
75
+ exports.recordByteLength = recordByteLength;
71
76
  exports.splitSubstreams = splitSubstreams;
@@ -1,2 +1,2 @@
1
- import { i as splitSubstreams, n as Substream, r as groupRecords, t as RecordGroup } from "../substreams-Ddtvn_Vr.cjs";
2
- export { RecordGroup, Substream, groupRecords, splitSubstreams };
1
+ import { a as splitSubstreams, i as recordByteLength, n as Substream, r as groupRecords, t as RecordGroup } from "../substreams-Cpy5Fi3d.cjs";
2
+ export { RecordGroup, Substream, groupRecords, recordByteLength, splitSubstreams };
@@ -1,2 +1,2 @@
1
- import { i as splitSubstreams, n as Substream, r as groupRecords, t as RecordGroup } from "../substreams-D7dQiJbp.js";
2
- export { RecordGroup, Substream, groupRecords, splitSubstreams };
1
+ import { a as splitSubstreams, i as recordByteLength, n as Substream, r as groupRecords, t as RecordGroup } from "../substreams-CmyZMtuM.js";
2
+ export { RecordGroup, Substream, groupRecords, recordByteLength, splitSubstreams };
@@ -1,6 +1,10 @@
1
1
  import "./record-types.js";
2
2
  import { BiffFormatError } from "./records.js";
3
3
  //#region src/biff/substreams.ts
4
+ /** The total byte length of a record's data across every block (the base record's and any Continues that followed it) -- what a reader needs whenever a trailing field's own length is implied by "whatever is left" rather than stated by a preceding count (a Mul record's entry count, an SST's own bounds check, a formula's RgbExtra trailer). */
5
+ function recordByteLength(record) {
6
+ return record.blocks.reduce((sum, block) => sum + block.length, 0);
7
+ }
4
8
  /** Joins each record to the Continue records following it, keeping the blocks separate. */
5
9
  function groupRecords(records) {
6
10
  const groups = [];
@@ -66,4 +70,4 @@ function readBofDocumentType(group) {
66
70
  return view.getUint16(2, true);
67
71
  }
68
72
  //#endregion
69
- export { groupRecords, splitSubstreams };
73
+ export { groupRecords, recordByteLength, splitSubstreams };
@@ -3,8 +3,32 @@ let document_schema_js = require("document-schema.js");
3
3
  //#region src/biff/xf-colors.ts
4
4
  /** FLSNULL: no fill pattern -- the cell's fill colour fields carry no meaning. */
5
5
  const FILL_PATTERN_NONE = 0;
6
- /** FLSSOLID: a solid fill, the only pattern this package maps onto ContentSheetCell.background -- "If this value is 1 ... then only icvFore is rendered" ([MS-XLS] CellXF). Every other pattern (50%/75%/25% gray, the stripe and crosshatch families, ...) is a real information-loss case this reader does not approximate: see resolveFillBackground below. */
6
+ /** FLSSOLID: a solid fill -- "If this value is 1 ... then only icvFore is rendered" ([MS-XLS] CellXF). */
7
7
  const FILL_PATTERN_SOLID = 1;
8
+ /**
9
+ * Every other named FillPattern value ([MS-XLS]/[MS-XLSB] "FillPattern" enumeration, 0x02-0x12), mapped onto the ContentCellPatternType name document-schema.js's own ContentCellPatternTypeSchema gives that same ECMA-376 ST_PatternType token verbatim -- this is the identical vocabulary, values 0x02 (FLSMEDGRAY, "50% gray") through 0x12 (FLSGRAY0625, "6.25% gray") mapping onto ST_PatternType's mediumGray/darkGray/lightGray/darkHorizontal/darkVertical/darkDown/darkUp/darkGrid/darkTrellis/lightHorizontal/lightVertical/lightDown/lightUp/lightGrid/lightTrellis/gray125/gray0625 in that exact order (see ContentCellPatternTypeSchema's own top comment for the full citation). Unlike doc-codec's Ipat table, every value in this contiguous range names a real pattern -- there is no ipatNil/ipatPctNew*-style gap to skip.
10
+ */
11
+ const FILL_PATTERN_TO_PATTERN_TYPE = {
12
+ 2: "mediumGray",
13
+ 3: "darkGray",
14
+ 4: "lightGray",
15
+ 5: "darkHorizontal",
16
+ 6: "darkVertical",
17
+ 7: "darkDown",
18
+ 8: "darkUp",
19
+ 9: "darkGrid",
20
+ 10: "darkTrellis",
21
+ 11: "lightHorizontal",
22
+ 12: "lightVertical",
23
+ 13: "lightDown",
24
+ 14: "lightUp",
25
+ 15: "lightGrid",
26
+ 16: "lightTrellis",
27
+ 17: "gray125",
28
+ 18: "gray0625"
29
+ };
30
+ /** The inverse of FILL_PATTERN_TO_PATTERN_TYPE, built from it rather than restated by hand so the two can never drift apart. Every ContentCellPatternType this package's own writer is ever asked to state has an entry, since the SpreadsheetML half of the shared vocabulary is exactly FILL_PATTERN_TO_PATTERN_TYPE's own value set -- the WordprocessingML-only members (the percentN family and the stripe/cross families ST_Shd names) are absent, FillPattern having no equivalent for them at all. */
31
+ const PATTERN_TYPE_TO_FILL_PATTERN = new Map(Object.entries(FILL_PATTERN_TO_PATTERN_TYPE).map(([fls, patternType]) => [patternType, Number(fls)]));
8
32
  const ALC_GENERAL = 0;
9
33
  const ALC_LEFT = 1;
10
34
  const ALC_CENTER = 2;
@@ -248,10 +272,30 @@ function borderStyleTokenFor(border) {
248
272
  case void 0: return SOLID_BORDER_STYLE[(0, document_schema_js.borderWeightForWidthPt)(border.widthPt)];
249
273
  }
250
274
  }
251
- /** A solid fill's own foreground colour resolved to a real background, or undefined for every other FillPattern value -- FLSNULL (no fill at all) and every pattern beyond solid (50%/75%/25% gray, the stripe and crosshatch family) alike. A non-solid pattern is a real information-loss case rather than an oversight: ContentSheetCell.background models one flat colour, and approximating a striped or crosshatched fill as its foreground colour alone would misrepresent what the cell actually shows -- see xls-codec's README for this package's own stated judgment call. */
252
- function resolveFillBackground(fillPattern, foregroundIcv, palette) {
253
- if (fillPattern !== 1) return;
254
- return resolveIcvColor(foregroundIcv, palette);
275
+ /**
276
+ * Resolves a cell's own FillPattern/icvFore/icvBack triple to a real ContentCellFill (ExaDev/documents.js#951), or undefined for FLSNULL (no fill at all), for a reserved/unrecognised FillPattern value, or for FLSSOLID when its own icvFore does not resolve to a fixed RGB value (an "Automatic" or otherwise unmapped icv, which leaves nothing to state a solid fill's colour as).
277
+ *
278
+ * FLSSOLID resolves to a 'solid' fill of icvFore alone -- "If this value is 1 ... then only icvFore is rendered" ([MS-XLS] CellXF), so icvBack carries no meaning for it and is never consulted. Every other named FillPattern resolves to a real 'pattern' fill via FILL_PATTERN_TO_PATTERN_TYPE, carrying whichever of icvFore/icvBack resolves to a real colour (either may be an "Automatic" icv this package cannot express as a fixed RGB value, matching ContentCellFillSchema's own "a colour can defer instead of asserting" convention).
279
+ */
280
+ function resolveFillBackground(fillPattern, foregroundIcv, backgroundIcv, palette) {
281
+ if (fillPattern === 0) return;
282
+ if (fillPattern === 1) {
283
+ const color = resolveIcvColor(foregroundIcv, palette);
284
+ return color === void 0 ? void 0 : {
285
+ kind: "solid",
286
+ color
287
+ };
288
+ }
289
+ const patternType = FILL_PATTERN_TO_PATTERN_TYPE[fillPattern];
290
+ if (patternType === void 0) return;
291
+ const foregroundColor = resolveIcvColor(foregroundIcv, palette);
292
+ const backgroundColor = resolveIcvColor(backgroundIcv, palette);
293
+ return {
294
+ kind: "pattern",
295
+ patternType,
296
+ ...foregroundColor !== void 0 ? { foregroundColor } : {},
297
+ ...backgroundColor !== void 0 ? { backgroundColor } : {}
298
+ };
255
299
  }
256
300
  const UNDECORATED_EDGE = {
257
301
  style: 0,
@@ -261,6 +305,7 @@ const UNDECORATED_EDGE = {
261
305
  const UNDECORATED_XF_FIELDS = {
262
306
  fillPattern: 0,
263
307
  fillForegroundIcv: 64,
308
+ fillBackgroundIcv: 65,
264
309
  left: UNDECORATED_EDGE,
265
310
  right: UNDECORATED_EDGE,
266
311
  top: UNDECORATED_EDGE,
@@ -288,6 +333,7 @@ function unpackXfDecoration(word2, word3, word4) {
288
333
  return {
289
334
  fillPattern: word3 >>> 26 & 63,
290
335
  fillForegroundIcv: word4 & 127,
336
+ fillBackgroundIcv: word4 >>> 7 & 127,
291
337
  left: {
292
338
  style: dgLeft,
293
339
  icv: icvLeft
@@ -313,10 +359,14 @@ function unpackXfDecoration(word2, word3, word4) {
313
359
  */
314
360
  function packXfDecorationWords(decoration = UNDECORATED_XF_FIELDS) {
315
361
  const { left, right, top, bottom } = decoration;
362
+ const word2 = left.style & 15 | (right.style & 15) << 4 | (top.style & 15) << 8 | (bottom.style & 15) << 12 | (left.icv & 127) << 16 | (right.icv & 127) << 23 | 0;
363
+ const word3 = top.icv & 127 | (bottom.icv & 127) << 7 | 0 | (decoration.fillPattern & 63) << 26;
364
+ const icvFore = decoration.fillPattern === 0 ? 64 : decoration.fillForegroundIcv;
365
+ const icvBack = decoration.fillPattern === 0 || decoration.fillPattern === 1 ? 65 : decoration.fillBackgroundIcv;
316
366
  return {
317
- word2: left.style & 15 | (right.style & 15) << 4 | (top.style & 15) << 8 | (bottom.style & 15) << 12 | (left.icv & 127) << 16 | (right.icv & 127) << 23 | 0,
318
- word3: top.icv & 127 | (bottom.icv & 127) << 7 | 0 | (decoration.fillPattern & 63) << 26,
319
- word4: (decoration.fillPattern === 1 ? decoration.fillForegroundIcv : 64) & 127 | 8320
367
+ word2,
368
+ word3,
369
+ word4: icvFore & 127 | (icvBack & 127) << 7
320
370
  };
321
371
  }
322
372
  /** LongRGB: red, green, blue, then a reserved byte that MUST be 0 -- one entry of a Palette record's rgColor array, or of the fixed-length buffer this package's own writer emits. */
@@ -358,6 +408,7 @@ exports.ICV_AUTOMATIC_BACKGROUND = ICV_AUTOMATIC_BACKGROUND;
358
408
  exports.ICV_AUTOMATIC_FOREGROUND = ICV_AUTOMATIC_FOREGROUND;
359
409
  exports.PALETTE_BASE_ICV = PALETTE_BASE_ICV;
360
410
  exports.PALETTE_ENTRY_COUNT = PALETTE_ENTRY_COUNT;
411
+ exports.PATTERN_TYPE_TO_FILL_PATTERN = PATTERN_TYPE_TO_FILL_PATTERN;
361
412
  exports.UNDECORATED_XF_FIELDS = UNDECORATED_XF_FIELDS;
362
413
  exports.borderStyleTokenFor = borderStyleTokenFor;
363
414
  exports.horizAlignTokenFor = horizAlignTokenFor;
@@ -1,2 +1,2 @@
1
- import { A as readLongRgbColor, C as XfAlignmentFields, D as horizAlignTokenFor, E as borderStyleTokenFor, F as resolveVerticalAlignment, I as unpackXfAlignment, L as unpackXfDecoration, M as resolveFillBackground, N as resolveHorizontalAlignment, O as longRgbBytesOf, P as resolveIcvColor, R as vertAlignTokenFor, S as UNDECORATED_XF_FIELDS, T as XfDecorationFields, _ as FILL_PATTERN_SOLID, a as BORDER_STYLE_DOUBLE, b as PALETTE_BASE_ICV, c as BORDER_STYLE_MEDIUM_DASHDOT, d as BORDER_STYLE_NONE, f as BORDER_STYLE_SLANT_DASHDOT, g as FILL_PATTERN_NONE, h as DEFAULT_PALETTE_HEX_TO_ICV, i as BORDER_STYLE_DOTTED, j as resolveBorderEdge, k as packXfDecorationWords, l as BORDER_STYLE_MEDIUM_DASHDOTDOT, m as BORDER_STYLE_THIN, n as BORDER_STYLE_DASHDOTDOT, o as BORDER_STYLE_HAIR, p as BORDER_STYLE_THICK, r as BORDER_STYLE_DASHED, s as BORDER_STYLE_MEDIUM, t as BORDER_STYLE_DASHDOT, u as BORDER_STYLE_MEDIUM_DASHED, v as ICV_AUTOMATIC_BACKGROUND, w as XfBorderEdge, x as PALETTE_ENTRY_COUNT, y as ICV_AUTOMATIC_FOREGROUND } from "../xf-colors-CehHZtBy.cjs";
2
- export { BORDER_STYLE_DASHDOT, BORDER_STYLE_DASHDOTDOT, BORDER_STYLE_DASHED, BORDER_STYLE_DOTTED, BORDER_STYLE_DOUBLE, BORDER_STYLE_HAIR, BORDER_STYLE_MEDIUM, BORDER_STYLE_MEDIUM_DASHDOT, BORDER_STYLE_MEDIUM_DASHDOTDOT, BORDER_STYLE_MEDIUM_DASHED, BORDER_STYLE_NONE, BORDER_STYLE_SLANT_DASHDOT, BORDER_STYLE_THICK, BORDER_STYLE_THIN, DEFAULT_PALETTE_HEX_TO_ICV, FILL_PATTERN_NONE, FILL_PATTERN_SOLID, ICV_AUTOMATIC_BACKGROUND, ICV_AUTOMATIC_FOREGROUND, PALETTE_BASE_ICV, PALETTE_ENTRY_COUNT, UNDECORATED_XF_FIELDS, XfAlignmentFields, XfBorderEdge, XfDecorationFields, borderStyleTokenFor, horizAlignTokenFor, longRgbBytesOf, packXfDecorationWords, readLongRgbColor, resolveBorderEdge, resolveFillBackground, resolveHorizontalAlignment, resolveIcvColor, resolveVerticalAlignment, unpackXfAlignment, unpackXfDecoration, vertAlignTokenFor };
1
+ import { A as packXfDecorationWords, C as UNDECORATED_XF_FIELDS, D as borderStyleTokenFor, E as XfDecorationFields, F as resolveIcvColor, I as resolveVerticalAlignment, L as unpackXfAlignment, M as resolveBorderEdge, N as resolveFillBackground, O as horizAlignTokenFor, P as resolveHorizontalAlignment, R as unpackXfDecoration, S as PATTERN_TYPE_TO_FILL_PATTERN, T as XfBorderEdge, _ as FILL_PATTERN_SOLID, a as BORDER_STYLE_DOUBLE, b as PALETTE_BASE_ICV, c as BORDER_STYLE_MEDIUM_DASHDOT, d as BORDER_STYLE_NONE, f as BORDER_STYLE_SLANT_DASHDOT, g as FILL_PATTERN_NONE, h as DEFAULT_PALETTE_HEX_TO_ICV, i as BORDER_STYLE_DOTTED, j as readLongRgbColor, k as longRgbBytesOf, l as BORDER_STYLE_MEDIUM_DASHDOTDOT, m as BORDER_STYLE_THIN, n as BORDER_STYLE_DASHDOTDOT, o as BORDER_STYLE_HAIR, p as BORDER_STYLE_THICK, r as BORDER_STYLE_DASHED, s as BORDER_STYLE_MEDIUM, t as BORDER_STYLE_DASHDOT, u as BORDER_STYLE_MEDIUM_DASHED, v as ICV_AUTOMATIC_BACKGROUND, w as XfAlignmentFields, x as PALETTE_ENTRY_COUNT, y as ICV_AUTOMATIC_FOREGROUND, z as vertAlignTokenFor } from "../xf-colors-BB5MKq6R.cjs";
2
+ export { BORDER_STYLE_DASHDOT, BORDER_STYLE_DASHDOTDOT, BORDER_STYLE_DASHED, BORDER_STYLE_DOTTED, BORDER_STYLE_DOUBLE, BORDER_STYLE_HAIR, BORDER_STYLE_MEDIUM, BORDER_STYLE_MEDIUM_DASHDOT, BORDER_STYLE_MEDIUM_DASHDOTDOT, BORDER_STYLE_MEDIUM_DASHED, BORDER_STYLE_NONE, BORDER_STYLE_SLANT_DASHDOT, BORDER_STYLE_THICK, BORDER_STYLE_THIN, DEFAULT_PALETTE_HEX_TO_ICV, FILL_PATTERN_NONE, FILL_PATTERN_SOLID, ICV_AUTOMATIC_BACKGROUND, ICV_AUTOMATIC_FOREGROUND, PALETTE_BASE_ICV, PALETTE_ENTRY_COUNT, PATTERN_TYPE_TO_FILL_PATTERN, UNDECORATED_XF_FIELDS, XfAlignmentFields, XfBorderEdge, XfDecorationFields, borderStyleTokenFor, horizAlignTokenFor, longRgbBytesOf, packXfDecorationWords, readLongRgbColor, resolveBorderEdge, resolveFillBackground, resolveHorizontalAlignment, resolveIcvColor, resolveVerticalAlignment, unpackXfAlignment, unpackXfDecoration, vertAlignTokenFor };
@@ -1,2 +1,2 @@
1
- import { A as readLongRgbColor, C as XfAlignmentFields, D as horizAlignTokenFor, E as borderStyleTokenFor, F as resolveVerticalAlignment, I as unpackXfAlignment, L as unpackXfDecoration, M as resolveFillBackground, N as resolveHorizontalAlignment, O as longRgbBytesOf, P as resolveIcvColor, R as vertAlignTokenFor, S as UNDECORATED_XF_FIELDS, T as XfDecorationFields, _ as FILL_PATTERN_SOLID, a as BORDER_STYLE_DOUBLE, b as PALETTE_BASE_ICV, c as BORDER_STYLE_MEDIUM_DASHDOT, d as BORDER_STYLE_NONE, f as BORDER_STYLE_SLANT_DASHDOT, g as FILL_PATTERN_NONE, h as DEFAULT_PALETTE_HEX_TO_ICV, i as BORDER_STYLE_DOTTED, j as resolveBorderEdge, k as packXfDecorationWords, l as BORDER_STYLE_MEDIUM_DASHDOTDOT, m as BORDER_STYLE_THIN, n as BORDER_STYLE_DASHDOTDOT, o as BORDER_STYLE_HAIR, p as BORDER_STYLE_THICK, r as BORDER_STYLE_DASHED, s as BORDER_STYLE_MEDIUM, t as BORDER_STYLE_DASHDOT, u as BORDER_STYLE_MEDIUM_DASHED, v as ICV_AUTOMATIC_BACKGROUND, w as XfBorderEdge, x as PALETTE_ENTRY_COUNT, y as ICV_AUTOMATIC_FOREGROUND } from "../xf-colors-CpykR3B9.js";
2
- export { BORDER_STYLE_DASHDOT, BORDER_STYLE_DASHDOTDOT, BORDER_STYLE_DASHED, BORDER_STYLE_DOTTED, BORDER_STYLE_DOUBLE, BORDER_STYLE_HAIR, BORDER_STYLE_MEDIUM, BORDER_STYLE_MEDIUM_DASHDOT, BORDER_STYLE_MEDIUM_DASHDOTDOT, BORDER_STYLE_MEDIUM_DASHED, BORDER_STYLE_NONE, BORDER_STYLE_SLANT_DASHDOT, BORDER_STYLE_THICK, BORDER_STYLE_THIN, DEFAULT_PALETTE_HEX_TO_ICV, FILL_PATTERN_NONE, FILL_PATTERN_SOLID, ICV_AUTOMATIC_BACKGROUND, ICV_AUTOMATIC_FOREGROUND, PALETTE_BASE_ICV, PALETTE_ENTRY_COUNT, UNDECORATED_XF_FIELDS, XfAlignmentFields, XfBorderEdge, XfDecorationFields, borderStyleTokenFor, horizAlignTokenFor, longRgbBytesOf, packXfDecorationWords, readLongRgbColor, resolveBorderEdge, resolveFillBackground, resolveHorizontalAlignment, resolveIcvColor, resolveVerticalAlignment, unpackXfAlignment, unpackXfDecoration, vertAlignTokenFor };
1
+ import { A as packXfDecorationWords, C as UNDECORATED_XF_FIELDS, D as borderStyleTokenFor, E as XfDecorationFields, F as resolveIcvColor, I as resolveVerticalAlignment, L as unpackXfAlignment, M as resolveBorderEdge, N as resolveFillBackground, O as horizAlignTokenFor, P as resolveHorizontalAlignment, R as unpackXfDecoration, S as PATTERN_TYPE_TO_FILL_PATTERN, T as XfBorderEdge, _ as FILL_PATTERN_SOLID, a as BORDER_STYLE_DOUBLE, b as PALETTE_BASE_ICV, c as BORDER_STYLE_MEDIUM_DASHDOT, d as BORDER_STYLE_NONE, f as BORDER_STYLE_SLANT_DASHDOT, g as FILL_PATTERN_NONE, h as DEFAULT_PALETTE_HEX_TO_ICV, i as BORDER_STYLE_DOTTED, j as readLongRgbColor, k as longRgbBytesOf, l as BORDER_STYLE_MEDIUM_DASHDOTDOT, m as BORDER_STYLE_THIN, n as BORDER_STYLE_DASHDOTDOT, o as BORDER_STYLE_HAIR, p as BORDER_STYLE_THICK, r as BORDER_STYLE_DASHED, s as BORDER_STYLE_MEDIUM, t as BORDER_STYLE_DASHDOT, u as BORDER_STYLE_MEDIUM_DASHED, v as ICV_AUTOMATIC_BACKGROUND, w as XfAlignmentFields, x as PALETTE_ENTRY_COUNT, y as ICV_AUTOMATIC_FOREGROUND, z as vertAlignTokenFor } from "../xf-colors--5oxSeI1.js";
2
+ export { BORDER_STYLE_DASHDOT, BORDER_STYLE_DASHDOTDOT, BORDER_STYLE_DASHED, BORDER_STYLE_DOTTED, BORDER_STYLE_DOUBLE, BORDER_STYLE_HAIR, BORDER_STYLE_MEDIUM, BORDER_STYLE_MEDIUM_DASHDOT, BORDER_STYLE_MEDIUM_DASHDOTDOT, BORDER_STYLE_MEDIUM_DASHED, BORDER_STYLE_NONE, BORDER_STYLE_SLANT_DASHDOT, BORDER_STYLE_THICK, BORDER_STYLE_THIN, DEFAULT_PALETTE_HEX_TO_ICV, FILL_PATTERN_NONE, FILL_PATTERN_SOLID, ICV_AUTOMATIC_BACKGROUND, ICV_AUTOMATIC_FOREGROUND, PALETTE_BASE_ICV, PALETTE_ENTRY_COUNT, PATTERN_TYPE_TO_FILL_PATTERN, UNDECORATED_XF_FIELDS, XfAlignmentFields, XfBorderEdge, XfDecorationFields, borderStyleTokenFor, horizAlignTokenFor, longRgbBytesOf, packXfDecorationWords, readLongRgbColor, resolveBorderEdge, resolveFillBackground, resolveHorizontalAlignment, resolveIcvColor, resolveVerticalAlignment, unpackXfAlignment, unpackXfDecoration, vertAlignTokenFor };
@@ -2,8 +2,32 @@ import { BORDER_WIDTH_PT, borderWeightForWidthPt, colorToRgbHex, dashedBorderWei
2
2
  //#region src/biff/xf-colors.ts
3
3
  /** FLSNULL: no fill pattern -- the cell's fill colour fields carry no meaning. */
4
4
  const FILL_PATTERN_NONE = 0;
5
- /** FLSSOLID: a solid fill, the only pattern this package maps onto ContentSheetCell.background -- "If this value is 1 ... then only icvFore is rendered" ([MS-XLS] CellXF). Every other pattern (50%/75%/25% gray, the stripe and crosshatch families, ...) is a real information-loss case this reader does not approximate: see resolveFillBackground below. */
5
+ /** FLSSOLID: a solid fill -- "If this value is 1 ... then only icvFore is rendered" ([MS-XLS] CellXF). */
6
6
  const FILL_PATTERN_SOLID = 1;
7
+ /**
8
+ * Every other named FillPattern value ([MS-XLS]/[MS-XLSB] "FillPattern" enumeration, 0x02-0x12), mapped onto the ContentCellPatternType name document-schema.js's own ContentCellPatternTypeSchema gives that same ECMA-376 ST_PatternType token verbatim -- this is the identical vocabulary, values 0x02 (FLSMEDGRAY, "50% gray") through 0x12 (FLSGRAY0625, "6.25% gray") mapping onto ST_PatternType's mediumGray/darkGray/lightGray/darkHorizontal/darkVertical/darkDown/darkUp/darkGrid/darkTrellis/lightHorizontal/lightVertical/lightDown/lightUp/lightGrid/lightTrellis/gray125/gray0625 in that exact order (see ContentCellPatternTypeSchema's own top comment for the full citation). Unlike doc-codec's Ipat table, every value in this contiguous range names a real pattern -- there is no ipatNil/ipatPctNew*-style gap to skip.
9
+ */
10
+ const FILL_PATTERN_TO_PATTERN_TYPE = {
11
+ 2: "mediumGray",
12
+ 3: "darkGray",
13
+ 4: "lightGray",
14
+ 5: "darkHorizontal",
15
+ 6: "darkVertical",
16
+ 7: "darkDown",
17
+ 8: "darkUp",
18
+ 9: "darkGrid",
19
+ 10: "darkTrellis",
20
+ 11: "lightHorizontal",
21
+ 12: "lightVertical",
22
+ 13: "lightDown",
23
+ 14: "lightUp",
24
+ 15: "lightGrid",
25
+ 16: "lightTrellis",
26
+ 17: "gray125",
27
+ 18: "gray0625"
28
+ };
29
+ /** The inverse of FILL_PATTERN_TO_PATTERN_TYPE, built from it rather than restated by hand so the two can never drift apart. Every ContentCellPatternType this package's own writer is ever asked to state has an entry, since the SpreadsheetML half of the shared vocabulary is exactly FILL_PATTERN_TO_PATTERN_TYPE's own value set -- the WordprocessingML-only members (the percentN family and the stripe/cross families ST_Shd names) are absent, FillPattern having no equivalent for them at all. */
30
+ const PATTERN_TYPE_TO_FILL_PATTERN = new Map(Object.entries(FILL_PATTERN_TO_PATTERN_TYPE).map(([fls, patternType]) => [patternType, Number(fls)]));
7
31
  const ALC_GENERAL = 0;
8
32
  const ALC_LEFT = 1;
9
33
  const ALC_CENTER = 2;
@@ -247,10 +271,30 @@ function borderStyleTokenFor(border) {
247
271
  case void 0: return SOLID_BORDER_STYLE[borderWeightForWidthPt(border.widthPt)];
248
272
  }
249
273
  }
250
- /** A solid fill's own foreground colour resolved to a real background, or undefined for every other FillPattern value -- FLSNULL (no fill at all) and every pattern beyond solid (50%/75%/25% gray, the stripe and crosshatch family) alike. A non-solid pattern is a real information-loss case rather than an oversight: ContentSheetCell.background models one flat colour, and approximating a striped or crosshatched fill as its foreground colour alone would misrepresent what the cell actually shows -- see xls-codec's README for this package's own stated judgment call. */
251
- function resolveFillBackground(fillPattern, foregroundIcv, palette) {
252
- if (fillPattern !== 1) return;
253
- return resolveIcvColor(foregroundIcv, palette);
274
+ /**
275
+ * Resolves a cell's own FillPattern/icvFore/icvBack triple to a real ContentCellFill (ExaDev/documents.js#951), or undefined for FLSNULL (no fill at all), for a reserved/unrecognised FillPattern value, or for FLSSOLID when its own icvFore does not resolve to a fixed RGB value (an "Automatic" or otherwise unmapped icv, which leaves nothing to state a solid fill's colour as).
276
+ *
277
+ * FLSSOLID resolves to a 'solid' fill of icvFore alone -- "If this value is 1 ... then only icvFore is rendered" ([MS-XLS] CellXF), so icvBack carries no meaning for it and is never consulted. Every other named FillPattern resolves to a real 'pattern' fill via FILL_PATTERN_TO_PATTERN_TYPE, carrying whichever of icvFore/icvBack resolves to a real colour (either may be an "Automatic" icv this package cannot express as a fixed RGB value, matching ContentCellFillSchema's own "a colour can defer instead of asserting" convention).
278
+ */
279
+ function resolveFillBackground(fillPattern, foregroundIcv, backgroundIcv, palette) {
280
+ if (fillPattern === 0) return;
281
+ if (fillPattern === 1) {
282
+ const color = resolveIcvColor(foregroundIcv, palette);
283
+ return color === void 0 ? void 0 : {
284
+ kind: "solid",
285
+ color
286
+ };
287
+ }
288
+ const patternType = FILL_PATTERN_TO_PATTERN_TYPE[fillPattern];
289
+ if (patternType === void 0) return;
290
+ const foregroundColor = resolveIcvColor(foregroundIcv, palette);
291
+ const backgroundColor = resolveIcvColor(backgroundIcv, palette);
292
+ return {
293
+ kind: "pattern",
294
+ patternType,
295
+ ...foregroundColor !== void 0 ? { foregroundColor } : {},
296
+ ...backgroundColor !== void 0 ? { backgroundColor } : {}
297
+ };
254
298
  }
255
299
  const UNDECORATED_EDGE = {
256
300
  style: 0,
@@ -260,6 +304,7 @@ const UNDECORATED_EDGE = {
260
304
  const UNDECORATED_XF_FIELDS = {
261
305
  fillPattern: 0,
262
306
  fillForegroundIcv: 64,
307
+ fillBackgroundIcv: 65,
263
308
  left: UNDECORATED_EDGE,
264
309
  right: UNDECORATED_EDGE,
265
310
  top: UNDECORATED_EDGE,
@@ -287,6 +332,7 @@ function unpackXfDecoration(word2, word3, word4) {
287
332
  return {
288
333
  fillPattern: word3 >>> 26 & 63,
289
334
  fillForegroundIcv: word4 & 127,
335
+ fillBackgroundIcv: word4 >>> 7 & 127,
290
336
  left: {
291
337
  style: dgLeft,
292
338
  icv: icvLeft
@@ -312,10 +358,14 @@ function unpackXfDecoration(word2, word3, word4) {
312
358
  */
313
359
  function packXfDecorationWords(decoration = UNDECORATED_XF_FIELDS) {
314
360
  const { left, right, top, bottom } = decoration;
361
+ const word2 = left.style & 15 | (right.style & 15) << 4 | (top.style & 15) << 8 | (bottom.style & 15) << 12 | (left.icv & 127) << 16 | (right.icv & 127) << 23 | 0;
362
+ const word3 = top.icv & 127 | (bottom.icv & 127) << 7 | 0 | (decoration.fillPattern & 63) << 26;
363
+ const icvFore = decoration.fillPattern === 0 ? 64 : decoration.fillForegroundIcv;
364
+ const icvBack = decoration.fillPattern === 0 || decoration.fillPattern === 1 ? 65 : decoration.fillBackgroundIcv;
315
365
  return {
316
- word2: left.style & 15 | (right.style & 15) << 4 | (top.style & 15) << 8 | (bottom.style & 15) << 12 | (left.icv & 127) << 16 | (right.icv & 127) << 23 | 0,
317
- word3: top.icv & 127 | (bottom.icv & 127) << 7 | 0 | (decoration.fillPattern & 63) << 26,
318
- word4: (decoration.fillPattern === 1 ? decoration.fillForegroundIcv : 64) & 127 | 8320
366
+ word2,
367
+ word3,
368
+ word4: icvFore & 127 | (icvBack & 127) << 7
319
369
  };
320
370
  }
321
371
  /** LongRGB: red, green, blue, then a reserved byte that MUST be 0 -- one entry of a Palette record's rgColor array, or of the fixed-length buffer this package's own writer emits. */
@@ -336,4 +386,4 @@ function longRgbBytesOf(color) {
336
386
  ];
337
387
  }
338
388
  //#endregion
339
- export { BORDER_STYLE_DASHDOT, BORDER_STYLE_DASHDOTDOT, BORDER_STYLE_DASHED, BORDER_STYLE_DOTTED, BORDER_STYLE_DOUBLE, BORDER_STYLE_HAIR, BORDER_STYLE_MEDIUM, BORDER_STYLE_MEDIUM_DASHDOT, BORDER_STYLE_MEDIUM_DASHDOTDOT, BORDER_STYLE_MEDIUM_DASHED, BORDER_STYLE_NONE, BORDER_STYLE_SLANT_DASHDOT, BORDER_STYLE_THICK, BORDER_STYLE_THIN, DEFAULT_PALETTE_HEX_TO_ICV, FILL_PATTERN_NONE, FILL_PATTERN_SOLID, ICV_AUTOMATIC_BACKGROUND, ICV_AUTOMATIC_FOREGROUND, PALETTE_BASE_ICV, PALETTE_ENTRY_COUNT, UNDECORATED_XF_FIELDS, borderStyleTokenFor, horizAlignTokenFor, longRgbBytesOf, packXfDecorationWords, readLongRgbColor, resolveBorderEdge, resolveFillBackground, resolveHorizontalAlignment, resolveIcvColor, resolveVerticalAlignment, unpackXfAlignment, unpackXfDecoration, vertAlignTokenFor };
389
+ export { BORDER_STYLE_DASHDOT, BORDER_STYLE_DASHDOTDOT, BORDER_STYLE_DASHED, BORDER_STYLE_DOTTED, BORDER_STYLE_DOUBLE, BORDER_STYLE_HAIR, BORDER_STYLE_MEDIUM, BORDER_STYLE_MEDIUM_DASHDOT, BORDER_STYLE_MEDIUM_DASHDOTDOT, BORDER_STYLE_MEDIUM_DASHED, BORDER_STYLE_NONE, BORDER_STYLE_SLANT_DASHDOT, BORDER_STYLE_THICK, BORDER_STYLE_THIN, DEFAULT_PALETTE_HEX_TO_ICV, FILL_PATTERN_NONE, FILL_PATTERN_SOLID, ICV_AUTOMATIC_BACKGROUND, ICV_AUTOMATIC_FOREGROUND, PALETTE_BASE_ICV, PALETTE_ENTRY_COUNT, PATTERN_TYPE_TO_FILL_PATTERN, UNDECORATED_XF_FIELDS, borderStyleTokenFor, horizAlignTokenFor, longRgbBytesOf, packXfDecorationWords, readLongRgbColor, resolveBorderEdge, resolveFillBackground, resolveHorizontalAlignment, resolveIcvColor, resolveVerticalAlignment, unpackXfAlignment, unpackXfDecoration, vertAlignTokenFor };
@@ -1,4 +1,4 @@
1
- import { T as XfDecorationFields } from "../xf-colors-CehHZtBy.cjs";
1
+ import { E as XfDecorationFields } from "../xf-colors-BB5MKq6R.cjs";
2
2
  import { Alignment, Color } from "document-schema.js";
3
3
  //#region src/biff/xf-writer.d.ts
4
4
  /** Writes one cell-format XF record (fStyle=0): ifnt/ifmt as given, ixfParent pointing at the Normal cell-style XF (index 0), a CellXF payload carrying `alignment`/`verticalAlignment`/`decoration`'s own fields -- general alignment, bottom vertical alignment, and no fill/border (the same bytes this always wrote before either existed) for whatever is omitted. Twenty bytes total ([MS-XLS] 2.4.353). */
@@ -1,4 +1,4 @@
1
- import { T as XfDecorationFields } from "../xf-colors-CpykR3B9.js";
1
+ import { E as XfDecorationFields } from "../xf-colors--5oxSeI1.js";
2
2
  import { Alignment, Color } from "document-schema.js";
3
3
  //#region src/biff/xf-writer.d.ts
4
4
  /** Writes one cell-format XF record (fStyle=0): ifnt/ifmt as given, ixfParent pointing at the Normal cell-style XF (index 0), a CellXF payload carrying `alignment`/`verticalAlignment`/`decoration`'s own fields -- general alignment, bottom vertical alignment, and no fill/border (the same bytes this always wrote before either existed) for whatever is omitted. Twenty bytes total ([MS-XLS] 2.4.353). */
package/dist/content.cjs CHANGED
@@ -192,14 +192,14 @@ function mapCell(cell, globals) {
192
192
  return mapped;
193
193
  }
194
194
  /**
195
- * A cell's own resolved fill colour, or undefined for a genuinely unfilled cell AND for every fill pattern beyond solid.
195
+ * A cell's own resolved background fill (ExaDev/documents.js#951), or undefined for a genuinely unfilled cell and for a reserved/unrecognised FillPattern value.
196
196
  *
197
- * A non-solid pattern (the 50%/75%/25% gray shades, the stripe and crosshatch family [MS-XLS]'s FillPattern enumeration also names) is a deliberate, permanent gap rather than an oversight: ContentSheetCell.background models one flat colour, and approximating a striped or crosshatched fill as its own foreground colour alone would misreport what the cell actually shows -- see xls-codec's README, "Cell decoration".
197
+ * A solid fill resolves to a 'solid' ContentCellFill of its own foreground colour; every other named FillPattern -- the 50%/75%/25% gray shades, the stripe and crosshatch family -- resolves to a real 'pattern' fill via xf-colors.ts's own FILL_PATTERN_TO_PATTERN_TYPE, carrying whichever of the pattern's foreground/background colours actually resolve to a fixed RGB value. See xls-codec's README, "Cell decoration".
198
198
  */
199
199
  function backgroundOf(globals, xfIndex) {
200
200
  const format = globals.cellFormats[xfIndex];
201
201
  if (format === void 0) return;
202
- return require_biff_xf_colors.resolveFillBackground(format.decoration.fillPattern, format.decoration.fillForegroundIcv, globals.palette);
202
+ return require_biff_xf_colors.resolveFillBackground(format.decoration.fillPattern, format.decoration.fillForegroundIcv, format.decoration.fillBackgroundIcv, globals.palette);
203
203
  }
204
204
  /** A cell's own resolved horizontal/vertical alignment -- already the exact Alignment/verticalAlignment members (or undefined) globals.ts's readCellFormat resolved through xf-colors.ts's unpackXfAlignment, so this is a lookup rather than a further resolution step, mirroring backgroundOf/bordersOf's own shape. Both fields undefined for a cell whose XF resolves to no CellFormat at all (an out-of-range xfIndex), matching every other resolveXOf helper's behaviour in that case. */
205
205
  function alignmentOf(globals, xfIndex) {
package/dist/content.js CHANGED
@@ -191,14 +191,14 @@ function mapCell(cell, globals) {
191
191
  return mapped;
192
192
  }
193
193
  /**
194
- * A cell's own resolved fill colour, or undefined for a genuinely unfilled cell AND for every fill pattern beyond solid.
194
+ * A cell's own resolved background fill (ExaDev/documents.js#951), or undefined for a genuinely unfilled cell and for a reserved/unrecognised FillPattern value.
195
195
  *
196
- * A non-solid pattern (the 50%/75%/25% gray shades, the stripe and crosshatch family [MS-XLS]'s FillPattern enumeration also names) is a deliberate, permanent gap rather than an oversight: ContentSheetCell.background models one flat colour, and approximating a striped or crosshatched fill as its own foreground colour alone would misreport what the cell actually shows -- see xls-codec's README, "Cell decoration".
196
+ * A solid fill resolves to a 'solid' ContentCellFill of its own foreground colour; every other named FillPattern -- the 50%/75%/25% gray shades, the stripe and crosshatch family -- resolves to a real 'pattern' fill via xf-colors.ts's own FILL_PATTERN_TO_PATTERN_TYPE, carrying whichever of the pattern's foreground/background colours actually resolve to a fixed RGB value. See xls-codec's README, "Cell decoration".
197
197
  */
198
198
  function backgroundOf(globals, xfIndex) {
199
199
  const format = globals.cellFormats[xfIndex];
200
200
  if (format === void 0) return;
201
- return resolveFillBackground(format.decoration.fillPattern, format.decoration.fillForegroundIcv, globals.palette);
201
+ return resolveFillBackground(format.decoration.fillPattern, format.decoration.fillForegroundIcv, format.decoration.fillBackgroundIcv, globals.palette);
202
202
  }
203
203
  /** A cell's own resolved horizontal/vertical alignment -- already the exact Alignment/verticalAlignment members (or undefined) globals.ts's readCellFormat resolved through xf-colors.ts's unpackXfAlignment, so this is a lookup rather than a further resolution step, mirroring backgroundOf/bordersOf's own shape. Both fields undefined for a cell whose XF resolves to no CellFormat at all (an out-of-range xfIndex), matching every other resolveXOf helper's behaviour in that case. */
204
204
  function alignmentOf(globals, xfIndex) {
package/dist/index.cjs CHANGED
@@ -109,8 +109,10 @@ exports.readShortXLUnicodeString = require_biff_strings.readShortXLUnicodeString
109
109
  exports.readWorkbookGlobals = require_workbook_globals.readWorkbookGlobals;
110
110
  exports.readWorkbookStreams = require_container.readWorkbookStreams;
111
111
  exports.readXLUnicodeString = require_biff_strings.readXLUnicodeString;
112
+ exports.readXLUnicodeStringNoCch = require_biff_strings.readXLUnicodeStringNoCch;
112
113
  exports.readXls = require_content.readXls;
113
114
  exports.readXlsContent = require_content.readXlsContent;
115
+ exports.recordByteLength = require_biff_substreams.recordByteLength;
114
116
  exports.serialToIsoDate = require_serial.serialToIsoDate;
115
117
  exports.serialToIsoDateTime = require_serial.serialToIsoDateTime;
116
118
  exports.serialToIsoTime = require_serial.serialToIsoTime;
package/dist/index.d.cts CHANGED
@@ -7,8 +7,8 @@ import { concatRecords, writeRecord } from "./biff/record-writer.cjs";
7
7
  import { n as BiffRecord, r as readRecords, t as BiffFormatError } from "./records-DVIqXFKk.cjs";
8
8
  import { decodeRkNumber } from "./biff/rk.cjs";
9
9
  import { writeRichExtendedString, writeShortXLUnicodeString, writeXLUnicodeString } from "./biff/string-writer.cjs";
10
- import { readRichExtendedString, readShortXLUnicodeString, readXLUnicodeString } from "./biff/strings.cjs";
11
- import { i as splitSubstreams, n as Substream, r as groupRecords, t as RecordGroup } from "./substreams-Ddtvn_Vr.cjs";
10
+ import { readRichExtendedString, readShortXLUnicodeString, readXLUnicodeString, readXLUnicodeStringNoCch } from "./biff/strings.cjs";
11
+ import { a as splitSubstreams, i as recordByteLength, n as Substream, r as groupRecords, t as RecordGroup } from "./substreams-Cpy5Fi3d.cjs";
12
12
  import { BiffWriteError } from "./biff/write-errors.cjs";
13
13
  import { writeCellXfRecord, writeFontRecord, writeFormatRecord, writePaletteRecord, writeStyleRecord, writeStyleXfRecord } from "./biff/xf-writer.cjs";
14
14
  import { SUMMARY_INFORMATION_STREAM, WorkbookStreams, isXlsFile, readWorkbookStreams } from "./container.cjs";
@@ -22,4 +22,4 @@ import { RawCell, RawCellValue, RawColumn, RawPrintSettings, RawRange, RawRow, R
22
22
  import { SheetWriteContext, buildWorksheetSubstream } from "./workbook/sheet-writer.cjs";
23
23
  import { writeXls, writeXlsContent } from "./write.cjs";
24
24
  export * from "excel-number-format";
25
- export { BIFF8_VERSION, BOF_TYPE_CHART, BOF_TYPE_MACRO, BOF_TYPE_WORKBOOK, BOF_TYPE_WORKSHEET, BiffFormatError, BiffRecord, BiffWriteError, BlockCursor, CellFormat, CellXfPlanEntry, GENERAL_CELL_XF_INDEX, MAX_RECORD_DATA_SIZE, RECORD_ARRAY, RECORD_BLANK, RECORD_BOF, RECORD_BOOLERR, RECORD_BOTTOMMARGIN, RECORD_BOUNDSHEET8, RECORD_CALCCOUNT, RECORD_CALCDELTA, RECORD_CALCITER, RECORD_CALCREFMODE, RECORD_CALCSAVERECALC, RECORD_COLINFO, RECORD_CONTINUE, RECORD_DATE1904, RECORD_DEFAULTROWHEIGHT, RECORD_DEFCOLWIDTH, RECORD_DIMENSIONS, RECORD_EOF, RECORD_EXTERNSHEET, RECORD_FILEPASS, RECORD_FONT, RECORD_FORMAT, RECORD_FORMULA, RECORD_HORIZONTALPAGEBREAKS, RECORD_LABEL, RECORD_LABELSST, RECORD_LBL, RECORD_LEFTMARGIN, RECORD_MERGECELLS, RECORD_MULBLANK, RECORD_MULRK, RECORD_NUMBER, RECORD_PALETTE, RECORD_PRINTGRID, RECORD_PRINTROWCOL, RECORD_RIGHTMARGIN, RECORD_RK, RECORD_ROW, RECORD_SETUP, RECORD_SHRFMLA, RECORD_SST, RECORD_STRING, RECORD_STYLE, RECORD_SUPBOOK, RECORD_TABLE, RECORD_TOPMARGIN, RECORD_VERTICALPAGEBREAKS, RECORD_WSBOOL, RECORD_XF, RawCell, RawCellValue, RawColumn, RawPrintSettings, RawRange, RawRow, RawSheet, RecordBuilder, RecordGroup, SUMMARY_INFORMATION_STREAM, SheetEntry, SheetWriteContext, Substream, WorkbookGlobals, WorkbookGlobalsBuild, WorkbookGlobalsPlan, WorkbookStreams, XlsContentDocument, buildWorkbookGlobals, buildWorksheetSubstream, columnWidthToPoints, concatRecords, decodeRkNumber, errorCodeOf, errorTextOf, formatCodeOf, groupRecords, inchesToPoints, isXlsFile, isoDateTimeToSerial, isoDateToSerial, isoTimeToSerial, layoutMetadataToSummaryInformation, millimetresToPoints, pointsToColumnWidth, pointsToInches, pointsToTwips, readRecords, readRichExtendedString, readSheetRecords, readShortXLUnicodeString, readWorkbookGlobals, readWorkbookStreams, readXLUnicodeString, readXls, readXlsContent, serialToIsoDate, serialToIsoDateTime, serialToIsoTime, splitSubstreams, twipsToPoints, writeBofData, writeCellXfRecord, writeFontRecord, writeFormatRecord, writePaletteRecord, writeRecord, writeRichExtendedString, writeShortXLUnicodeString, writeStyleRecord, writeStyleXfRecord, writeXLUnicodeString, writeXls, writeXlsContent };
25
+ export { BIFF8_VERSION, BOF_TYPE_CHART, BOF_TYPE_MACRO, BOF_TYPE_WORKBOOK, BOF_TYPE_WORKSHEET, BiffFormatError, BiffRecord, BiffWriteError, BlockCursor, CellFormat, CellXfPlanEntry, GENERAL_CELL_XF_INDEX, MAX_RECORD_DATA_SIZE, RECORD_ARRAY, RECORD_BLANK, RECORD_BOF, RECORD_BOOLERR, RECORD_BOTTOMMARGIN, RECORD_BOUNDSHEET8, RECORD_CALCCOUNT, RECORD_CALCDELTA, RECORD_CALCITER, RECORD_CALCREFMODE, RECORD_CALCSAVERECALC, RECORD_COLINFO, RECORD_CONTINUE, RECORD_DATE1904, RECORD_DEFAULTROWHEIGHT, RECORD_DEFCOLWIDTH, RECORD_DIMENSIONS, RECORD_EOF, RECORD_EXTERNSHEET, RECORD_FILEPASS, RECORD_FONT, RECORD_FORMAT, RECORD_FORMULA, RECORD_HORIZONTALPAGEBREAKS, RECORD_LABEL, RECORD_LABELSST, RECORD_LBL, RECORD_LEFTMARGIN, RECORD_MERGECELLS, RECORD_MULBLANK, RECORD_MULRK, RECORD_NUMBER, RECORD_PALETTE, RECORD_PRINTGRID, RECORD_PRINTROWCOL, RECORD_RIGHTMARGIN, RECORD_RK, RECORD_ROW, RECORD_SETUP, RECORD_SHRFMLA, RECORD_SST, RECORD_STRING, RECORD_STYLE, RECORD_SUPBOOK, RECORD_TABLE, RECORD_TOPMARGIN, RECORD_VERTICALPAGEBREAKS, RECORD_WSBOOL, RECORD_XF, RawCell, RawCellValue, RawColumn, RawPrintSettings, RawRange, RawRow, RawSheet, RecordBuilder, RecordGroup, SUMMARY_INFORMATION_STREAM, SheetEntry, SheetWriteContext, Substream, WorkbookGlobals, WorkbookGlobalsBuild, WorkbookGlobalsPlan, WorkbookStreams, XlsContentDocument, buildWorkbookGlobals, buildWorksheetSubstream, columnWidthToPoints, concatRecords, decodeRkNumber, errorCodeOf, errorTextOf, formatCodeOf, groupRecords, inchesToPoints, isXlsFile, isoDateTimeToSerial, isoDateToSerial, isoTimeToSerial, layoutMetadataToSummaryInformation, millimetresToPoints, pointsToColumnWidth, pointsToInches, pointsToTwips, readRecords, readRichExtendedString, readSheetRecords, readShortXLUnicodeString, readWorkbookGlobals, readWorkbookStreams, readXLUnicodeString, readXLUnicodeStringNoCch, readXls, readXlsContent, recordByteLength, serialToIsoDate, serialToIsoDateTime, serialToIsoTime, splitSubstreams, twipsToPoints, writeBofData, writeCellXfRecord, writeFontRecord, writeFormatRecord, writePaletteRecord, writeRecord, writeRichExtendedString, writeShortXLUnicodeString, writeStyleRecord, writeStyleXfRecord, writeXLUnicodeString, writeXls, writeXlsContent };
package/dist/index.d.ts CHANGED
@@ -7,8 +7,8 @@ import { concatRecords, writeRecord } from "./biff/record-writer.js";
7
7
  import { n as BiffRecord, r as readRecords, t as BiffFormatError } from "./records-DVIqXFKk.js";
8
8
  import { decodeRkNumber } from "./biff/rk.js";
9
9
  import { writeRichExtendedString, writeShortXLUnicodeString, writeXLUnicodeString } from "./biff/string-writer.js";
10
- import { readRichExtendedString, readShortXLUnicodeString, readXLUnicodeString } from "./biff/strings.js";
11
- import { i as splitSubstreams, n as Substream, r as groupRecords, t as RecordGroup } from "./substreams-D7dQiJbp.js";
10
+ import { readRichExtendedString, readShortXLUnicodeString, readXLUnicodeString, readXLUnicodeStringNoCch } from "./biff/strings.js";
11
+ import { a as splitSubstreams, i as recordByteLength, n as Substream, r as groupRecords, t as RecordGroup } from "./substreams-CmyZMtuM.js";
12
12
  import { BiffWriteError } from "./biff/write-errors.js";
13
13
  import { writeCellXfRecord, writeFontRecord, writeFormatRecord, writePaletteRecord, writeStyleRecord, writeStyleXfRecord } from "./biff/xf-writer.js";
14
14
  import { SUMMARY_INFORMATION_STREAM, WorkbookStreams, isXlsFile, readWorkbookStreams } from "./container.js";
@@ -22,4 +22,4 @@ import { RawCell, RawCellValue, RawColumn, RawPrintSettings, RawRange, RawRow, R
22
22
  import { SheetWriteContext, buildWorksheetSubstream } from "./workbook/sheet-writer.js";
23
23
  import { writeXls, writeXlsContent } from "./write.js";
24
24
  export * from "excel-number-format";
25
- export { BIFF8_VERSION, BOF_TYPE_CHART, BOF_TYPE_MACRO, BOF_TYPE_WORKBOOK, BOF_TYPE_WORKSHEET, BiffFormatError, BiffRecord, BiffWriteError, BlockCursor, CellFormat, CellXfPlanEntry, GENERAL_CELL_XF_INDEX, MAX_RECORD_DATA_SIZE, RECORD_ARRAY, RECORD_BLANK, RECORD_BOF, RECORD_BOOLERR, RECORD_BOTTOMMARGIN, RECORD_BOUNDSHEET8, RECORD_CALCCOUNT, RECORD_CALCDELTA, RECORD_CALCITER, RECORD_CALCREFMODE, RECORD_CALCSAVERECALC, RECORD_COLINFO, RECORD_CONTINUE, RECORD_DATE1904, RECORD_DEFAULTROWHEIGHT, RECORD_DEFCOLWIDTH, RECORD_DIMENSIONS, RECORD_EOF, RECORD_EXTERNSHEET, RECORD_FILEPASS, RECORD_FONT, RECORD_FORMAT, RECORD_FORMULA, RECORD_HORIZONTALPAGEBREAKS, RECORD_LABEL, RECORD_LABELSST, RECORD_LBL, RECORD_LEFTMARGIN, RECORD_MERGECELLS, RECORD_MULBLANK, RECORD_MULRK, RECORD_NUMBER, RECORD_PALETTE, RECORD_PRINTGRID, RECORD_PRINTROWCOL, RECORD_RIGHTMARGIN, RECORD_RK, RECORD_ROW, RECORD_SETUP, RECORD_SHRFMLA, RECORD_SST, RECORD_STRING, RECORD_STYLE, RECORD_SUPBOOK, RECORD_TABLE, RECORD_TOPMARGIN, RECORD_VERTICALPAGEBREAKS, RECORD_WSBOOL, RECORD_XF, RawCell, RawCellValue, RawColumn, RawPrintSettings, RawRange, RawRow, RawSheet, RecordBuilder, RecordGroup, SUMMARY_INFORMATION_STREAM, SheetEntry, SheetWriteContext, Substream, WorkbookGlobals, WorkbookGlobalsBuild, WorkbookGlobalsPlan, WorkbookStreams, XlsContentDocument, buildWorkbookGlobals, buildWorksheetSubstream, columnWidthToPoints, concatRecords, decodeRkNumber, errorCodeOf, errorTextOf, formatCodeOf, groupRecords, inchesToPoints, isXlsFile, isoDateTimeToSerial, isoDateToSerial, isoTimeToSerial, layoutMetadataToSummaryInformation, millimetresToPoints, pointsToColumnWidth, pointsToInches, pointsToTwips, readRecords, readRichExtendedString, readSheetRecords, readShortXLUnicodeString, readWorkbookGlobals, readWorkbookStreams, readXLUnicodeString, readXls, readXlsContent, serialToIsoDate, serialToIsoDateTime, serialToIsoTime, splitSubstreams, twipsToPoints, writeBofData, writeCellXfRecord, writeFontRecord, writeFormatRecord, writePaletteRecord, writeRecord, writeRichExtendedString, writeShortXLUnicodeString, writeStyleRecord, writeStyleXfRecord, writeXLUnicodeString, writeXls, writeXlsContent };
25
+ export { BIFF8_VERSION, BOF_TYPE_CHART, BOF_TYPE_MACRO, BOF_TYPE_WORKBOOK, BOF_TYPE_WORKSHEET, BiffFormatError, BiffRecord, BiffWriteError, BlockCursor, CellFormat, CellXfPlanEntry, GENERAL_CELL_XF_INDEX, MAX_RECORD_DATA_SIZE, RECORD_ARRAY, RECORD_BLANK, RECORD_BOF, RECORD_BOOLERR, RECORD_BOTTOMMARGIN, RECORD_BOUNDSHEET8, RECORD_CALCCOUNT, RECORD_CALCDELTA, RECORD_CALCITER, RECORD_CALCREFMODE, RECORD_CALCSAVERECALC, RECORD_COLINFO, RECORD_CONTINUE, RECORD_DATE1904, RECORD_DEFAULTROWHEIGHT, RECORD_DEFCOLWIDTH, RECORD_DIMENSIONS, RECORD_EOF, RECORD_EXTERNSHEET, RECORD_FILEPASS, RECORD_FONT, RECORD_FORMAT, RECORD_FORMULA, RECORD_HORIZONTALPAGEBREAKS, RECORD_LABEL, RECORD_LABELSST, RECORD_LBL, RECORD_LEFTMARGIN, RECORD_MERGECELLS, RECORD_MULBLANK, RECORD_MULRK, RECORD_NUMBER, RECORD_PALETTE, RECORD_PRINTGRID, RECORD_PRINTROWCOL, RECORD_RIGHTMARGIN, RECORD_RK, RECORD_ROW, RECORD_SETUP, RECORD_SHRFMLA, RECORD_SST, RECORD_STRING, RECORD_STYLE, RECORD_SUPBOOK, RECORD_TABLE, RECORD_TOPMARGIN, RECORD_VERTICALPAGEBREAKS, RECORD_WSBOOL, RECORD_XF, RawCell, RawCellValue, RawColumn, RawPrintSettings, RawRange, RawRow, RawSheet, RecordBuilder, RecordGroup, SUMMARY_INFORMATION_STREAM, SheetEntry, SheetWriteContext, Substream, WorkbookGlobals, WorkbookGlobalsBuild, WorkbookGlobalsPlan, WorkbookStreams, XlsContentDocument, buildWorkbookGlobals, buildWorksheetSubstream, columnWidthToPoints, concatRecords, decodeRkNumber, errorCodeOf, errorTextOf, formatCodeOf, groupRecords, inchesToPoints, isXlsFile, isoDateTimeToSerial, isoDateToSerial, isoTimeToSerial, layoutMetadataToSummaryInformation, millimetresToPoints, pointsToColumnWidth, pointsToInches, pointsToTwips, readRecords, readRichExtendedString, readSheetRecords, readShortXLUnicodeString, readWorkbookGlobals, readWorkbookStreams, readXLUnicodeString, readXLUnicodeStringNoCch, readXls, readXlsContent, recordByteLength, serialToIsoDate, serialToIsoDateTime, serialToIsoTime, splitSubstreams, twipsToPoints, writeBofData, writeCellXfRecord, writeFontRecord, writeFormatRecord, writePaletteRecord, writeRecord, writeRichExtendedString, writeShortXLUnicodeString, writeStyleRecord, writeStyleXfRecord, writeXLUnicodeString, writeXls, writeXlsContent };
package/dist/index.js CHANGED
@@ -2,11 +2,11 @@ import { BIFF8_VERSION, BOF_TYPE_CHART, BOF_TYPE_MACRO, BOF_TYPE_WORKBOOK, BOF_T
2
2
  import { BiffFormatError, readRecords } from "./biff/records.js";
3
3
  import { SUMMARY_INFORMATION_STREAM, isXlsFile, readWorkbookStreams } from "./container.js";
4
4
  import { columnWidthToPoints, inchesToPoints, millimetresToPoints, pointsToColumnWidth, pointsToInches, pointsToTwips, twipsToPoints } from "./units.js";
5
- import { groupRecords, splitSubstreams } from "./biff/substreams.js";
5
+ import { groupRecords, recordByteLength, splitSubstreams } from "./biff/substreams.js";
6
6
  import { BiffWriteError } from "./biff/write-errors.js";
7
7
  import { isoDateTimeToSerial, isoDateToSerial, isoTimeToSerial, serialToIsoDate, serialToIsoDateTime, serialToIsoTime } from "./serial.js";
8
8
  import { BlockCursor } from "./biff/cursor.js";
9
- import { readRichExtendedString, readShortXLUnicodeString, readXLUnicodeString } from "./biff/strings.js";
9
+ import { readRichExtendedString, readShortXLUnicodeString, readXLUnicodeString, readXLUnicodeStringNoCch } from "./biff/strings.js";
10
10
  import { RecordBuilder } from "./biff/builder.js";
11
11
  import { concatRecords, writeRecord } from "./biff/record-writer.js";
12
12
  import { formatCodeOf, readWorkbookGlobals } from "./workbook/globals.js";
@@ -22,4 +22,4 @@ import { GENERAL_CELL_XF_INDEX, buildWorkbookGlobals } from "./workbook/globals-
22
22
  import { buildWorksheetSubstream } from "./workbook/sheet-writer.js";
23
23
  import { writeXls, writeXlsContent } from "./write.js";
24
24
  export * from "excel-number-format";
25
- export { BIFF8_VERSION, BOF_TYPE_CHART, BOF_TYPE_MACRO, BOF_TYPE_WORKBOOK, BOF_TYPE_WORKSHEET, BiffFormatError, BiffWriteError, BlockCursor, GENERAL_CELL_XF_INDEX, MAX_RECORD_DATA_SIZE, RECORD_ARRAY, RECORD_BLANK, RECORD_BOF, RECORD_BOOLERR, RECORD_BOTTOMMARGIN, RECORD_BOUNDSHEET8, RECORD_CALCCOUNT, RECORD_CALCDELTA, RECORD_CALCITER, RECORD_CALCREFMODE, RECORD_CALCSAVERECALC, RECORD_COLINFO, RECORD_CONTINUE, RECORD_DATE1904, RECORD_DEFAULTROWHEIGHT, RECORD_DEFCOLWIDTH, RECORD_DIMENSIONS, RECORD_EOF, RECORD_EXTERNSHEET, RECORD_FILEPASS, RECORD_FONT, RECORD_FORMAT, RECORD_FORMULA, RECORD_HORIZONTALPAGEBREAKS, RECORD_LABEL, RECORD_LABELSST, RECORD_LBL, RECORD_LEFTMARGIN, RECORD_MERGECELLS, RECORD_MULBLANK, RECORD_MULRK, RECORD_NUMBER, RECORD_PALETTE, RECORD_PRINTGRID, RECORD_PRINTROWCOL, RECORD_RIGHTMARGIN, RECORD_RK, RECORD_ROW, RECORD_SETUP, RECORD_SHRFMLA, RECORD_SST, RECORD_STRING, RECORD_STYLE, RECORD_SUPBOOK, RECORD_TABLE, RECORD_TOPMARGIN, RECORD_VERTICALPAGEBREAKS, RECORD_WSBOOL, RECORD_XF, RecordBuilder, SUMMARY_INFORMATION_STREAM, buildWorkbookGlobals, buildWorksheetSubstream, columnWidthToPoints, concatRecords, decodeRkNumber, errorCodeOf, errorTextOf, formatCodeOf, groupRecords, inchesToPoints, isXlsFile, isoDateTimeToSerial, isoDateToSerial, isoTimeToSerial, layoutMetadataToSummaryInformation, millimetresToPoints, pointsToColumnWidth, pointsToInches, pointsToTwips, readRecords, readRichExtendedString, readSheetRecords, readShortXLUnicodeString, readWorkbookGlobals, readWorkbookStreams, readXLUnicodeString, readXls, readXlsContent, serialToIsoDate, serialToIsoDateTime, serialToIsoTime, splitSubstreams, twipsToPoints, writeBofData, writeCellXfRecord, writeFontRecord, writeFormatRecord, writePaletteRecord, writeRecord, writeRichExtendedString, writeShortXLUnicodeString, writeStyleRecord, writeStyleXfRecord, writeXLUnicodeString, writeXls, writeXlsContent };
25
+ export { BIFF8_VERSION, BOF_TYPE_CHART, BOF_TYPE_MACRO, BOF_TYPE_WORKBOOK, BOF_TYPE_WORKSHEET, BiffFormatError, BiffWriteError, BlockCursor, GENERAL_CELL_XF_INDEX, MAX_RECORD_DATA_SIZE, RECORD_ARRAY, RECORD_BLANK, RECORD_BOF, RECORD_BOOLERR, RECORD_BOTTOMMARGIN, RECORD_BOUNDSHEET8, RECORD_CALCCOUNT, RECORD_CALCDELTA, RECORD_CALCITER, RECORD_CALCREFMODE, RECORD_CALCSAVERECALC, RECORD_COLINFO, RECORD_CONTINUE, RECORD_DATE1904, RECORD_DEFAULTROWHEIGHT, RECORD_DEFCOLWIDTH, RECORD_DIMENSIONS, RECORD_EOF, RECORD_EXTERNSHEET, RECORD_FILEPASS, RECORD_FONT, RECORD_FORMAT, RECORD_FORMULA, RECORD_HORIZONTALPAGEBREAKS, RECORD_LABEL, RECORD_LABELSST, RECORD_LBL, RECORD_LEFTMARGIN, RECORD_MERGECELLS, RECORD_MULBLANK, RECORD_MULRK, RECORD_NUMBER, RECORD_PALETTE, RECORD_PRINTGRID, RECORD_PRINTROWCOL, RECORD_RIGHTMARGIN, RECORD_RK, RECORD_ROW, RECORD_SETUP, RECORD_SHRFMLA, RECORD_SST, RECORD_STRING, RECORD_STYLE, RECORD_SUPBOOK, RECORD_TABLE, RECORD_TOPMARGIN, RECORD_VERTICALPAGEBREAKS, RECORD_WSBOOL, RECORD_XF, RecordBuilder, SUMMARY_INFORMATION_STREAM, buildWorkbookGlobals, buildWorksheetSubstream, columnWidthToPoints, concatRecords, decodeRkNumber, errorCodeOf, errorTextOf, formatCodeOf, groupRecords, inchesToPoints, isXlsFile, isoDateTimeToSerial, isoDateToSerial, isoTimeToSerial, layoutMetadataToSummaryInformation, millimetresToPoints, pointsToColumnWidth, pointsToInches, pointsToTwips, readRecords, readRichExtendedString, readSheetRecords, readShortXLUnicodeString, readWorkbookGlobals, readWorkbookStreams, readXLUnicodeString, readXLUnicodeStringNoCch, readXls, readXlsContent, recordByteLength, serialToIsoDate, serialToIsoDateTime, serialToIsoTime, splitSubstreams, twipsToPoints, writeBofData, writeCellXfRecord, writeFontRecord, writeFormatRecord, writePaletteRecord, writeRecord, writeRichExtendedString, writeShortXLUnicodeString, writeStyleRecord, writeStyleXfRecord, writeXLUnicodeString, writeXls, writeXlsContent };
@@ -1,4 +1,4 @@
1
- import { t as RecordGroup } from "./substreams-D7dQiJbp.js";
1
+ import { t as RecordGroup } from "./substreams-CmyZMtuM.js";
2
2
  import { ContentSheetPrintRange, ContentSheetRepeatRange } from "document-schema.js";
3
3
  //#region src/workbook/print-names.d.ts
4
4
  /** One sheet's print names, as the Lbl records of the globals substream carry them. Every field is absent when the workbook declares no such name for that sheet. */
@@ -1,4 +1,4 @@
1
- import { t as RecordGroup } from "./substreams-Ddtvn_Vr.cjs";
1
+ import { t as RecordGroup } from "./substreams-Cpy5Fi3d.cjs";
2
2
  import { ContentSheetPrintRange, ContentSheetRepeatRange } from "document-schema.js";
3
3
  //#region src/workbook/print-names.d.ts
4
4
  /** One sheet's print names, as the Lbl records of the globals substream carry them. Every field is absent when the workbook declares no such name for that sheet. */
@@ -0,0 +1,49 @@
1
+ //#region src/biff/ptg.d.ts
2
+ /** A 3D reference's sheet scope, resolved from its ixti through EXTERNSHEET and a self-referencing SupBook ([MS-XLS] 2.4.271, 2.4.106, 2.5.344): the first and last sheet of the reference, both direct BoundSheet8 indices into FormulaSheetContext.sheets. A single-sheet 3D reference has `firstSheetIndex === lastSheetIndex`. Defined here rather than alongside the globals reader that produces it, since resolving it into reference text is what this module exists to do. */
3
+ interface SheetRange {
4
+ readonly firstSheetIndex: number;
5
+ readonly lastSheetIndex: number;
6
+ }
7
+ /**
8
+ * A 3D reference's sheet-prefix label, already fully formatted by workbook/globals.ts, for an ixti this reader cannot resolve into a plain SheetRange -- a genuinely external workbook (label carries `[workbook]sheet` or `[workbook]first:last`) or a supporting link of a kind this reader never resolves a sheet name from at all (add-in, DDE/OLE, same-sheet, unused, an unresolved sheet index, or a workbook name this reader's own deliberately partial VirtualPath decoding could not isolate -- label then carries a bracketed `#REF!(reason)` diagnostic, or a `[EXTERNAL]` placeholder workbook name, in place of real recovered data). Kept as a single pre-formatted string rather than a further structured shape, since resolveSheetLabel below only ever needs the finished label text and every other consumer of a 3D reference's sheet name is upstream of this module (see WorkbookGlobals.sheetRanges, which this type's own sheetRanges field matches field-for-field).
9
+ *
10
+ * `diagnostic` says which of those two this is: false only when both the external workbook's own file name and its sheet name(s) were genuinely recovered from the file's own virtPath and rgst, in which case `label` is real data worth writing back out as a formula's sheet-scope text; true whenever `label` instead carries this reader's OWN placeholder text standing in for something it could not resolve. resolveSheetLabel treats a diagnostic label the same as any other construct this reader cannot resolve -- the containing formula is left absent rather than having synthetic, non-formula text spliced into what a spreadsheet application would otherwise treat as real, writable formula content (see documents.js's own write paths, which take ContentSheetCell.formula as literal, verbatim formula text with no further validation).
11
+ *
12
+ * No `kind` tag beyond this: SheetRange's two fields are both required and this type's own `label`/`diagnostic` fields are required too, so the two shapes are already mutually exclusive by construction and a plain `"label" in candidate` check discriminates them.
13
+ */
14
+ interface ExternalSheetLabel {
15
+ readonly label: string;
16
+ readonly diagnostic: boolean;
17
+ }
18
+ /** What a 3D reference's own ixti resolves against: the workbook's sheets in BoundSheet8 order (only the name is needed here), and each ixti's own resolved sheet scope (undefined where this reader has nothing at all to say about it -- see WorkbookGlobals.sheetRanges, which this type's own sheetRanges field matches field-for-field). */
19
+ interface FormulaSheetContext {
20
+ readonly sheets: readonly {
21
+ readonly name: string;
22
+ }[];
23
+ readonly sheetRanges: readonly (SheetRange | ExternalSheetLabel | undefined)[];
24
+ }
25
+ /** A cell position a relative Ptg token's offset is resolved against -- the referencing cell currently being expanded, never the shared formula's own base cell. Exported only because it appears in ParseFormulaOptions.relativeTo and readPtgExpBase's own return type, both public. */
26
+ interface FormulaOrigin {
27
+ readonly row: number;
28
+ readonly column: number;
29
+ }
30
+ /**
31
+ * Parses a Formula record's compiled expression into the text a spreadsheet application would show, or returns undefined for a token this reader does not resolve -- a defined name, a natural-language reference, or a data table (see the module comment for the full list). The caller leaves ContentSheetCell.formula absent in that case, exactly as for any other unsupported construct.
32
+ *
33
+ * `rgce` is the formula's own token bytes, already sliced to their declared length (CellParsedFormula.cce/SharedParsedFormula.cce/ArrayParsedFormula.cce) by the caller -- this function reads exactly that many bytes and nothing past them.
34
+ */
35
+ interface ParseFormulaOptions {
36
+ /** The cell this formula is being evaluated for -- present only when `rgce` is a ShrFmla's own SharedParsedFormula being expanded for one specific referencing cell (see workbook/sheet.ts's collectFormulaGroups), which is the only place PtgRefN/PtgAreaN are legal. Absent for every other caller, in which case meeting one of those tokens aborts the parse exactly as it always has. */
37
+ readonly relativeTo?: FormulaOrigin;
38
+ /** The RgbExtra trailer following `rgce` in the same CellParsedFormula/ArrayParsedFormula ([MS-XLS] 7dd67f0a/242bcf20) -- consulted only when `rgce` contains a PtgArray, one PtgExtraArray pulled off the front for each in the order both arrays share ([MS-XLS] 70f743b2: "The order of the structures MUST be the same as the order of the Ptgs"). Absent (or exhausted before a PtgArray needs it) aborts the parse rather than guessing at the array's values. */
39
+ readonly rgcb?: Uint8Array<ArrayBuffer>;
40
+ }
41
+ declare function parseFormulaText(rgce: Uint8Array<ArrayBuffer>, context: FormulaSheetContext, options?: ParseFormulaOptions): string | undefined;
42
+ /**
43
+ * If `rgce` is EXACTLY one PtgExp token -- which is the only shape a Formula record belonging to a shared or array formula group ever has, including the group's own base cell, which points at itself -- returns the (row, column) of the Formula record that carries the real expression (a ShrFmla or Array record immediately follows it). Returns undefined for every other rgce, so a caller can try this first and fall back to parseFormulaText for a formula that merely happens to open with byte 0x01 for some other reason (it cannot: no other single-byte-opcode Ptg in this reader's vocabulary is 0x01, but a malformed or foreign rgce is not assumed well-formed here either) or is simply longer than five bytes.
44
+ *
45
+ * Exported for workbook/sheet.ts's collectFormulaGroups, which joins the returned cell against whichever ShrFmla/Array record follows the Formula record found there.
46
+ */
47
+ declare function readPtgExpBase(rgce: Uint8Array<ArrayBuffer>): FormulaOrigin | undefined;
48
+ //#endregion
49
+ export { SheetRange as a, ParseFormulaOptions as i, FormulaOrigin as n, parseFormulaText as o, FormulaSheetContext as r, readPtgExpBase as s, ExternalSheetLabel as t };