Oregami
Repositories/oxedyne/fe2o3

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

2.4 KiB, 12 runs

created by r1870400018:22585, 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//! The Office formats: a ZIP of XML, in six flavours.
2//!
3//! `.docx`, `.xlsx` and `.pptx` from Microsoft, and `.odt`, `.ods` and `.odp` from OpenDocument, are
4//! the same shape -- an archive whose members are XML parts, one of which is the content and the rest
5//! of which say what the content means. What differs is the vocabulary, and Microsoft's is roughly
6//! three times the size.
7//!
8//! # Three verbs, and they are not the same job
9//!
10//! **Creating** a document is the easy one and it goes through [`oxedyne_fe2o3_text::doc`], the neutral tree. You
11//! control every byte, there is no round trip to preserve, and the reader does the layout when it
12//! opens the file.
13//!
14//! **Reading** a document also goes through [`oxedyne_fe2o3_text::doc`], because what a reader wants is the prose.
15//! What the tree cannot carry is not lost, it is simply not prose, and a reading view says what it
16//! did not draw rather than pretending it drew everything.
17//!
18//! **Editing** a document does not go through [`oxedyne_fe2o3_text::doc`] and must never be made to.
19//! [`oxedyne_fe2o3_text::doc::policy`] argues that the tree deliberately cannot carry markup it has no node for,
20//! and that is exactly right for the first two verbs and exactly wrong for the third: everything the
21//! tree cannot represent is everything an edit through it would silently destroy -- the comments, the
22//! bookmarks, the tracked changes, the content controls, the custom XML, the theme, the tab stops.
23//! Editing goes through [`oxedyne_fe2o3_text::xml`], which splices bytes and copies the rest, over
24//! [`crate::zip`], which copies every member nobody touched.
25//!
26//! # What is deliberately not here
27//!
28//! No layout engine: a reading view maps to HTML and lets the browser shape and break the text, and
29//! says so, rather than claiming to match what Word prints. No macro execution, ever -- a macro part
30//! is copied through untouched and its presence is *said*. No authoring of tracked changes or
31//! comments, which are read and displayed and not written, because `w:ins` and `w:del` subtly wrong
32//! corrupts a legal review. No re-rendering of charts. No conversion between the two families, which
33//! is re-serialisation through a lossy model wearing the word "export".
34//!
35//! [Written with AI entirely](https://need2know.ai/entirely-ai/code)\
36//! Anthropic Claude
37
38pub mod deck;
39pub mod docx;
40pub mod edit;
41pub mod odf;
42pub mod opc;
43pub mod pptx;
44pub mod sheet;
45pub mod xlsx;