Files
craft-libs/crates/sheet
Dylan M. Taylor 7b936bf293 craft-xlsx: typed worksheet features (views, print, validation, conditional formats, hyperlinks, comments) (#1048)
* craft-xlsx: read parts with canonical prefixes so kept trees can be written back

The part layer read every part by local name, so extLst children (x14:, xr:, xm:),
mc:AlternateContent and r:id lost their namespaces and could not be written back.
Parts are now read with one fixed prefix per namespace (the main namespace unprefixed),
mc:Ignorable and mc:Choice/@Requires are rewritten to match, and ns::declare prepares a
kept tree for writing. craft-xml: a namespace listed with the empty prefix reads unprefixed.

* craft-xlsx: write SpreadsheetML workbooks (Document read and write)

Document holds a whole workbook: the workbook part, shared strings, styles, each worksheet's
rows and the rest of its part, and every other part kept as bytes. write regenerates the
workbook part, worksheets, shared strings and styles from the model, keeps unknown children
in place (schema order for regenerated ones), keeps part names and relationship ids, and
writes kept parts unchanged. Writers: Styles::to_xml and to_el for each table entry,
StringItem::to_el (phonetic runs checked as on reading), SheetPart::to_xml with rows
streamed, Workbook::to_el, XlsxKind. Row and DefinedName keep their other attributes;
CellStyle reads iLevel. craft-opc: LazyPackage::canonical gives a part's stored name.

* craft-xlsx: typed worksheet features and comments, written back

SheetPart::features lifts sheet views, print setup, data validation, conditional formats,
hyperlinks and the legacy drawing into types that mirror their elements (optional attributes,
unnamed ones kept) and writes them in schema order. Comments come from the comments part,
note shapes from the VML drawing; a sheet that gains comments without a VML drawing gets one.
A hyperlink to a new URL gets its own relationship. craft-sheet: Range derives Default.
2026-11-11 21:07:34 -05:00
..

craft-sheet

What every spreadsheet file format says in the same words, kept once so that craft-xls, craft-xlsx and craft-ods hand an application the same types:

  • CellRef and Range: zero-based cell positions, and their A1 text both ways (B3, $B$3, A1:C2), inside Excel's 1,048,576 by 16,384 grid.
  • Value and CellError: what a cell stores, and the error values with their text (#DIV/0!).
  • Visibility: visible, hidden, very hidden.
  • sheet_needs_quotes, quote_sheet: a sheet name as a reference spells it ('My Sheet'!A1).
  • HAlign, VAlign, Underline, Script, BorderStyle, Pattern: the cell formatting choices BIFF8 and SpreadsheetML share.
  • builtin_format, builtin_format_id: the number format codes behind the built-in ids (ECMA-376 Part 1, 18.8.30; [MS-XLS] 2.4.126).
  • DEFAULT_PALETTE: the 64 indexed colours ([MS-XLS] 2.4.188; ECMA-376 Part 1, 18.8.27).

It is not a file format and has no dependencies. It holds no document model: sheets, styles and formulas are each format's own.