xls-codec 4.1.6 → 4.2.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
@@ -13,7 +13,7 @@ Under active development, with real, tested **read and write** support. Built an
13
13
  - **Record framing** (`src/biff/records.ts`, `src/biff/record-writer.ts`) — the three-component record structure of [MS-XLS] 2.1.4 in both directions, with the 8224-byte data ceiling enforced and every malformed or oversized stream thrown on rather than silently truncated or split into a `Continue` chain the writer does not implement.
14
14
  - **Continuation-aware cursor and strings** (`src/biff/cursor.ts`, `src/biff/strings.ts`, `src/biff/string-writer.ts`) — `Continue` records ([MS-XLS] 2.4.58) joined per the rules of the record being continued on read, including the case a naive reader gets wrong: an `XLUnicodeRichExtendedString` ([MS-XLS] 2.5.293) resuming after a boundary re-states its own `fHighByte` flag, which may differ from the flag the string started with. All three string shapes (`XLUnicodeString`, `ShortXLUnicodeString`, `XLUnicodeRichExtendedString`) are read and written, compressed (one byte per UTF-16 code unit) whenever every character allows it and uncompressed otherwise.
15
15
  - **Workbook globals**, read (`src/workbook/globals.ts`) and write (`src/workbook/globals-writer.ts`) — `BoundSheet8` (sheet names, tab order, hidden state, type, and substream offsets), `SST` with its `Continue` chain on read, `Format` (custom number-format codes), `Font`, `XF`'s fixed prefix plus its trailing `CellXF`/`StyleXF` fill/border payload in both directions (`src/biff/xf-colors.ts`'s shared bit-layout packing/unpacking; see [Cell decoration](#cell-decoration)), `Palette` in both directions, the fifteen mandatory built-in `Style` records, and `Date1904`.
16
- - **Worksheet substreams**, read (`src/workbook/sheet.ts`) and write (`src/workbook/sheet-writer.ts`) — `Dimensions`, `Row` (height and hidden state), `ColInfo` (width and hidden state), `MergeCells`, the print-settings record group (see [Print settings](#print-settings)), and the cell-value family: `Number`, `BoolErr`, `LabelSst`, and `Blank` on write (`MulBlank`, `RK`, `MulRk`, `Label`, and `Formula` with its `String` result record are read-only — see below).
16
+ - **Worksheet substreams**, read (`src/workbook/sheet.ts`) and write (`src/workbook/sheet-writer.ts`) — `Dimensions`, `Row` (height and hidden state), `ColInfo` (width and hidden state), `MergeCells`, the print-settings record group (see [Print settings](#print-settings)), and the cell-value family: `Number`, `BoolErr`, `LabelSst`, and `Blank` on write (`MulBlank`, `RK`, `MulRk`, `Label`, and `Formula` with its `String` result record are read-only — see below). Cell comments are read-only too (`src/workbook/comments.ts`): a `Note` record's anchor and author joined to its own `Obj`+`Txo` pair's text via object id — see "Cell comments, resolved for real" under Read-side gaps below.
17
17
  - **Number-format classification and date serials** ([`excel-number-format`](../excel-number-format/README.md), `src/serial.ts`) — what turns a bare number into the schema's own `percentage`/`currency`/`date`/`time`/`dateTime` value kinds and back, honouring the workbook's own epoch flag (the writer always emits the 1900 system) and refusing the 1900 system's phantom leap day in both directions. The classification itself is a dependency, not local code: this package shares it with `ooxml.js`'s xlsx support, since it is the identical mini-language in both formats (ExaDev/documents.js#848). A cell's own `numberFormatCode` is preserved verbatim on write when present; absent, it resolves to a representative built-in code for its value kind (`General` for a plain number/string/boolean/error, `0%` for a percentage, a bare `$` format for a currency with no code, `mm-dd-yy`/`h:mm:ss`/`m/d/yy h:mm` for date/time/dateTime), and the workbook-wide `Format`/`XF` table is deduplicated across every sheet so two cells sharing one code share one entry.
18
18
  - **Formula text recovery, including shared, array, and external-reference formulas** (`src/biff/ptg.ts`, `src/biff/ptg-functions.ts`, `src/workbook/sheet.ts`'s `collectFormulaGroups`, `src/workbook/globals.ts`'s `readSupBook`) — a Formula record's compiled `rgce` token stream ([MS-XLS] 2.5.198's `Ptg` vocabulary) read and rebuilt into the infix text a spreadsheet application would show: literal operands (`PtgInt`/`PtgNum`/`PtgStr`/`PtgBool`/`PtgErr`/`PtgMissArg`), cell and range references including their 3D (cross-sheet) forms (`PtgRef`/`PtgArea`/`PtgRef3d`/`PtgArea3d`, `$`-qualified per their own relative/absolute flags), every arithmetic/comparison/unary/percent operator and explicit parentheses, function calls through both `PtgFunc` (fixed arity, resolved from a curated table of [MS-XLS]'s own Ftab grammar) and `PtgFuncVar` (variable arity, its own on-disk `cparams`), a **shared formula** (`PtgExp` joined against the `ShrFmla` record that follows its group's base cell, its relative `PtgRefN`/`PtgAreaN` tokens re-expanded for each referencing cell's own position, alongside any ordinary, non-relative token the same shared expression carries), an **array formula** (`PtgExp` joined against an `Array` record instead, its expression returned with no further wrapping — Excel's own `{...}` CSE bracing is formula-bar display syntax, never written into the formula itself, matching `ooxml.js`'s own xlsx convention; a `PtgArray` array-constant literal's `{...}` is genuine syntax, not this bracing, and is resolved from its own `PtgExtraArray` trailer wherever one appears, array-entered or not), and a **3D reference's sheet name**, resolved through `EXTERNSHEET` and `SupBook` for both a self-referencing workbook and a genuinely external one (its own file name and sheet name(s) recovered as far as `SupBook`'s `virtPath`/`rgst` fields allow); a DDE/OLE/add-in/same-sheet/unused link, an unresolved sheet index, or an undecoded `virtPath` form has no real name to recover, and leaves the whole containing formula unresolved exactly like any other unsupported construct, rather than writing a fabricated placeholder into what would otherwise be real formula text (`src/workbook/globals.ts`'s own `sheetRanges`) — see "Formula expressions" under Read-side gaps below for the exact boundary of what still resolves to nothing at all.
19
19
  - **Schema mapping** — `readXlsContent`/`readXls` (`src/content.ts`) as before, now also populating `ContentSheetCell.formula` wherever the Ptg reader above resolves it; `writeXlsContent`/`writeXls` (`src/write.ts`) the counterpart, taking a `ContentDocument`/`DocumentTree` of `kind: 'spreadsheet'` and producing genuine `.xls` bytes: a real BIFF8 `Workbook` stream (globals substream, one worksheet substream per sheet, `BoundSheet8.lbPlyPos` patched to each sheet's real byte offset once every substream's length is known) wrapped in a real [MS-CFB] compound file via `archive-codec`'s `writeCompoundFile`.
@@ -34,7 +34,8 @@ What `writeXlsContent`/`writeXls` cover: every `ContentCellValue` kind a real `.
34
34
  | 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
35
  | `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
36
  | 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, comments (`Note`/`Txo`), data validation, conditional formatting, defined names (`Lbl`) | Not read either (see below); there is no round trip to verify a writer for them against. |
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
+ | 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. |
38
39
  | 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). |
39
40
  | `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. |
40
41
  | `Continue`-chain splitting | A record whose data would exceed the 8224-byte single-record ceiling ([MS-XLS] 2.1.4) — an extremely long shared string, an enormous shared string table, or thousands of merged ranges in one sheet — is refused with a thrown `BiffWriteError` rather than silently split across `Continue` records. |
@@ -48,7 +49,8 @@ Each deliberate rather than overlooked:
48
49
  - **Formula expressions, including shared, array, and external-reference formulas.** A `Formula` record's compiled `Ptg` token stream (`src/biff/ptg.ts`) is walked and rebuilt into real formula text — literal operands, cell/range references (`$`-qualified, including 3D cross-sheet references), every arithmetic/comparison/unary/percent operator, explicit parentheses, and both fixed- and variable-arity function calls, resolved by name against [MS-XLS]'s own built-in function table (`src/biff/ptg-functions.ts`, covering the whole published table — [MS-XLS] 2.5.198.17 — cited to that table's own `iftab` index; PtgFunc's fixed argument count is a curated subset of it, since PtgFunc's own token carries no count and only a function [MS-XLS]'s grammar states a fixed, non-optional arity for is resolved through it, empirically confirmed against real LibreOffice-written BIFF8 rather than assumed from the grammar alone). Three constructs the read side used to leave `ContentSheetCell.formula` silently absent for are now resolved: a **shared formula** — a `PtgExp` token is joined (`src/workbook/sheet.ts`'s `collectFormulaGroups`) against the `ShrFmla` record that follows its group's base `Formula` record, and the shared expression's own relative tokens (`PtgRefN`/`PtgAreaN`, [MS-XLS] 2.5.198.88/2.5.198.31) are re-expanded for each referencing cell's own row/column, including the format's own sheet-edge wraparound rule, while any ordinary (non-relative) token the same expression carries is resolved once and reused unchanged for every referencing cell; an **array (CSE) formula** — the same `PtgExp` join against an `Array` record instead, its expression returned exactly as parsed, with no formula-bar bracing added (Excel's own `{...}` CSE braces are display syntax the formula-bar shows for an array-entered cell, never characters written into the formula itself — matching `ooxml.js`'s own xlsx convention for the identical construct); and a `PtgArray` array-constant literal (`{1,2,3}`-style, whether inside an array formula or an entirely ordinary one like `=SUM({1,2,3})`) — this bracing genuinely is real, retypeable formula syntax, unlike CSE bracing, and its values are read from the token's own `PtgExtraArray` trailer rather than left unresolved. A 3D reference's sheet name resolves through `EXTERNSHEET` and `SupBook` for both a self-referencing workbook and a genuinely external one — `SupBook`'s `virtPath` (the external workbook's own path, decoded for the common relative-path forms: same-drive, startup, alternate-startup, and library-relative) and `rgst` (its sheet names) recover a real `[Workbook.xlsx]Sheet1`-style label wherever they can, and that label is trusted as real formula text only when both halves were genuinely recovered from the file. An absolute drive volume, a UNC share, or a transfer-protocol URL in `virtPath`; a `virtPath` whose final file-path segment carries a bracket character anywhere in it, not only one already shaped like the bracketed sheet-name form (`[Book.xlsx]Sheet1`) — a bracket-named file is legal per [MS-XLS]'s own grammar, and a bracket's position within that final segment does not settle whether it is genuinely that form: the grammar's own bracketed alternative opens with a literal `[` before any directory at all, so a workbook sitting in a subdirectory (`[sub` + a directory separator + `Book.xlsx]Sheet1`) puts its closing bracket, non-leading, in the very same final segment this reader isolates once split on the separator — a real instance of the bracketed form just as much as the leading-bracket case (`[Book.xlsx]Sheet1` with no directory at all) is; a bracket elsewhere in an otherwise plain, single-directory file name (`My[Draft].xlsx`) is the case this reader can actually rule the bracketed form out for, since with no directory separator to split on, that whole segment's own leading character settles it — but returning it as a plain file name would still collide with this reader's own `[${fileName}]` wrapping of the resolved label, producing a raw, unbalanced bracket inside what should read as one clean `[Book.xlsx]`-style pair — so the whole segment is declined regardless of where the bracket falls or whether this reader could rule the bracketed form out, trading a known false negative for never emitting a mangled label; a `SupBook` that is a DDE/OLE data source, an add-in, a same-sheet, or an unused link in the first place; or a sheet index [MS-XLS] itself marks unresolvable or workbook-level — none of these has a real name to recover, and each leaves the WHOLE containing formula unresolved, exactly like any other construct this reader cannot turn into real formula text, rather than writing a fabricated placeholder into what a spreadsheet application would otherwise treat as live formula content. What remains genuinely unresolved for the same reason, still leaving `formula` absent for that cell: a `PtgTbl` data table, a defined name (`PtgName`/`PtgNameX`, for the same reason `Lbl` is not read at all yet — see below), and a natural-language "Elf" reference.
49
50
  - **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.
50
51
  - **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.
51
- - **Not read at all:** charts, drawings and images, cell comments (`Note`/`Txo`), 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.
52
+ - **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.
52
54
  - **Encrypted workbooks** are refused rather than mis-read: a `FilePass` record means every record after it is ciphertext.
53
55
 
54
56
  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,12 @@ 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
+ /** 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
+ const RECORD_NOTE = 28;
47
+ /** A drawing object's common properties (id, type) and, for a comment, its FtNts sub-structure ([MS-XLS] 2.4.181). */
48
+ const RECORD_OBJ = 93;
49
+ /** The rich text of a text box or comment, its characters and formatting runs carried in trailing Continue records ([MS-XLS] 2.4.329). */
50
+ const RECORD_TXO = 438;
45
51
  /** Whether the row and column headers are printed ([MS-XLS] 2.4.203). */
46
52
  const RECORD_PRINTROWCOL = 42;
47
53
  /** Whether the gridlines are printed ([MS-XLS] 2.4.202). */
@@ -148,7 +154,9 @@ exports.RECORD_LEFTMARGIN = RECORD_LEFTMARGIN;
148
154
  exports.RECORD_MERGECELLS = RECORD_MERGECELLS;
149
155
  exports.RECORD_MULBLANK = RECORD_MULBLANK;
150
156
  exports.RECORD_MULRK = RECORD_MULRK;
157
+ exports.RECORD_NOTE = RECORD_NOTE;
151
158
  exports.RECORD_NUMBER = RECORD_NUMBER;
159
+ exports.RECORD_OBJ = RECORD_OBJ;
152
160
  exports.RECORD_PALETTE = RECORD_PALETTE;
153
161
  exports.RECORD_PRINTGRID = RECORD_PRINTGRID;
154
162
  exports.RECORD_PRINTROWCOL = RECORD_PRINTROWCOL;
@@ -163,6 +171,7 @@ exports.RECORD_STYLE = RECORD_STYLE;
163
171
  exports.RECORD_SUPBOOK = RECORD_SUPBOOK;
164
172
  exports.RECORD_TABLE = RECORD_TABLE;
165
173
  exports.RECORD_TOPMARGIN = RECORD_TOPMARGIN;
174
+ exports.RECORD_TXO = RECORD_TXO;
166
175
  exports.RECORD_VERTICALPAGEBREAKS = RECORD_VERTICALPAGEBREAKS;
167
176
  exports.RECORD_WSBOOL = RECORD_WSBOOL;
168
177
  exports.RECORD_XF = RECORD_XF;
@@ -41,6 +41,12 @@ 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
+ /** 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
+ declare const RECORD_NOTE = 28;
46
+ /** A drawing object's common properties (id, type) and, for a comment, its FtNts sub-structure ([MS-XLS] 2.4.181). */
47
+ declare const RECORD_OBJ = 93;
48
+ /** The rich text of a text box or comment, its characters and formatting runs carried in trailing Continue records ([MS-XLS] 2.4.329). */
49
+ declare const RECORD_TXO = 438;
44
50
  /** Whether the row and column headers are printed ([MS-XLS] 2.4.203). */
45
51
  declare const RECORD_PRINTROWCOL = 42;
46
52
  /** Whether the gridlines are printed ([MS-XLS] 2.4.202). */
@@ -110,4 +116,4 @@ declare const BIFF8_VERSION = 1536;
110
116
  /** [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. */
111
117
  declare const MAX_RECORD_DATA_SIZE = 8224;
112
118
  //#endregion
113
- 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_NUMBER, RECORD_PALETTE, RECORD_PRINTGRID, RECORD_PRINTROWCOL, RECORD_RIGHTMARGIN, RECORD_RK, RECORD_ROW, RECORD_SETUP, RECORD_SHRFMLA, RECORD_SST, RECORD_STRING, RECORD_STYLE, RECORD_SUPBOOK, RECORD_TABLE, RECORD_TOPMARGIN, RECORD_VERTICALPAGEBREAKS, RECORD_WSBOOL, RECORD_XF };
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 };
@@ -41,6 +41,12 @@ 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
+ /** 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
+ declare const RECORD_NOTE = 28;
46
+ /** A drawing object's common properties (id, type) and, for a comment, its FtNts sub-structure ([MS-XLS] 2.4.181). */
47
+ declare const RECORD_OBJ = 93;
48
+ /** The rich text of a text box or comment, its characters and formatting runs carried in trailing Continue records ([MS-XLS] 2.4.329). */
49
+ declare const RECORD_TXO = 438;
44
50
  /** Whether the row and column headers are printed ([MS-XLS] 2.4.203). */
45
51
  declare const RECORD_PRINTROWCOL = 42;
46
52
  /** Whether the gridlines are printed ([MS-XLS] 2.4.202). */
@@ -110,4 +116,4 @@ declare const BIFF8_VERSION = 1536;
110
116
  /** [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. */
111
117
  declare const MAX_RECORD_DATA_SIZE = 8224;
112
118
  //#endregion
113
- 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_NUMBER, RECORD_PALETTE, RECORD_PRINTGRID, RECORD_PRINTROWCOL, RECORD_RIGHTMARGIN, RECORD_RK, RECORD_ROW, RECORD_SETUP, RECORD_SHRFMLA, RECORD_SST, RECORD_STRING, RECORD_STYLE, RECORD_SUPBOOK, RECORD_TABLE, RECORD_TOPMARGIN, RECORD_VERTICALPAGEBREAKS, RECORD_WSBOOL, RECORD_XF };
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 };
@@ -41,6 +41,12 @@ 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
+ /** 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
+ const RECORD_NOTE = 28;
46
+ /** A drawing object's common properties (id, type) and, for a comment, its FtNts sub-structure ([MS-XLS] 2.4.181). */
47
+ const RECORD_OBJ = 93;
48
+ /** The rich text of a text box or comment, its characters and formatting runs carried in trailing Continue records ([MS-XLS] 2.4.329). */
49
+ const RECORD_TXO = 438;
44
50
  /** Whether the row and column headers are printed ([MS-XLS] 2.4.203). */
45
51
  const RECORD_PRINTROWCOL = 42;
46
52
  /** Whether the gridlines are printed ([MS-XLS] 2.4.202). */
@@ -110,4 +116,4 @@ const BIFF8_VERSION = 1536;
110
116
  /** [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. */
111
117
  const MAX_RECORD_DATA_SIZE = 8224;
112
118
  //#endregion
113
- 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_NUMBER, RECORD_PALETTE, RECORD_PRINTGRID, RECORD_PRINTROWCOL, RECORD_RIGHTMARGIN, RECORD_RK, RECORD_ROW, RECORD_SETUP, RECORD_SHRFMLA, RECORD_SST, RECORD_STRING, RECORD_STYLE, RECORD_SUPBOOK, RECORD_TABLE, RECORD_TOPMARGIN, RECORD_VERTICALPAGEBREAKS, RECORD_WSBOOL, RECORD_XF };
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 };
package/dist/content.cjs CHANGED
@@ -6,6 +6,7 @@ const require_units = require("./units.cjs");
6
6
  const require_biff_print_setup = require("./biff/print-setup.cjs");
7
7
  const require_biff_substreams = require("./biff/substreams.cjs");
8
8
  const require_biff_xf_colors = require("./biff/xf-colors.cjs");
9
+ const require_workbook_comments = require("./workbook/comments.cjs");
9
10
  const require_serial = require("./serial.cjs");
10
11
  const require_workbook_globals = require("./workbook/globals.cjs");
11
12
  const require_workbook_sheet = require("./workbook/sheet.cjs");
@@ -122,9 +123,12 @@ function readSheet(entry, sheetIndex, substreams, globals) {
122
123
  sheets: globals.sheets,
123
124
  sheetRanges: globals.sheetRanges
124
125
  });
126
+ const comments = substream === void 0 ? /* @__PURE__ */ new Map() : require_workbook_comments.readSheetComments(substream.records);
127
+ const cells = mapCells(raw, globals);
128
+ applyCellComments(comments, cells);
125
129
  return {
126
130
  name: entry.name,
127
- cells: mapCells(raw, globals),
131
+ cells,
128
132
  columns: mapColumns(raw),
129
133
  rows: mapRows(raw),
130
134
  images: [],
@@ -163,6 +167,27 @@ function mapCells(raw, globals) {
163
167
  applyMerges(cells, raw);
164
168
  return cells;
165
169
  }
170
+ function applyCellComments(comments, cells) {
171
+ if (comments.size === 0) return;
172
+ const byPosition = /* @__PURE__ */ new Map();
173
+ for (const cell of cells) byPosition.set(`${cell.row}:${cell.column}`, cell);
174
+ for (const [key, { row, column, comment }] of comments) {
175
+ const existing = byPosition.get(key);
176
+ if (existing !== void 0) {
177
+ existing.comment = comment;
178
+ continue;
179
+ }
180
+ const materialised = {
181
+ row,
182
+ column,
183
+ value: { kind: "empty" },
184
+ displayText: "",
185
+ comment
186
+ };
187
+ cells.push(materialised);
188
+ byPosition.set(key, materialised);
189
+ }
190
+ }
166
191
  /**
167
192
  * Maps one raw cell, or drops it.
168
193
  *
package/dist/content.js CHANGED
@@ -5,6 +5,7 @@ import { inchesToPoints } from "./units.js";
5
5
  import { pageSizeFromSetup } from "./biff/print-setup.js";
6
6
  import { groupRecords, splitSubstreams } from "./biff/substreams.js";
7
7
  import { resolveBorderEdge, resolveFillBackground } from "./biff/xf-colors.js";
8
+ import { readSheetComments } from "./workbook/comments.js";
8
9
  import { serialToIsoDate, serialToIsoDateTime, serialToIsoTime } from "./serial.js";
9
10
  import { formatCodeOf, readWorkbookGlobals } from "./workbook/globals.js";
10
11
  import { readSheetRecords } from "./workbook/sheet.js";
@@ -121,9 +122,12 @@ function readSheet(entry, sheetIndex, substreams, globals) {
121
122
  sheets: globals.sheets,
122
123
  sheetRanges: globals.sheetRanges
123
124
  });
125
+ const comments = substream === void 0 ? /* @__PURE__ */ new Map() : readSheetComments(substream.records);
126
+ const cells = mapCells(raw, globals);
127
+ applyCellComments(comments, cells);
124
128
  return {
125
129
  name: entry.name,
126
- cells: mapCells(raw, globals),
130
+ cells,
127
131
  columns: mapColumns(raw),
128
132
  rows: mapRows(raw),
129
133
  images: [],
@@ -162,6 +166,27 @@ function mapCells(raw, globals) {
162
166
  applyMerges(cells, raw);
163
167
  return cells;
164
168
  }
169
+ function applyCellComments(comments, cells) {
170
+ if (comments.size === 0) return;
171
+ const byPosition = /* @__PURE__ */ new Map();
172
+ for (const cell of cells) byPosition.set(`${cell.row}:${cell.column}`, cell);
173
+ for (const [key, { row, column, comment }] of comments) {
174
+ const existing = byPosition.get(key);
175
+ if (existing !== void 0) {
176
+ existing.comment = comment;
177
+ continue;
178
+ }
179
+ const materialised = {
180
+ row,
181
+ column,
182
+ value: { kind: "empty" },
183
+ displayText: "",
184
+ comment
185
+ };
186
+ cells.push(materialised);
187
+ byPosition.set(key, materialised);
188
+ }
189
+ }
165
190
  /**
166
191
  * Maps one raw cell, or drops it.
167
192
  *
package/dist/index.cjs CHANGED
@@ -4,10 +4,10 @@ const require_biff_records = require("./biff/records.cjs");
4
4
  const require_container = require("./container.cjs");
5
5
  const require_units = require("./units.cjs");
6
6
  const require_biff_substreams = require("./biff/substreams.cjs");
7
- const require_biff_write_errors = require("./biff/write-errors.cjs");
8
- const require_serial = require("./serial.cjs");
9
7
  const require_biff_cursor = require("./biff/cursor.cjs");
10
8
  const require_biff_strings = require("./biff/strings.cjs");
9
+ const require_biff_write_errors = require("./biff/write-errors.cjs");
10
+ const require_serial = require("./serial.cjs");
11
11
  const require_biff_builder = require("./biff/builder.cjs");
12
12
  const require_biff_record_writer = require("./biff/record-writer.cjs");
13
13
  const require_workbook_globals = require("./workbook/globals.cjs");
@@ -63,7 +63,9 @@ exports.RECORD_LEFTMARGIN = require_biff_record_types.RECORD_LEFTMARGIN;
63
63
  exports.RECORD_MERGECELLS = require_biff_record_types.RECORD_MERGECELLS;
64
64
  exports.RECORD_MULBLANK = require_biff_record_types.RECORD_MULBLANK;
65
65
  exports.RECORD_MULRK = require_biff_record_types.RECORD_MULRK;
66
+ exports.RECORD_NOTE = require_biff_record_types.RECORD_NOTE;
66
67
  exports.RECORD_NUMBER = require_biff_record_types.RECORD_NUMBER;
68
+ exports.RECORD_OBJ = require_biff_record_types.RECORD_OBJ;
67
69
  exports.RECORD_PALETTE = require_biff_record_types.RECORD_PALETTE;
68
70
  exports.RECORD_PRINTGRID = require_biff_record_types.RECORD_PRINTGRID;
69
71
  exports.RECORD_PRINTROWCOL = require_biff_record_types.RECORD_PRINTROWCOL;
@@ -78,6 +80,7 @@ exports.RECORD_STYLE = require_biff_record_types.RECORD_STYLE;
78
80
  exports.RECORD_SUPBOOK = require_biff_record_types.RECORD_SUPBOOK;
79
81
  exports.RECORD_TABLE = require_biff_record_types.RECORD_TABLE;
80
82
  exports.RECORD_TOPMARGIN = require_biff_record_types.RECORD_TOPMARGIN;
83
+ exports.RECORD_TXO = require_biff_record_types.RECORD_TXO;
81
84
  exports.RECORD_VERTICALPAGEBREAKS = require_biff_record_types.RECORD_VERTICALPAGEBREAKS;
82
85
  exports.RECORD_WSBOOL = require_biff_record_types.RECORD_WSBOOL;
83
86
  exports.RECORD_XF = require_biff_record_types.RECORD_XF;
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_NUMBER, RECORD_PALETTE, RECORD_PRINTGRID, RECORD_PRINTROWCOL, RECORD_RIGHTMARGIN, RECORD_RK, RECORD_ROW, RECORD_SETUP, RECORD_SHRFMLA, RECORD_SST, RECORD_STRING, RECORD_STYLE, RECORD_SUPBOOK, RECORD_TABLE, RECORD_TOPMARGIN, RECORD_VERTICALPAGEBREAKS, RECORD_WSBOOL, RECORD_XF } 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_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";
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_NUMBER, RECORD_PALETTE, RECORD_PRINTGRID, RECORD_PRINTROWCOL, RECORD_RIGHTMARGIN, RECORD_RK, RECORD_ROW, RECORD_SETUP, RECORD_SHRFMLA, RECORD_SST, RECORD_STRING, RECORD_STYLE, RECORD_SUPBOOK, RECORD_TABLE, RECORD_TOPMARGIN, RECORD_VERTICALPAGEBREAKS, RECORD_WSBOOL, RECORD_XF, RawCell, RawCellValue, RawColumn, RawPrintSettings, RawRange, RawRow, RawSheet, RecordBuilder, RecordGroup, SUMMARY_INFORMATION_STREAM, SheetEntry, SheetWriteContext, Substream, WorkbookGlobals, WorkbookGlobalsBuild, WorkbookGlobalsPlan, WorkbookStreams, XlsContentDocument, buildWorkbookGlobals, buildWorksheetSubstream, columnWidthToPoints, concatRecords, decodeRkNumber, errorCodeOf, errorTextOf, formatCodeOf, groupRecords, inchesToPoints, isXlsFile, isoDateTimeToSerial, isoDateToSerial, isoTimeToSerial, layoutMetadataToSummaryInformation, millimetresToPoints, pointsToColumnWidth, pointsToInches, pointsToTwips, readRecords, readRichExtendedString, readSheetRecords, readShortXLUnicodeString, readWorkbookGlobals, readWorkbookStreams, readXLUnicodeString, readXLUnicodeStringNoCch, readXls, readXlsContent, recordByteLength, serialToIsoDate, serialToIsoDateTime, serialToIsoTime, splitSubstreams, twipsToPoints, writeBofData, writeCellXfRecord, writeFontRecord, writeFormatRecord, writePaletteRecord, writeRecord, writeRichExtendedString, writeShortXLUnicodeString, writeStyleRecord, writeStyleXfRecord, writeXLUnicodeString, writeXls, writeXlsContent };
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 };
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_NUMBER, RECORD_PALETTE, RECORD_PRINTGRID, RECORD_PRINTROWCOL, RECORD_RIGHTMARGIN, RECORD_RK, RECORD_ROW, RECORD_SETUP, RECORD_SHRFMLA, RECORD_SST, RECORD_STRING, RECORD_STYLE, RECORD_SUPBOOK, RECORD_TABLE, RECORD_TOPMARGIN, RECORD_VERTICALPAGEBREAKS, RECORD_WSBOOL, RECORD_XF } 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_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";
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_NUMBER, RECORD_PALETTE, RECORD_PRINTGRID, RECORD_PRINTROWCOL, RECORD_RIGHTMARGIN, RECORD_RK, RECORD_ROW, RECORD_SETUP, RECORD_SHRFMLA, RECORD_SST, RECORD_STRING, RECORD_STYLE, RECORD_SUPBOOK, RECORD_TABLE, RECORD_TOPMARGIN, RECORD_VERTICALPAGEBREAKS, RECORD_WSBOOL, RECORD_XF, RawCell, RawCellValue, RawColumn, RawPrintSettings, RawRange, RawRow, RawSheet, RecordBuilder, RecordGroup, SUMMARY_INFORMATION_STREAM, SheetEntry, SheetWriteContext, Substream, WorkbookGlobals, WorkbookGlobalsBuild, WorkbookGlobalsPlan, WorkbookStreams, XlsContentDocument, buildWorkbookGlobals, buildWorksheetSubstream, columnWidthToPoints, concatRecords, decodeRkNumber, errorCodeOf, errorTextOf, formatCodeOf, groupRecords, inchesToPoints, isXlsFile, isoDateTimeToSerial, isoDateToSerial, isoTimeToSerial, layoutMetadataToSummaryInformation, millimetresToPoints, pointsToColumnWidth, pointsToInches, pointsToTwips, readRecords, readRichExtendedString, readSheetRecords, readShortXLUnicodeString, readWorkbookGlobals, readWorkbookStreams, readXLUnicodeString, readXLUnicodeStringNoCch, readXls, readXlsContent, recordByteLength, serialToIsoDate, serialToIsoDateTime, serialToIsoTime, splitSubstreams, twipsToPoints, writeBofData, writeCellXfRecord, writeFontRecord, writeFormatRecord, writePaletteRecord, writeRecord, writeRichExtendedString, writeShortXLUnicodeString, writeStyleRecord, writeStyleXfRecord, writeXLUnicodeString, writeXls, writeXlsContent };
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 };
package/dist/index.js CHANGED
@@ -1,12 +1,12 @@
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_NUMBER, RECORD_PALETTE, RECORD_PRINTGRID, RECORD_PRINTROWCOL, RECORD_RIGHTMARGIN, RECORD_RK, RECORD_ROW, RECORD_SETUP, RECORD_SHRFMLA, RECORD_SST, RECORD_STRING, RECORD_STYLE, RECORD_SUPBOOK, RECORD_TABLE, RECORD_TOPMARGIN, RECORD_VERTICALPAGEBREAKS, RECORD_WSBOOL, RECORD_XF } 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_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";
2
2
  import { BiffFormatError, readRecords } from "./biff/records.js";
3
3
  import { SUMMARY_INFORMATION_STREAM, isXlsFile, readWorkbookStreams } from "./container.js";
4
4
  import { columnWidthToPoints, inchesToPoints, millimetresToPoints, pointsToColumnWidth, pointsToInches, pointsToTwips, twipsToPoints } from "./units.js";
5
5
  import { groupRecords, recordByteLength, splitSubstreams } from "./biff/substreams.js";
6
- import { BiffWriteError } from "./biff/write-errors.js";
7
- import { isoDateTimeToSerial, isoDateToSerial, isoTimeToSerial, serialToIsoDate, serialToIsoDateTime, serialToIsoTime } from "./serial.js";
8
6
  import { BlockCursor } from "./biff/cursor.js";
9
7
  import { readRichExtendedString, readShortXLUnicodeString, readXLUnicodeString, readXLUnicodeStringNoCch } from "./biff/strings.js";
8
+ import { BiffWriteError } from "./biff/write-errors.js";
9
+ import { isoDateTimeToSerial, isoDateToSerial, isoTimeToSerial, serialToIsoDate, serialToIsoDateTime, serialToIsoTime } from "./serial.js";
10
10
  import { RecordBuilder } from "./biff/builder.js";
11
11
  import { concatRecords, writeRecord } from "./biff/record-writer.js";
12
12
  import { formatCodeOf, readWorkbookGlobals } from "./workbook/globals.js";
@@ -22,4 +22,4 @@ import { GENERAL_CELL_XF_INDEX, buildWorkbookGlobals } from "./workbook/globals-
22
22
  import { buildWorksheetSubstream } from "./workbook/sheet-writer.js";
23
23
  import { writeXls, writeXlsContent } from "./write.js";
24
24
  export * from "excel-number-format";
25
- export { BIFF8_VERSION, BOF_TYPE_CHART, BOF_TYPE_MACRO, BOF_TYPE_WORKBOOK, BOF_TYPE_WORKSHEET, BiffFormatError, BiffWriteError, BlockCursor, GENERAL_CELL_XF_INDEX, MAX_RECORD_DATA_SIZE, RECORD_ARRAY, RECORD_BLANK, RECORD_BOF, RECORD_BOOLERR, RECORD_BOTTOMMARGIN, RECORD_BOUNDSHEET8, RECORD_CALCCOUNT, RECORD_CALCDELTA, RECORD_CALCITER, RECORD_CALCREFMODE, RECORD_CALCSAVERECALC, RECORD_COLINFO, RECORD_CONTINUE, RECORD_DATE1904, RECORD_DEFAULTROWHEIGHT, RECORD_DEFCOLWIDTH, RECORD_DIMENSIONS, RECORD_EOF, RECORD_EXTERNSHEET, RECORD_FILEPASS, RECORD_FONT, RECORD_FORMAT, RECORD_FORMULA, RECORD_HORIZONTALPAGEBREAKS, RECORD_LABEL, RECORD_LABELSST, RECORD_LBL, RECORD_LEFTMARGIN, RECORD_MERGECELLS, RECORD_MULBLANK, RECORD_MULRK, RECORD_NUMBER, RECORD_PALETTE, RECORD_PRINTGRID, RECORD_PRINTROWCOL, RECORD_RIGHTMARGIN, RECORD_RK, RECORD_ROW, RECORD_SETUP, RECORD_SHRFMLA, RECORD_SST, RECORD_STRING, RECORD_STYLE, RECORD_SUPBOOK, RECORD_TABLE, RECORD_TOPMARGIN, RECORD_VERTICALPAGEBREAKS, RECORD_WSBOOL, RECORD_XF, RecordBuilder, SUMMARY_INFORMATION_STREAM, buildWorkbookGlobals, buildWorksheetSubstream, columnWidthToPoints, concatRecords, decodeRkNumber, errorCodeOf, errorTextOf, formatCodeOf, groupRecords, inchesToPoints, isXlsFile, isoDateTimeToSerial, isoDateToSerial, isoTimeToSerial, layoutMetadataToSummaryInformation, millimetresToPoints, pointsToColumnWidth, pointsToInches, pointsToTwips, readRecords, readRichExtendedString, readSheetRecords, readShortXLUnicodeString, readWorkbookGlobals, readWorkbookStreams, readXLUnicodeString, 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_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 };
@@ -0,0 +1,85 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ require("../biff/record-types.cjs");
3
+ const require_biff_cursor = require("../biff/cursor.cjs");
4
+ const require_biff_strings = require("../biff/strings.cjs");
5
+ //#region src/workbook/comments.ts
6
+ /** [MS-XLS] 2.5.213 ObjId: which drawing-object type this package needs to recognise -- Note, so its own text can be told apart from any other shape's (a text box, a button) sharing the same TxO mechanism. */
7
+ const OBJECT_TYPE_NOTE = 25;
8
+ /** [MS-XLS] 2.5.163 NoteSh, this package's own field-by-field reading of a Note record's payload: row, col, a flags word this reader has no use for (fShow/fRwHidden/fColHidden govern on-screen display, not content), idObj (the Obj record naming this comment's text), and stAuthor -- the comment's author, carried on the anchor itself rather than on the text object. */
9
+ function readNoteAnchor(group) {
10
+ const cursor = new require_biff_cursor.BlockCursor(group.blocks);
11
+ const row = cursor.u16();
12
+ const column = cursor.u16();
13
+ cursor.skip(2);
14
+ const idObj = cursor.u16();
15
+ const author = require_biff_strings.readXLUnicodeString(cursor);
16
+ return author.length > 0 ? {
17
+ row,
18
+ column,
19
+ idObj,
20
+ author
21
+ } : {
22
+ row,
23
+ column,
24
+ idObj
25
+ };
26
+ }
27
+ /** [MS-XLS] 2.5.92 FtCmo, read only far enough to answer "is this a Note object, and if so, what id does its own TxO get associated through": ft/cb are fixed reserved values this reader does not validate, ot is the object type, id is what a Note record's idObj cross-references. */
28
+ function readObjTypeAndId(group) {
29
+ const cursor = new require_biff_cursor.BlockCursor(group.blocks);
30
+ cursor.skip(4);
31
+ return {
32
+ ot: cursor.u16(),
33
+ id: cursor.u16()
34
+ };
35
+ }
36
+ /** [MS-XLS] 2.4.329 TxO: the fixed fields up to and including ObjFmla are read in full (even the ones this reader discards) purely to advance the cursor correctly onto the Continue-carried text that follows -- reserved4+reserved5 and controlInfo are mutually exclusive per cmo.ot but identical in total size (6 bytes), so which one applies never needs deciding here. Only the plain text is kept: rich per-character formatting runs (cbRuns bytes, TxORuns) are skipped rather than modelled, the same scope limit readRichExtendedString already applies to the SST's own rich strings, for the same reason -- ContentSheetCellComment.text is a plain string with nowhere to carry them. */
37
+ function readTxoText(group) {
38
+ const cursor = new require_biff_cursor.BlockCursor(group.blocks);
39
+ cursor.skip(4);
40
+ cursor.skip(6);
41
+ const cchText = cursor.u16();
42
+ const cbRuns = cursor.u16();
43
+ cursor.skip(2);
44
+ const cbFmla = cursor.u16();
45
+ cursor.skip(cbFmla);
46
+ if (cchText === 0) return "";
47
+ const text = require_biff_strings.readXLUnicodeStringNoCch(cursor, cchText);
48
+ cursor.skip(cbRuns);
49
+ return text;
50
+ }
51
+ /** Every cell comment a worksheet substream's records carry, keyed `${row}:${column}` to match ooxml.js's own readSheetCellComments convention. A Note record whose idObj resolves to no Obj+TxO pair (a malformed or unusually ordered file) is skipped rather than materialised with fabricated or missing text -- this reader is tolerant of unusual record ordering elsewhere in the substream (see workbook/sheet.ts's own top comment) but a comment with no recoverable text is not real content worth keeping. */
52
+ function readSheetComments(records) {
53
+ const textByObjId = /* @__PURE__ */ new Map();
54
+ const noteAnchors = [];
55
+ let pendingNoteObjId;
56
+ for (const group of records) switch (group.type) {
57
+ case 93: {
58
+ const { ot, id } = readObjTypeAndId(group);
59
+ pendingNoteObjId = ot === OBJECT_TYPE_NOTE ? id : void 0;
60
+ break;
61
+ }
62
+ case 438:
63
+ if (pendingNoteObjId !== void 0) {
64
+ textByObjId.set(pendingNoteObjId, readTxoText(group));
65
+ pendingNoteObjId = void 0;
66
+ }
67
+ break;
68
+ case 28: noteAnchors.push(readNoteAnchor(group));
69
+ }
70
+ const comments = /* @__PURE__ */ new Map();
71
+ for (const anchor of noteAnchors) {
72
+ const text = textByObjId.get(anchor.idObj);
73
+ if (text === void 0) continue;
74
+ const comment = { text };
75
+ if (anchor.author !== void 0) comment.author = anchor.author;
76
+ comments.set(`${anchor.row}:${anchor.column}`, {
77
+ row: anchor.row,
78
+ column: anchor.column,
79
+ comment
80
+ });
81
+ }
82
+ return comments;
83
+ }
84
+ //#endregion
85
+ exports.readSheetComments = readSheetComments;
@@ -0,0 +1,13 @@
1
+ import { t as RecordGroup } from "../substreams-Cpy5Fi3d.cjs";
2
+ import { ContentSheetCellComment } from "document-schema.js";
3
+ //#region src/workbook/comments.d.ts
4
+ /** One comment, resolved to the cell position it is anchored to. */
5
+ interface SheetCellComment {
6
+ readonly row: number;
7
+ readonly column: number;
8
+ readonly comment: ContentSheetCellComment;
9
+ }
10
+ /** Every cell comment a worksheet substream's records carry, keyed `${row}:${column}` to match ooxml.js's own readSheetCellComments convention. A Note record whose idObj resolves to no Obj+TxO pair (a malformed or unusually ordered file) is skipped rather than materialised with fabricated or missing text -- this reader is tolerant of unusual record ordering elsewhere in the substream (see workbook/sheet.ts's own top comment) but a comment with no recoverable text is not real content worth keeping. */
11
+ declare function readSheetComments(records: readonly RecordGroup[]): ReadonlyMap<string, SheetCellComment>;
12
+ //#endregion
13
+ export { SheetCellComment, readSheetComments };
@@ -0,0 +1,13 @@
1
+ import { t as RecordGroup } from "../substreams-CmyZMtuM.js";
2
+ import { ContentSheetCellComment } from "document-schema.js";
3
+ //#region src/workbook/comments.d.ts
4
+ /** One comment, resolved to the cell position it is anchored to. */
5
+ interface SheetCellComment {
6
+ readonly row: number;
7
+ readonly column: number;
8
+ readonly comment: ContentSheetCellComment;
9
+ }
10
+ /** Every cell comment a worksheet substream's records carry, keyed `${row}:${column}` to match ooxml.js's own readSheetCellComments convention. A Note record whose idObj resolves to no Obj+TxO pair (a malformed or unusually ordered file) is skipped rather than materialised with fabricated or missing text -- this reader is tolerant of unusual record ordering elsewhere in the substream (see workbook/sheet.ts's own top comment) but a comment with no recoverable text is not real content worth keeping. */
11
+ declare function readSheetComments(records: readonly RecordGroup[]): ReadonlyMap<string, SheetCellComment>;
12
+ //#endregion
13
+ export { SheetCellComment, readSheetComments };
@@ -0,0 +1,84 @@
1
+ import "../biff/record-types.js";
2
+ import { BlockCursor } from "../biff/cursor.js";
3
+ import { readXLUnicodeString, readXLUnicodeStringNoCch } from "../biff/strings.js";
4
+ //#region src/workbook/comments.ts
5
+ /** [MS-XLS] 2.5.213 ObjId: which drawing-object type this package needs to recognise -- Note, so its own text can be told apart from any other shape's (a text box, a button) sharing the same TxO mechanism. */
6
+ const OBJECT_TYPE_NOTE = 25;
7
+ /** [MS-XLS] 2.5.163 NoteSh, this package's own field-by-field reading of a Note record's payload: row, col, a flags word this reader has no use for (fShow/fRwHidden/fColHidden govern on-screen display, not content), idObj (the Obj record naming this comment's text), and stAuthor -- the comment's author, carried on the anchor itself rather than on the text object. */
8
+ function readNoteAnchor(group) {
9
+ const cursor = new BlockCursor(group.blocks);
10
+ const row = cursor.u16();
11
+ const column = cursor.u16();
12
+ cursor.skip(2);
13
+ const idObj = cursor.u16();
14
+ const author = readXLUnicodeString(cursor);
15
+ return author.length > 0 ? {
16
+ row,
17
+ column,
18
+ idObj,
19
+ author
20
+ } : {
21
+ row,
22
+ column,
23
+ idObj
24
+ };
25
+ }
26
+ /** [MS-XLS] 2.5.92 FtCmo, read only far enough to answer "is this a Note object, and if so, what id does its own TxO get associated through": ft/cb are fixed reserved values this reader does not validate, ot is the object type, id is what a Note record's idObj cross-references. */
27
+ function readObjTypeAndId(group) {
28
+ const cursor = new BlockCursor(group.blocks);
29
+ cursor.skip(4);
30
+ return {
31
+ ot: cursor.u16(),
32
+ id: cursor.u16()
33
+ };
34
+ }
35
+ /** [MS-XLS] 2.4.329 TxO: the fixed fields up to and including ObjFmla are read in full (even the ones this reader discards) purely to advance the cursor correctly onto the Continue-carried text that follows -- reserved4+reserved5 and controlInfo are mutually exclusive per cmo.ot but identical in total size (6 bytes), so which one applies never needs deciding here. Only the plain text is kept: rich per-character formatting runs (cbRuns bytes, TxORuns) are skipped rather than modelled, the same scope limit readRichExtendedString already applies to the SST's own rich strings, for the same reason -- ContentSheetCellComment.text is a plain string with nowhere to carry them. */
36
+ function readTxoText(group) {
37
+ const cursor = new BlockCursor(group.blocks);
38
+ cursor.skip(4);
39
+ cursor.skip(6);
40
+ const cchText = cursor.u16();
41
+ const cbRuns = cursor.u16();
42
+ cursor.skip(2);
43
+ const cbFmla = cursor.u16();
44
+ cursor.skip(cbFmla);
45
+ if (cchText === 0) return "";
46
+ const text = readXLUnicodeStringNoCch(cursor, cchText);
47
+ cursor.skip(cbRuns);
48
+ return text;
49
+ }
50
+ /** Every cell comment a worksheet substream's records carry, keyed `${row}:${column}` to match ooxml.js's own readSheetCellComments convention. A Note record whose idObj resolves to no Obj+TxO pair (a malformed or unusually ordered file) is skipped rather than materialised with fabricated or missing text -- this reader is tolerant of unusual record ordering elsewhere in the substream (see workbook/sheet.ts's own top comment) but a comment with no recoverable text is not real content worth keeping. */
51
+ function readSheetComments(records) {
52
+ const textByObjId = /* @__PURE__ */ new Map();
53
+ const noteAnchors = [];
54
+ let pendingNoteObjId;
55
+ for (const group of records) switch (group.type) {
56
+ case 93: {
57
+ const { ot, id } = readObjTypeAndId(group);
58
+ pendingNoteObjId = ot === OBJECT_TYPE_NOTE ? id : void 0;
59
+ break;
60
+ }
61
+ case 438:
62
+ if (pendingNoteObjId !== void 0) {
63
+ textByObjId.set(pendingNoteObjId, readTxoText(group));
64
+ pendingNoteObjId = void 0;
65
+ }
66
+ break;
67
+ case 28: noteAnchors.push(readNoteAnchor(group));
68
+ }
69
+ const comments = /* @__PURE__ */ new Map();
70
+ for (const anchor of noteAnchors) {
71
+ const text = textByObjId.get(anchor.idObj);
72
+ if (text === void 0) continue;
73
+ const comment = { text };
74
+ if (anchor.author !== void 0) comment.author = anchor.author;
75
+ comments.set(`${anchor.row}:${anchor.column}`, {
76
+ row: anchor.row,
77
+ column: anchor.column,
78
+ comment
79
+ });
80
+ }
81
+ return comments;
82
+ }
83
+ //#endregion
84
+ export { readSheetComments };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xls-codec",
3
- "version": "4.1.6",
3
+ "version": "4.2.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": {