xls-codec 4.6.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 +1 -1
- 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-DyqonR1G.d.ts → conditional-format-12-D-X5g_O3.d.ts} +2 -2
- package/dist/{conditional-format-12-DPNiYLVp.d.cts → conditional-format-12-DBhe7Zo6.d.cts} +2 -2
- package/dist/{conditional-format-S9NaPjhr.d.cts → conditional-format-Czh2oTzQ.d.cts} +1 -1
- package/dist/{conditional-format-CWlz0Ty6.d.ts → conditional-format-DOdazxWe.d.ts} +1 -1
- package/dist/content.cjs +9 -6
- package/dist/content.d.cts +3 -3
- package/dist/content.d.ts +3 -3
- package/dist/content.js +9 -6
- 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.d.cts +1 -1
- package/dist/workbook/conditional-format-12.d.ts +1 -1
- package/dist/workbook/conditional-format.d.cts +1 -1
- package/dist/workbook/conditional-format.d.ts +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
|
@@ -58,7 +58,7 @@ Each deliberate rather than overlooked:
|
|
|
58
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
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
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
|
-
- **
|
|
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).
|
|
62
62
|
|
|
63
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).
|
|
64
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,6 @@
|
|
|
1
1
|
import { r as FormulaSheetContext } from "./ptg-CCBbJLZJ.js";
|
|
2
|
-
import { t as RecordGroup } from "./substreams-
|
|
3
|
-
import { i as RawConditionalFormatStyle } from "./conditional-format-
|
|
2
|
+
import { t as RecordGroup } from "./substreams-Dp5cZoUo.js";
|
|
3
|
+
import { i as RawConditionalFormatStyle } from "./conditional-format-DOdazxWe.js";
|
|
4
4
|
import { Color, ContentSheetConditionalFormat, ContentSheetConditionalFormatValue, ContentSheetRange } from "document-schema.js";
|
|
5
5
|
//#region src/workbook/conditional-format-12.d.ts
|
|
6
6
|
type RawCfColor = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as FormulaSheetContext } from "./ptg-CCBbJLZJ.cjs";
|
|
2
|
-
import { t as RecordGroup } from "./substreams-
|
|
3
|
-
import { i as RawConditionalFormatStyle } from "./conditional-format-
|
|
2
|
+
import { t as RecordGroup } from "./substreams-CHv3oWmn.cjs";
|
|
3
|
+
import { i as RawConditionalFormatStyle } from "./conditional-format-Czh2oTzQ.cjs";
|
|
4
4
|
import { Color, ContentSheetConditionalFormat, ContentSheetConditionalFormatValue, ContentSheetRange } from "document-schema.js";
|
|
5
5
|
//#region src/workbook/conditional-format-12.d.ts
|
|
6
6
|
type RawCfColor = {
|
|
@@ -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 {
|
|
@@ -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 {
|
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.
|
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 };
|
package/dist/content.js
CHANGED
|
@@ -9,6 +9,7 @@ import { readSheetComments } from "./workbook/comments.js";
|
|
|
9
9
|
import { serialToIsoDate, serialToIsoDateTime, serialToIsoTime } from "./serial.js";
|
|
10
10
|
import { formatCodeOf, readWorkbookGlobals } from "./workbook/globals.js";
|
|
11
11
|
import { readSheetRecords } from "./workbook/sheet.js";
|
|
12
|
+
import { decryptWorkbookRecords } from "./workbook/encryption.js";
|
|
12
13
|
import { readSummaryInformation, summaryInformationToLayoutMetadata } from "archive-codec";
|
|
13
14
|
import { PAGE_SIZE_LETTER, assembleTree } from "document-schema.js";
|
|
14
15
|
import { classifyNumberFormat } from "excel-number-format";
|
|
@@ -78,14 +79,16 @@ function mapPrintSettings(raw, names) {
|
|
|
78
79
|
/**
|
|
79
80
|
* Reads a .xls file's bytes into a ContentDocument.
|
|
80
81
|
*
|
|
81
|
-
* The counterpart of ooxml.js's readXlsxContent, producing the same shape from the older format.
|
|
82
|
+
* 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.
|
|
82
83
|
*/
|
|
83
|
-
function readXlsContent(bytes) {
|
|
84
|
+
function readXlsContent(bytes, password) {
|
|
84
85
|
const { workbook, metadata } = readWorkbookStreams(bytes);
|
|
85
|
-
const
|
|
86
|
+
const rawRecords = readRecords(workbook);
|
|
87
|
+
const filePassRecord = rawRecords.find((record) => record.type === 47);
|
|
88
|
+
const records = filePassRecord === void 0 ? rawRecords : decryptWorkbookRecords(rawRecords, filePassRecord, password);
|
|
89
|
+
const substreams = splitSubstreams(groupRecords(records));
|
|
86
90
|
const globalsSubstream = substreams[0];
|
|
87
91
|
if (globalsSubstream === void 0) throw new BiffFormatError("workbook stream holds no substreams, so it carries no globals substream");
|
|
88
|
-
if (globalsSubstream.records.some((rec) => rec.type === 47)) throw new BiffFormatError("workbook is encrypted (its globals substream carries a FilePass record); this reader does not decrypt");
|
|
89
92
|
const globals = readWorkbookGlobals(globalsSubstream.records);
|
|
90
93
|
const sheets = globals.sheets.map((entry, sheetIndex) => ({
|
|
91
94
|
entry,
|
|
@@ -98,8 +101,8 @@ function readXlsContent(bytes) {
|
|
|
98
101
|
};
|
|
99
102
|
}
|
|
100
103
|
/** The tree-form read: readXlsContent composed with the schema's own structural transform, exactly as ooxml.js's readXlsx wraps readXlsxContent. */
|
|
101
|
-
function readXls(bytes) {
|
|
102
|
-
return assembleTree(readXlsContent(bytes));
|
|
104
|
+
function readXls(bytes, password) {
|
|
105
|
+
return assembleTree(readXlsContent(bytes, password));
|
|
103
106
|
}
|
|
104
107
|
/**
|
|
105
108
|
* Locates a sheet's own substream and maps it.
|
|
@@ -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/data-validation.d.ts
|
|
5
5
|
interface RawDataValidation {
|
|
@@ -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/data-validation.d.ts
|
|
5
5
|
interface RawDataValidation {
|
package/dist/index.cjs
CHANGED
|
@@ -31,6 +31,7 @@ exports.BiffFormatError = require_biff_records.BiffFormatError;
|
|
|
31
31
|
exports.BiffWriteError = require_biff_write_errors.BiffWriteError;
|
|
32
32
|
exports.BlockCursor = require_biff_cursor.BlockCursor;
|
|
33
33
|
exports.GENERAL_CELL_XF_INDEX = require_workbook_globals_writer.GENERAL_CELL_XF_INDEX;
|
|
34
|
+
exports.HEADER_SIZE = require_biff_records.HEADER_SIZE;
|
|
34
35
|
exports.MAX_RECORD_DATA_SIZE = require_biff_record_types.MAX_RECORD_DATA_SIZE;
|
|
35
36
|
exports.RECORD_ARRAY = require_biff_record_types.RECORD_ARRAY;
|
|
36
37
|
exports.RECORD_BLANK = require_biff_record_types.RECORD_BLANK;
|
|
@@ -58,11 +59,13 @@ exports.RECORD_DV = require_biff_record_types.RECORD_DV;
|
|
|
58
59
|
exports.RECORD_DVAL = require_biff_record_types.RECORD_DVAL;
|
|
59
60
|
exports.RECORD_EOF = require_biff_record_types.RECORD_EOF;
|
|
60
61
|
exports.RECORD_EXTERNSHEET = require_biff_record_types.RECORD_EXTERNSHEET;
|
|
62
|
+
exports.RECORD_FILELOCK = require_biff_record_types.RECORD_FILELOCK;
|
|
61
63
|
exports.RECORD_FILEPASS = require_biff_record_types.RECORD_FILEPASS;
|
|
62
64
|
exports.RECORD_FONT = require_biff_record_types.RECORD_FONT;
|
|
63
65
|
exports.RECORD_FORMAT = require_biff_record_types.RECORD_FORMAT;
|
|
64
66
|
exports.RECORD_FORMULA = require_biff_record_types.RECORD_FORMULA;
|
|
65
67
|
exports.RECORD_HORIZONTALPAGEBREAKS = require_biff_record_types.RECORD_HORIZONTALPAGEBREAKS;
|
|
68
|
+
exports.RECORD_INTERFACEHDR = require_biff_record_types.RECORD_INTERFACEHDR;
|
|
66
69
|
exports.RECORD_LABEL = require_biff_record_types.RECORD_LABEL;
|
|
67
70
|
exports.RECORD_LABELSST = require_biff_record_types.RECORD_LABELSST;
|
|
68
71
|
exports.RECORD_LBL = require_biff_record_types.RECORD_LBL;
|
|
@@ -79,6 +82,8 @@ exports.RECORD_PRINTROWCOL = require_biff_record_types.RECORD_PRINTROWCOL;
|
|
|
79
82
|
exports.RECORD_RIGHTMARGIN = require_biff_record_types.RECORD_RIGHTMARGIN;
|
|
80
83
|
exports.RECORD_RK = require_biff_record_types.RECORD_RK;
|
|
81
84
|
exports.RECORD_ROW = require_biff_record_types.RECORD_ROW;
|
|
85
|
+
exports.RECORD_RRDHEAD = require_biff_record_types.RECORD_RRDHEAD;
|
|
86
|
+
exports.RECORD_RRDINFO = require_biff_record_types.RECORD_RRDINFO;
|
|
82
87
|
exports.RECORD_SETUP = require_biff_record_types.RECORD_SETUP;
|
|
83
88
|
exports.RECORD_SHRFMLA = require_biff_record_types.RECORD_SHRFMLA;
|
|
84
89
|
exports.RECORD_SST = require_biff_record_types.RECORD_SST;
|
|
@@ -88,6 +93,7 @@ exports.RECORD_SUPBOOK = require_biff_record_types.RECORD_SUPBOOK;
|
|
|
88
93
|
exports.RECORD_TABLE = require_biff_record_types.RECORD_TABLE;
|
|
89
94
|
exports.RECORD_TOPMARGIN = require_biff_record_types.RECORD_TOPMARGIN;
|
|
90
95
|
exports.RECORD_TXO = require_biff_record_types.RECORD_TXO;
|
|
96
|
+
exports.RECORD_USREXCL = require_biff_record_types.RECORD_USREXCL;
|
|
91
97
|
exports.RECORD_VERTICALPAGEBREAKS = require_biff_record_types.RECORD_VERTICALPAGEBREAKS;
|
|
92
98
|
exports.RECORD_WSBOOL = require_biff_record_types.RECORD_WSBOOL;
|
|
93
99
|
exports.RECORD_XF = require_biff_record_types.RECORD_XF;
|
package/dist/index.d.cts
CHANGED
|
@@ -2,13 +2,13 @@ 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_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 } from "./biff/record-types.cjs";
|
|
5
|
+
import { BIFF8_VERSION, BOF_TYPE_CHART, BOF_TYPE_MACRO, BOF_TYPE_WORKBOOK, BOF_TYPE_WORKSHEET, MAX_RECORD_DATA_SIZE, RECORD_ARRAY, RECORD_BLANK, RECORD_BOF, RECORD_BOOLERR, RECORD_BOTTOMMARGIN, RECORD_BOUNDSHEET8, RECORD_CALCCOUNT, RECORD_CALCDELTA, RECORD_CALCITER, RECORD_CALCREFMODE, RECORD_CALCSAVERECALC, RECORD_CF, RECORD_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 } from "./biff/record-types.cjs";
|
|
6
6
|
import { concatRecords, writeRecord } from "./biff/record-writer.cjs";
|
|
7
|
-
import { n as BiffRecord, r as
|
|
7
|
+
import { i as readRecords, n as BiffRecord, r as HEADER_SIZE, t as BiffFormatError } from "./records-G82UEVq8.cjs";
|
|
8
8
|
import { decodeRkNumber } from "./biff/rk.cjs";
|
|
9
9
|
import { writeRichExtendedString, writeShortXLUnicodeString, writeXLUnicodeString } from "./biff/string-writer.cjs";
|
|
10
10
|
import { readRichExtendedString, readShortXLUnicodeString, readXLUnicodeString, readXLUnicodeStringNoCch } from "./biff/strings.cjs";
|
|
11
|
-
import { a as splitSubstreams, i as recordByteLength, n as Substream, r as groupRecords, t as RecordGroup } from "./substreams-
|
|
11
|
+
import { a as splitSubstreams, i as recordByteLength, n as Substream, r as groupRecords, t as RecordGroup } from "./substreams-CHv3oWmn.cjs";
|
|
12
12
|
import { BiffWriteError } from "./biff/write-errors.cjs";
|
|
13
13
|
import { writeCellXfRecord, writeFontRecord, writeFormatRecord, writePaletteRecord, writeStyleRecord, writeStyleXfRecord } from "./biff/xf-writer.cjs";
|
|
14
14
|
import { SUMMARY_INFORMATION_STREAM, WorkbookStreams, isXlsFile, readWorkbookStreams } from "./container.cjs";
|
|
@@ -22,4 +22,4 @@ import { RawCell, RawCellValue, RawColumn, RawPrintSettings, RawRange, RawRow, R
|
|
|
22
22
|
import { SheetWriteContext, buildWorksheetSubstream } from "./workbook/sheet-writer.cjs";
|
|
23
23
|
import { writeXls, writeXlsContent } from "./write.cjs";
|
|
24
24
|
export * from "excel-number-format";
|
|
25
|
-
export { BIFF8_VERSION, BOF_TYPE_CHART, BOF_TYPE_MACRO, BOF_TYPE_WORKBOOK, BOF_TYPE_WORKSHEET, BiffFormatError, BiffRecord, BiffWriteError, BlockCursor, CellFormat, CellXfPlanEntry, GENERAL_CELL_XF_INDEX, MAX_RECORD_DATA_SIZE, RECORD_ARRAY, RECORD_BLANK, RECORD_BOF, RECORD_BOOLERR, RECORD_BOTTOMMARGIN, RECORD_BOUNDSHEET8, RECORD_CALCCOUNT, RECORD_CALCDELTA, RECORD_CALCITER, RECORD_CALCREFMODE, RECORD_CALCSAVERECALC, RECORD_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, 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, HEADER_SIZE, 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, 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,13 +2,13 @@ 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_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 } from "./biff/record-types.js";
|
|
5
|
+
import { BIFF8_VERSION, BOF_TYPE_CHART, BOF_TYPE_MACRO, BOF_TYPE_WORKBOOK, BOF_TYPE_WORKSHEET, MAX_RECORD_DATA_SIZE, RECORD_ARRAY, RECORD_BLANK, RECORD_BOF, RECORD_BOOLERR, RECORD_BOTTOMMARGIN, RECORD_BOUNDSHEET8, RECORD_CALCCOUNT, RECORD_CALCDELTA, RECORD_CALCITER, RECORD_CALCREFMODE, RECORD_CALCSAVERECALC, RECORD_CF, RECORD_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 } from "./biff/record-types.js";
|
|
6
6
|
import { concatRecords, writeRecord } from "./biff/record-writer.js";
|
|
7
|
-
import { n as BiffRecord, r as
|
|
7
|
+
import { i as readRecords, n as BiffRecord, r as HEADER_SIZE, t as BiffFormatError } from "./records-G82UEVq8.js";
|
|
8
8
|
import { decodeRkNumber } from "./biff/rk.js";
|
|
9
9
|
import { writeRichExtendedString, writeShortXLUnicodeString, writeXLUnicodeString } from "./biff/string-writer.js";
|
|
10
10
|
import { readRichExtendedString, readShortXLUnicodeString, readXLUnicodeString, readXLUnicodeStringNoCch } from "./biff/strings.js";
|
|
11
|
-
import { a as splitSubstreams, i as recordByteLength, n as Substream, r as groupRecords, t as RecordGroup } from "./substreams-
|
|
11
|
+
import { a as splitSubstreams, i as recordByteLength, n as Substream, r as groupRecords, t as RecordGroup } from "./substreams-Dp5cZoUo.js";
|
|
12
12
|
import { BiffWriteError } from "./biff/write-errors.js";
|
|
13
13
|
import { writeCellXfRecord, writeFontRecord, writeFormatRecord, writePaletteRecord, writeStyleRecord, writeStyleXfRecord } from "./biff/xf-writer.js";
|
|
14
14
|
import { SUMMARY_INFORMATION_STREAM, WorkbookStreams, isXlsFile, readWorkbookStreams } from "./container.js";
|
|
@@ -22,4 +22,4 @@ import { RawCell, RawCellValue, RawColumn, RawPrintSettings, RawRange, RawRow, R
|
|
|
22
22
|
import { SheetWriteContext, buildWorksheetSubstream } from "./workbook/sheet-writer.js";
|
|
23
23
|
import { writeXls, writeXlsContent } from "./write.js";
|
|
24
24
|
export * from "excel-number-format";
|
|
25
|
-
export { BIFF8_VERSION, BOF_TYPE_CHART, BOF_TYPE_MACRO, BOF_TYPE_WORKBOOK, BOF_TYPE_WORKSHEET, BiffFormatError, BiffRecord, BiffWriteError, BlockCursor, CellFormat, CellXfPlanEntry, GENERAL_CELL_XF_INDEX, MAX_RECORD_DATA_SIZE, RECORD_ARRAY, RECORD_BLANK, RECORD_BOF, RECORD_BOOLERR, RECORD_BOTTOMMARGIN, RECORD_BOUNDSHEET8, RECORD_CALCCOUNT, RECORD_CALCDELTA, RECORD_CALCITER, RECORD_CALCREFMODE, RECORD_CALCSAVERECALC, RECORD_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, 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, HEADER_SIZE, 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, 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,5 +1,5 @@
|
|
|
1
|
-
import { BIFF8_VERSION, BOF_TYPE_CHART, BOF_TYPE_MACRO, BOF_TYPE_WORKBOOK, BOF_TYPE_WORKSHEET, MAX_RECORD_DATA_SIZE, RECORD_ARRAY, RECORD_BLANK, RECORD_BOF, RECORD_BOOLERR, RECORD_BOTTOMMARGIN, RECORD_BOUNDSHEET8, RECORD_CALCCOUNT, RECORD_CALCDELTA, RECORD_CALCITER, RECORD_CALCREFMODE, RECORD_CALCSAVERECALC, RECORD_CF, RECORD_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 } from "./biff/record-types.js";
|
|
2
|
-
import { BiffFormatError, readRecords } from "./biff/records.js";
|
|
1
|
+
import { BIFF8_VERSION, BOF_TYPE_CHART, BOF_TYPE_MACRO, BOF_TYPE_WORKBOOK, BOF_TYPE_WORKSHEET, MAX_RECORD_DATA_SIZE, RECORD_ARRAY, RECORD_BLANK, RECORD_BOF, RECORD_BOOLERR, RECORD_BOTTOMMARGIN, RECORD_BOUNDSHEET8, RECORD_CALCCOUNT, RECORD_CALCDELTA, RECORD_CALCITER, RECORD_CALCREFMODE, RECORD_CALCSAVERECALC, RECORD_CF, RECORD_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 } from "./biff/record-types.js";
|
|
2
|
+
import { BiffFormatError, HEADER_SIZE, 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";
|
|
@@ -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_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, 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, HEADER_SIZE, 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, RecordBuilder, SUMMARY_INFORMATION_STREAM, buildWorkbookGlobals, buildWorksheetSubstream, columnWidthToPoints, concatRecords, decodeRkNumber, errorCodeOf, errorTextOf, formatCodeOf, groupRecords, inchesToPoints, isXlsFile, isoDateTimeToSerial, isoDateToSerial, isoTimeToSerial, layoutMetadataToSummaryInformation, millimetresToPoints, pointsToColumnWidth, pointsToInches, pointsToTwips, readRecords, readRichExtendedString, readSheetRecords, readShortXLUnicodeString, readWorkbookGlobals, readWorkbookStreams, readXLUnicodeString, readXLUnicodeStringNoCch, readXls, readXlsContent, recordByteLength, serialToIsoDate, serialToIsoDateTime, serialToIsoTime, splitSubstreams, twipsToPoints, writeBofData, writeCellXfRecord, writeFontRecord, writeFormatRecord, writePaletteRecord, writeRecord, writeRichExtendedString, writeShortXLUnicodeString, writeStyleRecord, writeStyleXfRecord, writeXLUnicodeString, writeXls, writeXlsContent };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as RecordGroup } from "./substreams-
|
|
1
|
+
import { t as RecordGroup } from "./substreams-CHv3oWmn.cjs";
|
|
2
2
|
import { ContentSheetPrintRange, ContentSheetRepeatRange } from "document-schema.js";
|
|
3
3
|
//#region src/workbook/print-names.d.ts
|
|
4
4
|
/** One sheet's print names, as the Lbl records of the globals substream carry them. Every field is absent when the workbook declares no such name for that sheet. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as RecordGroup } from "./substreams-
|
|
1
|
+
import { t as RecordGroup } from "./substreams-Dp5cZoUo.js";
|
|
2
2
|
import { ContentSheetPrintRange, ContentSheetRepeatRange } from "document-schema.js";
|
|
3
3
|
//#region src/workbook/print-names.d.ts
|
|
4
4
|
/** One sheet's print names, as the Lbl records of the globals substream carry them. Every field is absent when the workbook declares no such name for that sheet. */
|
|
@@ -10,6 +10,8 @@ interface BiffRecord {
|
|
|
10
10
|
declare class BiffFormatError extends Error {
|
|
11
11
|
constructor(message: string);
|
|
12
12
|
}
|
|
13
|
+
/** 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. */
|
|
14
|
+
declare const HEADER_SIZE = 4;
|
|
13
15
|
/**
|
|
14
16
|
* Splits a BIFF record stream into its records, in stream order.
|
|
15
17
|
*
|
|
@@ -17,4 +19,4 @@ declare class BiffFormatError extends Error {
|
|
|
17
19
|
*/
|
|
18
20
|
declare function readRecords(stream: Uint8Array<ArrayBuffer>): readonly BiffRecord[];
|
|
19
21
|
//#endregion
|
|
20
|
-
export { BiffRecord as n,
|
|
22
|
+
export { readRecords as i, BiffRecord as n, HEADER_SIZE as r, BiffFormatError as t };
|
|
@@ -10,6 +10,8 @@ interface BiffRecord {
|
|
|
10
10
|
declare class BiffFormatError extends Error {
|
|
11
11
|
constructor(message: string);
|
|
12
12
|
}
|
|
13
|
+
/** 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. */
|
|
14
|
+
declare const HEADER_SIZE = 4;
|
|
13
15
|
/**
|
|
14
16
|
* Splits a BIFF record stream into its records, in stream order.
|
|
15
17
|
*
|
|
@@ -17,4 +19,4 @@ declare class BiffFormatError extends Error {
|
|
|
17
19
|
*/
|
|
18
20
|
declare function readRecords(stream: Uint8Array<ArrayBuffer>): readonly BiffRecord[];
|
|
19
21
|
//#endregion
|
|
20
|
-
export { BiffRecord as n,
|
|
22
|
+
export { readRecords as i, BiffRecord as n, HEADER_SIZE as r, BiffFormatError as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as BiffRecord } from "./records-
|
|
1
|
+
import { n as BiffRecord } from "./records-G82UEVq8.cjs";
|
|
2
2
|
//#region src/biff/substreams.d.ts
|
|
3
3
|
/** One logical record: its type, its data blocks -- the base record's, then one per Continue that followed it -- and the base record's own offset in the stream. */
|
|
4
4
|
interface RecordGroup {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as BiffRecord } from "./records-
|
|
1
|
+
import { n as BiffRecord } from "./records-G82UEVq8.js";
|
|
2
2
|
//#region src/biff/substreams.d.ts
|
|
3
3
|
/** One logical record: its type, its data blocks -- the base record's, then one per Continue that followed it -- and the base record's own offset in the stream. */
|
|
4
4
|
interface RecordGroup {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as RecordGroup } from "../substreams-
|
|
1
|
+
import { t as RecordGroup } from "../substreams-CHv3oWmn.cjs";
|
|
2
2
|
import { ContentSheetCellComment } from "document-schema.js";
|
|
3
3
|
//#region src/workbook/comments.d.ts
|
|
4
4
|
/** One comment, resolved to the cell position it is anchored to. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as RecordGroup } from "../substreams-
|
|
1
|
+
import { t as RecordGroup } from "../substreams-Dp5cZoUo.js";
|
|
2
2
|
import { ContentSheetCellComment } from "document-schema.js";
|
|
3
3
|
//#region src/workbook/comments.d.ts
|
|
4
4
|
/** One comment, resolved to the cell position it is anchored to. */
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as RawConditionalFormat12, c as RawSimpleFilterFormat, d as RawTop10Format, f as readCondFmt12Group, i as RawColorScaleFormat, l as RawTimePeriod, n as RawAboveAverageFormat, o as RawDataBarFormat, r as RawCfColor, s as RawIconSetFormat, t as CondFmt12GroupResult, u as RawTimePeriodFormat } from "../conditional-format-12-
|
|
1
|
+
import { a as RawConditionalFormat12, c as RawSimpleFilterFormat, d as RawTop10Format, f as readCondFmt12Group, i as RawColorScaleFormat, l as RawTimePeriod, n as RawAboveAverageFormat, o as RawDataBarFormat, r as RawCfColor, s as RawIconSetFormat, t as CondFmt12GroupResult, u as RawTimePeriodFormat } from "../conditional-format-12-DBhe7Zo6.cjs";
|
|
2
2
|
export { CondFmt12GroupResult, RawAboveAverageFormat, RawCfColor, RawColorScaleFormat, RawConditionalFormat12, RawDataBarFormat, RawIconSetFormat, RawSimpleFilterFormat, RawTimePeriod, RawTimePeriodFormat, RawTop10Format, readCondFmt12Group };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as RawConditionalFormat12, c as RawSimpleFilterFormat, d as RawTop10Format, f as readCondFmt12Group, i as RawColorScaleFormat, l as RawTimePeriod, n as RawAboveAverageFormat, o as RawDataBarFormat, r as RawCfColor, s as RawIconSetFormat, t as CondFmt12GroupResult, u as RawTimePeriodFormat } from "../conditional-format-12-
|
|
1
|
+
import { a as RawConditionalFormat12, c as RawSimpleFilterFormat, d as RawTop10Format, f as readCondFmt12Group, i as RawColorScaleFormat, l as RawTimePeriod, n as RawAboveAverageFormat, o as RawDataBarFormat, r as RawCfColor, s as RawIconSetFormat, t as CondFmt12GroupResult, u as RawTimePeriodFormat } from "../conditional-format-12-D-X5g_O3.js";
|
|
2
2
|
export { CondFmt12GroupResult, RawAboveAverageFormat, RawCfColor, RawColorScaleFormat, RawConditionalFormat12, RawDataBarFormat, RawIconSetFormat, RawSimpleFilterFormat, RawTimePeriod, RawTimePeriodFormat, RawTop10Format, readCondFmt12Group };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as parseDxfStyle, i as RawConditionalFormatStyle, n as RawConditionalFormat, o as readCondFmtGroup, r as RawConditionalFormatFill, t as CondFmtGroupResult } from "../conditional-format-
|
|
1
|
+
import { a as parseDxfStyle, i as RawConditionalFormatStyle, n as RawConditionalFormat, o as readCondFmtGroup, r as RawConditionalFormatFill, t as CondFmtGroupResult } from "../conditional-format-Czh2oTzQ.cjs";
|
|
2
2
|
export { CondFmtGroupResult, RawConditionalFormat, RawConditionalFormatFill, RawConditionalFormatStyle, parseDxfStyle, readCondFmtGroup };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as parseDxfStyle, i as RawConditionalFormatStyle, n as RawConditionalFormat, o as readCondFmtGroup, r as RawConditionalFormatFill, t as CondFmtGroupResult } from "../conditional-format-
|
|
1
|
+
import { a as parseDxfStyle, i as RawConditionalFormatStyle, n as RawConditionalFormat, o as readCondFmtGroup, r as RawConditionalFormatFill, t as CondFmtGroupResult } from "../conditional-format-DOdazxWe.js";
|
|
2
2
|
export { CondFmtGroupResult, RawConditionalFormat, RawConditionalFormatFill, RawConditionalFormatStyle, parseDxfStyle, readCondFmtGroup };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as readDv, t as RawDataValidation } from "../data-validation-
|
|
1
|
+
import { n as readDv, t as RawDataValidation } from "../data-validation-DfpjUN-N.cjs";
|
|
2
2
|
export { RawDataValidation, readDv };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as readDv, t as RawDataValidation } from "../data-validation-
|
|
1
|
+
import { n as readDv, t as RawDataValidation } from "../data-validation-BXvIVU0e.js";
|
|
2
2
|
export { RawDataValidation, readDv };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_biff_record_types = require("../biff/record-types.cjs");
|
|
3
|
+
const require_biff_records = require("../biff/records.cjs");
|
|
4
|
+
const require_biff_cursor = require("../biff/cursor.cjs");
|
|
5
|
+
let archive_codec = require("archive-codec");
|
|
6
|
+
//#region src/workbook/encryption.ts
|
|
7
|
+
/** [MS-XLS] 2.4.117's own wEncryptionType: RC4 encryption, as opposed to 0x0000 (XOR obfuscation, out of scope). */
|
|
8
|
+
const ENCRYPTION_TYPE_RC4 = 1;
|
|
9
|
+
/** [MS-OFFCRYPTO] 2.3.6.1's own EncryptionVersionInfo: vMajor/vMinor MUST both be 1 for the "RC4 encryption header" this module reads. vMajor 2/3/4 with vMinor 2 names the RC4 CryptoAPI encryption header instead (2.3.5.1), a different, unimplemented header shape. */
|
|
10
|
+
const RC4_HEADER_VERSION_MAJOR = 1;
|
|
11
|
+
const RC4_HEADER_VERSION_MINOR = 1;
|
|
12
|
+
/** The first four bytes of a BoundSheet8 record's own data ([MS-XLS] 2.4.28): lbPlyPos, the one field [MS-XLS] 2.2.10 names as never encrypted even though the rest of the record is. */
|
|
13
|
+
const BOUNDSHEET8_LBPLYPOS_SIZE = 4;
|
|
14
|
+
/** [MS-XLS] 2.2.10's own list of records that "MUST NOT be obfuscated or encrypted" wherever they occur in the workbook stream -- BOF and FilePass are checked ahead of this set by their callers, since both matter beyond encryption too. */
|
|
15
|
+
const NEVER_ENCRYPTED_RECORD_TYPES = /* @__PURE__ */ new Set([
|
|
16
|
+
require_biff_record_types.RECORD_BOF,
|
|
17
|
+
47,
|
|
18
|
+
404,
|
|
19
|
+
405,
|
|
20
|
+
225,
|
|
21
|
+
406,
|
|
22
|
+
312
|
|
23
|
+
]);
|
|
24
|
+
/** Reads FilePass's own fields, rejecting the two encryption schemes this module does not implement with a specific message rather than a generic parse failure. */
|
|
25
|
+
function readFilePassRc4Header(filePassRecord) {
|
|
26
|
+
const cursor = new require_biff_cursor.BlockCursor([filePassRecord.data]);
|
|
27
|
+
const encryptionType = cursor.u16();
|
|
28
|
+
if (encryptionType !== ENCRYPTION_TYPE_RC4) throw new require_biff_records.BiffFormatError(`workbook uses FilePass wEncryptionType 0x${encryptionType.toString(16).padStart(4, "0")} (XOR obfuscation), which this reader does not decrypt`);
|
|
29
|
+
const versionMajor = cursor.u16();
|
|
30
|
+
const versionMinor = cursor.u16();
|
|
31
|
+
if (versionMajor !== RC4_HEADER_VERSION_MAJOR || versionMinor !== RC4_HEADER_VERSION_MINOR) throw new require_biff_records.BiffFormatError(`workbook uses RC4 CryptoAPI encryption (EncryptionVersionInfo ${versionMajor}.${versionMinor}), which this reader does not decrypt`);
|
|
32
|
+
return {
|
|
33
|
+
salt: cursor.take(archive_codec.OFFICE_RC4_VERIFIER_LENGTH),
|
|
34
|
+
encryptedVerifier: cursor.take(archive_codec.OFFICE_RC4_VERIFIER_LENGTH),
|
|
35
|
+
encryptedVerifierHash: cursor.take(archive_codec.OFFICE_RC4_VERIFIER_LENGTH)
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/** [MS-OFFCRYPTO] 2.3.6.4's own password verification: block 0's key decrypts EncryptedVerifier, and MD5 of the result must equal the same block's decryption of EncryptedVerifierHash. Both verifier fields sit in one continuous keystream starting at position 0, not two independently-reset ones -- though decryptOfficeRc4 regenerates its keystream fresh from block start on every call regardless, so decrypting them as two separate 16-byte calls at offsets 0 and 16 is equivalent to one 32-byte call, not merely close to it. */
|
|
39
|
+
function verifyOfficeRc4Password(baseHash, header) {
|
|
40
|
+
const decryptedVerifier = (0, archive_codec.decryptOfficeRc4)(baseHash, 0, header.encryptedVerifier);
|
|
41
|
+
const decryptedVerifierHash = (0, archive_codec.decryptOfficeRc4)(baseHash, archive_codec.OFFICE_RC4_VERIFIER_LENGTH, header.encryptedVerifierHash);
|
|
42
|
+
const computedHash = (0, archive_codec.md5)(decryptedVerifier);
|
|
43
|
+
if (!(computedHash.length === decryptedVerifierHash.length && computedHash.every((byte, index) => byte === decryptedVerifierHash[index]))) throw new require_biff_records.BiffFormatError("incorrect password for RC4-encrypted workbook");
|
|
44
|
+
}
|
|
45
|
+
/** Decrypts one record's own data in place against the derived base hash, honouring every [MS-XLS] 2.2.10 exclusion: a never-encrypted record's data is returned unchanged, BoundSheet8's own lbPlyPos prefix is preserved while the rest of its data is decrypted, and everything else is decrypted whole. `record.offset` is the record's own header start, so its data begins `HEADER_SIZE` bytes further into the stream -- the position [MS-OFFCRYPTO]'s block-keyed keystream is defined against. */
|
|
46
|
+
function decryptRecord(record, baseHash) {
|
|
47
|
+
if (NEVER_ENCRYPTED_RECORD_TYPES.has(record.type)) return record;
|
|
48
|
+
const dataOffset = record.offset + 4;
|
|
49
|
+
if (record.type === 133) {
|
|
50
|
+
const lbPlyPos = record.data.subarray(0, BOUNDSHEET8_LBPLYPOS_SIZE);
|
|
51
|
+
const decryptedRest = (0, archive_codec.decryptOfficeRc4)(baseHash, dataOffset + BOUNDSHEET8_LBPLYPOS_SIZE, record.data.subarray(BOUNDSHEET8_LBPLYPOS_SIZE));
|
|
52
|
+
const data = new Uint8Array(record.data.length);
|
|
53
|
+
data.set(lbPlyPos, 0);
|
|
54
|
+
data.set(decryptedRest, BOUNDSHEET8_LBPLYPOS_SIZE);
|
|
55
|
+
return {
|
|
56
|
+
...record,
|
|
57
|
+
data
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
return {
|
|
61
|
+
...record,
|
|
62
|
+
data: (0, archive_codec.decryptOfficeRc4)(baseHash, dataOffset, record.data)
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Decrypts every record of a workbook stream protected by [MS-OFFCRYPTO] 2.3.6.1's RC4 encryption header, given the `FilePass` record already located within `records` and the password to decrypt it with.
|
|
67
|
+
*
|
|
68
|
+
* Throws `BiffFormatError` for a missing password, an incorrect one, or an encryption scheme this module does not implement (RC4 CryptoAPI, XOR obfuscation) -- there is no partial or best-effort result to return in any of those cases.
|
|
69
|
+
*/
|
|
70
|
+
function decryptWorkbookRecords(records, filePassRecord, password) {
|
|
71
|
+
const header = readFilePassRc4Header(filePassRecord);
|
|
72
|
+
if (password === void 0) throw new require_biff_records.BiffFormatError("workbook is RC4-encrypted (FilePass record); call readXlsContent with a password to decrypt it");
|
|
73
|
+
const baseHash = (0, archive_codec.deriveOfficeRc4BaseHash)(password, header.salt);
|
|
74
|
+
verifyOfficeRc4Password(baseHash, header);
|
|
75
|
+
return records.map((record) => decryptRecord(record, baseHash));
|
|
76
|
+
}
|
|
77
|
+
//#endregion
|
|
78
|
+
exports.decryptWorkbookRecords = decryptWorkbookRecords;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { n as BiffRecord } from "../records-G82UEVq8.cjs";
|
|
2
|
+
//#region src/workbook/encryption.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Decrypts every record of a workbook stream protected by [MS-OFFCRYPTO] 2.3.6.1's RC4 encryption header, given the `FilePass` record already located within `records` and the password to decrypt it with.
|
|
5
|
+
*
|
|
6
|
+
* Throws `BiffFormatError` for a missing password, an incorrect one, or an encryption scheme this module does not implement (RC4 CryptoAPI, XOR obfuscation) -- there is no partial or best-effort result to return in any of those cases.
|
|
7
|
+
*/
|
|
8
|
+
declare function decryptWorkbookRecords(records: readonly BiffRecord[], filePassRecord: BiffRecord, password: string | undefined): readonly BiffRecord[];
|
|
9
|
+
//#endregion
|
|
10
|
+
export { decryptWorkbookRecords };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { n as BiffRecord } from "../records-G82UEVq8.js";
|
|
2
|
+
//#region src/workbook/encryption.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Decrypts every record of a workbook stream protected by [MS-OFFCRYPTO] 2.3.6.1's RC4 encryption header, given the `FilePass` record already located within `records` and the password to decrypt it with.
|
|
5
|
+
*
|
|
6
|
+
* Throws `BiffFormatError` for a missing password, an incorrect one, or an encryption scheme this module does not implement (RC4 CryptoAPI, XOR obfuscation) -- there is no partial or best-effort result to return in any of those cases.
|
|
7
|
+
*/
|
|
8
|
+
declare function decryptWorkbookRecords(records: readonly BiffRecord[], filePassRecord: BiffRecord, password: string | undefined): readonly BiffRecord[];
|
|
9
|
+
//#endregion
|
|
10
|
+
export { decryptWorkbookRecords };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { RECORD_BOF } from "../biff/record-types.js";
|
|
2
|
+
import { BiffFormatError } from "../biff/records.js";
|
|
3
|
+
import { BlockCursor } from "../biff/cursor.js";
|
|
4
|
+
import { OFFICE_RC4_VERIFIER_LENGTH, decryptOfficeRc4, deriveOfficeRc4BaseHash, md5 } from "archive-codec";
|
|
5
|
+
//#region src/workbook/encryption.ts
|
|
6
|
+
/** [MS-XLS] 2.4.117's own wEncryptionType: RC4 encryption, as opposed to 0x0000 (XOR obfuscation, out of scope). */
|
|
7
|
+
const ENCRYPTION_TYPE_RC4 = 1;
|
|
8
|
+
/** [MS-OFFCRYPTO] 2.3.6.1's own EncryptionVersionInfo: vMajor/vMinor MUST both be 1 for the "RC4 encryption header" this module reads. vMajor 2/3/4 with vMinor 2 names the RC4 CryptoAPI encryption header instead (2.3.5.1), a different, unimplemented header shape. */
|
|
9
|
+
const RC4_HEADER_VERSION_MAJOR = 1;
|
|
10
|
+
const RC4_HEADER_VERSION_MINOR = 1;
|
|
11
|
+
/** The first four bytes of a BoundSheet8 record's own data ([MS-XLS] 2.4.28): lbPlyPos, the one field [MS-XLS] 2.2.10 names as never encrypted even though the rest of the record is. */
|
|
12
|
+
const BOUNDSHEET8_LBPLYPOS_SIZE = 4;
|
|
13
|
+
/** [MS-XLS] 2.2.10's own list of records that "MUST NOT be obfuscated or encrypted" wherever they occur in the workbook stream -- BOF and FilePass are checked ahead of this set by their callers, since both matter beyond encryption too. */
|
|
14
|
+
const NEVER_ENCRYPTED_RECORD_TYPES = /* @__PURE__ */ new Set([
|
|
15
|
+
RECORD_BOF,
|
|
16
|
+
47,
|
|
17
|
+
404,
|
|
18
|
+
405,
|
|
19
|
+
225,
|
|
20
|
+
406,
|
|
21
|
+
312
|
|
22
|
+
]);
|
|
23
|
+
/** Reads FilePass's own fields, rejecting the two encryption schemes this module does not implement with a specific message rather than a generic parse failure. */
|
|
24
|
+
function readFilePassRc4Header(filePassRecord) {
|
|
25
|
+
const cursor = new BlockCursor([filePassRecord.data]);
|
|
26
|
+
const encryptionType = cursor.u16();
|
|
27
|
+
if (encryptionType !== ENCRYPTION_TYPE_RC4) throw new BiffFormatError(`workbook uses FilePass wEncryptionType 0x${encryptionType.toString(16).padStart(4, "0")} (XOR obfuscation), which this reader does not decrypt`);
|
|
28
|
+
const versionMajor = cursor.u16();
|
|
29
|
+
const versionMinor = cursor.u16();
|
|
30
|
+
if (versionMajor !== RC4_HEADER_VERSION_MAJOR || versionMinor !== RC4_HEADER_VERSION_MINOR) throw new BiffFormatError(`workbook uses RC4 CryptoAPI encryption (EncryptionVersionInfo ${versionMajor}.${versionMinor}), which this reader does not decrypt`);
|
|
31
|
+
return {
|
|
32
|
+
salt: cursor.take(OFFICE_RC4_VERIFIER_LENGTH),
|
|
33
|
+
encryptedVerifier: cursor.take(OFFICE_RC4_VERIFIER_LENGTH),
|
|
34
|
+
encryptedVerifierHash: cursor.take(OFFICE_RC4_VERIFIER_LENGTH)
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
/** [MS-OFFCRYPTO] 2.3.6.4's own password verification: block 0's key decrypts EncryptedVerifier, and MD5 of the result must equal the same block's decryption of EncryptedVerifierHash. Both verifier fields sit in one continuous keystream starting at position 0, not two independently-reset ones -- though decryptOfficeRc4 regenerates its keystream fresh from block start on every call regardless, so decrypting them as two separate 16-byte calls at offsets 0 and 16 is equivalent to one 32-byte call, not merely close to it. */
|
|
38
|
+
function verifyOfficeRc4Password(baseHash, header) {
|
|
39
|
+
const decryptedVerifier = decryptOfficeRc4(baseHash, 0, header.encryptedVerifier);
|
|
40
|
+
const decryptedVerifierHash = decryptOfficeRc4(baseHash, OFFICE_RC4_VERIFIER_LENGTH, header.encryptedVerifierHash);
|
|
41
|
+
const computedHash = md5(decryptedVerifier);
|
|
42
|
+
if (!(computedHash.length === decryptedVerifierHash.length && computedHash.every((byte, index) => byte === decryptedVerifierHash[index]))) throw new BiffFormatError("incorrect password for RC4-encrypted workbook");
|
|
43
|
+
}
|
|
44
|
+
/** Decrypts one record's own data in place against the derived base hash, honouring every [MS-XLS] 2.2.10 exclusion: a never-encrypted record's data is returned unchanged, BoundSheet8's own lbPlyPos prefix is preserved while the rest of its data is decrypted, and everything else is decrypted whole. `record.offset` is the record's own header start, so its data begins `HEADER_SIZE` bytes further into the stream -- the position [MS-OFFCRYPTO]'s block-keyed keystream is defined against. */
|
|
45
|
+
function decryptRecord(record, baseHash) {
|
|
46
|
+
if (NEVER_ENCRYPTED_RECORD_TYPES.has(record.type)) return record;
|
|
47
|
+
const dataOffset = record.offset + 4;
|
|
48
|
+
if (record.type === 133) {
|
|
49
|
+
const lbPlyPos = record.data.subarray(0, BOUNDSHEET8_LBPLYPOS_SIZE);
|
|
50
|
+
const decryptedRest = decryptOfficeRc4(baseHash, dataOffset + BOUNDSHEET8_LBPLYPOS_SIZE, record.data.subarray(BOUNDSHEET8_LBPLYPOS_SIZE));
|
|
51
|
+
const data = new Uint8Array(record.data.length);
|
|
52
|
+
data.set(lbPlyPos, 0);
|
|
53
|
+
data.set(decryptedRest, BOUNDSHEET8_LBPLYPOS_SIZE);
|
|
54
|
+
return {
|
|
55
|
+
...record,
|
|
56
|
+
data
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
...record,
|
|
61
|
+
data: decryptOfficeRc4(baseHash, dataOffset, record.data)
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Decrypts every record of a workbook stream protected by [MS-OFFCRYPTO] 2.3.6.1's RC4 encryption header, given the `FilePass` record already located within `records` and the password to decrypt it with.
|
|
66
|
+
*
|
|
67
|
+
* Throws `BiffFormatError` for a missing password, an incorrect one, or an encryption scheme this module does not implement (RC4 CryptoAPI, XOR obfuscation) -- there is no partial or best-effort result to return in any of those cases.
|
|
68
|
+
*/
|
|
69
|
+
function decryptWorkbookRecords(records, filePassRecord, password) {
|
|
70
|
+
const header = readFilePassRc4Header(filePassRecord);
|
|
71
|
+
if (password === void 0) throw new BiffFormatError("workbook is RC4-encrypted (FilePass record); call readXlsContent with a password to decrypt it");
|
|
72
|
+
const baseHash = deriveOfficeRc4BaseHash(password, header.salt);
|
|
73
|
+
verifyOfficeRc4Password(baseHash, header);
|
|
74
|
+
return records.map((record) => decryptRecord(record, baseHash));
|
|
75
|
+
}
|
|
76
|
+
//#endregion
|
|
77
|
+
export { decryptWorkbookRecords };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { E as XfDecorationFields } from "../xf-colors-mqerVt2O.cjs";
|
|
2
|
-
import { t as PrintNamePlanEntry } from "../print-names-
|
|
2
|
+
import { t as PrintNamePlanEntry } from "../print-names-CCwUHAoL.cjs";
|
|
3
3
|
import { Alignment, Color } from "document-schema.js";
|
|
4
4
|
//#region src/workbook/globals-writer.d.ts
|
|
5
5
|
/** [MS-XLS] 2.1.7.20.3's own XFS production requires at least sixteen XF records before any cell can reference one: BUILTIN_STYLES.length built-in cell styles, then at least one cell XF -- the "General, no declared format" one every workbook needs unconditionally, written immediately after them. Derived from BUILTIN_STYLES's own length rather than restated as a literal, so the two can never drift apart. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { E as XfDecorationFields } from "../xf-colors-d3OvRw76.js";
|
|
2
|
-
import { t as PrintNamePlanEntry } from "../print-names-
|
|
2
|
+
import { t as PrintNamePlanEntry } from "../print-names-CxAbgcjB.js";
|
|
3
3
|
import { Alignment, Color } from "document-schema.js";
|
|
4
4
|
//#region src/workbook/globals-writer.d.ts
|
|
5
5
|
/** [MS-XLS] 2.1.7.20.3's own XFS production requires at least sixteen XF records before any cell can reference one: BUILTIN_STYLES.length built-in cell styles, then at least one cell XF -- the "General, no declared format" one every workbook needs unconditionally, written immediately after them. Derived from BUILTIN_STYLES's own length rather than restated as a literal, so the two can never drift apart. */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as SheetRange, t as ExternalSheetLabel } from "../ptg-CCBbJLZJ.cjs";
|
|
2
|
-
import { t as RecordGroup } from "../substreams-
|
|
2
|
+
import { t as RecordGroup } from "../substreams-CHv3oWmn.cjs";
|
|
3
3
|
import { E as XfDecorationFields, w as XfAlignmentFields } from "../xf-colors-mqerVt2O.cjs";
|
|
4
|
-
import { n as SheetPrintNames } from "../print-names-
|
|
4
|
+
import { n as SheetPrintNames } from "../print-names-CCwUHAoL.cjs";
|
|
5
5
|
import { Color } from "document-schema.js";
|
|
6
6
|
//#region src/workbook/globals.d.ts
|
|
7
7
|
/** One sheet, as its BoundSheet8 record describes it ([MS-XLS] 2.4.28). */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as SheetRange, t as ExternalSheetLabel } from "../ptg-CCBbJLZJ.js";
|
|
2
|
-
import { t as RecordGroup } from "../substreams-
|
|
2
|
+
import { t as RecordGroup } from "../substreams-Dp5cZoUo.js";
|
|
3
3
|
import { E as XfDecorationFields, w as XfAlignmentFields } from "../xf-colors-d3OvRw76.js";
|
|
4
|
-
import { n as SheetPrintNames } from "../print-names-
|
|
4
|
+
import { n as SheetPrintNames } from "../print-names-CxAbgcjB.js";
|
|
5
5
|
import { Color } from "document-schema.js";
|
|
6
6
|
//#region src/workbook/globals.d.ts
|
|
7
7
|
/** One sheet, as its BoundSheet8 record describes it ([MS-XLS] 2.4.28). */
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as writePrintNameRecords, i as readPrintNames, n as SheetPrintNames, r as printNameEntriesFor, t as PrintNamePlanEntry } from "../print-names-
|
|
1
|
+
import { a as writePrintNameRecords, i as readPrintNames, n as SheetPrintNames, r as printNameEntriesFor, t as PrintNamePlanEntry } from "../print-names-CCwUHAoL.cjs";
|
|
2
2
|
export { PrintNamePlanEntry, SheetPrintNames, printNameEntriesFor, readPrintNames, writePrintNameRecords };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as writePrintNameRecords, i as readPrintNames, n as SheetPrintNames, r as printNameEntriesFor, t as PrintNamePlanEntry } from "../print-names-
|
|
1
|
+
import { a as writePrintNameRecords, i as readPrintNames, n as SheetPrintNames, r as printNameEntriesFor, t as PrintNamePlanEntry } from "../print-names-CxAbgcjB.js";
|
|
2
2
|
export { PrintNamePlanEntry, SheetPrintNames, printNameEntriesFor, readPrintNames, writePrintNameRecords };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { n as SetupFields } from "../print-setup-B_ihDvm5.cjs";
|
|
2
2
|
import { r as FormulaSheetContext } from "../ptg-CCBbJLZJ.cjs";
|
|
3
|
-
import { t as RecordGroup } from "../substreams-
|
|
4
|
-
import { n as RawConditionalFormat } from "../conditional-format-
|
|
5
|
-
import { a as RawConditionalFormat12 } from "../conditional-format-12-
|
|
6
|
-
import { t as RawDataValidation } from "../data-validation-
|
|
3
|
+
import { t as RecordGroup } from "../substreams-CHv3oWmn.cjs";
|
|
4
|
+
import { n as RawConditionalFormat } from "../conditional-format-Czh2oTzQ.cjs";
|
|
5
|
+
import { a as RawConditionalFormat12 } from "../conditional-format-12-DBhe7Zo6.cjs";
|
|
6
|
+
import { t as RawDataValidation } from "../data-validation-DfpjUN-N.cjs";
|
|
7
7
|
//#region src/workbook/sheet.d.ts
|
|
8
8
|
/** A cell's value as its own record carries it, before number-format classification decides whether a number is really a date, a percentage, or an amount of money. */
|
|
9
9
|
type RawCellValue = {
|
package/dist/workbook/sheet.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { n as SetupFields } from "../print-setup-B_ihDvm5.js";
|
|
2
2
|
import { r as FormulaSheetContext } from "../ptg-CCBbJLZJ.js";
|
|
3
|
-
import { t as RecordGroup } from "../substreams-
|
|
4
|
-
import { n as RawConditionalFormat } from "../conditional-format-
|
|
5
|
-
import { a as RawConditionalFormat12 } from "../conditional-format-12-
|
|
6
|
-
import { t as RawDataValidation } from "../data-validation-
|
|
3
|
+
import { t as RecordGroup } from "../substreams-Dp5cZoUo.js";
|
|
4
|
+
import { n as RawConditionalFormat } from "../conditional-format-DOdazxWe.js";
|
|
5
|
+
import { a as RawConditionalFormat12 } from "../conditional-format-12-D-X5g_O3.js";
|
|
6
|
+
import { t as RawDataValidation } from "../data-validation-BXvIVU0e.js";
|
|
7
7
|
//#region src/workbook/sheet.d.ts
|
|
8
8
|
/** A cell's value as its own record carries it, before number-format classification decides whether a number is really a date, a percentage, or an amount of money. */
|
|
9
9
|
type RawCellValue = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xls-codec",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.7.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": {
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
},
|
|
71
71
|
"packageManager": "pnpm@11.6.0",
|
|
72
72
|
"dependencies": {
|
|
73
|
-
"archive-codec": "^1.
|
|
73
|
+
"archive-codec": "^1.7.0",
|
|
74
74
|
"document-schema.js": "^7.3.0",
|
|
75
75
|
"excel-number-format": "^1.1.0"
|
|
76
76
|
},
|