xls-codec 4.2.3 → 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
@@ -21,6 +21,7 @@ Under active development, with real, tested **read and write** support. Built an
21
21
  - **Cell decoration** — a cell's background fill (every named `FillPattern` value, solid and pattern alike) and per-side borders, read from and written to `XF`'s trailing `CellXF` payload plus the workbook's own `Palette` record, in both directions and verified against real LibreOffice-produced BIFF8, not just this package's own round trip (see [Cell decoration](#cell-decoration)).
22
22
  - **Print settings** — every field of `ContentSheetPrintSettings`: page size and orientation, all four margins, gridline and row/column-header printing, page order, print scale or fit-to-page counts, manual page breaks, the print range, and the repeated header rows and columns — read from and written to the nine worksheet-substream records and the two built-in defined names that carry them, in both directions and verified against real LibreOffice-produced BIFF8 (see [Print settings](#print-settings)).
23
23
  - **Cell alignment** — a cell's own horizontal (`left`/`center`/`right`/`justify`) and vertical (`top`/`middle`) alignment, read from and written to `XF`'s trailing `CellXF`/`StyleXF` payload's own leading word, in both directions and verified against real LibreOffice-produced BIFF8 (see [Cell alignment](#cell-alignment)).
24
+ - **Data validation, read-only (ExaDev/documents.js#1098)** — a sheet's own `Dv` records (`src/workbook/data-validation.ts`) into `ContentSheet.dataValidations`: type, comparison operator, one or two formulas (via the same `Ptg` reader `Formula` records already use), allow-blank/show-input/show-error flags, error style, and prompt/error titles and messages, resolved directly against [MS-XLS]'s own published `Dv`/`DVal`/`DVParsedFormula`/`SqRefU` field layouts rather than a producer-specific convention.
24
25
 
25
26
  Verified primarily by round trip (`src/write.test.ts`, plus a dedicated `test/workers/write.test.ts` proving the whole write path inside a real `workerd` isolate, not just Node): build a `ContentDocument`, write it, read it back through this package's own independently-pinned reader, and check the result. Every record's own byte layout is additionally cited to its [MS-XLS] section in the writer's source, matching the reader's own convention.
26
27
 
@@ -34,7 +35,9 @@ What `writeXlsContent`/`writeXls` cover: every `ContentCellValue` kind a real `.
34
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. |
35
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.) |
36
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. |
37
- | Images, embedded objects, data validation, 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
+ | 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. |
38
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. |
39
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). |
40
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. |
@@ -50,7 +53,9 @@ Each deliberate rather than overlooked:
50
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.
51
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.
52
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.
53
- - **Not read at all:** charts, drawings and images, data validation, and conditional formatting. 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.
54
59
  - **Encrypted workbooks** are refused rather than mis-read: a `FilePass` record means every record after it is ciphertext.
55
60
 
56
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).
@@ -42,6 +42,14 @@ const RECORD_DEFCOLWIDTH = 85;
42
42
  const RECORD_DEFAULTROWHEIGHT = 549;
43
43
  /** Merged cell ranges ([MS-XLS] 2.4.168). */
44
44
  const RECORD_MERGECELLS = 229;
45
+ /** Marks the start of a collection of Dv records and carries only input-window UI state (position, drop-down Obj reference) this reader does not model ([MS-XLS] 2.4.96). Not read for its own fields -- the Dv records that follow it are found by type, not counted against DVal's own idvMac. */
46
+ const RECORD_DVAL = 434;
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
+ 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;
45
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). */
46
54
  const RECORD_NOTE = 28;
47
55
  /** A drawing object's common properties (id, type) and, for a comment, its FtNts sub-structure ([MS-XLS] 2.4.181). */
@@ -134,12 +142,16 @@ exports.RECORD_CALCDELTA = RECORD_CALCDELTA;
134
142
  exports.RECORD_CALCITER = RECORD_CALCITER;
135
143
  exports.RECORD_CALCREFMODE = RECORD_CALCREFMODE;
136
144
  exports.RECORD_CALCSAVERECALC = RECORD_CALCSAVERECALC;
145
+ exports.RECORD_CF = RECORD_CF;
137
146
  exports.RECORD_COLINFO = RECORD_COLINFO;
147
+ exports.RECORD_CONDFMT = RECORD_CONDFMT;
138
148
  exports.RECORD_CONTINUE = RECORD_CONTINUE;
139
149
  exports.RECORD_DATE1904 = RECORD_DATE1904;
140
150
  exports.RECORD_DEFAULTROWHEIGHT = RECORD_DEFAULTROWHEIGHT;
141
151
  exports.RECORD_DEFCOLWIDTH = RECORD_DEFCOLWIDTH;
142
152
  exports.RECORD_DIMENSIONS = RECORD_DIMENSIONS;
153
+ exports.RECORD_DV = RECORD_DV;
154
+ exports.RECORD_DVAL = RECORD_DVAL;
143
155
  exports.RECORD_EOF = RECORD_EOF;
144
156
  exports.RECORD_EXTERNSHEET = RECORD_EXTERNSHEET;
145
157
  exports.RECORD_FILEPASS = RECORD_FILEPASS;
@@ -41,6 +41,14 @@ declare const RECORD_DEFCOLWIDTH = 85;
41
41
  declare const RECORD_DEFAULTROWHEIGHT = 549;
42
42
  /** Merged cell ranges ([MS-XLS] 2.4.168). */
43
43
  declare const RECORD_MERGECELLS = 229;
44
+ /** Marks the start of a collection of Dv records and carries only input-window UI state (position, drop-down Obj reference) this reader does not model ([MS-XLS] 2.4.96). Not read for its own fields -- the Dv records that follow it are found by type, not counted against DVal's own idvMac. */
45
+ declare const RECORD_DVAL = 434;
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
+ 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;
44
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). */
45
53
  declare const RECORD_NOTE = 28;
46
54
  /** A drawing object's common properties (id, type) and, for a comment, its FtNts sub-structure ([MS-XLS] 2.4.181). */
@@ -116,4 +124,4 @@ declare const BIFF8_VERSION = 1536;
116
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. */
117
125
  declare const MAX_RECORD_DATA_SIZE = 8224;
118
126
  //#endregion
119
- 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_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 };
@@ -41,6 +41,14 @@ declare const RECORD_DEFCOLWIDTH = 85;
41
41
  declare const RECORD_DEFAULTROWHEIGHT = 549;
42
42
  /** Merged cell ranges ([MS-XLS] 2.4.168). */
43
43
  declare const RECORD_MERGECELLS = 229;
44
+ /** Marks the start of a collection of Dv records and carries only input-window UI state (position, drop-down Obj reference) this reader does not model ([MS-XLS] 2.4.96). Not read for its own fields -- the Dv records that follow it are found by type, not counted against DVal's own idvMac. */
45
+ declare const RECORD_DVAL = 434;
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
+ 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;
44
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). */
45
53
  declare const RECORD_NOTE = 28;
46
54
  /** A drawing object's common properties (id, type) and, for a comment, its FtNts sub-structure ([MS-XLS] 2.4.181). */
@@ -116,4 +124,4 @@ declare const BIFF8_VERSION = 1536;
116
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. */
117
125
  declare const MAX_RECORD_DATA_SIZE = 8224;
118
126
  //#endregion
119
- 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_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 };
@@ -41,6 +41,14 @@ const RECORD_DEFCOLWIDTH = 85;
41
41
  const RECORD_DEFAULTROWHEIGHT = 549;
42
42
  /** Merged cell ranges ([MS-XLS] 2.4.168). */
43
43
  const RECORD_MERGECELLS = 229;
44
+ /** Marks the start of a collection of Dv records and carries only input-window UI state (position, drop-down Obj reference) this reader does not model ([MS-XLS] 2.4.96). Not read for its own fields -- the Dv records that follow it are found by type, not counted against DVal's own idvMac. */
45
+ const RECORD_DVAL = 434;
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
+ 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;
44
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). */
45
53
  const RECORD_NOTE = 28;
46
54
  /** A drawing object's common properties (id, type) and, for a comment, its FtNts sub-structure ([MS-XLS] 2.4.181). */
@@ -116,4 +124,4 @@ const BIFF8_VERSION = 1536;
116
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. */
117
125
  const MAX_RECORD_DATA_SIZE = 8224;
118
126
  //#endregion
119
- 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_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
@@ -114,6 +114,8 @@ function readSheet(entry, sheetIndex, substreams, globals) {
114
114
  rows: [],
115
115
  columns: [],
116
116
  merges: [],
117
+ dataValidations: [],
118
+ conditionalFormats: [],
117
119
  print: {
118
120
  marginsPt: {},
119
121
  rowBreaks: [],
@@ -126,15 +128,60 @@ function readSheet(entry, sheetIndex, substreams, globals) {
126
128
  const comments = substream === void 0 ? /* @__PURE__ */ new Map() : require_workbook_comments.readSheetComments(substream.records);
127
129
  const cells = mapCells(raw, globals);
128
130
  applyCellComments(comments, cells);
131
+ const dataValidations = mapDataValidations(raw.dataValidations);
132
+ const conditionalFormats = mapConditionalFormats(raw.conditionalFormats, globals.palette);
129
133
  return {
130
134
  name: entry.name,
131
135
  cells,
132
136
  columns: mapColumns(raw),
133
137
  rows: mapRows(raw),
134
138
  images: [],
135
- printSettings: mapPrintSettings(raw.print, globals.printNames.get(sheetIndex))
139
+ printSettings: mapPrintSettings(raw.print, globals.printNames.get(sheetIndex)),
140
+ ...dataValidations.length > 0 ? { dataValidations } : {},
141
+ ...conditionalFormats.length > 0 ? { conditionalFormats } : {}
136
142
  };
137
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 } : {}
166
+ };
167
+ }
168
+ function mapDataValidations(raw) {
169
+ return raw.map((validation) => ({
170
+ ranges: validation.ranges,
171
+ type: validation.type,
172
+ ...validation.operator === void 0 ? {} : { operator: validation.operator },
173
+ ...validation.formula1 === void 0 ? {} : { formula1: validation.formula1 },
174
+ ...validation.formula2 === void 0 ? {} : { formula2: validation.formula2 },
175
+ ...validation.allowBlank ? { allowBlank: true } : {},
176
+ ...validation.showInputMessage ? { showInputMessage: true } : {},
177
+ ...validation.promptTitle.length > 0 ? { promptTitle: validation.promptTitle } : {},
178
+ ...validation.prompt.length > 0 ? { prompt: validation.prompt } : {},
179
+ ...validation.showErrorMessage ? { showErrorMessage: true } : {},
180
+ ...validation.errorStyle === "stop" ? {} : { errorStyle: validation.errorStyle },
181
+ ...validation.errorTitle.length > 0 ? { errorTitle: validation.errorTitle } : {},
182
+ ...validation.error.length > 0 ? { error: validation.error } : {}
183
+ }));
184
+ }
138
185
  function mapRows(raw) {
139
186
  const rows = [];
140
187
  for (const row of raw.rows) {
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";
@@ -113,6 +113,8 @@ function readSheet(entry, sheetIndex, substreams, globals) {
113
113
  rows: [],
114
114
  columns: [],
115
115
  merges: [],
116
+ dataValidations: [],
117
+ conditionalFormats: [],
116
118
  print: {
117
119
  marginsPt: {},
118
120
  rowBreaks: [],
@@ -125,15 +127,60 @@ function readSheet(entry, sheetIndex, substreams, globals) {
125
127
  const comments = substream === void 0 ? /* @__PURE__ */ new Map() : readSheetComments(substream.records);
126
128
  const cells = mapCells(raw, globals);
127
129
  applyCellComments(comments, cells);
130
+ const dataValidations = mapDataValidations(raw.dataValidations);
131
+ const conditionalFormats = mapConditionalFormats(raw.conditionalFormats, globals.palette);
128
132
  return {
129
133
  name: entry.name,
130
134
  cells,
131
135
  columns: mapColumns(raw),
132
136
  rows: mapRows(raw),
133
137
  images: [],
134
- printSettings: mapPrintSettings(raw.print, globals.printNames.get(sheetIndex))
138
+ printSettings: mapPrintSettings(raw.print, globals.printNames.get(sheetIndex)),
139
+ ...dataValidations.length > 0 ? { dataValidations } : {},
140
+ ...conditionalFormats.length > 0 ? { conditionalFormats } : {}
135
141
  };
136
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 } : {}
165
+ };
166
+ }
167
+ function mapDataValidations(raw) {
168
+ return raw.map((validation) => ({
169
+ ranges: validation.ranges,
170
+ type: validation.type,
171
+ ...validation.operator === void 0 ? {} : { operator: validation.operator },
172
+ ...validation.formula1 === void 0 ? {} : { formula1: validation.formula1 },
173
+ ...validation.formula2 === void 0 ? {} : { formula2: validation.formula2 },
174
+ ...validation.allowBlank ? { allowBlank: true } : {},
175
+ ...validation.showInputMessage ? { showInputMessage: true } : {},
176
+ ...validation.promptTitle.length > 0 ? { promptTitle: validation.promptTitle } : {},
177
+ ...validation.prompt.length > 0 ? { prompt: validation.prompt } : {},
178
+ ...validation.showErrorMessage ? { showErrorMessage: true } : {},
179
+ ...validation.errorStyle === "stop" ? {} : { errorStyle: validation.errorStyle },
180
+ ...validation.errorTitle.length > 0 ? { errorTitle: validation.errorTitle } : {},
181
+ ...validation.error.length > 0 ? { error: validation.error } : {}
182
+ }));
183
+ }
137
184
  function mapRows(raw) {
138
185
  const rows = [];
139
186
  for (const row of raw.rows) {
@@ -0,0 +1,22 @@
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/data-validation.d.ts
5
+ interface RawDataValidation {
6
+ readonly type: "whole" | "decimal" | "list" | "date" | "time" | "textLength" | "custom";
7
+ readonly operator: SheetRuleOperator | undefined;
8
+ readonly formula1: string | undefined;
9
+ readonly formula2: string | undefined;
10
+ readonly allowBlank: boolean;
11
+ readonly showInputMessage: boolean;
12
+ readonly showErrorMessage: boolean;
13
+ readonly errorStyle: "stop" | "warning" | "information";
14
+ readonly promptTitle: string;
15
+ readonly errorTitle: string;
16
+ readonly prompt: string;
17
+ readonly error: string;
18
+ readonly ranges: ContentSheetRange[];
19
+ }
20
+ declare function readDv(record: RecordGroup, formulaSheets: FormulaSheetContext): RawDataValidation | undefined;
21
+ //#endregion
22
+ export { readDv as n, RawDataValidation as t };
@@ -0,0 +1,22 @@
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/data-validation.d.ts
5
+ interface RawDataValidation {
6
+ readonly type: "whole" | "decimal" | "list" | "date" | "time" | "textLength" | "custom";
7
+ readonly operator: SheetRuleOperator | undefined;
8
+ readonly formula1: string | undefined;
9
+ readonly formula2: string | undefined;
10
+ readonly allowBlank: boolean;
11
+ readonly showInputMessage: boolean;
12
+ readonly showErrorMessage: boolean;
13
+ readonly errorStyle: "stop" | "warning" | "information";
14
+ readonly promptTitle: string;
15
+ readonly errorTitle: string;
16
+ readonly prompt: string;
17
+ readonly error: string;
18
+ readonly ranges: ContentSheetRange[];
19
+ }
20
+ declare function readDv(record: RecordGroup, formulaSheets: FormulaSheetContext): RawDataValidation | undefined;
21
+ //#endregion
22
+ export { readDv as n, RawDataValidation as t };
package/dist/index.cjs CHANGED
@@ -43,12 +43,16 @@ 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;
50
52
  exports.RECORD_DEFCOLWIDTH = require_biff_record_types.RECORD_DEFCOLWIDTH;
51
53
  exports.RECORD_DIMENSIONS = require_biff_record_types.RECORD_DIMENSIONS;
54
+ exports.RECORD_DV = require_biff_record_types.RECORD_DV;
55
+ exports.RECORD_DVAL = require_biff_record_types.RECORD_DVAL;
52
56
  exports.RECORD_EOF = require_biff_record_types.RECORD_EOF;
53
57
  exports.RECORD_EXTERNSHEET = require_biff_record_types.RECORD_EXTERNSHEET;
54
58
  exports.RECORD_FILEPASS = require_biff_record_types.RECORD_FILEPASS;
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_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_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_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_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_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_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 };
@@ -0,0 +1,90 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_biff_records = require("../biff/records.cjs");
3
+ const require_biff_cursor = require("../biff/cursor.cjs");
4
+ const require_biff_strings = require("../biff/strings.cjs");
5
+ const require_biff_ptg = require("../biff/ptg.cjs");
6
+ //#region src/workbook/data-validation.ts
7
+ const VALUE_TYPE_BY_VAL_TYPE = /* @__PURE__ */ new Map([
8
+ [0, "custom"],
9
+ [1, "whole"],
10
+ [2, "decimal"],
11
+ [3, "list"],
12
+ [4, "date"],
13
+ [5, "time"],
14
+ [6, "textLength"],
15
+ [7, "custom"]
16
+ ]);
17
+ const OPERATOR_BY_TYP_OPERATOR = /* @__PURE__ */ new Map([
18
+ [0, "between"],
19
+ [1, "notBetween"],
20
+ [2, "equal"],
21
+ [3, "notEqual"],
22
+ [4, "greaterThan"],
23
+ [5, "lessThan"],
24
+ [6, "greaterThanOrEqual"],
25
+ [7, "lessThanOrEqual"]
26
+ ]);
27
+ const ERROR_STYLE_BY_ERR_STYLE = /* @__PURE__ */ new Map([
28
+ [0, "stop"],
29
+ [1, "warning"],
30
+ [2, "information"]
31
+ ]);
32
+ function readDvParsedFormula(cursor, formulaSheets) {
33
+ const cce = cursor.u16();
34
+ cursor.skip(2);
35
+ if (cce === 0) return;
36
+ return require_biff_ptg.parseFormulaText(cursor.take(cce), formulaSheets);
37
+ }
38
+ function readDv(record, formulaSheets) {
39
+ try {
40
+ const cursor = new require_biff_cursor.BlockCursor(record.blocks);
41
+ const flags = cursor.u32();
42
+ const valType = flags & 15;
43
+ const errStyleBits = flags >>> 4 & 7;
44
+ const fAllowBlank = (flags >>> 8 & 1) !== 0;
45
+ const fShowInputMsg = (flags >>> 18 & 1) !== 0;
46
+ const fShowErrorMsg = (flags >>> 19 & 1) !== 0;
47
+ const typOperator = flags >>> 20 & 15;
48
+ const promptTitle = require_biff_strings.readXLUnicodeString(cursor);
49
+ const errorTitle = require_biff_strings.readXLUnicodeString(cursor);
50
+ const prompt = require_biff_strings.readXLUnicodeString(cursor);
51
+ const error = require_biff_strings.readXLUnicodeString(cursor);
52
+ const formula1 = readDvParsedFormula(cursor, formulaSheets);
53
+ const formula2 = readDvParsedFormula(cursor, formulaSheets);
54
+ const rangeCount = cursor.u16();
55
+ const ranges = [];
56
+ for (let index = 0; index < rangeCount; index += 1) {
57
+ const startRow = cursor.u16();
58
+ const endRow = cursor.u16();
59
+ const startColumn = cursor.u16();
60
+ const endColumn = cursor.u16();
61
+ ranges.push({
62
+ startRow,
63
+ startColumn,
64
+ endRow,
65
+ endColumn
66
+ });
67
+ }
68
+ const type = VALUE_TYPE_BY_VAL_TYPE.get(valType) ?? "custom";
69
+ return {
70
+ type,
71
+ operator: type === "list" || type === "custom" ? void 0 : OPERATOR_BY_TYP_OPERATOR.get(typOperator),
72
+ formula1,
73
+ formula2,
74
+ allowBlank: fAllowBlank,
75
+ showInputMessage: fShowInputMsg,
76
+ showErrorMessage: fShowErrorMsg,
77
+ errorStyle: ERROR_STYLE_BY_ERR_STYLE.get(errStyleBits) ?? "stop",
78
+ promptTitle,
79
+ errorTitle,
80
+ prompt,
81
+ error,
82
+ ranges
83
+ };
84
+ } catch (err) {
85
+ if (!(err instanceof require_biff_records.BiffFormatError)) throw err;
86
+ return;
87
+ }
88
+ }
89
+ //#endregion
90
+ exports.readDv = readDv;
@@ -0,0 +1,2 @@
1
+ import { n as readDv, t as RawDataValidation } from "../data-validation-DZPzAW-8.cjs";
2
+ export { RawDataValidation, readDv };
@@ -0,0 +1,2 @@
1
+ import { n as readDv, t as RawDataValidation } from "../data-validation-DsVG0Mms.js";
2
+ export { RawDataValidation, readDv };
@@ -0,0 +1,89 @@
1
+ import { BiffFormatError } from "../biff/records.js";
2
+ import { BlockCursor } from "../biff/cursor.js";
3
+ import { readXLUnicodeString } from "../biff/strings.js";
4
+ import { parseFormulaText } from "../biff/ptg.js";
5
+ //#region src/workbook/data-validation.ts
6
+ const VALUE_TYPE_BY_VAL_TYPE = /* @__PURE__ */ new Map([
7
+ [0, "custom"],
8
+ [1, "whole"],
9
+ [2, "decimal"],
10
+ [3, "list"],
11
+ [4, "date"],
12
+ [5, "time"],
13
+ [6, "textLength"],
14
+ [7, "custom"]
15
+ ]);
16
+ const OPERATOR_BY_TYP_OPERATOR = /* @__PURE__ */ new Map([
17
+ [0, "between"],
18
+ [1, "notBetween"],
19
+ [2, "equal"],
20
+ [3, "notEqual"],
21
+ [4, "greaterThan"],
22
+ [5, "lessThan"],
23
+ [6, "greaterThanOrEqual"],
24
+ [7, "lessThanOrEqual"]
25
+ ]);
26
+ const ERROR_STYLE_BY_ERR_STYLE = /* @__PURE__ */ new Map([
27
+ [0, "stop"],
28
+ [1, "warning"],
29
+ [2, "information"]
30
+ ]);
31
+ function readDvParsedFormula(cursor, formulaSheets) {
32
+ const cce = cursor.u16();
33
+ cursor.skip(2);
34
+ if (cce === 0) return;
35
+ return parseFormulaText(cursor.take(cce), formulaSheets);
36
+ }
37
+ function readDv(record, formulaSheets) {
38
+ try {
39
+ const cursor = new BlockCursor(record.blocks);
40
+ const flags = cursor.u32();
41
+ const valType = flags & 15;
42
+ const errStyleBits = flags >>> 4 & 7;
43
+ const fAllowBlank = (flags >>> 8 & 1) !== 0;
44
+ const fShowInputMsg = (flags >>> 18 & 1) !== 0;
45
+ const fShowErrorMsg = (flags >>> 19 & 1) !== 0;
46
+ const typOperator = flags >>> 20 & 15;
47
+ const promptTitle = readXLUnicodeString(cursor);
48
+ const errorTitle = readXLUnicodeString(cursor);
49
+ const prompt = readXLUnicodeString(cursor);
50
+ const error = readXLUnicodeString(cursor);
51
+ const formula1 = readDvParsedFormula(cursor, formulaSheets);
52
+ const formula2 = readDvParsedFormula(cursor, formulaSheets);
53
+ const rangeCount = cursor.u16();
54
+ const ranges = [];
55
+ for (let index = 0; index < rangeCount; index += 1) {
56
+ const startRow = cursor.u16();
57
+ const endRow = cursor.u16();
58
+ const startColumn = cursor.u16();
59
+ const endColumn = cursor.u16();
60
+ ranges.push({
61
+ startRow,
62
+ startColumn,
63
+ endRow,
64
+ endColumn
65
+ });
66
+ }
67
+ const type = VALUE_TYPE_BY_VAL_TYPE.get(valType) ?? "custom";
68
+ return {
69
+ type,
70
+ operator: type === "list" || type === "custom" ? void 0 : OPERATOR_BY_TYP_OPERATOR.get(typOperator),
71
+ formula1,
72
+ formula2,
73
+ allowBlank: fAllowBlank,
74
+ showInputMessage: fShowInputMsg,
75
+ showErrorMessage: fShowErrorMsg,
76
+ errorStyle: ERROR_STYLE_BY_ERR_STYLE.get(errStyleBits) ?? "stop",
77
+ promptTitle,
78
+ errorTitle,
79
+ prompt,
80
+ error,
81
+ ranges
82
+ };
83
+ } catch (err) {
84
+ if (!(err instanceof BiffFormatError)) throw err;
85
+ return;
86
+ }
87
+ }
88
+ //#endregion
89
+ export { readDv };
@@ -9,6 +9,8 @@ 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");
13
+ const require_workbook_data_validation = require("./data-validation.cjs");
12
14
  //#region src/workbook/sheet.ts
13
15
  /** Row record flag bits, in the 32-bit field following unused1 ([MS-XLS] 2.4.221). */
14
16
  const ROW_FLAG_HIDDEN = 32;
@@ -110,6 +112,8 @@ function readSheetRecords(records, sharedStrings, formulaSheets = EMPTY_FORMULA_
110
112
  const rows = [];
111
113
  const columns = [];
112
114
  const merges = [];
115
+ const dataValidations = [];
116
+ const conditionalFormats = [];
113
117
  let usedRange;
114
118
  const marginsPt = {};
115
119
  const rowBreaks = [];
@@ -134,6 +138,17 @@ function readSheetRecords(records, sharedStrings, formulaSheets = EMPTY_FORMULA_
134
138
  case 229:
135
139
  merges.push(...readMergeCells(record));
136
140
  break;
141
+ case 446: {
142
+ const validation = require_workbook_data_validation.readDv(record, formulaSheets);
143
+ if (validation !== void 0) dataValidations.push(validation);
144
+ break;
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
+ }
137
152
  case 513:
138
153
  cells.push(readBlank(record));
139
154
  break;
@@ -207,12 +222,16 @@ function readSheetRecords(records, sharedStrings, formulaSheets = EMPTY_FORMULA_
207
222
  rows,
208
223
  columns,
209
224
  merges,
225
+ dataValidations,
226
+ conditionalFormats,
210
227
  print
211
228
  } : {
212
229
  cells,
213
230
  rows,
214
231
  columns,
215
232
  merges,
233
+ dataValidations,
234
+ conditionalFormats,
216
235
  usedRange,
217
236
  print
218
237
  };
@@ -1,6 +1,8 @@
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";
5
+ import { t as RawDataValidation } from "../data-validation-DZPzAW-8.cjs";
4
6
  //#region src/workbook/sheet.d.ts
5
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. */
6
8
  type RawCellValue = {
@@ -81,6 +83,8 @@ interface RawSheet {
81
83
  readonly rows: readonly RawRow[];
82
84
  readonly columns: readonly RawColumn[];
83
85
  readonly merges: readonly RawRange[];
86
+ readonly dataValidations: readonly RawDataValidation[];
87
+ readonly conditionalFormats: readonly RawConditionalFormat[];
84
88
  /** The used range from the Dimensions record ([MS-XLS] 2.4.90), when the sheet declared one. */
85
89
  readonly usedRange?: RawRange;
86
90
  /** The sheet's own page setup, as far as its records state it. */
@@ -1,6 +1,8 @@
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";
5
+ import { t as RawDataValidation } from "../data-validation-DsVG0Mms.js";
4
6
  //#region src/workbook/sheet.d.ts
5
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. */
6
8
  type RawCellValue = {
@@ -81,6 +83,8 @@ interface RawSheet {
81
83
  readonly rows: readonly RawRow[];
82
84
  readonly columns: readonly RawColumn[];
83
85
  readonly merges: readonly RawRange[];
86
+ readonly dataValidations: readonly RawDataValidation[];
87
+ readonly conditionalFormats: readonly RawConditionalFormat[];
84
88
  /** The used range from the Dimensions record ([MS-XLS] 2.4.90), when the sheet declared one. */
85
89
  readonly usedRange?: RawRange;
86
90
  /** The sheet's own page setup, as far as its records state it. */
@@ -8,6 +8,8 @@ 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";
12
+ import { readDv } from "./data-validation.js";
11
13
  //#region src/workbook/sheet.ts
12
14
  /** Row record flag bits, in the 32-bit field following unused1 ([MS-XLS] 2.4.221). */
13
15
  const ROW_FLAG_HIDDEN = 32;
@@ -109,6 +111,8 @@ function readSheetRecords(records, sharedStrings, formulaSheets = EMPTY_FORMULA_
109
111
  const rows = [];
110
112
  const columns = [];
111
113
  const merges = [];
114
+ const dataValidations = [];
115
+ const conditionalFormats = [];
112
116
  let usedRange;
113
117
  const marginsPt = {};
114
118
  const rowBreaks = [];
@@ -133,6 +137,17 @@ function readSheetRecords(records, sharedStrings, formulaSheets = EMPTY_FORMULA_
133
137
  case 229:
134
138
  merges.push(...readMergeCells(record));
135
139
  break;
140
+ case 446: {
141
+ const validation = readDv(record, formulaSheets);
142
+ if (validation !== void 0) dataValidations.push(validation);
143
+ break;
144
+ }
145
+ case 432: {
146
+ const group = readCondFmtGroup(records, index, formulaSheets);
147
+ conditionalFormats.push(...group.formats);
148
+ index += group.recordsConsumed - 1;
149
+ break;
150
+ }
136
151
  case 513:
137
152
  cells.push(readBlank(record));
138
153
  break;
@@ -206,12 +221,16 @@ function readSheetRecords(records, sharedStrings, formulaSheets = EMPTY_FORMULA_
206
221
  rows,
207
222
  columns,
208
223
  merges,
224
+ dataValidations,
225
+ conditionalFormats,
209
226
  print
210
227
  } : {
211
228
  cells,
212
229
  rows,
213
230
  columns,
214
231
  merges,
232
+ dataValidations,
233
+ conditionalFormats,
215
234
  usedRange,
216
235
  print
217
236
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xls-codec",
3
- "version": "4.2.3",
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": {