xls-codec 4.3.0 → 4.4.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 CHANGED
@@ -35,8 +35,9 @@ What `writeXlsContent`/`writeXls` cover: every `ContentCellValue` kind a real `.
35
35
  | Per-cell font | The reader does not read one back: `ContentSheetCell` has no cell-level font field at all (`ooxml.js`'s xlsx reader makes the identical font-scope choice), so writing a real value here would be unverifiable by round trip. Every `XF` this writer emits still references the same single font. |
36
36
  | `MulBlank`/`RK`/`MulRk` | Pure compaction optimisations over information a plain `Blank`/`Number`/`LabelSst`/`BoolErr` record already carries losslessly. (`Blank` itself _is_ written, for a formatted empty cell — see the `empty` row below.) |
37
37
  | An `empty`-kind cell carrying no formatting | Written as nothing at all, which is what round-trips: `content.ts`'s reader drops an unformatted blank cell it reads, and a merged range's empty anchor is independently reconstructed from `MergeCells` alone. A formatted one (a fill, a border, or a non-default alignment) is the opposite case — its formatting exists only in the `XF` a cell record names, so it gets a real `Blank` record ([MS-XLS] 2.4.20) and round-trips with that formatting intact. |
38
- | Images, embedded objects, conditional formatting, defined names (`Lbl`) | Not read either (see below); there is no round trip to verify a writer for them against. |
38
+ | Images, embedded objects, defined names (`Lbl`) | Not read either (see below); there is no round trip to verify a writer for them against. |
39
39
  | Data validation (`Dv`/`DVal`) | The reader now recovers a sheet's own validation rules (see Read-side gaps below), but writing them back out is its own separate mechanism -- re-encoding a formula's own text back into `Ptg` tokens for `Dv`'s two `DVParsedFormula` fields, the same "not folded into recovering the read side" split this table already draws for `Formula` records. A `ContentSheet.dataValidations` is silently ignored on write. |
40
+ | Conditional formatting (`CondFmt`/`CF`) | The reader now recovers a sheet's own base `cellIs` rules (see Read-side gaps below), but writing them back out is its own separate mechanism, the same "not folded into recovering the read side" split this table already draws for `Formula` records and `Dv`. A `ContentSheet.conditionalFormats` is silently ignored on write. |
40
41
  | Cell comments (`Note`/`Txo`) | The reader now recovers a cell's comment (see Read-side gaps below), but writing one back out is its own separate mechanism -- a `Note`/`Obj`/`Txo` triple with its own object-id bookkeeping, distinct from every other cell record this writer already emits -- scoped as its own piece of work rather than folded into recovering the read side, the same split this table already draws for `Formula` records. A `ContentSheetCell.comment` is silently ignored on write. |
41
42
  | A page size no `iPaperSize` code names | Written as [MS-XLS] 2.4.257's own custom-paper value rather than as a named paper it is not — the dimensions themselves are unwritable, since `Setup` addresses paper only by code. See [Print settings](#print-settings). |
42
43
  | `Window1`/`Window2`, `CodePage`, `Index`/`DBCell`, the legacy interface records (`InterfaceHdr`, `WriteAccess`, …) | UI and interoperability bookkeeping [MS-XLS]'s own grammar names in the globals/worksheet substreams alongside the content-carrying records above, not data. `Index`/`DBCell` specifically is a pure cell-lookup performance optimisation (see [MS-XLS]'s own "Retrieval of Last-Calculated Cell Values Without Loading Cell Table") that this reader — and Excel's own reader — does not require to find a cell; real, well-established minimal BIFF8 writers (e.g. Python's `xlwt`) omit the same set and produce files Excel opens correctly. The calculation-state records (`CalcCount`, `CalcRefMode`, `CalcIter`, `CalcDelta`, `CalcSaveRecalc`) sat in this row until print settings needed them — see [Print settings](#print-settings) for why the writer emits them now. |
@@ -52,8 +53,9 @@ Each deliberate rather than overlooked:
52
53
  - **Cell decoration and alignment resolved for real; font still not.** `XF`'s trailing `CellXF` payload's fill pattern/colours and per-side border style/colour are read and resolved through the `Palette` record (or the default colour table when one is absent) — see [Cell decoration](#cell-decoration) for the full mapping, including every named pattern beyond solid, and how this was verified against real LibreOffice-produced BIFF8. The same payload's leading word is resolved too — see [Cell alignment](#cell-alignment) for the full `alc`/`alcV` mapping. `Font` records are not read at all: `ContentSheetCell` has no cell-level font field, and `ooxml.js`'s xlsx reader makes the identical scope choice.
53
54
  - **Print settings, resolved for real.** Every field of `ContentSheetPrintSettings` is read from the records that carry it, with Excel's own "Normal" preset standing in per field for whatever the file leaves unstated — see [Print settings](#print-settings) for the record map, the two of BIFF8's own conditional rules that decide how to read `Setup`, and the three things that genuinely do not come through.
54
55
  - **Cell comments, resolved for real (ExaDev/documents.js#949).** A legacy BIFF8 comment is split across three record kinds a single self-contained xlsx `<comment>` element never needs: a `Note` record ([MS-XLS] 2.4.179, wrapping a `NoteSh` structure) anchors the comment to a cell and names its author, but carries no text of its own; the text lives in a `Txo` record ([MS-XLS] 2.4.329), its characters carried across trailing `Continue` records; the two are joined through an `Obj` record ([MS-XLS] 2.4.181) whose `FtCmo` names an object id and type, the `Note`'s own `idObj` field naming that same id, and a `Txo` always immediately following the `Obj` record whose shape it belongs to (`src/workbook/comments.ts`). Read in one independent pass over the whole worksheet substream rather than assuming stream order between a `Note` and the `Obj`+`Txo` pair it names -- both are resolved regardless of which comes first. Legacy BIFF8 has no threading and no per-comment timestamp at all (unlike xlsx's own `[MS-XLSX]` threaded-comments extension), so `ContentSheetCellComment.replies` and `.createdAt` are never populated from an `.xls` source; rich per-character formatting within a comment (`TxORuns`) is skipped rather than modelled, the same scope limit this reader already applies to the shared string table's own rich runs, since `ContentSheetCellComment.text` is a plain string with nowhere to carry them.
55
- - **Data validation, resolved for real (ExaDev/documents.js#1098).** `Dv` ([MS-XLS] 2.4.95) is a fixed, published binary structure -- a bit-packed flags `DWORD` (`valType`/`errStyle`/`fAllowBlank`/`fShowInputMsg`/`fShowErrorMsg`/`typOperator`), four `XLUnicodeString`s (prompt/error titles and messages), one or two `DVParsedFormula` structures, and a trailing `SqRefU` range list -- read directly against that spec (`src/workbook/data-validation.ts`), unlike `calcext:condition`'s own LibreOffice-source-transcribed mini-language odf.js's equivalent reader needed. A `DVParsedFormula`'s own `rgce` is the identical `Ptg` token grammar a cell's `Formula` record carries, so its formula text is recovered with the same `parseFormulaText` this reader already uses for ordinary cell formulas. `DVal` ([MS-XLS] 2.4.96), the record that precedes a sheet's own `Dv` collection, carries only input-window UI state (position, drop-down `Obj` reference) with no counterpart in `ContentSheetDataValidationSchema` and is not read for its own fields. BIFF8's `CF`/`CFEx`/`CondFmt` conditional-formatting records remain unread (ExaDev/documents.js#1100) -- a separate record family, its own cycle.
56
- - **Not read at all:** charts, drawings and images, and conditional formatting (`CF`/`CFEx`/`CondFmt`, ExaDev/documents.js#1100). Defined names (`Lbl`) are read only for the two built-in ones a sheet's print range and repeated header bands live in ([Print settings](#print-settings)); a user-defined name has nowhere to land in `document-schema.js`'s spreadsheet model, so it is skipped.
56
+ - **Data validation, resolved for real (ExaDev/documents.js#1098).** `Dv` ([MS-XLS] 2.4.95) is a fixed, published binary structure -- a bit-packed flags `DWORD` (`valType`/`errStyle`/`fAllowBlank`/`fShowInputMsg`/`fShowErrorMsg`/`typOperator`), four `XLUnicodeString`s (prompt/error titles and messages), one or two `DVParsedFormula` structures, and a trailing `SqRefU` range list -- read directly against that spec (`src/workbook/data-validation.ts`), unlike `calcext:condition`'s own LibreOffice-source-transcribed mini-language odf.js's equivalent reader needed. A `DVParsedFormula`'s own `rgce` is the identical `Ptg` token grammar a cell's `Formula` record carries, so its formula text is recovered with the same `parseFormulaText` this reader already uses for ordinary cell formulas. `DVal` ([MS-XLS] 2.4.96), the record that precedes a sheet's own `Dv` collection, carries only input-window UI state (position, drop-down `Obj` reference) with no counterpart in `ContentSheetDataValidationSchema` and is not read for its own fields.
57
+ - **Conditional formatting, base rules resolved for real (ExaDev/documents.js#1102).** A `CondFmt` record ([MS-XLS] 2.4.56) marks the start of one to three `CF` records ([MS-XLS] 2.4.42) sharing one cell-range list, read together as a group (`src/workbook/conditional-format.ts`) since a `CF`'s own ranges live on its parent `CondFmt`, not on itself. Base BIFF8 (Excel 97) conditional formatting has exactly two rule shapes: a comparison ("Cell Value Is") condition, promoted to `ContentSheetConditionalFormat`'s `cellIs` variant with its formula(s) recovered through the same `parseFormulaText` this reader already uses for cell formulas and `Dv`; and a formula condition, left unpromoted for the same "no closed-form structure without a general formula engine" reason `data-validation.ts` and `ooxml.js`'s own xlsx `cfRule` reading already draw. A rule's resulting style -- font colour and fill background -- comes from its `CF`'s own `DXFN` structure, resolved through the identical `icv`/`Palette` colour machinery a regular cell's fill and border already use ([Cell decoration](#cell-decoration)); a `DXFN` naming a user-defined number format (`DXFNumUsr`) degrades that one rule's style to absent rather than risk misreading the font/fill fields that follow it, since [MS-XLS]'s own prose for `DXFNumUsr`'s length field does not settle whether it counts itself. Every richer rule type Excel 2007+ added -- top10, aboveAverage, colour scale, data bar, icon set, duplicate/unique values, text/date conditions -- has no representation in the base `CF` record at all; it rides a `CF12` record instead, linked to its own `CondFmt` through a `CFEx` extension record, which remains unread (ExaDev/documents.js#1100) -- a separate record family, its own cycle.
58
+ - **Not read at all:** charts, drawings and images, and `CF12`/`CFEx` conditional-formatting extension records (ExaDev/documents.js#1100). Defined names (`Lbl`) are read only for the two built-in ones a sheet's print range and repeated header bands live in ([Print settings](#print-settings)); a user-defined name has nowhere to land in `document-schema.js`'s spreadsheet model, so it is skipped.
57
59
  - **Encrypted workbooks** are refused rather than mis-read: a `FilePass` record means every record after it is ciphertext.
58
60
 
59
61
  This package is wired into `documents.js`'s conversion registry (`xlsToPdf`/`pdfToXls`, `convertDocument("xls", ...)`, and every same-variant spreadsheet bridge) — see that package's own README Fidelity table for exactly which pairs route and which don't. Remaining read+write scope gaps (formula writing and per-cell font) are tracked on [#815](https://github.com/ExaDev/documents.js/issues/815).
@@ -46,6 +46,10 @@ const RECORD_MERGECELLS = 229;
46
46
  const RECORD_DVAL = 434;
47
47
  /** One data-validation rule: its type/operator/error-style/flags, prompt and error text, one or two formulas, and the cell ranges it applies to ([MS-XLS] 2.4.95). */
48
48
  const RECORD_DV = 446;
49
+ /** Marks the start of a collection of 1-3 CF records and carries their own shared cell-range list (a bounding Ref8U plus a SqRefU) and a rule-set id CFEx can later extend ([MS-XLS] 2.4.56). */
50
+ const RECORD_CONDFMT = 432;
51
+ /** One conditional-formatting rule: a comparison ("Cell Value Is") or formula condition, one or two Ptg-encoded formulas, and a DXFN structure naming the resulting cell's own font/fill override ([MS-XLS] 2.4.42). Every richer rule type (top10, aboveAverage, colour scale, data bar, icon set, …) is a CF12/CFEx extension instead -- not this record. */
52
+ const RECORD_CF = 433;
49
53
  /** A cell comment's anchor -- row, column, and its own author, linking to the Obj record that names its text ([MS-XLS] 2.4.179). */
50
54
  const RECORD_NOTE = 28;
51
55
  /** A drawing object's common properties (id, type) and, for a comment, its FtNts sub-structure ([MS-XLS] 2.4.181). */
@@ -138,7 +142,9 @@ exports.RECORD_CALCDELTA = RECORD_CALCDELTA;
138
142
  exports.RECORD_CALCITER = RECORD_CALCITER;
139
143
  exports.RECORD_CALCREFMODE = RECORD_CALCREFMODE;
140
144
  exports.RECORD_CALCSAVERECALC = RECORD_CALCSAVERECALC;
145
+ exports.RECORD_CF = RECORD_CF;
141
146
  exports.RECORD_COLINFO = RECORD_COLINFO;
147
+ exports.RECORD_CONDFMT = RECORD_CONDFMT;
142
148
  exports.RECORD_CONTINUE = RECORD_CONTINUE;
143
149
  exports.RECORD_DATE1904 = RECORD_DATE1904;
144
150
  exports.RECORD_DEFAULTROWHEIGHT = RECORD_DEFAULTROWHEIGHT;
@@ -45,6 +45,10 @@ declare const RECORD_MERGECELLS = 229;
45
45
  declare const RECORD_DVAL = 434;
46
46
  /** One data-validation rule: its type/operator/error-style/flags, prompt and error text, one or two formulas, and the cell ranges it applies to ([MS-XLS] 2.4.95). */
47
47
  declare const RECORD_DV = 446;
48
+ /** Marks the start of a collection of 1-3 CF records and carries their own shared cell-range list (a bounding Ref8U plus a SqRefU) and a rule-set id CFEx can later extend ([MS-XLS] 2.4.56). */
49
+ declare const RECORD_CONDFMT = 432;
50
+ /** One conditional-formatting rule: a comparison ("Cell Value Is") or formula condition, one or two Ptg-encoded formulas, and a DXFN structure naming the resulting cell's own font/fill override ([MS-XLS] 2.4.42). Every richer rule type (top10, aboveAverage, colour scale, data bar, icon set, …) is a CF12/CFEx extension instead -- not this record. */
51
+ declare const RECORD_CF = 433;
48
52
  /** A cell comment's anchor -- row, column, and its own author, linking to the Obj record that names its text ([MS-XLS] 2.4.179). */
49
53
  declare const RECORD_NOTE = 28;
50
54
  /** A drawing object's common properties (id, type) and, for a comment, its FtNts sub-structure ([MS-XLS] 2.4.181). */
@@ -120,4 +124,4 @@ declare const BIFF8_VERSION = 1536;
120
124
  /** [MS-XLS] 2.1.4: "The record size ... MUST be less than or equal to 8224." The ceiling a writer splits a record at, and the bound a reader can sanity-check a declared size against. */
121
125
  declare const MAX_RECORD_DATA_SIZE = 8224;
122
126
  //#endregion
123
- export { BIFF8_VERSION, BOF_TYPE_CHART, BOF_TYPE_MACRO, BOF_TYPE_WORKBOOK, BOF_TYPE_WORKSHEET, 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_DV, RECORD_DVAL, 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_NOTE, RECORD_NUMBER, RECORD_OBJ, 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_TXO, RECORD_VERTICALPAGEBREAKS, RECORD_WSBOOL, RECORD_XF };
127
+ export { BIFF8_VERSION, BOF_TYPE_CHART, BOF_TYPE_MACRO, BOF_TYPE_WORKBOOK, BOF_TYPE_WORKSHEET, 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_CF, RECORD_COLINFO, RECORD_CONDFMT, RECORD_CONTINUE, RECORD_DATE1904, RECORD_DEFAULTROWHEIGHT, RECORD_DEFCOLWIDTH, RECORD_DIMENSIONS, RECORD_DV, RECORD_DVAL, 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_NOTE, RECORD_NUMBER, RECORD_OBJ, 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_TXO, RECORD_VERTICALPAGEBREAKS, RECORD_WSBOOL, RECORD_XF };
@@ -45,6 +45,10 @@ declare const RECORD_MERGECELLS = 229;
45
45
  declare const RECORD_DVAL = 434;
46
46
  /** One data-validation rule: its type/operator/error-style/flags, prompt and error text, one or two formulas, and the cell ranges it applies to ([MS-XLS] 2.4.95). */
47
47
  declare const RECORD_DV = 446;
48
+ /** Marks the start of a collection of 1-3 CF records and carries their own shared cell-range list (a bounding Ref8U plus a SqRefU) and a rule-set id CFEx can later extend ([MS-XLS] 2.4.56). */
49
+ declare const RECORD_CONDFMT = 432;
50
+ /** One conditional-formatting rule: a comparison ("Cell Value Is") or formula condition, one or two Ptg-encoded formulas, and a DXFN structure naming the resulting cell's own font/fill override ([MS-XLS] 2.4.42). Every richer rule type (top10, aboveAverage, colour scale, data bar, icon set, …) is a CF12/CFEx extension instead -- not this record. */
51
+ declare const RECORD_CF = 433;
48
52
  /** A cell comment's anchor -- row, column, and its own author, linking to the Obj record that names its text ([MS-XLS] 2.4.179). */
49
53
  declare const RECORD_NOTE = 28;
50
54
  /** A drawing object's common properties (id, type) and, for a comment, its FtNts sub-structure ([MS-XLS] 2.4.181). */
@@ -120,4 +124,4 @@ declare const BIFF8_VERSION = 1536;
120
124
  /** [MS-XLS] 2.1.4: "The record size ... MUST be less than or equal to 8224." The ceiling a writer splits a record at, and the bound a reader can sanity-check a declared size against. */
121
125
  declare const MAX_RECORD_DATA_SIZE = 8224;
122
126
  //#endregion
123
- export { BIFF8_VERSION, BOF_TYPE_CHART, BOF_TYPE_MACRO, BOF_TYPE_WORKBOOK, BOF_TYPE_WORKSHEET, 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_DV, RECORD_DVAL, 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_NOTE, RECORD_NUMBER, RECORD_OBJ, 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_TXO, RECORD_VERTICALPAGEBREAKS, RECORD_WSBOOL, RECORD_XF };
127
+ export { BIFF8_VERSION, BOF_TYPE_CHART, BOF_TYPE_MACRO, BOF_TYPE_WORKBOOK, BOF_TYPE_WORKSHEET, 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_CF, RECORD_COLINFO, RECORD_CONDFMT, RECORD_CONTINUE, RECORD_DATE1904, RECORD_DEFAULTROWHEIGHT, RECORD_DEFCOLWIDTH, RECORD_DIMENSIONS, RECORD_DV, RECORD_DVAL, 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_NOTE, RECORD_NUMBER, RECORD_OBJ, 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_TXO, RECORD_VERTICALPAGEBREAKS, RECORD_WSBOOL, RECORD_XF };
@@ -45,6 +45,10 @@ const RECORD_MERGECELLS = 229;
45
45
  const RECORD_DVAL = 434;
46
46
  /** One data-validation rule: its type/operator/error-style/flags, prompt and error text, one or two formulas, and the cell ranges it applies to ([MS-XLS] 2.4.95). */
47
47
  const RECORD_DV = 446;
48
+ /** Marks the start of a collection of 1-3 CF records and carries their own shared cell-range list (a bounding Ref8U plus a SqRefU) and a rule-set id CFEx can later extend ([MS-XLS] 2.4.56). */
49
+ const RECORD_CONDFMT = 432;
50
+ /** One conditional-formatting rule: a comparison ("Cell Value Is") or formula condition, one or two Ptg-encoded formulas, and a DXFN structure naming the resulting cell's own font/fill override ([MS-XLS] 2.4.42). Every richer rule type (top10, aboveAverage, colour scale, data bar, icon set, …) is a CF12/CFEx extension instead -- not this record. */
51
+ const RECORD_CF = 433;
48
52
  /** A cell comment's anchor -- row, column, and its own author, linking to the Obj record that names its text ([MS-XLS] 2.4.179). */
49
53
  const RECORD_NOTE = 28;
50
54
  /** A drawing object's common properties (id, type) and, for a comment, its FtNts sub-structure ([MS-XLS] 2.4.181). */
@@ -120,4 +124,4 @@ const BIFF8_VERSION = 1536;
120
124
  /** [MS-XLS] 2.1.4: "The record size ... MUST be less than or equal to 8224." The ceiling a writer splits a record at, and the bound a reader can sanity-check a declared size against. */
121
125
  const MAX_RECORD_DATA_SIZE = 8224;
122
126
  //#endregion
123
- export { BIFF8_VERSION, BOF_TYPE_CHART, BOF_TYPE_MACRO, BOF_TYPE_WORKBOOK, BOF_TYPE_WORKSHEET, 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_DV, RECORD_DVAL, 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_NOTE, RECORD_NUMBER, RECORD_OBJ, 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_TXO, RECORD_VERTICALPAGEBREAKS, RECORD_WSBOOL, RECORD_XF };
127
+ export { BIFF8_VERSION, BOF_TYPE_CHART, BOF_TYPE_MACRO, BOF_TYPE_WORKBOOK, BOF_TYPE_WORKSHEET, 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_CF, RECORD_COLINFO, RECORD_CONDFMT, RECORD_CONTINUE, RECORD_DATE1904, RECORD_DEFAULTROWHEIGHT, RECORD_DEFCOLWIDTH, RECORD_DIMENSIONS, RECORD_DV, RECORD_DVAL, 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_NOTE, RECORD_NUMBER, RECORD_OBJ, 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_TXO, RECORD_VERTICALPAGEBREAKS, RECORD_WSBOOL, RECORD_XF };
@@ -0,0 +1,28 @@
1
+ import { r as FormulaSheetContext } from "./ptg-CCBbJLZJ.js";
2
+ import { t as RecordGroup } from "./substreams-CmyZMtuM.js";
3
+ import { ContentSheetRange, SheetRuleOperator } from "document-schema.js";
4
+ //#region src/workbook/conditional-format.d.ts
5
+ interface RawConditionalFormatFill {
6
+ readonly fillPattern: number;
7
+ readonly fillForegroundIcv: number;
8
+ readonly fillBackgroundIcv: number;
9
+ }
10
+ interface RawConditionalFormatStyle {
11
+ readonly fontColorIcv: number | undefined;
12
+ readonly fill: RawConditionalFormatFill | undefined;
13
+ }
14
+ interface RawConditionalFormat {
15
+ readonly operator: SheetRuleOperator;
16
+ readonly formula1: string;
17
+ readonly formula2: string | undefined;
18
+ readonly style: RawConditionalFormatStyle | undefined;
19
+ readonly ranges: ContentSheetRange[];
20
+ }
21
+ interface CondFmtGroupResult {
22
+ readonly formats: RawConditionalFormat[];
23
+ /** How many records (the CondFmt itself plus every CF it claimed) the caller should advance past, regardless of how many rules actually promoted. */
24
+ readonly recordsConsumed: number;
25
+ }
26
+ declare function readCondFmtGroup(records: readonly RecordGroup[], startIndex: number, formulaSheets: FormulaSheetContext): CondFmtGroupResult;
27
+ //#endregion
28
+ export { readCondFmtGroup as a, RawConditionalFormatStyle as i, RawConditionalFormat as n, RawConditionalFormatFill as r, CondFmtGroupResult as t };
@@ -0,0 +1,28 @@
1
+ import { r as FormulaSheetContext } from "./ptg-CCBbJLZJ.cjs";
2
+ import { t as RecordGroup } from "./substreams-Cpy5Fi3d.cjs";
3
+ import { ContentSheetRange, SheetRuleOperator } from "document-schema.js";
4
+ //#region src/workbook/conditional-format.d.ts
5
+ interface RawConditionalFormatFill {
6
+ readonly fillPattern: number;
7
+ readonly fillForegroundIcv: number;
8
+ readonly fillBackgroundIcv: number;
9
+ }
10
+ interface RawConditionalFormatStyle {
11
+ readonly fontColorIcv: number | undefined;
12
+ readonly fill: RawConditionalFormatFill | undefined;
13
+ }
14
+ interface RawConditionalFormat {
15
+ readonly operator: SheetRuleOperator;
16
+ readonly formula1: string;
17
+ readonly formula2: string | undefined;
18
+ readonly style: RawConditionalFormatStyle | undefined;
19
+ readonly ranges: ContentSheetRange[];
20
+ }
21
+ interface CondFmtGroupResult {
22
+ readonly formats: RawConditionalFormat[];
23
+ /** How many records (the CondFmt itself plus every CF it claimed) the caller should advance past, regardless of how many rules actually promoted. */
24
+ readonly recordsConsumed: number;
25
+ }
26
+ declare function readCondFmtGroup(records: readonly RecordGroup[], startIndex: number, formulaSheets: FormulaSheetContext): CondFmtGroupResult;
27
+ //#endregion
28
+ export { readCondFmtGroup as a, RawConditionalFormatStyle as i, RawConditionalFormat as n, RawConditionalFormatFill as r, CondFmtGroupResult as t };
package/dist/content.cjs CHANGED
@@ -115,6 +115,7 @@ function readSheet(entry, sheetIndex, substreams, globals) {
115
115
  columns: [],
116
116
  merges: [],
117
117
  dataValidations: [],
118
+ conditionalFormats: [],
118
119
  print: {
119
120
  marginsPt: {},
120
121
  rowBreaks: [],
@@ -128,6 +129,7 @@ function readSheet(entry, sheetIndex, substreams, globals) {
128
129
  const cells = mapCells(raw, globals);
129
130
  applyCellComments(comments, cells);
130
131
  const dataValidations = mapDataValidations(raw.dataValidations);
132
+ const conditionalFormats = mapConditionalFormats(raw.conditionalFormats, globals.palette);
131
133
  return {
132
134
  name: entry.name,
133
135
  cells,
@@ -135,7 +137,32 @@ function readSheet(entry, sheetIndex, substreams, globals) {
135
137
  rows: mapRows(raw),
136
138
  images: [],
137
139
  printSettings: mapPrintSettings(raw.print, globals.printNames.get(sheetIndex)),
138
- ...dataValidations.length > 0 ? { dataValidations } : {}
140
+ ...dataValidations.length > 0 ? { dataValidations } : {},
141
+ ...conditionalFormats.length > 0 ? { conditionalFormats } : {}
142
+ };
143
+ }
144
+ function mapConditionalFormats(raw, palette) {
145
+ return raw.map((format) => {
146
+ const style = mapConditionalFormatStyle(format.style, palette);
147
+ return {
148
+ type: "cellIs",
149
+ ranges: format.ranges,
150
+ operator: format.operator,
151
+ formula1: format.formula1,
152
+ ...format.formula2 !== void 0 ? { formula2: format.formula2 } : {},
153
+ ...style !== void 0 ? { style } : {}
154
+ };
155
+ });
156
+ }
157
+ function mapConditionalFormatStyle(raw, palette) {
158
+ if (raw === void 0) return;
159
+ const textColor = raw.fontColorIcv === void 0 ? void 0 : require_biff_xf_colors.resolveIcvColor(raw.fontColorIcv, palette);
160
+ const fill = raw.fill === void 0 ? void 0 : require_biff_xf_colors.resolveFillBackground(raw.fill.fillPattern, raw.fill.fillForegroundIcv, raw.fill.fillBackgroundIcv, palette);
161
+ const background = fill?.kind === "solid" ? fill.color : void 0;
162
+ if (textColor === void 0 && background === void 0) return;
163
+ return {
164
+ ...textColor !== void 0 ? { textColor } : {},
165
+ ...background !== void 0 ? { background } : {}
139
166
  };
140
167
  }
141
168
  function mapDataValidations(raw) {
package/dist/content.js CHANGED
@@ -4,7 +4,7 @@ import { readWorkbookStreams } from "./container.js";
4
4
  import { inchesToPoints } from "./units.js";
5
5
  import { pageSizeFromSetup } from "./biff/print-setup.js";
6
6
  import { groupRecords, splitSubstreams } from "./biff/substreams.js";
7
- import { resolveBorderEdge, resolveFillBackground } from "./biff/xf-colors.js";
7
+ import { resolveBorderEdge, resolveFillBackground, resolveIcvColor } from "./biff/xf-colors.js";
8
8
  import { readSheetComments } from "./workbook/comments.js";
9
9
  import { serialToIsoDate, serialToIsoDateTime, serialToIsoTime } from "./serial.js";
10
10
  import { formatCodeOf, readWorkbookGlobals } from "./workbook/globals.js";
@@ -114,6 +114,7 @@ function readSheet(entry, sheetIndex, substreams, globals) {
114
114
  columns: [],
115
115
  merges: [],
116
116
  dataValidations: [],
117
+ conditionalFormats: [],
117
118
  print: {
118
119
  marginsPt: {},
119
120
  rowBreaks: [],
@@ -127,6 +128,7 @@ function readSheet(entry, sheetIndex, substreams, globals) {
127
128
  const cells = mapCells(raw, globals);
128
129
  applyCellComments(comments, cells);
129
130
  const dataValidations = mapDataValidations(raw.dataValidations);
131
+ const conditionalFormats = mapConditionalFormats(raw.conditionalFormats, globals.palette);
130
132
  return {
131
133
  name: entry.name,
132
134
  cells,
@@ -134,7 +136,32 @@ function readSheet(entry, sheetIndex, substreams, globals) {
134
136
  rows: mapRows(raw),
135
137
  images: [],
136
138
  printSettings: mapPrintSettings(raw.print, globals.printNames.get(sheetIndex)),
137
- ...dataValidations.length > 0 ? { dataValidations } : {}
139
+ ...dataValidations.length > 0 ? { dataValidations } : {},
140
+ ...conditionalFormats.length > 0 ? { conditionalFormats } : {}
141
+ };
142
+ }
143
+ function mapConditionalFormats(raw, palette) {
144
+ return raw.map((format) => {
145
+ const style = mapConditionalFormatStyle(format.style, palette);
146
+ return {
147
+ type: "cellIs",
148
+ ranges: format.ranges,
149
+ operator: format.operator,
150
+ formula1: format.formula1,
151
+ ...format.formula2 !== void 0 ? { formula2: format.formula2 } : {},
152
+ ...style !== void 0 ? { style } : {}
153
+ };
154
+ });
155
+ }
156
+ function mapConditionalFormatStyle(raw, palette) {
157
+ if (raw === void 0) return;
158
+ const textColor = raw.fontColorIcv === void 0 ? void 0 : resolveIcvColor(raw.fontColorIcv, palette);
159
+ const fill = raw.fill === void 0 ? void 0 : resolveFillBackground(raw.fill.fillPattern, raw.fill.fillForegroundIcv, raw.fill.fillBackgroundIcv, palette);
160
+ const background = fill?.kind === "solid" ? fill.color : void 0;
161
+ if (textColor === void 0 && background === void 0) return;
162
+ return {
163
+ ...textColor !== void 0 ? { textColor } : {},
164
+ ...background !== void 0 ? { background } : {}
138
165
  };
139
166
  }
140
167
  function mapDataValidations(raw) {
package/dist/index.cjs CHANGED
@@ -43,7 +43,9 @@ exports.RECORD_CALCDELTA = require_biff_record_types.RECORD_CALCDELTA;
43
43
  exports.RECORD_CALCITER = require_biff_record_types.RECORD_CALCITER;
44
44
  exports.RECORD_CALCREFMODE = require_biff_record_types.RECORD_CALCREFMODE;
45
45
  exports.RECORD_CALCSAVERECALC = require_biff_record_types.RECORD_CALCSAVERECALC;
46
+ exports.RECORD_CF = require_biff_record_types.RECORD_CF;
46
47
  exports.RECORD_COLINFO = require_biff_record_types.RECORD_COLINFO;
48
+ exports.RECORD_CONDFMT = require_biff_record_types.RECORD_CONDFMT;
47
49
  exports.RECORD_CONTINUE = require_biff_record_types.RECORD_CONTINUE;
48
50
  exports.RECORD_DATE1904 = require_biff_record_types.RECORD_DATE1904;
49
51
  exports.RECORD_DEFAULTROWHEIGHT = require_biff_record_types.RECORD_DEFAULTROWHEIGHT;
package/dist/index.d.cts CHANGED
@@ -2,7 +2,7 @@ import { writeBofData } from "./biff/bof-writer.cjs";
2
2
  import { RecordBuilder } from "./biff/builder.cjs";
3
3
  import { t as BlockCursor } from "./cursor-VMtw9uVP.cjs";
4
4
  import { errorCodeOf, errorTextOf } from "./biff/errors.cjs";
5
- import { BIFF8_VERSION, BOF_TYPE_CHART, BOF_TYPE_MACRO, BOF_TYPE_WORKBOOK, BOF_TYPE_WORKSHEET, 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_DV, RECORD_DVAL, 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_NOTE, RECORD_NUMBER, RECORD_OBJ, 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_TXO, RECORD_VERTICALPAGEBREAKS, RECORD_WSBOOL, RECORD_XF } from "./biff/record-types.cjs";
5
+ import { BIFF8_VERSION, BOF_TYPE_CHART, BOF_TYPE_MACRO, BOF_TYPE_WORKBOOK, BOF_TYPE_WORKSHEET, 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_CF, RECORD_COLINFO, RECORD_CONDFMT, RECORD_CONTINUE, RECORD_DATE1904, RECORD_DEFAULTROWHEIGHT, RECORD_DEFCOLWIDTH, RECORD_DIMENSIONS, RECORD_DV, RECORD_DVAL, 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_NOTE, RECORD_NUMBER, RECORD_OBJ, 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_TXO, RECORD_VERTICALPAGEBREAKS, RECORD_WSBOOL, RECORD_XF } from "./biff/record-types.cjs";
6
6
  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";
@@ -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_DV, RECORD_DVAL, 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_NOTE, RECORD_NUMBER, RECORD_OBJ, 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_TXO, 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 };
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_CF, RECORD_COLINFO, RECORD_CONDFMT, RECORD_CONTINUE, RECORD_DATE1904, RECORD_DEFAULTROWHEIGHT, RECORD_DEFCOLWIDTH, RECORD_DIMENSIONS, RECORD_DV, RECORD_DVAL, 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_NOTE, RECORD_NUMBER, RECORD_OBJ, 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_TXO, 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
@@ -2,7 +2,7 @@ import { writeBofData } from "./biff/bof-writer.js";
2
2
  import { RecordBuilder } from "./biff/builder.js";
3
3
  import { t as BlockCursor } from "./cursor-VMtw9uVP.js";
4
4
  import { errorCodeOf, errorTextOf } from "./biff/errors.js";
5
- import { BIFF8_VERSION, BOF_TYPE_CHART, BOF_TYPE_MACRO, BOF_TYPE_WORKBOOK, BOF_TYPE_WORKSHEET, 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_DV, RECORD_DVAL, 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_NOTE, RECORD_NUMBER, RECORD_OBJ, 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_TXO, RECORD_VERTICALPAGEBREAKS, RECORD_WSBOOL, RECORD_XF } from "./biff/record-types.js";
5
+ import { BIFF8_VERSION, BOF_TYPE_CHART, BOF_TYPE_MACRO, BOF_TYPE_WORKBOOK, BOF_TYPE_WORKSHEET, 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_CF, RECORD_COLINFO, RECORD_CONDFMT, RECORD_CONTINUE, RECORD_DATE1904, RECORD_DEFAULTROWHEIGHT, RECORD_DEFCOLWIDTH, RECORD_DIMENSIONS, RECORD_DV, RECORD_DVAL, 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_NOTE, RECORD_NUMBER, RECORD_OBJ, 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_TXO, RECORD_VERTICALPAGEBREAKS, RECORD_WSBOOL, RECORD_XF } from "./biff/record-types.js";
6
6
  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";
@@ -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_DV, RECORD_DVAL, 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_NOTE, RECORD_NUMBER, RECORD_OBJ, 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_TXO, 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 };
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_CF, RECORD_COLINFO, RECORD_CONDFMT, RECORD_CONTINUE, RECORD_DATE1904, RECORD_DEFAULTROWHEIGHT, RECORD_DEFCOLWIDTH, RECORD_DIMENSIONS, RECORD_DV, RECORD_DVAL, 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_NOTE, RECORD_NUMBER, RECORD_OBJ, 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_TXO, 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
@@ -1,4 +1,4 @@
1
- import { BIFF8_VERSION, BOF_TYPE_CHART, BOF_TYPE_MACRO, BOF_TYPE_WORKBOOK, BOF_TYPE_WORKSHEET, 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_DV, RECORD_DVAL, 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_NOTE, RECORD_NUMBER, RECORD_OBJ, 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_TXO, RECORD_VERTICALPAGEBREAKS, RECORD_WSBOOL, RECORD_XF } from "./biff/record-types.js";
1
+ import { BIFF8_VERSION, BOF_TYPE_CHART, BOF_TYPE_MACRO, BOF_TYPE_WORKBOOK, BOF_TYPE_WORKSHEET, 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_CF, RECORD_COLINFO, RECORD_CONDFMT, RECORD_CONTINUE, RECORD_DATE1904, RECORD_DEFAULTROWHEIGHT, RECORD_DEFCOLWIDTH, RECORD_DIMENSIONS, RECORD_DV, RECORD_DVAL, 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_NOTE, RECORD_NUMBER, RECORD_OBJ, 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_TXO, RECORD_VERTICALPAGEBREAKS, RECORD_WSBOOL, RECORD_XF } from "./biff/record-types.js";
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";
@@ -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_DV, RECORD_DVAL, 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_NOTE, RECORD_NUMBER, RECORD_OBJ, 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_TXO, 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 };
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_CF, RECORD_COLINFO, RECORD_CONDFMT, RECORD_CONTINUE, RECORD_DATE1904, RECORD_DEFAULTROWHEIGHT, RECORD_DEFCOLWIDTH, RECORD_DIMENSIONS, RECORD_DV, RECORD_DVAL, 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_NOTE, RECORD_NUMBER, RECORD_OBJ, 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_TXO, 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 };
@@ -0,0 +1,141 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ require("../biff/record-types.cjs");
3
+ const require_biff_records = require("../biff/records.cjs");
4
+ const require_biff_substreams = require("../biff/substreams.cjs");
5
+ const require_biff_cursor = require("../biff/cursor.cjs");
6
+ const require_biff_ptg = require("../biff/ptg.cjs");
7
+ //#region src/workbook/conditional-format.ts
8
+ const CP_TO_OPERATOR = /* @__PURE__ */ new Map([
9
+ [1, "between"],
10
+ [2, "notBetween"],
11
+ [3, "equal"],
12
+ [4, "notEqual"],
13
+ [5, "greaterThan"],
14
+ [6, "lessThan"],
15
+ [7, "greaterThanOrEqual"],
16
+ [8, "lessThanOrEqual"]
17
+ ]);
18
+ const DXFFNTD_LENGTH = 122;
19
+ const DXFFNTD_ICV_FORE_OFFSET = 80;
20
+ const DXF_DEFAULT_FOREGROUND_TEXT_COLOR = 32767;
21
+ function parseDxfStyle(dxfBytes) {
22
+ if (dxfBytes.length === 0) return;
23
+ try {
24
+ const cursor = new require_biff_cursor.BlockCursor([dxfBytes]);
25
+ const flags1 = cursor.u32();
26
+ const flags2 = cursor.u16();
27
+ const hasNum = (flags1 >>> 25 & 1) !== 0;
28
+ const hasFnt = (flags1 >>> 26 & 1) !== 0;
29
+ const hasAlc = (flags1 >>> 27 & 1) !== 0;
30
+ const hasBdr = (flags1 >>> 28 & 1) !== 0;
31
+ const hasPat = (flags1 >>> 29 & 1) !== 0;
32
+ const fIfmtUser = (flags2 & 1) !== 0;
33
+ if (hasNum) {
34
+ if (fIfmtUser) return;
35
+ cursor.skip(2);
36
+ }
37
+ let fontColorIcv;
38
+ if (hasFnt) {
39
+ const fontBlock = cursor.take(DXFFNTD_LENGTH);
40
+ const icvFore = new DataView(fontBlock.buffer, fontBlock.byteOffset, fontBlock.byteLength).getInt32(DXFFNTD_ICV_FORE_OFFSET, true);
41
+ if (icvFore >= 0 && icvFore !== DXF_DEFAULT_FOREGROUND_TEXT_COLOR) fontColorIcv = icvFore;
42
+ }
43
+ if (hasAlc) cursor.skip(8);
44
+ if (hasBdr) cursor.skip(8);
45
+ let fill;
46
+ if (hasPat) {
47
+ const patWord = cursor.u32();
48
+ fill = {
49
+ fillPattern: patWord >>> 10 & 63,
50
+ fillForegroundIcv: patWord >>> 16 & 127,
51
+ fillBackgroundIcv: patWord >>> 23 & 127
52
+ };
53
+ }
54
+ if (fontColorIcv === void 0 && fill === void 0) return;
55
+ return {
56
+ fontColorIcv,
57
+ fill
58
+ };
59
+ } catch (err) {
60
+ if (!(err instanceof require_biff_records.BiffFormatError)) throw err;
61
+ return;
62
+ }
63
+ }
64
+ function readCf(record, ranges, formulaSheets) {
65
+ try {
66
+ const cursor = new require_biff_cursor.BlockCursor(record.blocks);
67
+ const ct = cursor.u8();
68
+ const cp = cursor.u8();
69
+ const cce1 = cursor.u16();
70
+ const cce2 = cursor.u16();
71
+ if (ct === 2) return;
72
+ const operator = CP_TO_OPERATOR.get(cp);
73
+ if (operator === void 0) return;
74
+ const dxfLength = require_biff_substreams.recordByteLength(record) - 6 - cce1 - cce2;
75
+ const dxfBytes = cursor.take(dxfLength);
76
+ const rgce1 = cursor.take(cce1);
77
+ const rgce2 = cursor.take(cce2);
78
+ if (cce1 === 0) return;
79
+ const formula1 = require_biff_ptg.parseFormulaText(rgce1, formulaSheets);
80
+ if (formula1 === void 0) return;
81
+ return {
82
+ operator,
83
+ formula1,
84
+ formula2: cce2 > 0 ? require_biff_ptg.parseFormulaText(rgce2, formulaSheets) : void 0,
85
+ style: parseDxfStyle(dxfBytes),
86
+ ranges
87
+ };
88
+ } catch (err) {
89
+ if (!(err instanceof require_biff_records.BiffFormatError)) throw err;
90
+ return;
91
+ }
92
+ }
93
+ function readCondFmtGroup(records, startIndex, formulaSheets) {
94
+ const condFmt = records[startIndex];
95
+ if (condFmt === void 0) return {
96
+ formats: [],
97
+ recordsConsumed: 1
98
+ };
99
+ try {
100
+ const cursor = new require_biff_cursor.BlockCursor(condFmt.blocks);
101
+ const ccf = cursor.u16();
102
+ cursor.skip(2);
103
+ cursor.skip(8);
104
+ const crefCount = cursor.u16();
105
+ const ranges = [];
106
+ for (let index = 0; index < crefCount; index += 1) {
107
+ const startRow = cursor.u16();
108
+ const endRow = cursor.u16();
109
+ const startColumn = cursor.u16();
110
+ const endColumn = cursor.u16();
111
+ ranges.push({
112
+ startRow,
113
+ startColumn,
114
+ endRow,
115
+ endColumn
116
+ });
117
+ }
118
+ const formats = [];
119
+ for (let offset = 1; offset <= ccf; offset += 1) {
120
+ const cfRecord = records[startIndex + offset];
121
+ if (cfRecord?.type !== 433) return {
122
+ formats: [],
123
+ recordsConsumed: 1
124
+ };
125
+ const format = readCf(cfRecord, ranges, formulaSheets);
126
+ if (format !== void 0) formats.push(format);
127
+ }
128
+ return {
129
+ formats,
130
+ recordsConsumed: 1 + ccf
131
+ };
132
+ } catch (err) {
133
+ if (!(err instanceof require_biff_records.BiffFormatError)) throw err;
134
+ return {
135
+ formats: [],
136
+ recordsConsumed: 1
137
+ };
138
+ }
139
+ }
140
+ //#endregion
141
+ exports.readCondFmtGroup = readCondFmtGroup;
@@ -0,0 +1,2 @@
1
+ import { a as readCondFmtGroup, i as RawConditionalFormatStyle, n as RawConditionalFormat, r as RawConditionalFormatFill, t as CondFmtGroupResult } from "../conditional-format-DUQuOrNW.cjs";
2
+ export { CondFmtGroupResult, RawConditionalFormat, RawConditionalFormatFill, RawConditionalFormatStyle, readCondFmtGroup };
@@ -0,0 +1,2 @@
1
+ import { a as readCondFmtGroup, i as RawConditionalFormatStyle, n as RawConditionalFormat, r as RawConditionalFormatFill, t as CondFmtGroupResult } from "../conditional-format-BV2313jL.js";
2
+ export { CondFmtGroupResult, RawConditionalFormat, RawConditionalFormatFill, RawConditionalFormatStyle, readCondFmtGroup };
@@ -0,0 +1,140 @@
1
+ import "../biff/record-types.js";
2
+ import { BiffFormatError } from "../biff/records.js";
3
+ import { recordByteLength } from "../biff/substreams.js";
4
+ import { BlockCursor } from "../biff/cursor.js";
5
+ import { parseFormulaText } from "../biff/ptg.js";
6
+ //#region src/workbook/conditional-format.ts
7
+ const CP_TO_OPERATOR = /* @__PURE__ */ new Map([
8
+ [1, "between"],
9
+ [2, "notBetween"],
10
+ [3, "equal"],
11
+ [4, "notEqual"],
12
+ [5, "greaterThan"],
13
+ [6, "lessThan"],
14
+ [7, "greaterThanOrEqual"],
15
+ [8, "lessThanOrEqual"]
16
+ ]);
17
+ const DXFFNTD_LENGTH = 122;
18
+ const DXFFNTD_ICV_FORE_OFFSET = 80;
19
+ const DXF_DEFAULT_FOREGROUND_TEXT_COLOR = 32767;
20
+ function parseDxfStyle(dxfBytes) {
21
+ if (dxfBytes.length === 0) return;
22
+ try {
23
+ const cursor = new BlockCursor([dxfBytes]);
24
+ const flags1 = cursor.u32();
25
+ const flags2 = cursor.u16();
26
+ const hasNum = (flags1 >>> 25 & 1) !== 0;
27
+ const hasFnt = (flags1 >>> 26 & 1) !== 0;
28
+ const hasAlc = (flags1 >>> 27 & 1) !== 0;
29
+ const hasBdr = (flags1 >>> 28 & 1) !== 0;
30
+ const hasPat = (flags1 >>> 29 & 1) !== 0;
31
+ const fIfmtUser = (flags2 & 1) !== 0;
32
+ if (hasNum) {
33
+ if (fIfmtUser) return;
34
+ cursor.skip(2);
35
+ }
36
+ let fontColorIcv;
37
+ if (hasFnt) {
38
+ const fontBlock = cursor.take(DXFFNTD_LENGTH);
39
+ const icvFore = new DataView(fontBlock.buffer, fontBlock.byteOffset, fontBlock.byteLength).getInt32(DXFFNTD_ICV_FORE_OFFSET, true);
40
+ if (icvFore >= 0 && icvFore !== DXF_DEFAULT_FOREGROUND_TEXT_COLOR) fontColorIcv = icvFore;
41
+ }
42
+ if (hasAlc) cursor.skip(8);
43
+ if (hasBdr) cursor.skip(8);
44
+ let fill;
45
+ if (hasPat) {
46
+ const patWord = cursor.u32();
47
+ fill = {
48
+ fillPattern: patWord >>> 10 & 63,
49
+ fillForegroundIcv: patWord >>> 16 & 127,
50
+ fillBackgroundIcv: patWord >>> 23 & 127
51
+ };
52
+ }
53
+ if (fontColorIcv === void 0 && fill === void 0) return;
54
+ return {
55
+ fontColorIcv,
56
+ fill
57
+ };
58
+ } catch (err) {
59
+ if (!(err instanceof BiffFormatError)) throw err;
60
+ return;
61
+ }
62
+ }
63
+ function readCf(record, ranges, formulaSheets) {
64
+ try {
65
+ const cursor = new BlockCursor(record.blocks);
66
+ const ct = cursor.u8();
67
+ const cp = cursor.u8();
68
+ const cce1 = cursor.u16();
69
+ const cce2 = cursor.u16();
70
+ if (ct === 2) return;
71
+ const operator = CP_TO_OPERATOR.get(cp);
72
+ if (operator === void 0) return;
73
+ const dxfLength = recordByteLength(record) - 6 - cce1 - cce2;
74
+ const dxfBytes = cursor.take(dxfLength);
75
+ const rgce1 = cursor.take(cce1);
76
+ const rgce2 = cursor.take(cce2);
77
+ if (cce1 === 0) return;
78
+ const formula1 = parseFormulaText(rgce1, formulaSheets);
79
+ if (formula1 === void 0) return;
80
+ return {
81
+ operator,
82
+ formula1,
83
+ formula2: cce2 > 0 ? parseFormulaText(rgce2, formulaSheets) : void 0,
84
+ style: parseDxfStyle(dxfBytes),
85
+ ranges
86
+ };
87
+ } catch (err) {
88
+ if (!(err instanceof BiffFormatError)) throw err;
89
+ return;
90
+ }
91
+ }
92
+ function readCondFmtGroup(records, startIndex, formulaSheets) {
93
+ const condFmt = records[startIndex];
94
+ if (condFmt === void 0) return {
95
+ formats: [],
96
+ recordsConsumed: 1
97
+ };
98
+ try {
99
+ const cursor = new BlockCursor(condFmt.blocks);
100
+ const ccf = cursor.u16();
101
+ cursor.skip(2);
102
+ cursor.skip(8);
103
+ const crefCount = cursor.u16();
104
+ const ranges = [];
105
+ for (let index = 0; index < crefCount; index += 1) {
106
+ const startRow = cursor.u16();
107
+ const endRow = cursor.u16();
108
+ const startColumn = cursor.u16();
109
+ const endColumn = cursor.u16();
110
+ ranges.push({
111
+ startRow,
112
+ startColumn,
113
+ endRow,
114
+ endColumn
115
+ });
116
+ }
117
+ const formats = [];
118
+ for (let offset = 1; offset <= ccf; offset += 1) {
119
+ const cfRecord = records[startIndex + offset];
120
+ if (cfRecord?.type !== 433) return {
121
+ formats: [],
122
+ recordsConsumed: 1
123
+ };
124
+ const format = readCf(cfRecord, ranges, formulaSheets);
125
+ if (format !== void 0) formats.push(format);
126
+ }
127
+ return {
128
+ formats,
129
+ recordsConsumed: 1 + ccf
130
+ };
131
+ } catch (err) {
132
+ if (!(err instanceof BiffFormatError)) throw err;
133
+ return {
134
+ formats: [],
135
+ recordsConsumed: 1
136
+ };
137
+ }
138
+ }
139
+ //#endregion
140
+ export { readCondFmtGroup };
@@ -9,6 +9,7 @@ const require_biff_strings = require("../biff/strings.cjs");
9
9
  const require_biff_errors = require("../biff/errors.cjs");
10
10
  const require_biff_ptg = require("../biff/ptg.cjs");
11
11
  const require_biff_rk = require("../biff/rk.cjs");
12
+ const require_workbook_conditional_format = require("./conditional-format.cjs");
12
13
  const require_workbook_data_validation = require("./data-validation.cjs");
13
14
  //#region src/workbook/sheet.ts
14
15
  /** Row record flag bits, in the 32-bit field following unused1 ([MS-XLS] 2.4.221). */
@@ -112,6 +113,7 @@ function readSheetRecords(records, sharedStrings, formulaSheets = EMPTY_FORMULA_
112
113
  const columns = [];
113
114
  const merges = [];
114
115
  const dataValidations = [];
116
+ const conditionalFormats = [];
115
117
  let usedRange;
116
118
  const marginsPt = {};
117
119
  const rowBreaks = [];
@@ -141,6 +143,12 @@ function readSheetRecords(records, sharedStrings, formulaSheets = EMPTY_FORMULA_
141
143
  if (validation !== void 0) dataValidations.push(validation);
142
144
  break;
143
145
  }
146
+ case 432: {
147
+ const group = require_workbook_conditional_format.readCondFmtGroup(records, index, formulaSheets);
148
+ conditionalFormats.push(...group.formats);
149
+ index += group.recordsConsumed - 1;
150
+ break;
151
+ }
144
152
  case 513:
145
153
  cells.push(readBlank(record));
146
154
  break;
@@ -215,6 +223,7 @@ function readSheetRecords(records, sharedStrings, formulaSheets = EMPTY_FORMULA_
215
223
  columns,
216
224
  merges,
217
225
  dataValidations,
226
+ conditionalFormats,
218
227
  print
219
228
  } : {
220
229
  cells,
@@ -222,6 +231,7 @@ function readSheetRecords(records, sharedStrings, formulaSheets = EMPTY_FORMULA_
222
231
  columns,
223
232
  merges,
224
233
  dataValidations,
234
+ conditionalFormats,
225
235
  usedRange,
226
236
  print
227
237
  };
@@ -1,6 +1,7 @@
1
1
  import { n as SetupFields } from "../print-setup-B_ihDvm5.cjs";
2
2
  import { r as FormulaSheetContext } from "../ptg-CCBbJLZJ.cjs";
3
3
  import { t as RecordGroup } from "../substreams-Cpy5Fi3d.cjs";
4
+ import { n as RawConditionalFormat } from "../conditional-format-DUQuOrNW.cjs";
4
5
  import { t as RawDataValidation } from "../data-validation-DZPzAW-8.cjs";
5
6
  //#region src/workbook/sheet.d.ts
6
7
  /** A cell's value as its own record carries it, before number-format classification decides whether a number is really a date, a percentage, or an amount of money. */
@@ -83,6 +84,7 @@ interface RawSheet {
83
84
  readonly columns: readonly RawColumn[];
84
85
  readonly merges: readonly RawRange[];
85
86
  readonly dataValidations: readonly RawDataValidation[];
87
+ readonly conditionalFormats: readonly RawConditionalFormat[];
86
88
  /** The used range from the Dimensions record ([MS-XLS] 2.4.90), when the sheet declared one. */
87
89
  readonly usedRange?: RawRange;
88
90
  /** The sheet's own page setup, as far as its records state it. */
@@ -1,6 +1,7 @@
1
1
  import { n as SetupFields } from "../print-setup-B_ihDvm5.js";
2
2
  import { r as FormulaSheetContext } from "../ptg-CCBbJLZJ.js";
3
3
  import { t as RecordGroup } from "../substreams-CmyZMtuM.js";
4
+ import { n as RawConditionalFormat } from "../conditional-format-BV2313jL.js";
4
5
  import { t as RawDataValidation } from "../data-validation-DsVG0Mms.js";
5
6
  //#region src/workbook/sheet.d.ts
6
7
  /** A cell's value as its own record carries it, before number-format classification decides whether a number is really a date, a percentage, or an amount of money. */
@@ -83,6 +84,7 @@ interface RawSheet {
83
84
  readonly columns: readonly RawColumn[];
84
85
  readonly merges: readonly RawRange[];
85
86
  readonly dataValidations: readonly RawDataValidation[];
87
+ readonly conditionalFormats: readonly RawConditionalFormat[];
86
88
  /** The used range from the Dimensions record ([MS-XLS] 2.4.90), when the sheet declared one. */
87
89
  readonly usedRange?: RawRange;
88
90
  /** The sheet's own page setup, as far as its records state it. */
@@ -8,6 +8,7 @@ import { readXLUnicodeString } from "../biff/strings.js";
8
8
  import { errorTextOf } from "../biff/errors.js";
9
9
  import { parseFormulaText, readPtgExpBase } from "../biff/ptg.js";
10
10
  import { decodeRkNumber } from "../biff/rk.js";
11
+ import { readCondFmtGroup } from "./conditional-format.js";
11
12
  import { readDv } from "./data-validation.js";
12
13
  //#region src/workbook/sheet.ts
13
14
  /** Row record flag bits, in the 32-bit field following unused1 ([MS-XLS] 2.4.221). */
@@ -111,6 +112,7 @@ function readSheetRecords(records, sharedStrings, formulaSheets = EMPTY_FORMULA_
111
112
  const columns = [];
112
113
  const merges = [];
113
114
  const dataValidations = [];
115
+ const conditionalFormats = [];
114
116
  let usedRange;
115
117
  const marginsPt = {};
116
118
  const rowBreaks = [];
@@ -140,6 +142,12 @@ function readSheetRecords(records, sharedStrings, formulaSheets = EMPTY_FORMULA_
140
142
  if (validation !== void 0) dataValidations.push(validation);
141
143
  break;
142
144
  }
145
+ case 432: {
146
+ const group = readCondFmtGroup(records, index, formulaSheets);
147
+ conditionalFormats.push(...group.formats);
148
+ index += group.recordsConsumed - 1;
149
+ break;
150
+ }
143
151
  case 513:
144
152
  cells.push(readBlank(record));
145
153
  break;
@@ -214,6 +222,7 @@ function readSheetRecords(records, sharedStrings, formulaSheets = EMPTY_FORMULA_
214
222
  columns,
215
223
  merges,
216
224
  dataValidations,
225
+ conditionalFormats,
217
226
  print
218
227
  } : {
219
228
  cells,
@@ -221,6 +230,7 @@ function readSheetRecords(records, sharedStrings, formulaSheets = EMPTY_FORMULA_
221
230
  columns,
222
231
  merges,
223
232
  dataValidations,
233
+ conditionalFormats,
224
234
  usedRange,
225
235
  print
226
236
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xls-codec",
3
- "version": "4.3.0",
3
+ "version": "4.4.0",
4
4
  "description": "Hand-written reader for the legacy Excel Binary File Format (.xls, BIFF8) as specified by [MS-XLS], mapping a workbook's record stream onto the shared document-schema.js spreadsheet model - the .xls codec for the documents.js family.",
5
5
  "type": "module",
6
6
  "repository": {