xls-codec 4.4.0 → 4.6.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 +5 -3
- package/dist/biff/record-types.cjs +9 -0
- package/dist/biff/record-types.d.cts +7 -1
- package/dist/biff/record-types.d.ts +7 -1
- package/dist/biff/record-types.js +7 -1
- package/dist/biff/substreams.cjs +8 -0
- package/dist/biff/substreams.js +8 -0
- package/dist/biff/xf-colors.cjs +61 -0
- package/dist/biff/xf-colors.d.cts +2 -2
- package/dist/biff/xf-colors.d.ts +2 -2
- package/dist/biff/xf-colors.js +61 -1
- package/dist/biff/xf-writer.d.cts +1 -1
- package/dist/biff/xf-writer.d.ts +1 -1
- package/dist/conditional-format-12-DPNiYLVp.d.cts +76 -0
- package/dist/conditional-format-12-DyqonR1G.d.ts +76 -0
- package/dist/{conditional-format-BV2313jL.d.ts → conditional-format-CWlz0Ty6.d.ts} +2 -1
- package/dist/{conditional-format-DUQuOrNW.d.cts → conditional-format-S9NaPjhr.d.cts} +2 -1
- package/dist/content.cjs +103 -1
- package/dist/content.js +104 -2
- package/dist/index.cjs +3 -0
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/workbook/conditional-format-12.cjs +331 -0
- package/dist/workbook/conditional-format-12.d.cts +2 -0
- package/dist/workbook/conditional-format-12.d.ts +2 -0
- package/dist/workbook/conditional-format-12.js +330 -0
- package/dist/workbook/conditional-format.cjs +1 -0
- package/dist/workbook/conditional-format.d.cts +2 -2
- package/dist/workbook/conditional-format.d.ts +2 -2
- package/dist/workbook/conditional-format.js +1 -1
- package/dist/workbook/globals-writer.d.cts +1 -1
- package/dist/workbook/globals-writer.d.ts +1 -1
- package/dist/workbook/globals.d.cts +1 -1
- package/dist/workbook/globals.d.ts +1 -1
- package/dist/workbook/sheet.cjs +11 -1
- package/dist/workbook/sheet.d.cts +3 -1
- package/dist/workbook/sheet.d.ts +3 -1
- package/dist/workbook/sheet.js +11 -1
- package/dist/{xf-colors--5oxSeI1.d.ts → xf-colors-d3OvRw76.d.ts} +7 -1
- package/dist/{xf-colors-BB5MKq6R.d.cts → xf-colors-mqerVt2O.d.cts} +7 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -37,7 +37,7 @@ What `writeXlsContent`/`writeXls` cover: every `ContentCellValue` kind a real `.
|
|
|
37
37
|
| An `empty`-kind cell carrying no formatting | Written as nothing at all, which is what round-trips: `content.ts`'s reader drops an unformatted blank cell it reads, and a merged range's empty anchor is independently reconstructed from `MergeCells` alone. A formatted one (a fill, a border, or a non-default alignment) is the opposite case — its formatting exists only in the `XF` a cell record names, so it gets a real `Blank` record ([MS-XLS] 2.4.20) and round-trips with that formatting intact. |
|
|
38
38
|
| Images, embedded objects, defined names (`Lbl`) | Not read either (see below); there is no round trip to verify a writer for them against. |
|
|
39
39
|
| Data validation (`Dv`/`DVal`) | The reader now recovers a sheet's own validation rules (see Read-side gaps below), but writing them back out is its own separate mechanism -- re-encoding a formula's own text back into `Ptg` tokens for `Dv`'s two `DVParsedFormula` fields, the same "not folded into recovering the read side" split this table already draws for `Formula` records. A `ContentSheet.dataValidations` is silently ignored on write. |
|
|
40
|
-
| Conditional formatting (`CondFmt`/`CF`)
|
|
40
|
+
| Conditional formatting (`CondFmt`/`CF`, `CondFmt12`/`CF12`) | The reader now recovers a sheet's own base `cellIs` rules and `CF12`'s colour scale/data bar/icon set rules (see Read-side gaps below), but writing them back out is its own separate mechanism, the same "not folded into recovering the read side" split this table already draws for `Formula` records and `Dv`. A `ContentSheet.conditionalFormats` is silently ignored on write. |
|
|
41
41
|
| Cell comments (`Note`/`Txo`) | The reader now recovers a cell's comment (see Read-side gaps below), but writing one back out is its own separate mechanism -- a `Note`/`Obj`/`Txo` triple with its own object-id bookkeeping, distinct from every other cell record this writer already emits -- scoped as its own piece of work rather than folded into recovering the read side, the same split this table already draws for `Formula` records. A `ContentSheetCell.comment` is silently ignored on write. |
|
|
42
42
|
| A page size no `iPaperSize` code names | Written as [MS-XLS] 2.4.257's own custom-paper value rather than as a named paper it is not — the dimensions themselves are unwritable, since `Setup` addresses paper only by code. See [Print settings](#print-settings). |
|
|
43
43
|
| `Window1`/`Window2`, `CodePage`, `Index`/`DBCell`, the legacy interface records (`InterfaceHdr`, `WriteAccess`, …) | UI and interoperability bookkeeping [MS-XLS]'s own grammar names in the globals/worksheet substreams alongside the content-carrying records above, not data. `Index`/`DBCell` specifically is a pure cell-lookup performance optimisation (see [MS-XLS]'s own "Retrieval of Last-Calculated Cell Values Without Loading Cell Table") that this reader — and Excel's own reader — does not require to find a cell; real, well-established minimal BIFF8 writers (e.g. Python's `xlwt`) omit the same set and produce files Excel opens correctly. The calculation-state records (`CalcCount`, `CalcRefMode`, `CalcIter`, `CalcDelta`, `CalcSaveRecalc`) sat in this row until print settings needed them — see [Print settings](#print-settings) for why the writer emits them now. |
|
|
@@ -54,8 +54,10 @@ Each deliberate rather than overlooked:
|
|
|
54
54
|
- **Print settings, resolved for real.** Every field of `ContentSheetPrintSettings` is read from the records that carry it, with Excel's own "Normal" preset standing in per field for whatever the file leaves unstated — see [Print settings](#print-settings) for the record map, the two of BIFF8's own conditional rules that decide how to read `Setup`, and the three things that genuinely do not come through.
|
|
55
55
|
- **Cell comments, resolved for real (ExaDev/documents.js#949).** A legacy BIFF8 comment is split across three record kinds a single self-contained xlsx `<comment>` element never needs: a `Note` record ([MS-XLS] 2.4.179, wrapping a `NoteSh` structure) anchors the comment to a cell and names its author, but carries no text of its own; the text lives in a `Txo` record ([MS-XLS] 2.4.329), its characters carried across trailing `Continue` records; the two are joined through an `Obj` record ([MS-XLS] 2.4.181) whose `FtCmo` names an object id and type, the `Note`'s own `idObj` field naming that same id, and a `Txo` always immediately following the `Obj` record whose shape it belongs to (`src/workbook/comments.ts`). Read in one independent pass over the whole worksheet substream rather than assuming stream order between a `Note` and the `Obj`+`Txo` pair it names -- both are resolved regardless of which comes first. Legacy BIFF8 has no threading and no per-comment timestamp at all (unlike xlsx's own `[MS-XLSX]` threaded-comments extension), so `ContentSheetCellComment.replies` and `.createdAt` are never populated from an `.xls` source; rich per-character formatting within a comment (`TxORuns`) is skipped rather than modelled, the same scope limit this reader already applies to the shared string table's own rich runs, since `ContentSheetCellComment.text` is a plain string with nowhere to carry them.
|
|
56
56
|
- **Data validation, resolved for real (ExaDev/documents.js#1098).** `Dv` ([MS-XLS] 2.4.95) is a fixed, published binary structure -- a bit-packed flags `DWORD` (`valType`/`errStyle`/`fAllowBlank`/`fShowInputMsg`/`fShowErrorMsg`/`typOperator`), four `XLUnicodeString`s (prompt/error titles and messages), one or two `DVParsedFormula` structures, and a trailing `SqRefU` range list -- read directly against that spec (`src/workbook/data-validation.ts`), unlike `calcext:condition`'s own LibreOffice-source-transcribed mini-language odf.js's equivalent reader needed. A `DVParsedFormula`'s own `rgce` is the identical `Ptg` token grammar a cell's `Formula` record carries, so its formula text is recovered with the same `parseFormulaText` this reader already uses for ordinary cell formulas. `DVal` ([MS-XLS] 2.4.96), the record that precedes a sheet's own `Dv` collection, carries only input-window UI state (position, drop-down `Obj` reference) with no counterpart in `ContentSheetDataValidationSchema` and is not read for its own fields.
|
|
57
|
-
- **Conditional formatting, base rules resolved for real (ExaDev/documents.js#1102).** A `CondFmt` record ([MS-XLS] 2.4.56) marks the start of one to three `CF` records ([MS-XLS] 2.4.42) sharing one cell-range list, read together as a group (`src/workbook/conditional-format.ts`) since a `CF`'s own ranges live on its parent `CondFmt`, not on itself. Base BIFF8 (Excel 97) conditional formatting has exactly two rule shapes: a comparison ("Cell Value Is") condition, promoted to `ContentSheetConditionalFormat`'s `cellIs` variant with its formula(s) recovered through the same `parseFormulaText` this reader already uses for cell formulas and `Dv`; and a formula condition, left unpromoted for the same "no closed-form structure without a general formula engine" reason `data-validation.ts` and `ooxml.js`'s own xlsx `cfRule` reading already draw. A rule's resulting style -- font colour and fill background -- comes from its `CF`'s own `DXFN` structure, resolved through the identical `icv`/`Palette` colour machinery a regular cell's fill and border already use ([Cell decoration](#cell-decoration)); a `DXFN` naming a user-defined number format (`DXFNumUsr`) degrades that one rule's style to absent rather than risk misreading the font/fill fields that follow it, since [MS-XLS]'s own prose for `DXFNumUsr`'s length field does not settle whether it counts itself. Every richer rule type Excel 2007+ added
|
|
58
|
-
- **
|
|
57
|
+
- **Conditional formatting, base rules resolved for real (ExaDev/documents.js#1102).** A `CondFmt` record ([MS-XLS] 2.4.56) marks the start of one to three `CF` records ([MS-XLS] 2.4.42) sharing one cell-range list, read together as a group (`src/workbook/conditional-format.ts`) since a `CF`'s own ranges live on its parent `CondFmt`, not on itself. Base BIFF8 (Excel 97) conditional formatting has exactly two rule shapes: a comparison ("Cell Value Is") condition, promoted to `ContentSheetConditionalFormat`'s `cellIs` variant with its formula(s) recovered through the same `parseFormulaText` this reader already uses for cell formulas and `Dv`; and a formula condition, left unpromoted for the same "no closed-form structure without a general formula engine" reason `data-validation.ts` and `ooxml.js`'s own xlsx `cfRule` reading already draw. A rule's resulting style -- font colour and fill background -- comes from its `CF`'s own `DXFN` structure, resolved through the identical `icv`/`Palette` colour machinery a regular cell's fill and border already use ([Cell decoration](#cell-decoration)); a `DXFN` naming a user-defined number format (`DXFNumUsr`) degrades that one rule's style to absent rather than risk misreading the font/fill fields that follow it, since [MS-XLS]'s own prose for `DXFNumUsr`'s length field does not settle whether it counts itself. Every richer rule type Excel 2007+ added has no representation in the base `CF` record at all; it rides a `CF12` record instead, linked to its own `CondFmt` through a `CFEx` extension record.
|
|
58
|
+
- **Conditional formatting, CF12's colour scale/data bar/icon set rules resolved for real (ExaDev/documents.js#1104).** `CF12`'s own `ct` field picks one of six rule shapes ([MS-XLS] 2.4.43); this reader promotes the three that share a genuine array-of-thresholds building block already modelled in `document-schema.js` -- colour scale, data bar, and icon set (`src/workbook/conditional-format-12.ts`) -- each reading an array of `CFVO` threshold objects (the identical `num`/`percent`/`max`/`min`/`formula`/`percentile` vocabulary `ContentSheetConditionalFormatValueSchema` already carries for `ooxml.js`'s xlsx reader and `odf.js`'s ods reader) paired with `CFColor` values. A `CFColor` naming an indexed colour resolves through the same `icv`/`Palette` machinery as base `CF`'s own `DXFN`, then Excel's own TintAndShade model applies the colour's own tint/shade Xnum (`xf-colors.ts`'s `applyTint`); one naming a plain RGB triple resolves directly, tint included; one naming an automatic or theme colour degrades the whole rule to absent, since this package has no BIFF8 `Theme` reader to resolve a theme reference against. Icon set's own `iIconSet` byte maps to the identical ECMA-376 `ST_IconSetType` vocabulary (`3Arrows`, `3TrafficLights1`, `5Quarters`, and the rest of the seventeen built-in sets) `ooxml.js`'s xlsx `cfRule` reading already carries as a plain string. A record longer than the 8224-byte single-record ceiling continues onto `ContinueFrt12` rather than the plain `Continue` every other record in this package joins against; `groupRecords` (`src/biff/substreams.ts`) strips its own restated `FrtRefHeader` before joining it.
|
|
59
|
+
- **Conditional formatting, CF12's filter-dispatched template rules resolved for real (ExaDev/documents.js#1106).** `ct` 0x05 ("filter") dispatches further through `icfTemplate`, alongside a 16-byte `CFExTemplateParams` block always present regardless of `ct`. Of that block's five variants, only two need real parsing -- `CFExFilterParams` (top10's own `fTop`/`fPercent`/`iParam`) and `CFExAveragesTemplateParams` (the aboveAverage family's own standard-deviation count) -- since `CFExDefaultTemplateParams` (duplicateValues/uniqueValues/the four blank/error conditions) is 16 reserved bytes and `CFExDateTemplateParams`'s own `dateOp` field is a fixed restatement of `icfTemplate` for all ten date/time periods, so both dispatch directly off `icfTemplate` with no further byte reading. Unlike colour scale/data bar/icon set, [MS-XLS] does not force a `ct` 0x05 rule's own `cbDxf` to zero, so its `DXFN12` can carry a genuine font/fill override; that structure resolves through the identical `parseDxfStyle` base `CF`'s own `DXFN` already uses. A malformed `iParam` of zero degrades a top10 rule to absent rather than promoting a `rank` `ContentSheetConditionalFormatSchema` itself requires to be positive. Comparison/formula rules re-expressed in this newer record shape, `containsText`'s own four sub-types (`CFExTextTemplateParams` names which one a rule is but not its actual search string, and CF12's own formula fields are spec'd to be zero for every `ct` 0x05 rule -- where the literal text operand lives is a genuine open question), and `CFEx`'s own extension of a legacy `CF` record all remain unread (ExaDev/documents.js#1100).
|
|
60
|
+
- **Not read at all:** charts, drawings and images, `CF12`'s `containsText` filter rules, and `CFEx`'s own `CF`-record extension (ExaDev/documents.js#1100). Defined names (`Lbl`) are read only for the two built-in ones a sheet's print range and repeated header bands live in ([Print settings](#print-settings)); a user-defined name has nowhere to land in `document-schema.js`'s spreadsheet model, so it is skipped.
|
|
59
61
|
- **Encrypted workbooks** are refused rather than mis-read: a `FilePass` record means every record after it is ciphertext.
|
|
60
62
|
|
|
61
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).
|
|
@@ -6,6 +6,8 @@ const RECORD_BOF = 2057;
|
|
|
6
6
|
const RECORD_EOF = 10;
|
|
7
7
|
/** Carries the overflow of a preceding record whose data exceeds what one record can hold ([MS-XLS] 2.4.58). */
|
|
8
8
|
const RECORD_CONTINUE = 60;
|
|
9
|
+
/** Carries the overflow of a preceding "future record type" (FRT) record -- CondFmt12/CF12 among them -- whose data exceeds what one record can hold, restating a 12-byte FrtRefHeader of its own before the actual continuation bytes ([MS-XLS] 2.4.62). Plain Continue never follows an FRT record; this is its own record type precisely so a reader can tell the two apart. */
|
|
10
|
+
const RECORD_CONTINUEFRT12 = 2175;
|
|
9
11
|
/** One per sheet: its name, hidden state, type, and the stream offset of its own BOF ([MS-XLS] 2.4.28). */
|
|
10
12
|
const RECORD_BOUNDSHEET8 = 133;
|
|
11
13
|
/** The shared string table every LabelSst cell indexes into ([MS-XLS] 2.4.265). */
|
|
@@ -50,6 +52,10 @@ const RECORD_DV = 446;
|
|
|
50
52
|
const RECORD_CONDFMT = 432;
|
|
51
53
|
/** One conditional-formatting rule: a comparison ("Cell Value Is") or formula condition, one or two Ptg-encoded formulas, and a DXFN structure naming the resulting cell's own font/fill override ([MS-XLS] 2.4.42). Every richer rule type (top10, aboveAverage, colour scale, data bar, icon set, …) is a CF12/CFEx extension instead -- not this record. */
|
|
52
54
|
const RECORD_CF = 433;
|
|
55
|
+
/** Marks the start of a collection of CF12 records, the "future record" (FRT) equivalent of CondFmt for the rule types Excel 97's own CF record cannot express ([MS-XLS] 2.4.57). Wraps a CondFmtStructure -- the same ccf/flags/refBound/sqref shape CondFmt's own body carries, just prefixed by a 12-byte FrtRefHeaderU this reader never needs to read. */
|
|
56
|
+
const RECORD_CONDFMT12 = 2169;
|
|
57
|
+
/** One extended conditional-formatting rule: colour scale, data bar, icon set, a filter-dispatched template (top10, aboveAverage, contains-text, a date/time period, …), or a plain comparison/formula rule re-expressed in the newer record shape ([MS-XLS] 2.4.43). This reader only promotes the three rule types with a genuine array-of-thresholds shape already shared with ooxml.js's xlsx cfRule reading -- colour scale, data bar, icon set (ExaDev/documents.js#1104); the filter-template family stays unread (ExaDev/documents.js#1100). */
|
|
58
|
+
const RECORD_CF12 = 2170;
|
|
53
59
|
/** A cell comment's anchor -- row, column, and its own author, linking to the Obj record that names its text ([MS-XLS] 2.4.179). */
|
|
54
60
|
const RECORD_NOTE = 28;
|
|
55
61
|
/** A drawing object's common properties (id, type) and, for a comment, its FtNts sub-structure ([MS-XLS] 2.4.181). */
|
|
@@ -143,9 +149,12 @@ exports.RECORD_CALCITER = RECORD_CALCITER;
|
|
|
143
149
|
exports.RECORD_CALCREFMODE = RECORD_CALCREFMODE;
|
|
144
150
|
exports.RECORD_CALCSAVERECALC = RECORD_CALCSAVERECALC;
|
|
145
151
|
exports.RECORD_CF = RECORD_CF;
|
|
152
|
+
exports.RECORD_CF12 = RECORD_CF12;
|
|
146
153
|
exports.RECORD_COLINFO = RECORD_COLINFO;
|
|
147
154
|
exports.RECORD_CONDFMT = RECORD_CONDFMT;
|
|
155
|
+
exports.RECORD_CONDFMT12 = RECORD_CONDFMT12;
|
|
148
156
|
exports.RECORD_CONTINUE = RECORD_CONTINUE;
|
|
157
|
+
exports.RECORD_CONTINUEFRT12 = RECORD_CONTINUEFRT12;
|
|
149
158
|
exports.RECORD_DATE1904 = RECORD_DATE1904;
|
|
150
159
|
exports.RECORD_DEFAULTROWHEIGHT = RECORD_DEFAULTROWHEIGHT;
|
|
151
160
|
exports.RECORD_DEFCOLWIDTH = RECORD_DEFCOLWIDTH;
|
|
@@ -5,6 +5,8 @@ declare const RECORD_BOF = 2057;
|
|
|
5
5
|
declare const RECORD_EOF = 10;
|
|
6
6
|
/** Carries the overflow of a preceding record whose data exceeds what one record can hold ([MS-XLS] 2.4.58). */
|
|
7
7
|
declare const RECORD_CONTINUE = 60;
|
|
8
|
+
/** Carries the overflow of a preceding "future record type" (FRT) record -- CondFmt12/CF12 among them -- whose data exceeds what one record can hold, restating a 12-byte FrtRefHeader of its own before the actual continuation bytes ([MS-XLS] 2.4.62). Plain Continue never follows an FRT record; this is its own record type precisely so a reader can tell the two apart. */
|
|
9
|
+
declare const RECORD_CONTINUEFRT12 = 2175;
|
|
8
10
|
/** One per sheet: its name, hidden state, type, and the stream offset of its own BOF ([MS-XLS] 2.4.28). */
|
|
9
11
|
declare const RECORD_BOUNDSHEET8 = 133;
|
|
10
12
|
/** The shared string table every LabelSst cell indexes into ([MS-XLS] 2.4.265). */
|
|
@@ -49,6 +51,10 @@ declare const RECORD_DV = 446;
|
|
|
49
51
|
declare const RECORD_CONDFMT = 432;
|
|
50
52
|
/** One conditional-formatting rule: a comparison ("Cell Value Is") or formula condition, one or two Ptg-encoded formulas, and a DXFN structure naming the resulting cell's own font/fill override ([MS-XLS] 2.4.42). Every richer rule type (top10, aboveAverage, colour scale, data bar, icon set, …) is a CF12/CFEx extension instead -- not this record. */
|
|
51
53
|
declare const RECORD_CF = 433;
|
|
54
|
+
/** Marks the start of a collection of CF12 records, the "future record" (FRT) equivalent of CondFmt for the rule types Excel 97's own CF record cannot express ([MS-XLS] 2.4.57). Wraps a CondFmtStructure -- the same ccf/flags/refBound/sqref shape CondFmt's own body carries, just prefixed by a 12-byte FrtRefHeaderU this reader never needs to read. */
|
|
55
|
+
declare const RECORD_CONDFMT12 = 2169;
|
|
56
|
+
/** One extended conditional-formatting rule: colour scale, data bar, icon set, a filter-dispatched template (top10, aboveAverage, contains-text, a date/time period, …), or a plain comparison/formula rule re-expressed in the newer record shape ([MS-XLS] 2.4.43). This reader only promotes the three rule types with a genuine array-of-thresholds shape already shared with ooxml.js's xlsx cfRule reading -- colour scale, data bar, icon set (ExaDev/documents.js#1104); the filter-template family stays unread (ExaDev/documents.js#1100). */
|
|
57
|
+
declare const RECORD_CF12 = 2170;
|
|
52
58
|
/** A cell comment's anchor -- row, column, and its own author, linking to the Obj record that names its text ([MS-XLS] 2.4.179). */
|
|
53
59
|
declare const RECORD_NOTE = 28;
|
|
54
60
|
/** A drawing object's common properties (id, type) and, for a comment, its FtNts sub-structure ([MS-XLS] 2.4.181). */
|
|
@@ -124,4 +130,4 @@ declare const BIFF8_VERSION = 1536;
|
|
|
124
130
|
/** [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. */
|
|
125
131
|
declare const MAX_RECORD_DATA_SIZE = 8224;
|
|
126
132
|
//#endregion
|
|
127
|
-
export { BIFF8_VERSION, BOF_TYPE_CHART, BOF_TYPE_MACRO, BOF_TYPE_WORKBOOK, BOF_TYPE_WORKSHEET, MAX_RECORD_DATA_SIZE, RECORD_ARRAY, RECORD_BLANK, RECORD_BOF, RECORD_BOOLERR, RECORD_BOTTOMMARGIN, RECORD_BOUNDSHEET8, RECORD_CALCCOUNT, RECORD_CALCDELTA, RECORD_CALCITER, RECORD_CALCREFMODE, RECORD_CALCSAVERECALC, RECORD_CF, RECORD_COLINFO, RECORD_CONDFMT, RECORD_CONTINUE, RECORD_DATE1904, RECORD_DEFAULTROWHEIGHT, RECORD_DEFCOLWIDTH, RECORD_DIMENSIONS, RECORD_DV, RECORD_DVAL, RECORD_EOF, RECORD_EXTERNSHEET, RECORD_FILEPASS, RECORD_FONT, RECORD_FORMAT, RECORD_FORMULA, RECORD_HORIZONTALPAGEBREAKS, RECORD_LABEL, RECORD_LABELSST, RECORD_LBL, RECORD_LEFTMARGIN, RECORD_MERGECELLS, RECORD_MULBLANK, RECORD_MULRK, RECORD_NOTE, RECORD_NUMBER, RECORD_OBJ, RECORD_PALETTE, RECORD_PRINTGRID, RECORD_PRINTROWCOL, RECORD_RIGHTMARGIN, RECORD_RK, RECORD_ROW, RECORD_SETUP, RECORD_SHRFMLA, RECORD_SST, RECORD_STRING, RECORD_STYLE, RECORD_SUPBOOK, RECORD_TABLE, RECORD_TOPMARGIN, RECORD_TXO, RECORD_VERTICALPAGEBREAKS, RECORD_WSBOOL, RECORD_XF };
|
|
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 };
|
|
@@ -5,6 +5,8 @@ declare const RECORD_BOF = 2057;
|
|
|
5
5
|
declare const RECORD_EOF = 10;
|
|
6
6
|
/** Carries the overflow of a preceding record whose data exceeds what one record can hold ([MS-XLS] 2.4.58). */
|
|
7
7
|
declare const RECORD_CONTINUE = 60;
|
|
8
|
+
/** Carries the overflow of a preceding "future record type" (FRT) record -- CondFmt12/CF12 among them -- whose data exceeds what one record can hold, restating a 12-byte FrtRefHeader of its own before the actual continuation bytes ([MS-XLS] 2.4.62). Plain Continue never follows an FRT record; this is its own record type precisely so a reader can tell the two apart. */
|
|
9
|
+
declare const RECORD_CONTINUEFRT12 = 2175;
|
|
8
10
|
/** One per sheet: its name, hidden state, type, and the stream offset of its own BOF ([MS-XLS] 2.4.28). */
|
|
9
11
|
declare const RECORD_BOUNDSHEET8 = 133;
|
|
10
12
|
/** The shared string table every LabelSst cell indexes into ([MS-XLS] 2.4.265). */
|
|
@@ -49,6 +51,10 @@ declare const RECORD_DV = 446;
|
|
|
49
51
|
declare const RECORD_CONDFMT = 432;
|
|
50
52
|
/** One conditional-formatting rule: a comparison ("Cell Value Is") or formula condition, one or two Ptg-encoded formulas, and a DXFN structure naming the resulting cell's own font/fill override ([MS-XLS] 2.4.42). Every richer rule type (top10, aboveAverage, colour scale, data bar, icon set, …) is a CF12/CFEx extension instead -- not this record. */
|
|
51
53
|
declare const RECORD_CF = 433;
|
|
54
|
+
/** Marks the start of a collection of CF12 records, the "future record" (FRT) equivalent of CondFmt for the rule types Excel 97's own CF record cannot express ([MS-XLS] 2.4.57). Wraps a CondFmtStructure -- the same ccf/flags/refBound/sqref shape CondFmt's own body carries, just prefixed by a 12-byte FrtRefHeaderU this reader never needs to read. */
|
|
55
|
+
declare const RECORD_CONDFMT12 = 2169;
|
|
56
|
+
/** One extended conditional-formatting rule: colour scale, data bar, icon set, a filter-dispatched template (top10, aboveAverage, contains-text, a date/time period, …), or a plain comparison/formula rule re-expressed in the newer record shape ([MS-XLS] 2.4.43). This reader only promotes the three rule types with a genuine array-of-thresholds shape already shared with ooxml.js's xlsx cfRule reading -- colour scale, data bar, icon set (ExaDev/documents.js#1104); the filter-template family stays unread (ExaDev/documents.js#1100). */
|
|
57
|
+
declare const RECORD_CF12 = 2170;
|
|
52
58
|
/** A cell comment's anchor -- row, column, and its own author, linking to the Obj record that names its text ([MS-XLS] 2.4.179). */
|
|
53
59
|
declare const RECORD_NOTE = 28;
|
|
54
60
|
/** A drawing object's common properties (id, type) and, for a comment, its FtNts sub-structure ([MS-XLS] 2.4.181). */
|
|
@@ -124,4 +130,4 @@ declare const BIFF8_VERSION = 1536;
|
|
|
124
130
|
/** [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. */
|
|
125
131
|
declare const MAX_RECORD_DATA_SIZE = 8224;
|
|
126
132
|
//#endregion
|
|
127
|
-
export { BIFF8_VERSION, BOF_TYPE_CHART, BOF_TYPE_MACRO, BOF_TYPE_WORKBOOK, BOF_TYPE_WORKSHEET, MAX_RECORD_DATA_SIZE, RECORD_ARRAY, RECORD_BLANK, RECORD_BOF, RECORD_BOOLERR, RECORD_BOTTOMMARGIN, RECORD_BOUNDSHEET8, RECORD_CALCCOUNT, RECORD_CALCDELTA, RECORD_CALCITER, RECORD_CALCREFMODE, RECORD_CALCSAVERECALC, RECORD_CF, RECORD_COLINFO, RECORD_CONDFMT, RECORD_CONTINUE, RECORD_DATE1904, RECORD_DEFAULTROWHEIGHT, RECORD_DEFCOLWIDTH, RECORD_DIMENSIONS, RECORD_DV, RECORD_DVAL, RECORD_EOF, RECORD_EXTERNSHEET, RECORD_FILEPASS, RECORD_FONT, RECORD_FORMAT, RECORD_FORMULA, RECORD_HORIZONTALPAGEBREAKS, RECORD_LABEL, RECORD_LABELSST, RECORD_LBL, RECORD_LEFTMARGIN, RECORD_MERGECELLS, RECORD_MULBLANK, RECORD_MULRK, RECORD_NOTE, RECORD_NUMBER, RECORD_OBJ, RECORD_PALETTE, RECORD_PRINTGRID, RECORD_PRINTROWCOL, RECORD_RIGHTMARGIN, RECORD_RK, RECORD_ROW, RECORD_SETUP, RECORD_SHRFMLA, RECORD_SST, RECORD_STRING, RECORD_STYLE, RECORD_SUPBOOK, RECORD_TABLE, RECORD_TOPMARGIN, RECORD_TXO, RECORD_VERTICALPAGEBREAKS, RECORD_WSBOOL, RECORD_XF };
|
|
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 };
|
|
@@ -5,6 +5,8 @@ const RECORD_BOF = 2057;
|
|
|
5
5
|
const RECORD_EOF = 10;
|
|
6
6
|
/** Carries the overflow of a preceding record whose data exceeds what one record can hold ([MS-XLS] 2.4.58). */
|
|
7
7
|
const RECORD_CONTINUE = 60;
|
|
8
|
+
/** Carries the overflow of a preceding "future record type" (FRT) record -- CondFmt12/CF12 among them -- whose data exceeds what one record can hold, restating a 12-byte FrtRefHeader of its own before the actual continuation bytes ([MS-XLS] 2.4.62). Plain Continue never follows an FRT record; this is its own record type precisely so a reader can tell the two apart. */
|
|
9
|
+
const RECORD_CONTINUEFRT12 = 2175;
|
|
8
10
|
/** One per sheet: its name, hidden state, type, and the stream offset of its own BOF ([MS-XLS] 2.4.28). */
|
|
9
11
|
const RECORD_BOUNDSHEET8 = 133;
|
|
10
12
|
/** The shared string table every LabelSst cell indexes into ([MS-XLS] 2.4.265). */
|
|
@@ -49,6 +51,10 @@ const RECORD_DV = 446;
|
|
|
49
51
|
const RECORD_CONDFMT = 432;
|
|
50
52
|
/** One conditional-formatting rule: a comparison ("Cell Value Is") or formula condition, one or two Ptg-encoded formulas, and a DXFN structure naming the resulting cell's own font/fill override ([MS-XLS] 2.4.42). Every richer rule type (top10, aboveAverage, colour scale, data bar, icon set, …) is a CF12/CFEx extension instead -- not this record. */
|
|
51
53
|
const RECORD_CF = 433;
|
|
54
|
+
/** Marks the start of a collection of CF12 records, the "future record" (FRT) equivalent of CondFmt for the rule types Excel 97's own CF record cannot express ([MS-XLS] 2.4.57). Wraps a CondFmtStructure -- the same ccf/flags/refBound/sqref shape CondFmt's own body carries, just prefixed by a 12-byte FrtRefHeaderU this reader never needs to read. */
|
|
55
|
+
const RECORD_CONDFMT12 = 2169;
|
|
56
|
+
/** One extended conditional-formatting rule: colour scale, data bar, icon set, a filter-dispatched template (top10, aboveAverage, contains-text, a date/time period, …), or a plain comparison/formula rule re-expressed in the newer record shape ([MS-XLS] 2.4.43). This reader only promotes the three rule types with a genuine array-of-thresholds shape already shared with ooxml.js's xlsx cfRule reading -- colour scale, data bar, icon set (ExaDev/documents.js#1104); the filter-template family stays unread (ExaDev/documents.js#1100). */
|
|
57
|
+
const RECORD_CF12 = 2170;
|
|
52
58
|
/** A cell comment's anchor -- row, column, and its own author, linking to the Obj record that names its text ([MS-XLS] 2.4.179). */
|
|
53
59
|
const RECORD_NOTE = 28;
|
|
54
60
|
/** A drawing object's common properties (id, type) and, for a comment, its FtNts sub-structure ([MS-XLS] 2.4.181). */
|
|
@@ -124,4 +130,4 @@ const BIFF8_VERSION = 1536;
|
|
|
124
130
|
/** [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. */
|
|
125
131
|
const MAX_RECORD_DATA_SIZE = 8224;
|
|
126
132
|
//#endregion
|
|
127
|
-
export { BIFF8_VERSION, BOF_TYPE_CHART, BOF_TYPE_MACRO, BOF_TYPE_WORKBOOK, BOF_TYPE_WORKSHEET, MAX_RECORD_DATA_SIZE, RECORD_ARRAY, RECORD_BLANK, RECORD_BOF, RECORD_BOOLERR, RECORD_BOTTOMMARGIN, RECORD_BOUNDSHEET8, RECORD_CALCCOUNT, RECORD_CALCDELTA, RECORD_CALCITER, RECORD_CALCREFMODE, RECORD_CALCSAVERECALC, RECORD_CF, RECORD_COLINFO, RECORD_CONDFMT, RECORD_CONTINUE, RECORD_DATE1904, RECORD_DEFAULTROWHEIGHT, RECORD_DEFCOLWIDTH, RECORD_DIMENSIONS, RECORD_DV, RECORD_DVAL, RECORD_EOF, RECORD_EXTERNSHEET, RECORD_FILEPASS, RECORD_FONT, RECORD_FORMAT, RECORD_FORMULA, RECORD_HORIZONTALPAGEBREAKS, RECORD_LABEL, RECORD_LABELSST, RECORD_LBL, RECORD_LEFTMARGIN, RECORD_MERGECELLS, RECORD_MULBLANK, RECORD_MULRK, RECORD_NOTE, RECORD_NUMBER, RECORD_OBJ, RECORD_PALETTE, RECORD_PRINTGRID, RECORD_PRINTROWCOL, RECORD_RIGHTMARGIN, RECORD_RK, RECORD_ROW, RECORD_SETUP, RECORD_SHRFMLA, RECORD_SST, RECORD_STRING, RECORD_STYLE, RECORD_SUPBOOK, RECORD_TABLE, RECORD_TOPMARGIN, RECORD_TXO, RECORD_VERTICALPAGEBREAKS, RECORD_WSBOOL, RECORD_XF };
|
|
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 };
|
package/dist/biff/substreams.cjs
CHANGED
|
@@ -2,6 +2,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
2
2
|
require("./record-types.cjs");
|
|
3
3
|
const require_biff_records = require("./records.cjs");
|
|
4
4
|
//#region src/biff/substreams.ts
|
|
5
|
+
/** FrtRefHeader/FrtRefHeaderU's own fixed size ([MS-XLS] 2.4), restated at the front of every ContinueFrt12 record and stripped before its remaining bytes join the record it continues. */
|
|
6
|
+
const FRT_REF_HEADER_SIZE = 12;
|
|
5
7
|
/** The total byte length of a record's data across every block (the base record's and any Continues that followed it) -- what a reader needs whenever a trailing field's own length is implied by "whatever is left" rather than stated by a preceding count (a Mul record's entry count, an SST's own bounds check, a formula's RgbExtra trailer). */
|
|
6
8
|
function recordByteLength(record) {
|
|
7
9
|
return record.blocks.reduce((sum, block) => sum + block.length, 0);
|
|
@@ -16,6 +18,12 @@ function groupRecords(records) {
|
|
|
16
18
|
current.blocks.push(record.data);
|
|
17
19
|
continue;
|
|
18
20
|
}
|
|
21
|
+
if (record.type === 2175) {
|
|
22
|
+
const current = groups[groups.length - 1];
|
|
23
|
+
if (current === void 0) throw new require_biff_records.BiffFormatError("ContinueFrt12 record with no preceding record to continue");
|
|
24
|
+
current.blocks.push(record.data.subarray(FRT_REF_HEADER_SIZE));
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
19
27
|
groups.push({
|
|
20
28
|
type: record.type,
|
|
21
29
|
blocks: [record.data],
|
package/dist/biff/substreams.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import "./record-types.js";
|
|
2
2
|
import { BiffFormatError } from "./records.js";
|
|
3
3
|
//#region src/biff/substreams.ts
|
|
4
|
+
/** FrtRefHeader/FrtRefHeaderU's own fixed size ([MS-XLS] 2.4), restated at the front of every ContinueFrt12 record and stripped before its remaining bytes join the record it continues. */
|
|
5
|
+
const FRT_REF_HEADER_SIZE = 12;
|
|
4
6
|
/** The total byte length of a record's data across every block (the base record's and any Continues that followed it) -- what a reader needs whenever a trailing field's own length is implied by "whatever is left" rather than stated by a preceding count (a Mul record's entry count, an SST's own bounds check, a formula's RgbExtra trailer). */
|
|
5
7
|
function recordByteLength(record) {
|
|
6
8
|
return record.blocks.reduce((sum, block) => sum + block.length, 0);
|
|
@@ -15,6 +17,12 @@ function groupRecords(records) {
|
|
|
15
17
|
current.blocks.push(record.data);
|
|
16
18
|
continue;
|
|
17
19
|
}
|
|
20
|
+
if (record.type === 2175) {
|
|
21
|
+
const current = groups[groups.length - 1];
|
|
22
|
+
if (current === void 0) throw new BiffFormatError("ContinueFrt12 record with no preceding record to continue");
|
|
23
|
+
current.blocks.push(record.data.subarray(FRT_REF_HEADER_SIZE));
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
18
26
|
groups.push({
|
|
19
27
|
type: record.type,
|
|
20
28
|
blocks: [record.data],
|
package/dist/biff/xf-colors.cjs
CHANGED
|
@@ -186,6 +186,66 @@ function resolveIcvColor(icv, palette) {
|
|
|
186
186
|
return palette === void 0 ? DEFAULT_PALETTE_TABLE[index] : palette[index];
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
|
+
function rgbToHsl(color) {
|
|
190
|
+
const { r, g, b } = color;
|
|
191
|
+
const max = Math.max(r, g, b);
|
|
192
|
+
const min = Math.min(r, g, b);
|
|
193
|
+
const l = (max + min) / 2;
|
|
194
|
+
if (max === min) return {
|
|
195
|
+
h: 0,
|
|
196
|
+
s: 0,
|
|
197
|
+
l
|
|
198
|
+
};
|
|
199
|
+
const d = max - min;
|
|
200
|
+
const s = l > .5 ? d / (2 - max - min) : d / (max + min);
|
|
201
|
+
let h;
|
|
202
|
+
if (max === r) h = (g - b) / d + (g < b ? 6 : 0);
|
|
203
|
+
else if (max === g) h = (b - r) / d + 2;
|
|
204
|
+
else h = (r - g) / d + 4;
|
|
205
|
+
return {
|
|
206
|
+
h: h / 6,
|
|
207
|
+
s,
|
|
208
|
+
l
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
function hslToRgb(hsl) {
|
|
212
|
+
const { h, s, l } = hsl;
|
|
213
|
+
if (s === 0) return {
|
|
214
|
+
r: l,
|
|
215
|
+
g: l,
|
|
216
|
+
b: l
|
|
217
|
+
};
|
|
218
|
+
const hueToRgb = (p, q, t) => {
|
|
219
|
+
let tt = t;
|
|
220
|
+
if (tt < 0) tt += 1;
|
|
221
|
+
if (tt > 1) tt -= 1;
|
|
222
|
+
if (tt < 1 / 6) return p + (q - p) * 6 * tt;
|
|
223
|
+
if (tt < 1 / 2) return q;
|
|
224
|
+
if (tt < 2 / 3) return p + (q - p) * (2 / 3 - tt) * 6;
|
|
225
|
+
return p;
|
|
226
|
+
};
|
|
227
|
+
const q = l < .5 ? l * (1 + s) : l + s - l * s;
|
|
228
|
+
const p = 2 * l - q;
|
|
229
|
+
return {
|
|
230
|
+
r: hueToRgb(p, q, h + 1 / 3),
|
|
231
|
+
g: hueToRgb(p, q, h),
|
|
232
|
+
b: hueToRgb(p, q, h - 1 / 3)
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Applies Excel's own "TintAndShade" colour model to an already-resolved colour: a single -1.0..1.0 value shading a colour toward black (negative) or tinting it toward white (positive), the model CFColor's own numTint field ([MS-XLS] 2.4, https://learn.microsoft.com/en-us/openspecs/office_file_formats/ms-xls/fd8e679d-069f-486b-ab48-2382cc167305) carries -- distinct from DrawingML's own separate shade/tint elements (ooxml.js's typed/shared/color.ts), which apply in linear light rather than adjusting HSL lightness directly.
|
|
237
|
+
*
|
|
238
|
+
* The formula itself -- Lum' = Lum*(1+tint) for a negative tint, Lum' = Lum*(1-tint) + tint for a positive one -- is Microsoft's own documented Color.TintAndShade algorithm, cross-checked against Apache POI's XSSFColor#getTint/#setTint javadoc (a completely independent implementation carrying the identical formula) rather than trusted from memory alone.
|
|
239
|
+
*/
|
|
240
|
+
function applyTint(color, tint) {
|
|
241
|
+
if (tint === 0) return color;
|
|
242
|
+
const hsl = rgbToHsl(color);
|
|
243
|
+
const l = tint < 0 ? hsl.l * (1 + tint) : hsl.l * (1 - tint) + tint;
|
|
244
|
+
return hslToRgb({
|
|
245
|
+
...hsl,
|
|
246
|
+
l
|
|
247
|
+
});
|
|
248
|
+
}
|
|
189
249
|
/** Every BorderStyle token this reader resolves to a (weight, pattern) pair -- BORDER_STYLE_NONE has no entry, since "no border" is handled by the caller before consulting this table. The dash-family tokens (dashDot/dashDotDot and their medium/slant variants) collapse to 'dashed', the closest ContentStrokeStyle member, exactly as ooxml.js's own XLSX_BORDER_STYLE table does for the equivalent xlsx tokens. */
|
|
190
250
|
const BIFF_BORDER_STYLE = {
|
|
191
251
|
[1]: {
|
|
@@ -410,6 +470,7 @@ exports.PALETTE_BASE_ICV = PALETTE_BASE_ICV;
|
|
|
410
470
|
exports.PALETTE_ENTRY_COUNT = PALETTE_ENTRY_COUNT;
|
|
411
471
|
exports.PATTERN_TYPE_TO_FILL_PATTERN = PATTERN_TYPE_TO_FILL_PATTERN;
|
|
412
472
|
exports.UNDECORATED_XF_FIELDS = UNDECORATED_XF_FIELDS;
|
|
473
|
+
exports.applyTint = applyTint;
|
|
413
474
|
exports.borderStyleTokenFor = borderStyleTokenFor;
|
|
414
475
|
exports.horizAlignTokenFor = horizAlignTokenFor;
|
|
415
476
|
exports.longRgbBytesOf = longRgbBytesOf;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
export { BORDER_STYLE_DASHDOT, BORDER_STYLE_DASHDOTDOT, BORDER_STYLE_DASHED, BORDER_STYLE_DOTTED, BORDER_STYLE_DOUBLE, BORDER_STYLE_HAIR, BORDER_STYLE_MEDIUM, BORDER_STYLE_MEDIUM_DASHDOT, BORDER_STYLE_MEDIUM_DASHDOTDOT, BORDER_STYLE_MEDIUM_DASHED, BORDER_STYLE_NONE, BORDER_STYLE_SLANT_DASHDOT, BORDER_STYLE_THICK, BORDER_STYLE_THIN, DEFAULT_PALETTE_HEX_TO_ICV, FILL_PATTERN_NONE, FILL_PATTERN_SOLID, ICV_AUTOMATIC_BACKGROUND, ICV_AUTOMATIC_FOREGROUND, PALETTE_BASE_ICV, PALETTE_ENTRY_COUNT, PATTERN_TYPE_TO_FILL_PATTERN, UNDECORATED_XF_FIELDS, XfAlignmentFields, XfBorderEdge, XfDecorationFields, borderStyleTokenFor, horizAlignTokenFor, longRgbBytesOf, packXfDecorationWords, readLongRgbColor, resolveBorderEdge, resolveFillBackground, resolveHorizontalAlignment, resolveIcvColor, resolveVerticalAlignment, unpackXfAlignment, unpackXfDecoration, vertAlignTokenFor };
|
|
1
|
+
import { A as longRgbBytesOf, B as vertAlignTokenFor, C as UNDECORATED_XF_FIELDS, D as applyTint, E as XfDecorationFields, F as resolveHorizontalAlignment, I as resolveIcvColor, L as resolveVerticalAlignment, M as readLongRgbColor, N as resolveBorderEdge, O as borderStyleTokenFor, P as resolveFillBackground, R as unpackXfAlignment, S as PATTERN_TYPE_TO_FILL_PATTERN, T as XfBorderEdge, _ as FILL_PATTERN_SOLID, a as BORDER_STYLE_DOUBLE, b as PALETTE_BASE_ICV, c as BORDER_STYLE_MEDIUM_DASHDOT, d as BORDER_STYLE_NONE, f as BORDER_STYLE_SLANT_DASHDOT, g as FILL_PATTERN_NONE, h as DEFAULT_PALETTE_HEX_TO_ICV, i as BORDER_STYLE_DOTTED, j as packXfDecorationWords, k as horizAlignTokenFor, l as BORDER_STYLE_MEDIUM_DASHDOTDOT, m as BORDER_STYLE_THIN, n as BORDER_STYLE_DASHDOTDOT, o as BORDER_STYLE_HAIR, p as BORDER_STYLE_THICK, r as BORDER_STYLE_DASHED, s as BORDER_STYLE_MEDIUM, t as BORDER_STYLE_DASHDOT, u as BORDER_STYLE_MEDIUM_DASHED, v as ICV_AUTOMATIC_BACKGROUND, w as XfAlignmentFields, x as PALETTE_ENTRY_COUNT, y as ICV_AUTOMATIC_FOREGROUND, z as unpackXfDecoration } from "../xf-colors-mqerVt2O.cjs";
|
|
2
|
+
export { BORDER_STYLE_DASHDOT, BORDER_STYLE_DASHDOTDOT, BORDER_STYLE_DASHED, BORDER_STYLE_DOTTED, BORDER_STYLE_DOUBLE, BORDER_STYLE_HAIR, BORDER_STYLE_MEDIUM, BORDER_STYLE_MEDIUM_DASHDOT, BORDER_STYLE_MEDIUM_DASHDOTDOT, BORDER_STYLE_MEDIUM_DASHED, BORDER_STYLE_NONE, BORDER_STYLE_SLANT_DASHDOT, BORDER_STYLE_THICK, BORDER_STYLE_THIN, DEFAULT_PALETTE_HEX_TO_ICV, FILL_PATTERN_NONE, FILL_PATTERN_SOLID, ICV_AUTOMATIC_BACKGROUND, ICV_AUTOMATIC_FOREGROUND, PALETTE_BASE_ICV, PALETTE_ENTRY_COUNT, PATTERN_TYPE_TO_FILL_PATTERN, UNDECORATED_XF_FIELDS, XfAlignmentFields, XfBorderEdge, XfDecorationFields, applyTint, borderStyleTokenFor, horizAlignTokenFor, longRgbBytesOf, packXfDecorationWords, readLongRgbColor, resolveBorderEdge, resolveFillBackground, resolveHorizontalAlignment, resolveIcvColor, resolveVerticalAlignment, unpackXfAlignment, unpackXfDecoration, vertAlignTokenFor };
|
package/dist/biff/xf-colors.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
export { BORDER_STYLE_DASHDOT, BORDER_STYLE_DASHDOTDOT, BORDER_STYLE_DASHED, BORDER_STYLE_DOTTED, BORDER_STYLE_DOUBLE, BORDER_STYLE_HAIR, BORDER_STYLE_MEDIUM, BORDER_STYLE_MEDIUM_DASHDOT, BORDER_STYLE_MEDIUM_DASHDOTDOT, BORDER_STYLE_MEDIUM_DASHED, BORDER_STYLE_NONE, BORDER_STYLE_SLANT_DASHDOT, BORDER_STYLE_THICK, BORDER_STYLE_THIN, DEFAULT_PALETTE_HEX_TO_ICV, FILL_PATTERN_NONE, FILL_PATTERN_SOLID, ICV_AUTOMATIC_BACKGROUND, ICV_AUTOMATIC_FOREGROUND, PALETTE_BASE_ICV, PALETTE_ENTRY_COUNT, PATTERN_TYPE_TO_FILL_PATTERN, UNDECORATED_XF_FIELDS, XfAlignmentFields, XfBorderEdge, XfDecorationFields, borderStyleTokenFor, horizAlignTokenFor, longRgbBytesOf, packXfDecorationWords, readLongRgbColor, resolveBorderEdge, resolveFillBackground, resolveHorizontalAlignment, resolveIcvColor, resolveVerticalAlignment, unpackXfAlignment, unpackXfDecoration, vertAlignTokenFor };
|
|
1
|
+
import { A as longRgbBytesOf, B as vertAlignTokenFor, C as UNDECORATED_XF_FIELDS, D as applyTint, E as XfDecorationFields, F as resolveHorizontalAlignment, I as resolveIcvColor, L as resolveVerticalAlignment, M as readLongRgbColor, N as resolveBorderEdge, O as borderStyleTokenFor, P as resolveFillBackground, R as unpackXfAlignment, S as PATTERN_TYPE_TO_FILL_PATTERN, T as XfBorderEdge, _ as FILL_PATTERN_SOLID, a as BORDER_STYLE_DOUBLE, b as PALETTE_BASE_ICV, c as BORDER_STYLE_MEDIUM_DASHDOT, d as BORDER_STYLE_NONE, f as BORDER_STYLE_SLANT_DASHDOT, g as FILL_PATTERN_NONE, h as DEFAULT_PALETTE_HEX_TO_ICV, i as BORDER_STYLE_DOTTED, j as packXfDecorationWords, k as horizAlignTokenFor, l as BORDER_STYLE_MEDIUM_DASHDOTDOT, m as BORDER_STYLE_THIN, n as BORDER_STYLE_DASHDOTDOT, o as BORDER_STYLE_HAIR, p as BORDER_STYLE_THICK, r as BORDER_STYLE_DASHED, s as BORDER_STYLE_MEDIUM, t as BORDER_STYLE_DASHDOT, u as BORDER_STYLE_MEDIUM_DASHED, v as ICV_AUTOMATIC_BACKGROUND, w as XfAlignmentFields, x as PALETTE_ENTRY_COUNT, y as ICV_AUTOMATIC_FOREGROUND, z as unpackXfDecoration } from "../xf-colors-d3OvRw76.js";
|
|
2
|
+
export { BORDER_STYLE_DASHDOT, BORDER_STYLE_DASHDOTDOT, BORDER_STYLE_DASHED, BORDER_STYLE_DOTTED, BORDER_STYLE_DOUBLE, BORDER_STYLE_HAIR, BORDER_STYLE_MEDIUM, BORDER_STYLE_MEDIUM_DASHDOT, BORDER_STYLE_MEDIUM_DASHDOTDOT, BORDER_STYLE_MEDIUM_DASHED, BORDER_STYLE_NONE, BORDER_STYLE_SLANT_DASHDOT, BORDER_STYLE_THICK, BORDER_STYLE_THIN, DEFAULT_PALETTE_HEX_TO_ICV, FILL_PATTERN_NONE, FILL_PATTERN_SOLID, ICV_AUTOMATIC_BACKGROUND, ICV_AUTOMATIC_FOREGROUND, PALETTE_BASE_ICV, PALETTE_ENTRY_COUNT, PATTERN_TYPE_TO_FILL_PATTERN, UNDECORATED_XF_FIELDS, XfAlignmentFields, XfBorderEdge, XfDecorationFields, applyTint, borderStyleTokenFor, horizAlignTokenFor, longRgbBytesOf, packXfDecorationWords, readLongRgbColor, resolveBorderEdge, resolveFillBackground, resolveHorizontalAlignment, resolveIcvColor, resolveVerticalAlignment, unpackXfAlignment, unpackXfDecoration, vertAlignTokenFor };
|
package/dist/biff/xf-colors.js
CHANGED
|
@@ -185,6 +185,66 @@ function resolveIcvColor(icv, palette) {
|
|
|
185
185
|
return palette === void 0 ? DEFAULT_PALETTE_TABLE[index] : palette[index];
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
|
+
function rgbToHsl(color) {
|
|
189
|
+
const { r, g, b } = color;
|
|
190
|
+
const max = Math.max(r, g, b);
|
|
191
|
+
const min = Math.min(r, g, b);
|
|
192
|
+
const l = (max + min) / 2;
|
|
193
|
+
if (max === min) return {
|
|
194
|
+
h: 0,
|
|
195
|
+
s: 0,
|
|
196
|
+
l
|
|
197
|
+
};
|
|
198
|
+
const d = max - min;
|
|
199
|
+
const s = l > .5 ? d / (2 - max - min) : d / (max + min);
|
|
200
|
+
let h;
|
|
201
|
+
if (max === r) h = (g - b) / d + (g < b ? 6 : 0);
|
|
202
|
+
else if (max === g) h = (b - r) / d + 2;
|
|
203
|
+
else h = (r - g) / d + 4;
|
|
204
|
+
return {
|
|
205
|
+
h: h / 6,
|
|
206
|
+
s,
|
|
207
|
+
l
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
function hslToRgb(hsl) {
|
|
211
|
+
const { h, s, l } = hsl;
|
|
212
|
+
if (s === 0) return {
|
|
213
|
+
r: l,
|
|
214
|
+
g: l,
|
|
215
|
+
b: l
|
|
216
|
+
};
|
|
217
|
+
const hueToRgb = (p, q, t) => {
|
|
218
|
+
let tt = t;
|
|
219
|
+
if (tt < 0) tt += 1;
|
|
220
|
+
if (tt > 1) tt -= 1;
|
|
221
|
+
if (tt < 1 / 6) return p + (q - p) * 6 * tt;
|
|
222
|
+
if (tt < 1 / 2) return q;
|
|
223
|
+
if (tt < 2 / 3) return p + (q - p) * (2 / 3 - tt) * 6;
|
|
224
|
+
return p;
|
|
225
|
+
};
|
|
226
|
+
const q = l < .5 ? l * (1 + s) : l + s - l * s;
|
|
227
|
+
const p = 2 * l - q;
|
|
228
|
+
return {
|
|
229
|
+
r: hueToRgb(p, q, h + 1 / 3),
|
|
230
|
+
g: hueToRgb(p, q, h),
|
|
231
|
+
b: hueToRgb(p, q, h - 1 / 3)
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Applies Excel's own "TintAndShade" colour model to an already-resolved colour: a single -1.0..1.0 value shading a colour toward black (negative) or tinting it toward white (positive), the model CFColor's own numTint field ([MS-XLS] 2.4, https://learn.microsoft.com/en-us/openspecs/office_file_formats/ms-xls/fd8e679d-069f-486b-ab48-2382cc167305) carries -- distinct from DrawingML's own separate shade/tint elements (ooxml.js's typed/shared/color.ts), which apply in linear light rather than adjusting HSL lightness directly.
|
|
236
|
+
*
|
|
237
|
+
* The formula itself -- Lum' = Lum*(1+tint) for a negative tint, Lum' = Lum*(1-tint) + tint for a positive one -- is Microsoft's own documented Color.TintAndShade algorithm, cross-checked against Apache POI's XSSFColor#getTint/#setTint javadoc (a completely independent implementation carrying the identical formula) rather than trusted from memory alone.
|
|
238
|
+
*/
|
|
239
|
+
function applyTint(color, tint) {
|
|
240
|
+
if (tint === 0) return color;
|
|
241
|
+
const hsl = rgbToHsl(color);
|
|
242
|
+
const l = tint < 0 ? hsl.l * (1 + tint) : hsl.l * (1 - tint) + tint;
|
|
243
|
+
return hslToRgb({
|
|
244
|
+
...hsl,
|
|
245
|
+
l
|
|
246
|
+
});
|
|
247
|
+
}
|
|
188
248
|
/** Every BorderStyle token this reader resolves to a (weight, pattern) pair -- BORDER_STYLE_NONE has no entry, since "no border" is handled by the caller before consulting this table. The dash-family tokens (dashDot/dashDotDot and their medium/slant variants) collapse to 'dashed', the closest ContentStrokeStyle member, exactly as ooxml.js's own XLSX_BORDER_STYLE table does for the equivalent xlsx tokens. */
|
|
189
249
|
const BIFF_BORDER_STYLE = {
|
|
190
250
|
[1]: {
|
|
@@ -386,4 +446,4 @@ function longRgbBytesOf(color) {
|
|
|
386
446
|
];
|
|
387
447
|
}
|
|
388
448
|
//#endregion
|
|
389
|
-
export { BORDER_STYLE_DASHDOT, BORDER_STYLE_DASHDOTDOT, BORDER_STYLE_DASHED, BORDER_STYLE_DOTTED, BORDER_STYLE_DOUBLE, BORDER_STYLE_HAIR, BORDER_STYLE_MEDIUM, BORDER_STYLE_MEDIUM_DASHDOT, BORDER_STYLE_MEDIUM_DASHDOTDOT, BORDER_STYLE_MEDIUM_DASHED, BORDER_STYLE_NONE, BORDER_STYLE_SLANT_DASHDOT, BORDER_STYLE_THICK, BORDER_STYLE_THIN, DEFAULT_PALETTE_HEX_TO_ICV, FILL_PATTERN_NONE, FILL_PATTERN_SOLID, ICV_AUTOMATIC_BACKGROUND, ICV_AUTOMATIC_FOREGROUND, PALETTE_BASE_ICV, PALETTE_ENTRY_COUNT, PATTERN_TYPE_TO_FILL_PATTERN, UNDECORATED_XF_FIELDS, borderStyleTokenFor, horizAlignTokenFor, longRgbBytesOf, packXfDecorationWords, readLongRgbColor, resolveBorderEdge, resolveFillBackground, resolveHorizontalAlignment, resolveIcvColor, resolveVerticalAlignment, unpackXfAlignment, unpackXfDecoration, vertAlignTokenFor };
|
|
449
|
+
export { BORDER_STYLE_DASHDOT, BORDER_STYLE_DASHDOTDOT, BORDER_STYLE_DASHED, BORDER_STYLE_DOTTED, BORDER_STYLE_DOUBLE, BORDER_STYLE_HAIR, BORDER_STYLE_MEDIUM, BORDER_STYLE_MEDIUM_DASHDOT, BORDER_STYLE_MEDIUM_DASHDOTDOT, BORDER_STYLE_MEDIUM_DASHED, BORDER_STYLE_NONE, BORDER_STYLE_SLANT_DASHDOT, BORDER_STYLE_THICK, BORDER_STYLE_THIN, DEFAULT_PALETTE_HEX_TO_ICV, FILL_PATTERN_NONE, FILL_PATTERN_SOLID, ICV_AUTOMATIC_BACKGROUND, ICV_AUTOMATIC_FOREGROUND, PALETTE_BASE_ICV, PALETTE_ENTRY_COUNT, PATTERN_TYPE_TO_FILL_PATTERN, UNDECORATED_XF_FIELDS, applyTint, borderStyleTokenFor, horizAlignTokenFor, longRgbBytesOf, packXfDecorationWords, readLongRgbColor, resolveBorderEdge, resolveFillBackground, resolveHorizontalAlignment, resolveIcvColor, resolveVerticalAlignment, unpackXfAlignment, unpackXfDecoration, vertAlignTokenFor };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { E as XfDecorationFields } from "../xf-colors-
|
|
1
|
+
import { E as XfDecorationFields } from "../xf-colors-mqerVt2O.cjs";
|
|
2
2
|
import { Alignment, Color } from "document-schema.js";
|
|
3
3
|
//#region src/biff/xf-writer.d.ts
|
|
4
4
|
/** Writes one cell-format XF record (fStyle=0): ifnt/ifmt as given, ixfParent pointing at the Normal cell-style XF (index 0), a CellXF payload carrying `alignment`/`verticalAlignment`/`decoration`'s own fields -- general alignment, bottom vertical alignment, and no fill/border (the same bytes this always wrote before either existed) for whatever is omitted. Twenty bytes total ([MS-XLS] 2.4.353). */
|
package/dist/biff/xf-writer.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { E as XfDecorationFields } from "../xf-colors
|
|
1
|
+
import { E as XfDecorationFields } from "../xf-colors-d3OvRw76.js";
|
|
2
2
|
import { Alignment, Color } from "document-schema.js";
|
|
3
3
|
//#region src/biff/xf-writer.d.ts
|
|
4
4
|
/** Writes one cell-format XF record (fStyle=0): ifnt/ifmt as given, ixfParent pointing at the Normal cell-style XF (index 0), a CellXF payload carrying `alignment`/`verticalAlignment`/`decoration`'s own fields -- general alignment, bottom vertical alignment, and no fill/border (the same bytes this always wrote before either existed) for whatever is omitted. Twenty bytes total ([MS-XLS] 2.4.353). */
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { r as FormulaSheetContext } from "./ptg-CCBbJLZJ.cjs";
|
|
2
|
+
import { t as RecordGroup } from "./substreams-Cpy5Fi3d.cjs";
|
|
3
|
+
import { i as RawConditionalFormatStyle } from "./conditional-format-S9NaPjhr.cjs";
|
|
4
|
+
import { Color, ContentSheetConditionalFormat, ContentSheetConditionalFormatValue, ContentSheetRange } from "document-schema.js";
|
|
5
|
+
//#region src/workbook/conditional-format-12.d.ts
|
|
6
|
+
type RawCfColor = {
|
|
7
|
+
readonly kind: "icv";
|
|
8
|
+
readonly icv: number;
|
|
9
|
+
readonly tint: number;
|
|
10
|
+
} | {
|
|
11
|
+
readonly kind: "rgb";
|
|
12
|
+
readonly color: Color;
|
|
13
|
+
readonly tint: number;
|
|
14
|
+
};
|
|
15
|
+
interface RawConditionalFormat12Common {
|
|
16
|
+
/** CF12's own ipriority field, always genuinely present and meaningful (MUST be unique across every CF12 record in the worksheet substream) -- unlike base CF, which has no priority concept at all, this is never an "absent" or omittable-default value. */
|
|
17
|
+
readonly priority: number;
|
|
18
|
+
readonly stopIfTrue: boolean;
|
|
19
|
+
readonly ranges: ContentSheetRange[];
|
|
20
|
+
}
|
|
21
|
+
interface RawColorScaleFormat extends RawConditionalFormat12Common {
|
|
22
|
+
readonly kind: "colorScale";
|
|
23
|
+
readonly stops: readonly {
|
|
24
|
+
readonly value: ContentSheetConditionalFormatValue;
|
|
25
|
+
readonly color: RawCfColor;
|
|
26
|
+
}[];
|
|
27
|
+
}
|
|
28
|
+
interface RawDataBarFormat extends RawConditionalFormat12Common {
|
|
29
|
+
readonly kind: "dataBar";
|
|
30
|
+
readonly min: ContentSheetConditionalFormatValue;
|
|
31
|
+
readonly max: ContentSheetConditionalFormatValue;
|
|
32
|
+
readonly color: RawCfColor;
|
|
33
|
+
readonly showValue: boolean;
|
|
34
|
+
}
|
|
35
|
+
interface RawIconSetFormat extends RawConditionalFormat12Common {
|
|
36
|
+
readonly kind: "iconSet";
|
|
37
|
+
readonly iconSetType: string;
|
|
38
|
+
readonly thresholds: readonly ContentSheetConditionalFormatValue[];
|
|
39
|
+
readonly reverse: boolean;
|
|
40
|
+
readonly showValue: boolean;
|
|
41
|
+
}
|
|
42
|
+
type RawTimePeriod = Extract<ContentSheetConditionalFormat, {
|
|
43
|
+
readonly type: "timePeriod";
|
|
44
|
+
}>["timePeriod"];
|
|
45
|
+
interface RawFilterFormatCommon extends RawConditionalFormat12Common {
|
|
46
|
+
readonly style: RawConditionalFormatStyle | undefined;
|
|
47
|
+
}
|
|
48
|
+
interface RawTop10Format extends RawFilterFormatCommon {
|
|
49
|
+
readonly kind: "top10";
|
|
50
|
+
readonly rank: number;
|
|
51
|
+
readonly percent: boolean;
|
|
52
|
+
readonly bottom: boolean;
|
|
53
|
+
}
|
|
54
|
+
interface RawAboveAverageFormat extends RawFilterFormatCommon {
|
|
55
|
+
readonly kind: "aboveAverage";
|
|
56
|
+
readonly aboveAverage: boolean;
|
|
57
|
+
readonly equalAverage: boolean;
|
|
58
|
+
readonly stdDev: number | undefined;
|
|
59
|
+
}
|
|
60
|
+
interface RawTimePeriodFormat extends RawFilterFormatCommon {
|
|
61
|
+
readonly kind: "timePeriod";
|
|
62
|
+
readonly timePeriod: RawTimePeriod;
|
|
63
|
+
}
|
|
64
|
+
/** duplicateValues/uniqueValues and the four blank/error conditions carry no data beyond which one a rule is -- CFExDefaultTemplateParams is 16 reserved bytes ([MS-XLS] 2.4, https://learn.microsoft.com/en-us/openspecs/office_file_formats/ms-xls/c8f156b6-10ec-4594-adb1-c734fbb1fc11). */
|
|
65
|
+
interface RawSimpleFilterFormat extends RawFilterFormatCommon {
|
|
66
|
+
readonly kind: "containsBlanks" | "notContainsBlanks" | "containsErrors" | "notContainsErrors" | "uniqueValues" | "duplicateValues";
|
|
67
|
+
}
|
|
68
|
+
type RawConditionalFormat12 = RawColorScaleFormat | RawDataBarFormat | RawIconSetFormat | RawTop10Format | RawAboveAverageFormat | RawTimePeriodFormat | RawSimpleFilterFormat;
|
|
69
|
+
interface CondFmt12GroupResult {
|
|
70
|
+
readonly formats: RawConditionalFormat12[];
|
|
71
|
+
/** How many records (the CondFmt12 itself plus every CF12 it claimed) the caller should advance past, regardless of how many rules actually promoted. */
|
|
72
|
+
readonly recordsConsumed: number;
|
|
73
|
+
}
|
|
74
|
+
declare function readCondFmt12Group(records: readonly RecordGroup[], startIndex: number, formulaSheets: FormulaSheetContext): CondFmt12GroupResult;
|
|
75
|
+
//#endregion
|
|
76
|
+
export { RawConditionalFormat12 as a, RawSimpleFilterFormat as c, RawTop10Format as d, readCondFmt12Group as f, RawColorScaleFormat as i, RawTimePeriod as l, RawAboveAverageFormat as n, RawDataBarFormat as o, RawCfColor as r, RawIconSetFormat as s, CondFmt12GroupResult as t, RawTimePeriodFormat as u };
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { r as FormulaSheetContext } from "./ptg-CCBbJLZJ.js";
|
|
2
|
+
import { t as RecordGroup } from "./substreams-CmyZMtuM.js";
|
|
3
|
+
import { i as RawConditionalFormatStyle } from "./conditional-format-CWlz0Ty6.js";
|
|
4
|
+
import { Color, ContentSheetConditionalFormat, ContentSheetConditionalFormatValue, ContentSheetRange } from "document-schema.js";
|
|
5
|
+
//#region src/workbook/conditional-format-12.d.ts
|
|
6
|
+
type RawCfColor = {
|
|
7
|
+
readonly kind: "icv";
|
|
8
|
+
readonly icv: number;
|
|
9
|
+
readonly tint: number;
|
|
10
|
+
} | {
|
|
11
|
+
readonly kind: "rgb";
|
|
12
|
+
readonly color: Color;
|
|
13
|
+
readonly tint: number;
|
|
14
|
+
};
|
|
15
|
+
interface RawConditionalFormat12Common {
|
|
16
|
+
/** CF12's own ipriority field, always genuinely present and meaningful (MUST be unique across every CF12 record in the worksheet substream) -- unlike base CF, which has no priority concept at all, this is never an "absent" or omittable-default value. */
|
|
17
|
+
readonly priority: number;
|
|
18
|
+
readonly stopIfTrue: boolean;
|
|
19
|
+
readonly ranges: ContentSheetRange[];
|
|
20
|
+
}
|
|
21
|
+
interface RawColorScaleFormat extends RawConditionalFormat12Common {
|
|
22
|
+
readonly kind: "colorScale";
|
|
23
|
+
readonly stops: readonly {
|
|
24
|
+
readonly value: ContentSheetConditionalFormatValue;
|
|
25
|
+
readonly color: RawCfColor;
|
|
26
|
+
}[];
|
|
27
|
+
}
|
|
28
|
+
interface RawDataBarFormat extends RawConditionalFormat12Common {
|
|
29
|
+
readonly kind: "dataBar";
|
|
30
|
+
readonly min: ContentSheetConditionalFormatValue;
|
|
31
|
+
readonly max: ContentSheetConditionalFormatValue;
|
|
32
|
+
readonly color: RawCfColor;
|
|
33
|
+
readonly showValue: boolean;
|
|
34
|
+
}
|
|
35
|
+
interface RawIconSetFormat extends RawConditionalFormat12Common {
|
|
36
|
+
readonly kind: "iconSet";
|
|
37
|
+
readonly iconSetType: string;
|
|
38
|
+
readonly thresholds: readonly ContentSheetConditionalFormatValue[];
|
|
39
|
+
readonly reverse: boolean;
|
|
40
|
+
readonly showValue: boolean;
|
|
41
|
+
}
|
|
42
|
+
type RawTimePeriod = Extract<ContentSheetConditionalFormat, {
|
|
43
|
+
readonly type: "timePeriod";
|
|
44
|
+
}>["timePeriod"];
|
|
45
|
+
interface RawFilterFormatCommon extends RawConditionalFormat12Common {
|
|
46
|
+
readonly style: RawConditionalFormatStyle | undefined;
|
|
47
|
+
}
|
|
48
|
+
interface RawTop10Format extends RawFilterFormatCommon {
|
|
49
|
+
readonly kind: "top10";
|
|
50
|
+
readonly rank: number;
|
|
51
|
+
readonly percent: boolean;
|
|
52
|
+
readonly bottom: boolean;
|
|
53
|
+
}
|
|
54
|
+
interface RawAboveAverageFormat extends RawFilterFormatCommon {
|
|
55
|
+
readonly kind: "aboveAverage";
|
|
56
|
+
readonly aboveAverage: boolean;
|
|
57
|
+
readonly equalAverage: boolean;
|
|
58
|
+
readonly stdDev: number | undefined;
|
|
59
|
+
}
|
|
60
|
+
interface RawTimePeriodFormat extends RawFilterFormatCommon {
|
|
61
|
+
readonly kind: "timePeriod";
|
|
62
|
+
readonly timePeriod: RawTimePeriod;
|
|
63
|
+
}
|
|
64
|
+
/** duplicateValues/uniqueValues and the four blank/error conditions carry no data beyond which one a rule is -- CFExDefaultTemplateParams is 16 reserved bytes ([MS-XLS] 2.4, https://learn.microsoft.com/en-us/openspecs/office_file_formats/ms-xls/c8f156b6-10ec-4594-adb1-c734fbb1fc11). */
|
|
65
|
+
interface RawSimpleFilterFormat extends RawFilterFormatCommon {
|
|
66
|
+
readonly kind: "containsBlanks" | "notContainsBlanks" | "containsErrors" | "notContainsErrors" | "uniqueValues" | "duplicateValues";
|
|
67
|
+
}
|
|
68
|
+
type RawConditionalFormat12 = RawColorScaleFormat | RawDataBarFormat | RawIconSetFormat | RawTop10Format | RawAboveAverageFormat | RawTimePeriodFormat | RawSimpleFilterFormat;
|
|
69
|
+
interface CondFmt12GroupResult {
|
|
70
|
+
readonly formats: RawConditionalFormat12[];
|
|
71
|
+
/** How many records (the CondFmt12 itself plus every CF12 it claimed) the caller should advance past, regardless of how many rules actually promoted. */
|
|
72
|
+
readonly recordsConsumed: number;
|
|
73
|
+
}
|
|
74
|
+
declare function readCondFmt12Group(records: readonly RecordGroup[], startIndex: number, formulaSheets: FormulaSheetContext): CondFmt12GroupResult;
|
|
75
|
+
//#endregion
|
|
76
|
+
export { RawConditionalFormat12 as a, RawSimpleFilterFormat as c, RawTop10Format as d, readCondFmt12Group as f, RawColorScaleFormat as i, RawTimePeriod as l, RawAboveAverageFormat as n, RawDataBarFormat as o, RawCfColor as r, RawIconSetFormat as s, CondFmt12GroupResult as t, RawTimePeriodFormat as u };
|
|
@@ -18,6 +18,7 @@ interface RawConditionalFormat {
|
|
|
18
18
|
readonly style: RawConditionalFormatStyle | undefined;
|
|
19
19
|
readonly ranges: ContentSheetRange[];
|
|
20
20
|
}
|
|
21
|
+
declare function parseDxfStyle(dxfBytes: Uint8Array<ArrayBuffer>): RawConditionalFormatStyle | undefined;
|
|
21
22
|
interface CondFmtGroupResult {
|
|
22
23
|
readonly formats: RawConditionalFormat[];
|
|
23
24
|
/** How many records (the CondFmt itself plus every CF it claimed) the caller should advance past, regardless of how many rules actually promoted. */
|
|
@@ -25,4 +26,4 @@ interface CondFmtGroupResult {
|
|
|
25
26
|
}
|
|
26
27
|
declare function readCondFmtGroup(records: readonly RecordGroup[], startIndex: number, formulaSheets: FormulaSheetContext): CondFmtGroupResult;
|
|
27
28
|
//#endregion
|
|
28
|
-
export {
|
|
29
|
+
export { parseDxfStyle as a, RawConditionalFormatStyle as i, RawConditionalFormat as n, readCondFmtGroup as o, RawConditionalFormatFill as r, CondFmtGroupResult as t };
|
|
@@ -18,6 +18,7 @@ interface RawConditionalFormat {
|
|
|
18
18
|
readonly style: RawConditionalFormatStyle | undefined;
|
|
19
19
|
readonly ranges: ContentSheetRange[];
|
|
20
20
|
}
|
|
21
|
+
declare function parseDxfStyle(dxfBytes: Uint8Array<ArrayBuffer>): RawConditionalFormatStyle | undefined;
|
|
21
22
|
interface CondFmtGroupResult {
|
|
22
23
|
readonly formats: RawConditionalFormat[];
|
|
23
24
|
/** How many records (the CondFmt itself plus every CF it claimed) the caller should advance past, regardless of how many rules actually promoted. */
|
|
@@ -25,4 +26,4 @@ interface CondFmtGroupResult {
|
|
|
25
26
|
}
|
|
26
27
|
declare function readCondFmtGroup(records: readonly RecordGroup[], startIndex: number, formulaSheets: FormulaSheetContext): CondFmtGroupResult;
|
|
27
28
|
//#endregion
|
|
28
|
-
export {
|
|
29
|
+
export { parseDxfStyle as a, RawConditionalFormatStyle as i, RawConditionalFormat as n, readCondFmtGroup as o, RawConditionalFormatFill as r, CondFmtGroupResult as t };
|