* craft-docx: keep a table style's w:tblInd on read and save A table style's own indent was dropped on read, so it was gone on save. pandoc's Table style sets it to 0, and Word for Mac places a table whose style chain sets no indent about 5.4 pt further right than one set to 0. craft-wordmodel gains TableStyleParts::indent, merged through basedOn. The reader takes a dxa indent (nil is 0; pct and auto set none) and the writer emits it in schema order, 0 included. Part of storytold/wordcraft#5767. * craft-docx: a table style's w:tblInd without w:w is 0 CT_TblWidth's w:w defaults to 0, so the style resets a based-on style's indent instead of inheriting it. The test helper now fails when a saved style is missing rather than matching an empty string. * craft-docx: the tblInd override test checks the base sets an indent Without it the test would pass if the reader dropped the base style's indent, since there would be nothing to override.
craft-wordmodel
A word-processing document model: stories, paragraphs, runs, tables, sections, styles, numbering, fields, content controls, notes, comments, revisions, floating objects, drawings and math. It is what the DOCX, RTF, ODT and other text-format crates read into and write from.
It is WordCraft's document model (crates/doc), moved without its editing code. Module paths,
type names and serde attributes are as they were, so an app that re-exports the crate keeps its
native file format.
use craft_wordmodel::{Block, Document};
let doc = Document::from_text("One\nTwo");
assert_eq!(doc.body.len(), 2);
assert!(matches!(&*doc.body[0], Block::Para(p) if p.text == "One"));
What is here
Document: the body story, secondary stories (parts: headers, footers, notes, comments, text boxes), the style sheet, list definitions, comments, revisions, settings, document properties, media and parts kept from the source file.Block,Paragraph,Run,InlineObject,Table: the content. Paragraph text is UTF-8; an inline object stands in the text as U+FFFC (para::OBJ).props,styles,resolve,numbering,section: formatting and its resolution.math,math_latex,math_linear,math_symbols: the equation tree (MNode) and its linear and LaTeX forms.chart,smart_art,graphic,fill,connector,freeform,wordart,effects,picfx,line_dash: drawing objects as the model holds them. Reading and writing their DrawingML iscraft-drawingml's job, in the format crates.kept: markup kept from the file a document was read from, so what is not edited is written back as it was.walk,work,geom,bidi,cluster,collate,locale_number,symbol_fonts.
Not here
Range editing, copy and paste, IME text and equation editing stay with the app that edits.
Code pages are craft-rtf's codepage, the ZIP entry-count check is craft-opc's.
Limits
The model carries the limits its readers rely on: nesting of tables (table::MAX_TABLE_DEPTH),
text boxes (MAX_TEXT_BOX_DEPTH, BoxBudget), math (math::MAX_DEPTH, matrix sizes), group
children, alt text length, linked boxes and the walk depth (PARA_WALK_DEPTH). Their tests
moved with them.