Oregami
Repositories/oxedyne/fe2o3

oxedyne/fe2o3/fe2o3_file/src/office/xlsx/mod.rs

2.1 KiB, 7 runs

created by r1870400018:22744, which is this file's identity for as long as the history lasts, whatever it is later renamed to

download · who wrote it · its history

1//! SpreadsheetML: the `.xlsx` half of the Office formats.
2//!
3//! # What a `.xlsx` is, in one paragraph
4//!
5//! A ZIP holding `xl/workbook.xml`, which names the sheets and points at them; one
6//! `xl/worksheets/sheetN.xml` per sheet, which holds the cells; `xl/sharedStrings.xml`, which holds
7//! every distinct string in the book once; and `xl/styles.xml`, which is where a number turns out to
8//! be a date. Plus the two parts every Office document has, `[Content_Types].xml` and `_rels/.rels`.
9//!
10//! Inside a sheet the nesting is `worksheet > sheetData > row > c > v`: rows of cells, each carrying a
11//! value and, where there is one, an `<f>` holding the formula that produced it.
12//!
13//! # Three things about this format are traps and all three are handled here
14//!
15//! **A string is not in the cell.** `<c r="A1" t="s"><v>4</v></c>` does not hold the number four; it
16//! holds shared string number four. A reader that took the `<v>` at face value returns a column of
17//! small integers where the names were.
18//!
19//! **A date is not a date.** It is a number, and the only thing that makes it a date is the number
20//! format its style points at. Reading a sheet without reading `xl/styles.xml` turns every date in it
21//! into a five-digit integer.
22//!
23//! **A cell is not where its position says.** Rows and cells are sparse and carry their own
24//! addresses: a row may be missing entirely, and `<c r="D3">` may follow `<c r="A3">` with nothing
25//! between. A reader that pushed cells onto the end of a row puts every value after a gap in the wrong
26//! column, which is the kind of wrong that looks right.
27//!
28//! # The stored value is the value
29//!
30//! Nothing here recalculates a formula. See [`crate::office::sheet`] for why that is the correct
31//! answer rather than a shortcut.
32//!
33//! [Written with AI entirely](https://need2know.ai/entirely-ai/code)\
34//! Anthropic Claude
35
36pub mod edit;
37pub mod read;
38pub mod write;
39
40pub use read::read;
41pub use write::write;
42
43/// The SpreadsheetML namespace, which nearly every element of a workbook is in.
44pub const NS_S: &str = "http://schemas.openxmlformats.org/spreadsheetml/2006/main";