xls-codec 4.5.0 → 4.7.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 +4 -3
- package/dist/biff/record-types.cjs +15 -0
- package/dist/biff/record-types.d.cts +11 -1
- package/dist/biff/record-types.d.ts +11 -1
- package/dist/biff/record-types.js +11 -1
- package/dist/biff/records.cjs +4 -3
- package/dist/biff/records.d.cts +2 -2
- package/dist/biff/records.d.ts +2 -2
- package/dist/biff/records.js +4 -4
- package/dist/biff/substreams.d.cts +1 -1
- package/dist/biff/substreams.d.ts +1 -1
- package/dist/{conditional-format-12-Dw82ECRh.d.ts → conditional-format-12-D-X5g_O3.d.ts} +31 -4
- package/dist/{conditional-format-12-DdEL5DL0.d.cts → conditional-format-12-DBhe7Zo6.d.cts} +31 -4
- package/dist/{conditional-format-DUQuOrNW.d.cts → conditional-format-Czh2oTzQ.d.cts} +3 -2
- package/dist/{conditional-format-BV2313jL.d.ts → conditional-format-DOdazxWe.d.ts} +3 -2
- package/dist/content.cjs +57 -11
- package/dist/content.d.cts +3 -3
- package/dist/content.d.ts +3 -3
- package/dist/content.js +57 -11
- package/dist/{data-validation-DsVG0Mms.d.ts → data-validation-BXvIVU0e.d.ts} +1 -1
- package/dist/{data-validation-DZPzAW-8.d.cts → data-validation-DfpjUN-N.d.cts} +1 -1
- package/dist/index.cjs +6 -0
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +3 -3
- package/dist/{print-names-DyYloloV.d.cts → print-names-CCwUHAoL.d.cts} +1 -1
- package/dist/{print-names-C-PQ2vAy.d.ts → print-names-CxAbgcjB.d.ts} +1 -1
- package/dist/{records-DVIqXFKk.d.cts → records-G82UEVq8.d.cts} +3 -1
- package/dist/{records-DVIqXFKk.d.ts → records-G82UEVq8.d.ts} +3 -1
- package/dist/{substreams-Cpy5Fi3d.d.cts → substreams-CHv3oWmn.d.cts} +1 -1
- package/dist/{substreams-CmyZMtuM.d.ts → substreams-Dp5cZoUo.d.ts} +1 -1
- package/dist/workbook/comments.d.cts +1 -1
- package/dist/workbook/comments.d.ts +1 -1
- package/dist/workbook/conditional-format-12.cjs +79 -3
- package/dist/workbook/conditional-format-12.d.cts +2 -2
- package/dist/workbook/conditional-format-12.d.ts +2 -2
- package/dist/workbook/conditional-format-12.js +79 -3
- package/dist/workbook/conditional-format.cjs +1 -0
- package/dist/workbook/conditional-format.d.cts +2 -2
- package/dist/workbook/conditional-format.d.ts +2 -2
- package/dist/workbook/conditional-format.js +1 -1
- package/dist/workbook/data-validation.d.cts +1 -1
- package/dist/workbook/data-validation.d.ts +1 -1
- package/dist/workbook/encryption.cjs +78 -0
- package/dist/workbook/encryption.d.cts +10 -0
- package/dist/workbook/encryption.d.ts +10 -0
- package/dist/workbook/encryption.js +77 -0
- package/dist/workbook/globals-writer.d.cts +1 -1
- package/dist/workbook/globals-writer.d.ts +1 -1
- package/dist/workbook/globals.d.cts +2 -2
- package/dist/workbook/globals.d.ts +2 -2
- package/dist/workbook/print-names.d.cts +1 -1
- package/dist/workbook/print-names.d.ts +1 -1
- package/dist/workbook/sheet.d.cts +4 -4
- package/dist/workbook/sheet.d.ts +4 -4
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -55,9 +55,10 @@ Each deliberate rather than overlooked:
|
|
|
55
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.
|
|
56
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
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 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.
|
|
58
|
-
- **Conditional formatting, CF12's colour scale/data bar/icon set rules resolved for real (ExaDev/documents.js#1104).** `CF12`'s own `ct` field picks one of six rule shapes ([MS-XLS] 2.4.43); this reader promotes the three that share a genuine array-of-thresholds building block already modelled in `document-schema.js` -- colour scale, data bar, and icon set (`src/workbook/conditional-format-12.ts`) -- each reading an array of `CFVO` threshold objects (the identical `num`/`percent`/`max`/`min`/`formula`/`percentile` vocabulary `ContentSheetConditionalFormatValueSchema` already carries for `ooxml.js`'s xlsx reader and `odf.js`'s ods reader) paired with `CFColor` values. A `CFColor` naming an indexed colour resolves through the same `icv`/`Palette` machinery as base `CF`'s own `DXFN
|
|
59
|
-
- **
|
|
60
|
-
- **
|
|
58
|
+
- **Conditional formatting, CF12's colour scale/data bar/icon set rules resolved for real (ExaDev/documents.js#1104).** `CF12`'s own `ct` field picks one of six rule shapes ([MS-XLS] 2.4.43); this reader promotes the three that share a genuine array-of-thresholds building block already modelled in `document-schema.js` -- colour scale, data bar, and icon set (`src/workbook/conditional-format-12.ts`) -- each reading an array of `CFVO` threshold objects (the identical `num`/`percent`/`max`/`min`/`formula`/`percentile` vocabulary `ContentSheetConditionalFormatValueSchema` already carries for `ooxml.js`'s xlsx reader and `odf.js`'s ods reader) paired with `CFColor` values. A `CFColor` naming an indexed colour resolves through the same `icv`/`Palette` machinery as base `CF`'s own `DXFN`, then Excel's own TintAndShade model applies the colour's own tint/shade Xnum (`xf-colors.ts`'s `applyTint`); one naming a plain RGB triple resolves directly, tint included; one naming an automatic or theme colour degrades the whole rule to absent, since this package has no BIFF8 `Theme` reader to resolve a theme reference against. Icon set's own `iIconSet` byte maps to the identical ECMA-376 `ST_IconSetType` vocabulary (`3Arrows`, `3TrafficLights1`, `5Quarters`, and the rest of the seventeen built-in sets) `ooxml.js`'s xlsx `cfRule` reading already carries as a plain string. A record longer than the 8224-byte single-record ceiling continues onto `ContinueFrt12` rather than the plain `Continue` every other record in this package joins against; `groupRecords` (`src/biff/substreams.ts`) strips its own restated `FrtRefHeader` before joining it.
|
|
59
|
+
- **Conditional formatting, CF12's filter-dispatched template rules resolved for real (ExaDev/documents.js#1106).** `ct` 0x05 ("filter") dispatches further through `icfTemplate`, alongside a 16-byte `CFExTemplateParams` block always present regardless of `ct`. Of that block's five variants, only two need real parsing -- `CFExFilterParams` (top10's own `fTop`/`fPercent`/`iParam`) and `CFExAveragesTemplateParams` (the aboveAverage family's own standard-deviation count) -- since `CFExDefaultTemplateParams` (duplicateValues/uniqueValues/the four blank/error conditions) is 16 reserved bytes and `CFExDateTemplateParams`'s own `dateOp` field is a fixed restatement of `icfTemplate` for all ten date/time periods, so both dispatch directly off `icfTemplate` with no further byte reading. Unlike colour scale/data bar/icon set, [MS-XLS] does not force a `ct` 0x05 rule's own `cbDxf` to zero, so its `DXFN12` can carry a genuine font/fill override; that structure resolves through the identical `parseDxfStyle` base `CF`'s own `DXFN` already uses. A malformed `iParam` of zero degrades a top10 rule to absent rather than promoting a `rank` `ContentSheetConditionalFormatSchema` itself requires to be positive. Comparison/formula rules re-expressed in this newer record shape, `containsText`'s own four sub-types (`CFExTextTemplateParams` names which one a rule is but not its actual search string, and CF12's own formula fields are spec'd to be zero for every `ct` 0x05 rule -- where the literal text operand lives is a genuine open question), and `CFEx`'s own extension of a legacy `CF` record all remain unread (ExaDev/documents.js#1100).
|
|
60
|
+
- **Not read at all:** charts, drawings and images, `CF12`'s `containsText` filter rules, and `CFEx`'s own `CF`-record extension (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.
|
|
61
|
+
- **RC4-encrypted workbooks, decrypted for real (ExaDev/documents.js#1108).** A `FilePass` record ([MS-XLS] 2.4.117) means every record after it is ciphertext under one of three schemes; this reader implements exactly one, the [MS-OFFCRYPTO] 2.3.6.1 "RC4 encryption header" -- `readXlsContent`/`readXls` take an optional `password`, verify it against the header's own `EncryptedVerifier`/`EncryptedVerifierHash` pair, then decrypt every subsequent record's data (`src/workbook/encryption.ts`) using the RC4/MD5 primitives [`archive-codec`](../archive-codec/README.md#legacy-office-encryption) shares with `doc-codec`/`ppt-codec`'s own eventual integration. [MS-XLS] 2.2.10's own exclusion list -- `BOF`, `FilePass`, and four shared-workbook revision-tracking records this package otherwise never reads, plus `BoundSheet8`'s own `lbPlyPos` field specifically -- is honoured exactly, re-derived independently in this package's own tests rather than trusted by construction. A missing or incorrect password throws rather than returning a garbled document; the newer "RC4 CryptoAPI encryption header" scheme and XOR obfuscation are explicitly out of scope, tracked separately on [#922](https://github.com/ExaDev/documents.js/issues/922).
|
|
61
62
|
|
|
62
63
|
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).
|
|
63
64
|
|
|
@@ -24,6 +24,16 @@ const RECORD_DATE1904 = 34;
|
|
|
24
24
|
const RECORD_STYLE = 659;
|
|
25
25
|
/** Present only in an encrypted workbook, where every record after it is ciphertext ([MS-XLS] 2.4.117). */
|
|
26
26
|
const RECORD_FILEPASS = 47;
|
|
27
|
+
/** Specifies whether a user holds an exclusive lock on a shared workbook ([MS-XLS] 2.4.339). */
|
|
28
|
+
const RECORD_USREXCL = 404;
|
|
29
|
+
/** Specifies that a shared workbook was locked by a particular user ([MS-XLS] 2.4.116). */
|
|
30
|
+
const RECORD_FILELOCK = 405;
|
|
31
|
+
/** Specifies the user-interface code page and opens the globals substream's own record collection ([MS-XLS] 2.4.146). */
|
|
32
|
+
const RECORD_INTERFACEHDR = 225;
|
|
33
|
+
/** Information about a shared workbook's revision tracking ([MS-XLS] 2.4.227). */
|
|
34
|
+
const RECORD_RRDINFO = 406;
|
|
35
|
+
/** Metadata about one user's set of revisions in a shared workbook ([MS-XLS] 2.4.226). */
|
|
36
|
+
const RECORD_RRDHEAD = 312;
|
|
27
37
|
/** A collection of XTI structures resolving a formula's ixti to a sheet range, for a 3D reference ([MS-XLS] 2.4.106). */
|
|
28
38
|
const RECORD_EXTERNSHEET = 23;
|
|
29
39
|
/** The beginning of a supporting-link's own record collection: another workbook, a DDE/OLE data source, an add-in, or -- the one case this reader resolves -- this same workbook, self-referencing ([MS-XLS] 2.4.271). */
|
|
@@ -163,11 +173,13 @@ exports.RECORD_DV = RECORD_DV;
|
|
|
163
173
|
exports.RECORD_DVAL = RECORD_DVAL;
|
|
164
174
|
exports.RECORD_EOF = RECORD_EOF;
|
|
165
175
|
exports.RECORD_EXTERNSHEET = RECORD_EXTERNSHEET;
|
|
176
|
+
exports.RECORD_FILELOCK = RECORD_FILELOCK;
|
|
166
177
|
exports.RECORD_FILEPASS = RECORD_FILEPASS;
|
|
167
178
|
exports.RECORD_FONT = RECORD_FONT;
|
|
168
179
|
exports.RECORD_FORMAT = RECORD_FORMAT;
|
|
169
180
|
exports.RECORD_FORMULA = RECORD_FORMULA;
|
|
170
181
|
exports.RECORD_HORIZONTALPAGEBREAKS = RECORD_HORIZONTALPAGEBREAKS;
|
|
182
|
+
exports.RECORD_INTERFACEHDR = RECORD_INTERFACEHDR;
|
|
171
183
|
exports.RECORD_LABEL = RECORD_LABEL;
|
|
172
184
|
exports.RECORD_LABELSST = RECORD_LABELSST;
|
|
173
185
|
exports.RECORD_LBL = RECORD_LBL;
|
|
@@ -184,6 +196,8 @@ exports.RECORD_PRINTROWCOL = RECORD_PRINTROWCOL;
|
|
|
184
196
|
exports.RECORD_RIGHTMARGIN = RECORD_RIGHTMARGIN;
|
|
185
197
|
exports.RECORD_RK = RECORD_RK;
|
|
186
198
|
exports.RECORD_ROW = RECORD_ROW;
|
|
199
|
+
exports.RECORD_RRDHEAD = RECORD_RRDHEAD;
|
|
200
|
+
exports.RECORD_RRDINFO = RECORD_RRDINFO;
|
|
187
201
|
exports.RECORD_SETUP = RECORD_SETUP;
|
|
188
202
|
exports.RECORD_SHRFMLA = RECORD_SHRFMLA;
|
|
189
203
|
exports.RECORD_SST = RECORD_SST;
|
|
@@ -193,6 +207,7 @@ exports.RECORD_SUPBOOK = RECORD_SUPBOOK;
|
|
|
193
207
|
exports.RECORD_TABLE = RECORD_TABLE;
|
|
194
208
|
exports.RECORD_TOPMARGIN = RECORD_TOPMARGIN;
|
|
195
209
|
exports.RECORD_TXO = RECORD_TXO;
|
|
210
|
+
exports.RECORD_USREXCL = RECORD_USREXCL;
|
|
196
211
|
exports.RECORD_VERTICALPAGEBREAKS = RECORD_VERTICALPAGEBREAKS;
|
|
197
212
|
exports.RECORD_WSBOOL = RECORD_WSBOOL;
|
|
198
213
|
exports.RECORD_XF = RECORD_XF;
|
|
@@ -23,6 +23,16 @@ declare const RECORD_DATE1904 = 34;
|
|
|
23
23
|
declare const RECORD_STYLE = 659;
|
|
24
24
|
/** Present only in an encrypted workbook, where every record after it is ciphertext ([MS-XLS] 2.4.117). */
|
|
25
25
|
declare const RECORD_FILEPASS = 47;
|
|
26
|
+
/** Specifies whether a user holds an exclusive lock on a shared workbook ([MS-XLS] 2.4.339). */
|
|
27
|
+
declare const RECORD_USREXCL = 404;
|
|
28
|
+
/** Specifies that a shared workbook was locked by a particular user ([MS-XLS] 2.4.116). */
|
|
29
|
+
declare const RECORD_FILELOCK = 405;
|
|
30
|
+
/** Specifies the user-interface code page and opens the globals substream's own record collection ([MS-XLS] 2.4.146). */
|
|
31
|
+
declare const RECORD_INTERFACEHDR = 225;
|
|
32
|
+
/** Information about a shared workbook's revision tracking ([MS-XLS] 2.4.227). */
|
|
33
|
+
declare const RECORD_RRDINFO = 406;
|
|
34
|
+
/** Metadata about one user's set of revisions in a shared workbook ([MS-XLS] 2.4.226). */
|
|
35
|
+
declare const RECORD_RRDHEAD = 312;
|
|
26
36
|
/** A collection of XTI structures resolving a formula's ixti to a sheet range, for a 3D reference ([MS-XLS] 2.4.106). */
|
|
27
37
|
declare const RECORD_EXTERNSHEET = 23;
|
|
28
38
|
/** The beginning of a supporting-link's own record collection: another workbook, a DDE/OLE data source, an add-in, or -- the one case this reader resolves -- this same workbook, self-referencing ([MS-XLS] 2.4.271). */
|
|
@@ -130,4 +140,4 @@ declare const BIFF8_VERSION = 1536;
|
|
|
130
140
|
/** [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. */
|
|
131
141
|
declare const MAX_RECORD_DATA_SIZE = 8224;
|
|
132
142
|
//#endregion
|
|
133
|
-
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_CF12, RECORD_COLINFO, RECORD_CONDFMT, RECORD_CONDFMT12, RECORD_CONTINUE, RECORD_CONTINUEFRT12, 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 };
|
|
143
|
+
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_CF12, RECORD_COLINFO, RECORD_CONDFMT, RECORD_CONDFMT12, RECORD_CONTINUE, RECORD_CONTINUEFRT12, RECORD_DATE1904, RECORD_DEFAULTROWHEIGHT, RECORD_DEFCOLWIDTH, RECORD_DIMENSIONS, RECORD_DV, RECORD_DVAL, RECORD_EOF, RECORD_EXTERNSHEET, RECORD_FILELOCK, RECORD_FILEPASS, RECORD_FONT, RECORD_FORMAT, RECORD_FORMULA, RECORD_HORIZONTALPAGEBREAKS, RECORD_INTERFACEHDR, 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_RRDHEAD, RECORD_RRDINFO, RECORD_SETUP, RECORD_SHRFMLA, RECORD_SST, RECORD_STRING, RECORD_STYLE, RECORD_SUPBOOK, RECORD_TABLE, RECORD_TOPMARGIN, RECORD_TXO, RECORD_USREXCL, RECORD_VERTICALPAGEBREAKS, RECORD_WSBOOL, RECORD_XF };
|
|
@@ -23,6 +23,16 @@ declare const RECORD_DATE1904 = 34;
|
|
|
23
23
|
declare const RECORD_STYLE = 659;
|
|
24
24
|
/** Present only in an encrypted workbook, where every record after it is ciphertext ([MS-XLS] 2.4.117). */
|
|
25
25
|
declare const RECORD_FILEPASS = 47;
|
|
26
|
+
/** Specifies whether a user holds an exclusive lock on a shared workbook ([MS-XLS] 2.4.339). */
|
|
27
|
+
declare const RECORD_USREXCL = 404;
|
|
28
|
+
/** Specifies that a shared workbook was locked by a particular user ([MS-XLS] 2.4.116). */
|
|
29
|
+
declare const RECORD_FILELOCK = 405;
|
|
30
|
+
/** Specifies the user-interface code page and opens the globals substream's own record collection ([MS-XLS] 2.4.146). */
|
|
31
|
+
declare const RECORD_INTERFACEHDR = 225;
|
|
32
|
+
/** Information about a shared workbook's revision tracking ([MS-XLS] 2.4.227). */
|
|
33
|
+
declare const RECORD_RRDINFO = 406;
|
|
34
|
+
/** Metadata about one user's set of revisions in a shared workbook ([MS-XLS] 2.4.226). */
|
|
35
|
+
declare const RECORD_RRDHEAD = 312;
|
|
26
36
|
/** A collection of XTI structures resolving a formula's ixti to a sheet range, for a 3D reference ([MS-XLS] 2.4.106). */
|
|
27
37
|
declare const RECORD_EXTERNSHEET = 23;
|
|
28
38
|
/** The beginning of a supporting-link's own record collection: another workbook, a DDE/OLE data source, an add-in, or -- the one case this reader resolves -- this same workbook, self-referencing ([MS-XLS] 2.4.271). */
|
|
@@ -130,4 +140,4 @@ declare const BIFF8_VERSION = 1536;
|
|
|
130
140
|
/** [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. */
|
|
131
141
|
declare const MAX_RECORD_DATA_SIZE = 8224;
|
|
132
142
|
//#endregion
|
|
133
|
-
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_CF12, RECORD_COLINFO, RECORD_CONDFMT, RECORD_CONDFMT12, RECORD_CONTINUE, RECORD_CONTINUEFRT12, 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 };
|
|
143
|
+
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_CF12, RECORD_COLINFO, RECORD_CONDFMT, RECORD_CONDFMT12, RECORD_CONTINUE, RECORD_CONTINUEFRT12, RECORD_DATE1904, RECORD_DEFAULTROWHEIGHT, RECORD_DEFCOLWIDTH, RECORD_DIMENSIONS, RECORD_DV, RECORD_DVAL, RECORD_EOF, RECORD_EXTERNSHEET, RECORD_FILELOCK, RECORD_FILEPASS, RECORD_FONT, RECORD_FORMAT, RECORD_FORMULA, RECORD_HORIZONTALPAGEBREAKS, RECORD_INTERFACEHDR, 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_RRDHEAD, RECORD_RRDINFO, RECORD_SETUP, RECORD_SHRFMLA, RECORD_SST, RECORD_STRING, RECORD_STYLE, RECORD_SUPBOOK, RECORD_TABLE, RECORD_TOPMARGIN, RECORD_TXO, RECORD_USREXCL, RECORD_VERTICALPAGEBREAKS, RECORD_WSBOOL, RECORD_XF };
|
|
@@ -23,6 +23,16 @@ const RECORD_DATE1904 = 34;
|
|
|
23
23
|
const RECORD_STYLE = 659;
|
|
24
24
|
/** Present only in an encrypted workbook, where every record after it is ciphertext ([MS-XLS] 2.4.117). */
|
|
25
25
|
const RECORD_FILEPASS = 47;
|
|
26
|
+
/** Specifies whether a user holds an exclusive lock on a shared workbook ([MS-XLS] 2.4.339). */
|
|
27
|
+
const RECORD_USREXCL = 404;
|
|
28
|
+
/** Specifies that a shared workbook was locked by a particular user ([MS-XLS] 2.4.116). */
|
|
29
|
+
const RECORD_FILELOCK = 405;
|
|
30
|
+
/** Specifies the user-interface code page and opens the globals substream's own record collection ([MS-XLS] 2.4.146). */
|
|
31
|
+
const RECORD_INTERFACEHDR = 225;
|
|
32
|
+
/** Information about a shared workbook's revision tracking ([MS-XLS] 2.4.227). */
|
|
33
|
+
const RECORD_RRDINFO = 406;
|
|
34
|
+
/** Metadata about one user's set of revisions in a shared workbook ([MS-XLS] 2.4.226). */
|
|
35
|
+
const RECORD_RRDHEAD = 312;
|
|
26
36
|
/** A collection of XTI structures resolving a formula's ixti to a sheet range, for a 3D reference ([MS-XLS] 2.4.106). */
|
|
27
37
|
const RECORD_EXTERNSHEET = 23;
|
|
28
38
|
/** The beginning of a supporting-link's own record collection: another workbook, a DDE/OLE data source, an add-in, or -- the one case this reader resolves -- this same workbook, self-referencing ([MS-XLS] 2.4.271). */
|
|
@@ -130,4 +140,4 @@ const BIFF8_VERSION = 1536;
|
|
|
130
140
|
/** [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. */
|
|
131
141
|
const MAX_RECORD_DATA_SIZE = 8224;
|
|
132
142
|
//#endregion
|
|
133
|
-
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_CF12, RECORD_COLINFO, RECORD_CONDFMT, RECORD_CONDFMT12, RECORD_CONTINUE, RECORD_CONTINUEFRT12, 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 };
|
|
143
|
+
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_CF12, RECORD_COLINFO, RECORD_CONDFMT, RECORD_CONDFMT12, RECORD_CONTINUE, RECORD_CONTINUEFRT12, RECORD_DATE1904, RECORD_DEFAULTROWHEIGHT, RECORD_DEFCOLWIDTH, RECORD_DIMENSIONS, RECORD_DV, RECORD_DVAL, RECORD_EOF, RECORD_EXTERNSHEET, RECORD_FILELOCK, RECORD_FILEPASS, RECORD_FONT, RECORD_FORMAT, RECORD_FORMULA, RECORD_HORIZONTALPAGEBREAKS, RECORD_INTERFACEHDR, 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_RRDHEAD, RECORD_RRDINFO, RECORD_SETUP, RECORD_SHRFMLA, RECORD_SST, RECORD_STRING, RECORD_STYLE, RECORD_SUPBOOK, RECORD_TABLE, RECORD_TOPMARGIN, RECORD_TXO, RECORD_USREXCL, RECORD_VERTICALPAGEBREAKS, RECORD_WSBOOL, RECORD_XF };
|
package/dist/biff/records.cjs
CHANGED
|
@@ -8,7 +8,7 @@ var BiffFormatError = class extends Error {
|
|
|
8
8
|
this.name = "BiffFormatError";
|
|
9
9
|
}
|
|
10
10
|
};
|
|
11
|
-
/** The four-byte record header: a two-byte type followed by a two-byte size. */
|
|
11
|
+
/** The four-byte record header: a two-byte type followed by a two-byte size. Exported for workbook/encryption.ts, which needs a record's own data start offset (the byte position right after this header) to derive the correct RC4 keystream position -- [MS-XLS] 2.2.10 counts a record's own header bytes toward the encryption stream's position even though the header itself is never encrypted. */
|
|
12
12
|
const HEADER_SIZE = 4;
|
|
13
13
|
/**
|
|
14
14
|
* Splits a BIFF record stream into its records, in stream order.
|
|
@@ -20,11 +20,11 @@ function readRecords(stream) {
|
|
|
20
20
|
const records = [];
|
|
21
21
|
let offset = 0;
|
|
22
22
|
while (offset < stream.length) {
|
|
23
|
-
if (offset +
|
|
23
|
+
if (offset + 4 > stream.length) throw new BiffFormatError(`record header at offset ${offset} runs past the end of the ${stream.length}-byte stream`);
|
|
24
24
|
const type = view.getUint16(offset, true);
|
|
25
25
|
const size = view.getUint16(offset + 2, true);
|
|
26
26
|
if (size > 8224) throw new BiffFormatError(`record 0x${type.toString(16)} at offset ${offset} declares ${size} bytes of data, above the ${require_biff_record_types.MAX_RECORD_DATA_SIZE}-byte maximum`);
|
|
27
|
-
const dataStart = offset +
|
|
27
|
+
const dataStart = offset + 4;
|
|
28
28
|
if (dataStart + size > stream.length) throw new BiffFormatError(`record 0x${type.toString(16)} at offset ${offset} declares ${size} bytes of data, running past the end of the ${stream.length}-byte stream`);
|
|
29
29
|
records.push({
|
|
30
30
|
type,
|
|
@@ -37,4 +37,5 @@ function readRecords(stream) {
|
|
|
37
37
|
}
|
|
38
38
|
//#endregion
|
|
39
39
|
exports.BiffFormatError = BiffFormatError;
|
|
40
|
+
exports.HEADER_SIZE = HEADER_SIZE;
|
|
40
41
|
exports.readRecords = readRecords;
|
package/dist/biff/records.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as BiffRecord, r as
|
|
2
|
-
export { BiffFormatError, BiffRecord, readRecords };
|
|
1
|
+
import { i as readRecords, n as BiffRecord, r as HEADER_SIZE, t as BiffFormatError } from "../records-G82UEVq8.cjs";
|
|
2
|
+
export { BiffFormatError, BiffRecord, HEADER_SIZE, readRecords };
|
package/dist/biff/records.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as BiffRecord, r as
|
|
2
|
-
export { BiffFormatError, BiffRecord, readRecords };
|
|
1
|
+
import { i as readRecords, n as BiffRecord, r as HEADER_SIZE, t as BiffFormatError } from "../records-G82UEVq8.js";
|
|
2
|
+
export { BiffFormatError, BiffRecord, HEADER_SIZE, readRecords };
|
package/dist/biff/records.js
CHANGED
|
@@ -7,7 +7,7 @@ var BiffFormatError = class extends Error {
|
|
|
7
7
|
this.name = "BiffFormatError";
|
|
8
8
|
}
|
|
9
9
|
};
|
|
10
|
-
/** The four-byte record header: a two-byte type followed by a two-byte size. */
|
|
10
|
+
/** The four-byte record header: a two-byte type followed by a two-byte size. Exported for workbook/encryption.ts, which needs a record's own data start offset (the byte position right after this header) to derive the correct RC4 keystream position -- [MS-XLS] 2.2.10 counts a record's own header bytes toward the encryption stream's position even though the header itself is never encrypted. */
|
|
11
11
|
const HEADER_SIZE = 4;
|
|
12
12
|
/**
|
|
13
13
|
* Splits a BIFF record stream into its records, in stream order.
|
|
@@ -19,11 +19,11 @@ function readRecords(stream) {
|
|
|
19
19
|
const records = [];
|
|
20
20
|
let offset = 0;
|
|
21
21
|
while (offset < stream.length) {
|
|
22
|
-
if (offset +
|
|
22
|
+
if (offset + 4 > stream.length) throw new BiffFormatError(`record header at offset ${offset} runs past the end of the ${stream.length}-byte stream`);
|
|
23
23
|
const type = view.getUint16(offset, true);
|
|
24
24
|
const size = view.getUint16(offset + 2, true);
|
|
25
25
|
if (size > 8224) throw new BiffFormatError(`record 0x${type.toString(16)} at offset ${offset} declares ${size} bytes of data, above the ${MAX_RECORD_DATA_SIZE}-byte maximum`);
|
|
26
|
-
const dataStart = offset +
|
|
26
|
+
const dataStart = offset + 4;
|
|
27
27
|
if (dataStart + size > stream.length) throw new BiffFormatError(`record 0x${type.toString(16)} at offset ${offset} declares ${size} bytes of data, running past the end of the ${stream.length}-byte stream`);
|
|
28
28
|
records.push({
|
|
29
29
|
type,
|
|
@@ -35,4 +35,4 @@ function readRecords(stream) {
|
|
|
35
35
|
return records;
|
|
36
36
|
}
|
|
37
37
|
//#endregion
|
|
38
|
-
export { BiffFormatError, readRecords };
|
|
38
|
+
export { BiffFormatError, HEADER_SIZE, readRecords };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as splitSubstreams, i as recordByteLength, n as Substream, r as groupRecords, t as RecordGroup } from "../substreams-
|
|
1
|
+
import { a as splitSubstreams, i as recordByteLength, n as Substream, r as groupRecords, t as RecordGroup } from "../substreams-CHv3oWmn.cjs";
|
|
2
2
|
export { RecordGroup, Substream, groupRecords, recordByteLength, splitSubstreams };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as splitSubstreams, i as recordByteLength, n as Substream, r as groupRecords, t as RecordGroup } from "../substreams-
|
|
1
|
+
import { a as splitSubstreams, i as recordByteLength, n as Substream, r as groupRecords, t as RecordGroup } from "../substreams-Dp5cZoUo.js";
|
|
2
2
|
export { RecordGroup, Substream, groupRecords, recordByteLength, splitSubstreams };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { r as FormulaSheetContext } from "./ptg-CCBbJLZJ.js";
|
|
2
|
-
import { t as RecordGroup } from "./substreams-
|
|
3
|
-
import {
|
|
2
|
+
import { t as RecordGroup } from "./substreams-Dp5cZoUo.js";
|
|
3
|
+
import { i as RawConditionalFormatStyle } from "./conditional-format-DOdazxWe.js";
|
|
4
|
+
import { Color, ContentSheetConditionalFormat, ContentSheetConditionalFormatValue, ContentSheetRange } from "document-schema.js";
|
|
4
5
|
//#region src/workbook/conditional-format-12.d.ts
|
|
5
6
|
type RawCfColor = {
|
|
6
7
|
readonly kind: "icv";
|
|
@@ -38,7 +39,33 @@ interface RawIconSetFormat extends RawConditionalFormat12Common {
|
|
|
38
39
|
readonly reverse: boolean;
|
|
39
40
|
readonly showValue: boolean;
|
|
40
41
|
}
|
|
41
|
-
type
|
|
42
|
+
type RawTimePeriod = Extract<ContentSheetConditionalFormat, {
|
|
43
|
+
readonly type: "timePeriod";
|
|
44
|
+
}>["timePeriod"];
|
|
45
|
+
interface RawFilterFormatCommon extends RawConditionalFormat12Common {
|
|
46
|
+
readonly style: RawConditionalFormatStyle | undefined;
|
|
47
|
+
}
|
|
48
|
+
interface RawTop10Format extends RawFilterFormatCommon {
|
|
49
|
+
readonly kind: "top10";
|
|
50
|
+
readonly rank: number;
|
|
51
|
+
readonly percent: boolean;
|
|
52
|
+
readonly bottom: boolean;
|
|
53
|
+
}
|
|
54
|
+
interface RawAboveAverageFormat extends RawFilterFormatCommon {
|
|
55
|
+
readonly kind: "aboveAverage";
|
|
56
|
+
readonly aboveAverage: boolean;
|
|
57
|
+
readonly equalAverage: boolean;
|
|
58
|
+
readonly stdDev: number | undefined;
|
|
59
|
+
}
|
|
60
|
+
interface RawTimePeriodFormat extends RawFilterFormatCommon {
|
|
61
|
+
readonly kind: "timePeriod";
|
|
62
|
+
readonly timePeriod: RawTimePeriod;
|
|
63
|
+
}
|
|
64
|
+
/** duplicateValues/uniqueValues and the four blank/error conditions carry no data beyond which one a rule is -- CFExDefaultTemplateParams is 16 reserved bytes ([MS-XLS] 2.4, https://learn.microsoft.com/en-us/openspecs/office_file_formats/ms-xls/c8f156b6-10ec-4594-adb1-c734fbb1fc11). */
|
|
65
|
+
interface RawSimpleFilterFormat extends RawFilterFormatCommon {
|
|
66
|
+
readonly kind: "containsBlanks" | "notContainsBlanks" | "containsErrors" | "notContainsErrors" | "uniqueValues" | "duplicateValues";
|
|
67
|
+
}
|
|
68
|
+
type RawConditionalFormat12 = RawColorScaleFormat | RawDataBarFormat | RawIconSetFormat | RawTop10Format | RawAboveAverageFormat | RawTimePeriodFormat | RawSimpleFilterFormat;
|
|
42
69
|
interface CondFmt12GroupResult {
|
|
43
70
|
readonly formats: RawConditionalFormat12[];
|
|
44
71
|
/** How many records (the CondFmt12 itself plus every CF12 it claimed) the caller should advance past, regardless of how many rules actually promoted. */
|
|
@@ -46,4 +73,4 @@ interface CondFmt12GroupResult {
|
|
|
46
73
|
}
|
|
47
74
|
declare function readCondFmt12Group(records: readonly RecordGroup[], startIndex: number, formulaSheets: FormulaSheetContext): CondFmt12GroupResult;
|
|
48
75
|
//#endregion
|
|
49
|
-
export {
|
|
76
|
+
export { RawConditionalFormat12 as a, RawSimpleFilterFormat as c, RawTop10Format as d, readCondFmt12Group as f, RawColorScaleFormat as i, RawTimePeriod as l, RawAboveAverageFormat as n, RawDataBarFormat as o, RawCfColor as r, RawIconSetFormat as s, CondFmt12GroupResult as t, RawTimePeriodFormat as u };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { r as FormulaSheetContext } from "./ptg-CCBbJLZJ.cjs";
|
|
2
|
-
import { t as RecordGroup } from "./substreams-
|
|
3
|
-
import {
|
|
2
|
+
import { t as RecordGroup } from "./substreams-CHv3oWmn.cjs";
|
|
3
|
+
import { i as RawConditionalFormatStyle } from "./conditional-format-Czh2oTzQ.cjs";
|
|
4
|
+
import { Color, ContentSheetConditionalFormat, ContentSheetConditionalFormatValue, ContentSheetRange } from "document-schema.js";
|
|
4
5
|
//#region src/workbook/conditional-format-12.d.ts
|
|
5
6
|
type RawCfColor = {
|
|
6
7
|
readonly kind: "icv";
|
|
@@ -38,7 +39,33 @@ interface RawIconSetFormat extends RawConditionalFormat12Common {
|
|
|
38
39
|
readonly reverse: boolean;
|
|
39
40
|
readonly showValue: boolean;
|
|
40
41
|
}
|
|
41
|
-
type
|
|
42
|
+
type RawTimePeriod = Extract<ContentSheetConditionalFormat, {
|
|
43
|
+
readonly type: "timePeriod";
|
|
44
|
+
}>["timePeriod"];
|
|
45
|
+
interface RawFilterFormatCommon extends RawConditionalFormat12Common {
|
|
46
|
+
readonly style: RawConditionalFormatStyle | undefined;
|
|
47
|
+
}
|
|
48
|
+
interface RawTop10Format extends RawFilterFormatCommon {
|
|
49
|
+
readonly kind: "top10";
|
|
50
|
+
readonly rank: number;
|
|
51
|
+
readonly percent: boolean;
|
|
52
|
+
readonly bottom: boolean;
|
|
53
|
+
}
|
|
54
|
+
interface RawAboveAverageFormat extends RawFilterFormatCommon {
|
|
55
|
+
readonly kind: "aboveAverage";
|
|
56
|
+
readonly aboveAverage: boolean;
|
|
57
|
+
readonly equalAverage: boolean;
|
|
58
|
+
readonly stdDev: number | undefined;
|
|
59
|
+
}
|
|
60
|
+
interface RawTimePeriodFormat extends RawFilterFormatCommon {
|
|
61
|
+
readonly kind: "timePeriod";
|
|
62
|
+
readonly timePeriod: RawTimePeriod;
|
|
63
|
+
}
|
|
64
|
+
/** duplicateValues/uniqueValues and the four blank/error conditions carry no data beyond which one a rule is -- CFExDefaultTemplateParams is 16 reserved bytes ([MS-XLS] 2.4, https://learn.microsoft.com/en-us/openspecs/office_file_formats/ms-xls/c8f156b6-10ec-4594-adb1-c734fbb1fc11). */
|
|
65
|
+
interface RawSimpleFilterFormat extends RawFilterFormatCommon {
|
|
66
|
+
readonly kind: "containsBlanks" | "notContainsBlanks" | "containsErrors" | "notContainsErrors" | "uniqueValues" | "duplicateValues";
|
|
67
|
+
}
|
|
68
|
+
type RawConditionalFormat12 = RawColorScaleFormat | RawDataBarFormat | RawIconSetFormat | RawTop10Format | RawAboveAverageFormat | RawTimePeriodFormat | RawSimpleFilterFormat;
|
|
42
69
|
interface CondFmt12GroupResult {
|
|
43
70
|
readonly formats: RawConditionalFormat12[];
|
|
44
71
|
/** How many records (the CondFmt12 itself plus every CF12 it claimed) the caller should advance past, regardless of how many rules actually promoted. */
|
|
@@ -46,4 +73,4 @@ interface CondFmt12GroupResult {
|
|
|
46
73
|
}
|
|
47
74
|
declare function readCondFmt12Group(records: readonly RecordGroup[], startIndex: number, formulaSheets: FormulaSheetContext): CondFmt12GroupResult;
|
|
48
75
|
//#endregion
|
|
49
|
-
export {
|
|
76
|
+
export { RawConditionalFormat12 as a, RawSimpleFilterFormat as c, RawTop10Format as d, readCondFmt12Group as f, RawColorScaleFormat as i, RawTimePeriod as l, RawAboveAverageFormat as n, RawDataBarFormat as o, RawCfColor as r, RawIconSetFormat as s, CondFmt12GroupResult as t, RawTimePeriodFormat as u };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as FormulaSheetContext } from "./ptg-CCBbJLZJ.cjs";
|
|
2
|
-
import { t as RecordGroup } from "./substreams-
|
|
2
|
+
import { t as RecordGroup } from "./substreams-CHv3oWmn.cjs";
|
|
3
3
|
import { ContentSheetRange, SheetRuleOperator } from "document-schema.js";
|
|
4
4
|
//#region src/workbook/conditional-format.d.ts
|
|
5
5
|
interface RawConditionalFormatFill {
|
|
@@ -18,6 +18,7 @@ interface RawConditionalFormat {
|
|
|
18
18
|
readonly style: RawConditionalFormatStyle | undefined;
|
|
19
19
|
readonly ranges: ContentSheetRange[];
|
|
20
20
|
}
|
|
21
|
+
declare function parseDxfStyle(dxfBytes: Uint8Array<ArrayBuffer>): RawConditionalFormatStyle | undefined;
|
|
21
22
|
interface CondFmtGroupResult {
|
|
22
23
|
readonly formats: RawConditionalFormat[];
|
|
23
24
|
/** How many records (the CondFmt itself plus every CF it claimed) the caller should advance past, regardless of how many rules actually promoted. */
|
|
@@ -25,4 +26,4 @@ interface CondFmtGroupResult {
|
|
|
25
26
|
}
|
|
26
27
|
declare function readCondFmtGroup(records: readonly RecordGroup[], startIndex: number, formulaSheets: FormulaSheetContext): CondFmtGroupResult;
|
|
27
28
|
//#endregion
|
|
28
|
-
export {
|
|
29
|
+
export { parseDxfStyle as a, RawConditionalFormatStyle as i, RawConditionalFormat as n, readCondFmtGroup as o, RawConditionalFormatFill as r, CondFmtGroupResult as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as FormulaSheetContext } from "./ptg-CCBbJLZJ.js";
|
|
2
|
-
import { t as RecordGroup } from "./substreams-
|
|
2
|
+
import { t as RecordGroup } from "./substreams-Dp5cZoUo.js";
|
|
3
3
|
import { ContentSheetRange, SheetRuleOperator } from "document-schema.js";
|
|
4
4
|
//#region src/workbook/conditional-format.d.ts
|
|
5
5
|
interface RawConditionalFormatFill {
|
|
@@ -18,6 +18,7 @@ interface RawConditionalFormat {
|
|
|
18
18
|
readonly style: RawConditionalFormatStyle | undefined;
|
|
19
19
|
readonly ranges: ContentSheetRange[];
|
|
20
20
|
}
|
|
21
|
+
declare function parseDxfStyle(dxfBytes: Uint8Array<ArrayBuffer>): RawConditionalFormatStyle | undefined;
|
|
21
22
|
interface CondFmtGroupResult {
|
|
22
23
|
readonly formats: RawConditionalFormat[];
|
|
23
24
|
/** How many records (the CondFmt itself plus every CF it claimed) the caller should advance past, regardless of how many rules actually promoted. */
|
|
@@ -25,4 +26,4 @@ interface CondFmtGroupResult {
|
|
|
25
26
|
}
|
|
26
27
|
declare function readCondFmtGroup(records: readonly RecordGroup[], startIndex: number, formulaSheets: FormulaSheetContext): CondFmtGroupResult;
|
|
27
28
|
//#endregion
|
|
28
|
-
export {
|
|
29
|
+
export { parseDxfStyle as a, RawConditionalFormatStyle as i, RawConditionalFormat as n, readCondFmtGroup as o, RawConditionalFormatFill as r, CondFmtGroupResult as t };
|
package/dist/content.cjs
CHANGED
|
@@ -10,6 +10,7 @@ const require_workbook_comments = require("./workbook/comments.cjs");
|
|
|
10
10
|
const require_serial = require("./serial.cjs");
|
|
11
11
|
const require_workbook_globals = require("./workbook/globals.cjs");
|
|
12
12
|
const require_workbook_sheet = require("./workbook/sheet.cjs");
|
|
13
|
+
const require_workbook_encryption = require("./workbook/encryption.cjs");
|
|
13
14
|
let archive_codec = require("archive-codec");
|
|
14
15
|
let document_schema_js = require("document-schema.js");
|
|
15
16
|
let excel_number_format = require("excel-number-format");
|
|
@@ -79,14 +80,16 @@ function mapPrintSettings(raw, names) {
|
|
|
79
80
|
/**
|
|
80
81
|
* Reads a .xls file's bytes into a ContentDocument.
|
|
81
82
|
*
|
|
82
|
-
* The counterpart of ooxml.js's readXlsxContent, producing the same shape from the older format.
|
|
83
|
+
* The counterpart of ooxml.js's readXlsxContent, producing the same shape from the older format. `password` decrypts a workbook protected by [MS-XLS] 2.4.117's FilePass record under the [MS-OFFCRYPTO] 2.3.6.1 RC4 encryption header scheme -- see workbook/encryption.ts. It is ignored for an unencrypted workbook, and a missing or incorrect password against an encrypted one throws rather than returning a partial or garbled document.
|
|
83
84
|
*/
|
|
84
|
-
function readXlsContent(bytes) {
|
|
85
|
+
function readXlsContent(bytes, password) {
|
|
85
86
|
const { workbook, metadata } = require_container.readWorkbookStreams(bytes);
|
|
86
|
-
const
|
|
87
|
+
const rawRecords = require_biff_records.readRecords(workbook);
|
|
88
|
+
const filePassRecord = rawRecords.find((record) => record.type === 47);
|
|
89
|
+
const records = filePassRecord === void 0 ? rawRecords : require_workbook_encryption.decryptWorkbookRecords(rawRecords, filePassRecord, password);
|
|
90
|
+
const substreams = require_biff_substreams.splitSubstreams(require_biff_substreams.groupRecords(records));
|
|
87
91
|
const globalsSubstream = substreams[0];
|
|
88
92
|
if (globalsSubstream === void 0) throw new require_biff_records.BiffFormatError("workbook stream holds no substreams, so it carries no globals substream");
|
|
89
|
-
if (globalsSubstream.records.some((rec) => rec.type === 47)) throw new require_biff_records.BiffFormatError("workbook is encrypted (its globals substream carries a FilePass record); this reader does not decrypt");
|
|
90
93
|
const globals = require_workbook_globals.readWorkbookGlobals(globalsSubstream.records);
|
|
91
94
|
const sheets = globals.sheets.map((entry, sheetIndex) => ({
|
|
92
95
|
entry,
|
|
@@ -99,8 +102,8 @@ function readXlsContent(bytes) {
|
|
|
99
102
|
};
|
|
100
103
|
}
|
|
101
104
|
/** The tree-form read: readXlsContent composed with the schema's own structural transform, exactly as ooxml.js's readXlsx wraps readXlsxContent. */
|
|
102
|
-
function readXls(bytes) {
|
|
103
|
-
return (0, document_schema_js.assembleTree)(readXlsContent(bytes));
|
|
105
|
+
function readXls(bytes, password) {
|
|
106
|
+
return (0, document_schema_js.assembleTree)(readXlsContent(bytes, password));
|
|
104
107
|
}
|
|
105
108
|
/**
|
|
106
109
|
* Locates a sheet's own substream and maps it.
|
|
@@ -186,12 +189,55 @@ function mapConditionalFormats12(raw, palette) {
|
|
|
186
189
|
});
|
|
187
190
|
continue;
|
|
188
191
|
}
|
|
192
|
+
if (format.kind === "iconSet") {
|
|
193
|
+
results.push({
|
|
194
|
+
type: "iconSet",
|
|
195
|
+
iconSetType: format.iconSetType,
|
|
196
|
+
thresholds: [...format.thresholds],
|
|
197
|
+
...format.reverse ? { reverse: true } : {},
|
|
198
|
+
...format.showValue ? {} : { showValue: false },
|
|
199
|
+
...common
|
|
200
|
+
});
|
|
201
|
+
continue;
|
|
202
|
+
}
|
|
203
|
+
if (format.kind === "top10") {
|
|
204
|
+
const style = mapConditionalFormatStyle(format.style, palette);
|
|
205
|
+
results.push({
|
|
206
|
+
type: "top10",
|
|
207
|
+
rank: format.rank,
|
|
208
|
+
...format.percent ? { percent: true } : {},
|
|
209
|
+
...format.bottom ? { bottom: true } : {},
|
|
210
|
+
...style !== void 0 ? { style } : {},
|
|
211
|
+
...common
|
|
212
|
+
});
|
|
213
|
+
continue;
|
|
214
|
+
}
|
|
215
|
+
if (format.kind === "aboveAverage") {
|
|
216
|
+
const style = mapConditionalFormatStyle(format.style, palette);
|
|
217
|
+
results.push({
|
|
218
|
+
type: "aboveAverage",
|
|
219
|
+
...format.aboveAverage ? {} : { aboveAverage: false },
|
|
220
|
+
...format.equalAverage ? { equalAverage: true } : {},
|
|
221
|
+
...format.stdDev !== void 0 ? { stdDev: format.stdDev } : {},
|
|
222
|
+
...style !== void 0 ? { style } : {},
|
|
223
|
+
...common
|
|
224
|
+
});
|
|
225
|
+
continue;
|
|
226
|
+
}
|
|
227
|
+
if (format.kind === "timePeriod") {
|
|
228
|
+
const style = mapConditionalFormatStyle(format.style, palette);
|
|
229
|
+
results.push({
|
|
230
|
+
type: "timePeriod",
|
|
231
|
+
timePeriod: format.timePeriod,
|
|
232
|
+
...style !== void 0 ? { style } : {},
|
|
233
|
+
...common
|
|
234
|
+
});
|
|
235
|
+
continue;
|
|
236
|
+
}
|
|
237
|
+
const style = mapConditionalFormatStyle(format.style, palette);
|
|
189
238
|
results.push({
|
|
190
|
-
type:
|
|
191
|
-
|
|
192
|
-
thresholds: [...format.thresholds],
|
|
193
|
-
...format.reverse ? { reverse: true } : {},
|
|
194
|
-
...format.showValue ? {} : { showValue: false },
|
|
239
|
+
type: format.kind,
|
|
240
|
+
...style !== void 0 ? { style } : {},
|
|
195
241
|
...common
|
|
196
242
|
});
|
|
197
243
|
}
|
package/dist/content.d.cts
CHANGED
|
@@ -11,10 +11,10 @@ type XlsContentDocument = Extract<ContentDocument, {
|
|
|
11
11
|
/**
|
|
12
12
|
* Reads a .xls file's bytes into a ContentDocument.
|
|
13
13
|
*
|
|
14
|
-
* The counterpart of ooxml.js's readXlsxContent, producing the same shape from the older format.
|
|
14
|
+
* The counterpart of ooxml.js's readXlsxContent, producing the same shape from the older format. `password` decrypts a workbook protected by [MS-XLS] 2.4.117's FilePass record under the [MS-OFFCRYPTO] 2.3.6.1 RC4 encryption header scheme -- see workbook/encryption.ts. It is ignored for an unencrypted workbook, and a missing or incorrect password against an encrypted one throws rather than returning a partial or garbled document.
|
|
15
15
|
*/
|
|
16
|
-
declare function readXlsContent(bytes: Uint8Array<ArrayBuffer
|
|
16
|
+
declare function readXlsContent(bytes: Uint8Array<ArrayBuffer>, password?: string): XlsContentDocument;
|
|
17
17
|
/** The tree-form read: readXlsContent composed with the schema's own structural transform, exactly as ooxml.js's readXlsx wraps readXlsxContent. */
|
|
18
|
-
declare function readXls(bytes: Uint8Array<ArrayBuffer
|
|
18
|
+
declare function readXls(bytes: Uint8Array<ArrayBuffer>, password?: string): DocumentTree;
|
|
19
19
|
//#endregion
|
|
20
20
|
export { XlsContentDocument, readXls, readXlsContent };
|
package/dist/content.d.ts
CHANGED
|
@@ -11,10 +11,10 @@ type XlsContentDocument = Extract<ContentDocument, {
|
|
|
11
11
|
/**
|
|
12
12
|
* Reads a .xls file's bytes into a ContentDocument.
|
|
13
13
|
*
|
|
14
|
-
* The counterpart of ooxml.js's readXlsxContent, producing the same shape from the older format.
|
|
14
|
+
* The counterpart of ooxml.js's readXlsxContent, producing the same shape from the older format. `password` decrypts a workbook protected by [MS-XLS] 2.4.117's FilePass record under the [MS-OFFCRYPTO] 2.3.6.1 RC4 encryption header scheme -- see workbook/encryption.ts. It is ignored for an unencrypted workbook, and a missing or incorrect password against an encrypted one throws rather than returning a partial or garbled document.
|
|
15
15
|
*/
|
|
16
|
-
declare function readXlsContent(bytes: Uint8Array<ArrayBuffer
|
|
16
|
+
declare function readXlsContent(bytes: Uint8Array<ArrayBuffer>, password?: string): XlsContentDocument;
|
|
17
17
|
/** The tree-form read: readXlsContent composed with the schema's own structural transform, exactly as ooxml.js's readXlsx wraps readXlsxContent. */
|
|
18
|
-
declare function readXls(bytes: Uint8Array<ArrayBuffer
|
|
18
|
+
declare function readXls(bytes: Uint8Array<ArrayBuffer>, password?: string): DocumentTree;
|
|
19
19
|
//#endregion
|
|
20
20
|
export { XlsContentDocument, readXls, readXlsContent };
|