From 20050077adcd794cfef32805f73de6191069962d Mon Sep 17 00:00:00 2001 From: kiwi4boy Date: Thu, 12 Nov 2026 23:36:47 -0500 Subject: [PATCH] craft-xlsx: the README describes formulas in binary workbooks They were "token streams that are not decoded". The README now says what the decoder gives (text in the file's spelling, shared and array kinds and ranges, cell metadata, each shared copy's own text), what keeps its saved result and why, that the function table and printer are this crate's own, and the binary_formula_text limit with the decoder's fixed bounds. --- crates/xlsx/README.md | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/crates/xlsx/README.md b/crates/xlsx/README.md index 3d3808ad3..1dc30574d 100644 --- a/crates/xlsx/README.md +++ b/crates/xlsx/README.md @@ -83,9 +83,15 @@ for new pictures (`vm = i + 1`) and the `XLDAPR` dynamic-array metadata (`cm = 1 The parts this crate writes use the transitional namespaces; a strict file's kept parts stay as they were. A binary workbook is not written. -A binary workbook gives the same `Workbook`, strings, rows and merged cells, with saved values -only: its formulas are token streams that are not decoded, and its styles are not read (each -cell keeps its format index). +A binary workbook gives the same `Workbook`, strings, rows and merged cells. Its styles are not +read (each cell keeps its format index). Its cell formulas are decoded from their tokens into the +text an `.xlsx` file holds (`_xlfn.` and `_xlpm.` names as written, no implicit `@`), with +`FormulaKind::Shared` or `FormulaKind::Array` and their ranges, and `BrtCellMeta` as the cell +metadata index. Every cell of a shared formula gets its own text, decoded at the cell, since the +file keeps the tokens once. A formula whose decoding needs something the reader does not read +keeps only its saved result, with a warning saying why: user defined names, table references, +other workbooks, Python code stored outside the cell, data tables. The XLSB function table +(`xlsb/ftab.rs`) and the expression printer are this crate's own, apart from `craft-xls`'s. ## Hostile input @@ -94,7 +100,9 @@ cell keeps its format index). string and what is left of a part, not a sheet's length. - `Limits.binary_records`, `binary_cells`, `binary_text`: a binary workbook, over all its parts (40 million records, 4 million cells and as many shared strings, 256 MiB of text, as - `craft-xls` allows). Fixed caps: 1024 sheets, 100,000 merged ranges per sheet, 64 nested + `craft-xls` allows). `binary_formula_text`: decoded formula text over the workbook (128 MiB); + past it, formulas keep their saved results. A formula's tokens are bounded at 16 KB, its + nesting at 256 levels and an array constant at 65,536 values. Fixed caps: 1024 sheets, 100,000 merged ranges per sheet, 64 nested extension blocks. - Cells and rows outside the 1,048,576 × 16,384 grid are dropped and counted.