From 488db3751675d5fc8c36020f5e0d5625ed51dbdf Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 1 Nov 2026 02:41:03 +0000 Subject: [PATCH] Gap 19: ODT contextual spacing and LibreOffice layout settings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Contextual spacing (`style:contextual-spacing`, ODF 1.3 §20.255: no space between paragraphs of one style) is read from paragraph, custom and kind styles and written back, and the List Paragraph style is written like any other, so bulleted items keep their spacing; they were written in Standard and spread apart. LibreOffice switches many layout behaviours by `settings.xml`, and a file without them is laid out its own way. A file's own `settings.xml` is now kept through a save; a document from elsewhere gets the switches LibreOffice uses for Word files, as WordCraft lays text out as Word does. Tab stops are written from the margin either way. A Word-made document saved as ODT drew 38,652 px apart from LibreOffice's own ODT of it; now 3,302, with the same line breaks. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01GBVQLyDnrG8Tn1yDQcUabC --- ROADMAP.md | 3 +- crates/formats/src/model/from_doc.rs | 3 +- crates/formats/src/model/to_doc.rs | 3 + crates/formats/src/odt/body.rs | 3 + crates/formats/src/odt/import.rs | 15 ++- crates/formats/src/odt/package.rs | 116 ++++++++++++++++-- crates/formats/src/odt/styles.rs | 14 ++- crates/formats/src/odt/tests_more.rs | 1 + crates/formats/src/odt/tests_more/settings.rs | 51 ++++++++ crates/formats/src/odt/tests_more/spacing.rs | 28 +++++ crates/formats/src/odt/writer.rs | 3 + docs/file-format-parity.md | 3 +- 12 files changed, 225 insertions(+), 18 deletions(-) create mode 100644 crates/formats/src/odt/tests_more/settings.rs diff --git a/ROADMAP.md b/ROADMAP.md index b7ac676baa..e2c40b53fb 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -4,7 +4,7 @@ **Stage: alpha** · next: beta, ~15 points (60% → 75% ready for real work) and ~150–230 h away -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-31 · **Change:** trivial (progress log: ODT character styles); previously trivial (progress log: ODT custom styles); previously trivial (progress log: ODT equations saved); previously trivial (progress log: ODT floating pictures); previously trivial (progress log: ODT paragraph borders); previously trivial (progress log: ODT heading numbering); previously trivial (progress log: ODT table borders); previously trivial (progress log: ODT heading styles); previously trivial (progress log: ODT tab stops); previously trivial (progress log: ODT character formatting); previously trivial (progress log: ODT lists); previously trivial (progress log: ODT comments); previously trivial (progress log: ODT footnotes and endnotes); previously trivial (progress log: ODT headers, footers and fields); previously trivial (progress log: ODT paragraph spacing); previously trivial (progress log: a paragraph naming an undefined style is formatted as Normal, #5077); previously trivial (progress log: TOC page numbers as PAGEREF fields, #5097); previously trivial (progress log: Backstage keytips, #4960); previously trivial (Progress log: only the printer's PDF leaves out links; Save these pages as PDF keeps them, #4734); previously trivial (progress log: Chinese and Japanese text counts a word per character, #4547; previously trivial: aligned-copy review fixes retain the document axis through scrolling and include secondary selections (#4764)); previously trivial (connector rerouting indexes laid-out object positions once per batch (#3631); previously trivial (progress log: corporate authors in bibliographies, #4848); previously trivial (custom-property bookmark-link preservation, #4767); previously trivial (progress log: Table Properties follows the selection, #4857); previously trivial (Relative font-size commands preserve mixed sizes in the selection (#4903); existing button steps and one-point shortcuts are unchanged; readiness estimates unchanged); previously trivial (Arabic Backspace removes one combining mark and keeps its base letter (#4757); previously trivial (note conversion walks reference offsets and formatting runs together, #4750); previously trivial (DOCX comment-ID save lookups); previously trivial (progress log: RTF pictures stored as Windows or Enhanced Metafiles are imported, #4259); previously trivial (#4658 bounds nested Markdown reference-label work); previously trivial (HTML import keeps preformatted lines with CR or CRLF input newlines, #4810); previously trivial (progress log: Insert › Shapes icon grid, #4349); previously trivial (progress log: AutoCorrect Options with no document open, #4585); previously trivial (progress log: window fallback geometry and equation symbol tooltips); previously trivial (progress log: window titles omit NUL characters, #3634); previously trivial (Recipient labels continue across product-sized sheets instead of stopping after the first sheet (#4880)); previously trivial (progress log: Custom document properties dialog, #2982; previously trivial: progress log: View › New Window; previously trivial: progress log: interface translations come from storytold/craft-i18n through the `craft-i18n` crate; previously trivial: progress log: disabled-control reasons translated in every interface language, #2678; previously trivial: progress log: mail merge record navigation and record ranges for printing, #3028; previously trivial: selection bar for right-to-left paragraphs and table rows; previously trivial: group connector rerouting preserves rotated and flipped free or unresolved endpoints under nonuniform group scaling; readiness estimates unchanged; previously trivial: progress log: a word with no break opportunity in it no longer makes the layout quadratic, #3412; previously trivial: progress log: a relationship the markup names without the prefix is read as it wrote, and an ordinary `id` names no part; previously trivial: progress log: a document with many relationships opens in the time its part takes, and an id the text only mentions is not a reference, #3411; previously trivial: progress log: read only and comments-only protection grey out edits; previously trivial: progress log: an empty paragraph with a hidden mark shows nothing, not even its list number, #3982; previously trivial: progress log: "NaN" in the Font dialog's Size box no longer closes the app, #3663; previously trivial: progress log: a table cell span from a `.json` file no longer overflows, #3637; previously trivial: progress log: a click in the footer while editing the header moves there; previously trivial: explicit documents keep the editor when recovery discovery finishes; readable recovery controls; previously trivial: Slovenian interface catalog, 2,614 entries; previously trivial: Insert Table of Figures dialog for any caption label, #3013; previously trivial: progress log: Home › Underline drop-down, #2738; previously trivial: personal templates in File › New and Save as Word Template, #2852; previously trivial: progress log: the scrollbar page tip stays on one line, #3341; previously trivial: progress log: forms protection greys out the control buttons; previously trivial: progress log: a document with many content controls saves in the time the controls take, #13; previously trivial: progress log: Word signature lines kept on save; previously trivial: a Thai run with Latin finds one installed font covering it all on Linux too, #1549; previously trivial: progress log: closing the header returns to the body selection, #3331; previously trivial: progress log: saving to a NAS share mounted by GVFS, #3003; previously trivial: progress log: a picture dragged near the bottom of a page lands there, #3169; previously trivial: centred list labels after leading page breaks, #2964; previously trivial: progress log: inline pictures drag to an insertion cursor and stay inline, #2233, #2234; previously trivial: progress log: a text file saved over itself closes without asking, #2376; previously trivial: progress log: a text frame in the paragraph defaults frames nothing, #2360; previously trivial: fixed font inputs in four layout controls; previously trivial: typing no longer starts render threads on every repaint, #3027; previously trivial: a right, centre or decimal tab whose text doesn't fit, or a left tab past the right indent, goes to the next line with its text, #1840; previously trivial: progress log: banded rows shade as in Word, #3415; previously trivial: progress log: the table handles show while the caret is in the table, #2428; previously trivial: progress log: a click below a floating table reaches the text after it, #2038; previously trivial: progress log: Delete on selected table cells leaves one empty paragraph in each, #2802; previously trivial: progress log: lam-alef in exported PDFs extracts whole with fonts that draw it as two glyphs, #2310; previously trivial: Bullets and Numbering toggle off style-inherited lists at their effective level, including basedOn chains and numbered ListParagraph styles; other paragraphs and list definitions stay unchanged (related to #3459); previously trivial: Russian sorting keeps ё with е and recognises decomposed ё/й; previously trivial: progress log: a text box that keeps the keyboard no longer resets the input method every frame, #2986; previously trivial: progress log: recovery copies and .json files store pictures as base64, #586 follow-up; previously trivial: progress log: legacy menu keys, #1697; previously trivial: progress log: shape gradients and transparency, #1500; previously trivial: progress log: Focus fills the screen, and Full Screen View shows the pages alone, #1678; previously trivial: progress log: text above a float's anchor wraps around it, #2048; previously trivial: progress log: File › Recover follows the app theme, #3243; previously trivial: progress log: formatting toolbar with the text context menu, #2959; previously trivial: progress log: caret inside ligatures, #1974; previously trivial: text typed into a content control takes the control's formatting; localized placeholder styles recognised; previously trivial: forms protection keeps its content controls: no inserting, Properties or Remove Content Control; previously trivial: long navigation headings wrap onto further lines within the pane, #3015; previously trivial: clearing a no-match font query keeps the recent heading visible, #2068; previously trivial: a word after a slash wraps whole, like Word, #2963; previously trivial: progress log: a header-cell picture watermark sits behind the text, #1775; previously trivial: symbols keep their font when the text font changes, #2036; previously trivial: opening a DOCX no longer copies its pictures; previously trivial: Add Font imports every selected font file, #1789); previously trivial (RTF export writes sections (gap 19); previously trivial: ODT export writes sections (gap 19); previously trivial: Read Aloud speaks each sentence in its own language, #1843; previously trivial: hint-reliant CJK outlines; previously trivial: Ctrl+wheel zoom no longer scrolls the document, #1743; previously trivial: progress log: Turkish case mapping in AutoCorrect, #1923; previously trivial: a mouse drag on a table leaves the view where it is, #1738; previously trivial: progress log: Hebrew field results and smart quotes, #1670; previously trivial: Backspace removes a selected table, rows or columns, #1844; previously trivial: progress log: mixed Hebrew/Latin text keeps its order in Word, #1543; previously trivial: progress log: web typing in non-Latin text no longer repeats, #1480; previously trivial: progress log: font family caches bounded and math font lookups follow font changes, #1354; previously trivial: `-->` AutoCorrect replacement, #2223; previously trivial: numbered headings, #1793; previously trivial: Navigation Find exposes Results, #2096; previously trivial: progress log: Columns on selected text, #2024; previously trivial: progress log: legacy outline, shadow, emboss and imprint text effects drawn, #2534; previously trivial: progress log: Indonesian proofing, #498; previously trivial: progress log: DOCX glossary documents (building blocks); previously trivial: progress log: Read Mode keeps the keyboard and shows whole, unobscured columns, #1772); previously trivial: progress log: font list entries of tall-ascent fonts no longer cut off, #2570); previously trivial: progress log: Split Cells and Convert Text to Table dialogs follow the Word check, #2592; previously trivial: a new source's Tag is made like Word's, three letters of the author and two digits of the year with a number added when taken, and an edit keeps the Tag, #2094; previously trivial: Web Layout fills the window width, #1876; previously trivial: progress log: Different First Page headers reachable from page 1, #2826; previously trivial: Language dialog keeps inherited proofing language and no-proof choices (#2717); previously trivial: progress log: web preferences kept between visits, #2132; previously trivial: progress log: undrawable private-use list bullets show the level's default bullet, #1683; previously trivial: progress log: `w:eastAsianLayout` kept on save; previously trivial: table style editor formats every part, #714); previously trivial: VML freeforms read and kept on save; previously trivial: progress log: consistent preferred cell widths; previously trivial: multi-paragraph field instructions no longer add blank lines; previously trivial: page-break-only list paragraphs hide their labels; previously trivial: progress log: grouped `flowChartOr` shapes draw their circle and crossing spokes; previously trivial: progress log: copies keep their formatting in other programs, #1523; previously trivial: progress log: privacy options on save, #1062; previously trivial: progress log: equation pictures in theme colours on Windows, #1002; previously trivial: symbol fonts, #776; previously trivial: the save prompt answers from the keyboard, #861; previously trivial: table column and row markers on the rulers, #700; previously trivial: table borders and the resize handle drag on the page, #217; previously trivial: formatting revisions landed, #41; previously trivial: Draw tab ink, #307, and Draw Table and Eraser, #303, landed: catalog 402/434; previously minor: readiness table with hours per audience; full number back to the additive weighted sum, 60%; mainstream and essentials numbers added; alpha gate checked; previously major: full re-measure against Word for Mac 16.113.4; progress docs restructured) · **Target:** Microsoft Word (Microsoft 365) for Mac 16.113.4 +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-31 · **Change:** trivial (progress log: ODT layout settings); previously trivial (progress log: ODT character styles); previously trivial (progress log: ODT custom styles); previously trivial (progress log: ODT equations saved); previously trivial (progress log: ODT floating pictures); previously trivial (progress log: ODT paragraph borders); previously trivial (progress log: ODT heading numbering); previously trivial (progress log: ODT table borders); previously trivial (progress log: ODT heading styles); previously trivial (progress log: ODT tab stops); previously trivial (progress log: ODT character formatting); previously trivial (progress log: ODT lists); previously trivial (progress log: ODT comments); previously trivial (progress log: ODT footnotes and endnotes); previously trivial (progress log: ODT headers, footers and fields); previously trivial (progress log: ODT paragraph spacing); previously trivial (progress log: a paragraph naming an undefined style is formatted as Normal, #5077); previously trivial (progress log: TOC page numbers as PAGEREF fields, #5097); previously trivial (progress log: Backstage keytips, #4960); previously trivial (Progress log: only the printer's PDF leaves out links; Save these pages as PDF keeps them, #4734); previously trivial (progress log: Chinese and Japanese text counts a word per character, #4547; previously trivial: aligned-copy review fixes retain the document axis through scrolling and include secondary selections (#4764)); previously trivial (connector rerouting indexes laid-out object positions once per batch (#3631); previously trivial (progress log: corporate authors in bibliographies, #4848); previously trivial (custom-property bookmark-link preservation, #4767); previously trivial (progress log: Table Properties follows the selection, #4857); previously trivial (Relative font-size commands preserve mixed sizes in the selection (#4903); existing button steps and one-point shortcuts are unchanged; readiness estimates unchanged); previously trivial (Arabic Backspace removes one combining mark and keeps its base letter (#4757); previously trivial (note conversion walks reference offsets and formatting runs together, #4750); previously trivial (DOCX comment-ID save lookups); previously trivial (progress log: RTF pictures stored as Windows or Enhanced Metafiles are imported, #4259); previously trivial (#4658 bounds nested Markdown reference-label work); previously trivial (HTML import keeps preformatted lines with CR or CRLF input newlines, #4810); previously trivial (progress log: Insert › Shapes icon grid, #4349); previously trivial (progress log: AutoCorrect Options with no document open, #4585); previously trivial (progress log: window fallback geometry and equation symbol tooltips); previously trivial (progress log: window titles omit NUL characters, #3634); previously trivial (Recipient labels continue across product-sized sheets instead of stopping after the first sheet (#4880)); previously trivial (progress log: Custom document properties dialog, #2982; previously trivial: progress log: View › New Window; previously trivial: progress log: interface translations come from storytold/craft-i18n through the `craft-i18n` crate; previously trivial: progress log: disabled-control reasons translated in every interface language, #2678; previously trivial: progress log: mail merge record navigation and record ranges for printing, #3028; previously trivial: selection bar for right-to-left paragraphs and table rows; previously trivial: group connector rerouting preserves rotated and flipped free or unresolved endpoints under nonuniform group scaling; readiness estimates unchanged; previously trivial: progress log: a word with no break opportunity in it no longer makes the layout quadratic, #3412; previously trivial: progress log: a relationship the markup names without the prefix is read as it wrote, and an ordinary `id` names no part; previously trivial: progress log: a document with many relationships opens in the time its part takes, and an id the text only mentions is not a reference, #3411; previously trivial: progress log: read only and comments-only protection grey out edits; previously trivial: progress log: an empty paragraph with a hidden mark shows nothing, not even its list number, #3982; previously trivial: progress log: "NaN" in the Font dialog's Size box no longer closes the app, #3663; previously trivial: progress log: a table cell span from a `.json` file no longer overflows, #3637; previously trivial: progress log: a click in the footer while editing the header moves there; previously trivial: explicit documents keep the editor when recovery discovery finishes; readable recovery controls; previously trivial: Slovenian interface catalog, 2,614 entries; previously trivial: Insert Table of Figures dialog for any caption label, #3013; previously trivial: progress log: Home › Underline drop-down, #2738; previously trivial: personal templates in File › New and Save as Word Template, #2852; previously trivial: progress log: the scrollbar page tip stays on one line, #3341; previously trivial: progress log: forms protection greys out the control buttons; previously trivial: progress log: a document with many content controls saves in the time the controls take, #13; previously trivial: progress log: Word signature lines kept on save; previously trivial: a Thai run with Latin finds one installed font covering it all on Linux too, #1549; previously trivial: progress log: closing the header returns to the body selection, #3331; previously trivial: progress log: saving to a NAS share mounted by GVFS, #3003; previously trivial: progress log: a picture dragged near the bottom of a page lands there, #3169; previously trivial: centred list labels after leading page breaks, #2964; previously trivial: progress log: inline pictures drag to an insertion cursor and stay inline, #2233, #2234; previously trivial: progress log: a text file saved over itself closes without asking, #2376; previously trivial: progress log: a text frame in the paragraph defaults frames nothing, #2360; previously trivial: fixed font inputs in four layout controls; previously trivial: typing no longer starts render threads on every repaint, #3027; previously trivial: a right, centre or decimal tab whose text doesn't fit, or a left tab past the right indent, goes to the next line with its text, #1840; previously trivial: progress log: banded rows shade as in Word, #3415; previously trivial: progress log: the table handles show while the caret is in the table, #2428; previously trivial: progress log: a click below a floating table reaches the text after it, #2038; previously trivial: progress log: Delete on selected table cells leaves one empty paragraph in each, #2802; previously trivial: progress log: lam-alef in exported PDFs extracts whole with fonts that draw it as two glyphs, #2310; previously trivial: Bullets and Numbering toggle off style-inherited lists at their effective level, including basedOn chains and numbered ListParagraph styles; other paragraphs and list definitions stay unchanged (related to #3459); previously trivial: Russian sorting keeps ё with е and recognises decomposed ё/й; previously trivial: progress log: a text box that keeps the keyboard no longer resets the input method every frame, #2986; previously trivial: progress log: recovery copies and .json files store pictures as base64, #586 follow-up; previously trivial: progress log: legacy menu keys, #1697; previously trivial: progress log: shape gradients and transparency, #1500; previously trivial: progress log: Focus fills the screen, and Full Screen View shows the pages alone, #1678; previously trivial: progress log: text above a float's anchor wraps around it, #2048; previously trivial: progress log: File › Recover follows the app theme, #3243; previously trivial: progress log: formatting toolbar with the text context menu, #2959; previously trivial: progress log: caret inside ligatures, #1974; previously trivial: text typed into a content control takes the control's formatting; localized placeholder styles recognised; previously trivial: forms protection keeps its content controls: no inserting, Properties or Remove Content Control; previously trivial: long navigation headings wrap onto further lines within the pane, #3015; previously trivial: clearing a no-match font query keeps the recent heading visible, #2068; previously trivial: a word after a slash wraps whole, like Word, #2963; previously trivial: progress log: a header-cell picture watermark sits behind the text, #1775; previously trivial: symbols keep their font when the text font changes, #2036; previously trivial: opening a DOCX no longer copies its pictures; previously trivial: Add Font imports every selected font file, #1789); previously trivial (RTF export writes sections (gap 19); previously trivial: ODT export writes sections (gap 19); previously trivial: Read Aloud speaks each sentence in its own language, #1843; previously trivial: hint-reliant CJK outlines; previously trivial: Ctrl+wheel zoom no longer scrolls the document, #1743; previously trivial: progress log: Turkish case mapping in AutoCorrect, #1923; previously trivial: a mouse drag on a table leaves the view where it is, #1738; previously trivial: progress log: Hebrew field results and smart quotes, #1670; previously trivial: Backspace removes a selected table, rows or columns, #1844; previously trivial: progress log: mixed Hebrew/Latin text keeps its order in Word, #1543; previously trivial: progress log: web typing in non-Latin text no longer repeats, #1480; previously trivial: progress log: font family caches bounded and math font lookups follow font changes, #1354; previously trivial: `-->` AutoCorrect replacement, #2223; previously trivial: numbered headings, #1793; previously trivial: Navigation Find exposes Results, #2096; previously trivial: progress log: Columns on selected text, #2024; previously trivial: progress log: legacy outline, shadow, emboss and imprint text effects drawn, #2534; previously trivial: progress log: Indonesian proofing, #498; previously trivial: progress log: DOCX glossary documents (building blocks); previously trivial: progress log: Read Mode keeps the keyboard and shows whole, unobscured columns, #1772); previously trivial: progress log: font list entries of tall-ascent fonts no longer cut off, #2570); previously trivial: progress log: Split Cells and Convert Text to Table dialogs follow the Word check, #2592; previously trivial: a new source's Tag is made like Word's, three letters of the author and two digits of the year with a number added when taken, and an edit keeps the Tag, #2094; previously trivial: Web Layout fills the window width, #1876; previously trivial: progress log: Different First Page headers reachable from page 1, #2826; previously trivial: Language dialog keeps inherited proofing language and no-proof choices (#2717); previously trivial: progress log: web preferences kept between visits, #2132; previously trivial: progress log: undrawable private-use list bullets show the level's default bullet, #1683; previously trivial: progress log: `w:eastAsianLayout` kept on save; previously trivial: table style editor formats every part, #714); previously trivial: VML freeforms read and kept on save; previously trivial: progress log: consistent preferred cell widths; previously trivial: multi-paragraph field instructions no longer add blank lines; previously trivial: page-break-only list paragraphs hide their labels; previously trivial: progress log: grouped `flowChartOr` shapes draw their circle and crossing spokes; previously trivial: progress log: copies keep their formatting in other programs, #1523; previously trivial: progress log: privacy options on save, #1062; previously trivial: progress log: equation pictures in theme colours on Windows, #1002; previously trivial: symbol fonts, #776; previously trivial: the save prompt answers from the keyboard, #861; previously trivial: table column and row markers on the rulers, #700; previously trivial: table borders and the resize handle drag on the page, #217; previously trivial: formatting revisions landed, #41; previously trivial: Draw tab ink, #307, and Draw Table and Eraser, #303, landed: catalog 402/434; previously minor: readiness table with hours per audience; full number back to the additive weighted sum, 60%; mainstream and essentials numbers added; alpha gate checked; previously major: full re-measure against Word for Mac 16.113.4; progress docs restructured) · **Target:** Microsoft Word (Microsoft 365) for Mac 16.113.4 > **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-29 · **Change:** trivial (Recipient labels continue across product-sized sheets instead of stopping after the first sheet (#4880)); previously trivial (English dialects in proofing, #1281; previously trivial: triple borders draw three lines, #1740; previously trivial: progress log: double-clicking a later page's footer no longer scrolls up, #2103; previously trivial: long navigation headings wrap onto further lines within the pane, #3015; previously trivial: clearing a no-match font query keeps the recent heading visible, #2068; previously trivial: a word after a slash wraps whole, like Word, #2963; previously trivial: RTF export writes sections (gap 19); previously trivial: ODT export writes sections (gap 19); previously trivial: progress log: pasted blockquotes are indented paragraphs, #1270; previously trivial: progress log: print-area strings translated in every catalog; previously trivial: progress log: comments readable in the dark theme, #2045; previously trivial: progress log: ODT sections, #1379; previously trivial: progress log: table deletes, Change Case and Unlink Fields respect Track Changes and locked content controls, #1329; previously trivial: progress log: rounded rectangle corners, #1476; previously trivial: progress log: Save As type list, #1399; previously trivial: progress log: privacy options on save, #1062; previously trivial: progress log: equation pictures in theme colours on Windows, #1002; previously trivial: symbol fonts, #776; previously trivial: the save prompt answers from the keyboard, #861; previously trivial: table column and row markers on the rulers, #700; previously trivial: table borders and the resize handle drag on the page, #217; previously trivial: formatting revisions landed, #41; previously trivial: Draw tab ink, #307, and Draw Table and Eraser, #303, landed: catalog 402/434; previously minor: readiness table with hours per audience; full number back to the additive weighted sum, 60%; mainstream and essentials numbers added; alpha gate checked; previously major: full re-measure against Word for Mac 16.113.4; progress docs restructured) · **Target:** Microsoft Word (Microsoft 365) for Mac 16.113.4 > **Printing update:** 2026-10-12 · direct desktop printing through craft-print; details below. @@ -140,6 +140,7 @@ Ranked, to beta (detail and remaining milestones in [docs/roadmap.md](docs/roadm ## Progress log +- 2026-11-01: ODT: saved files carry LibreOffice's layout settings (the file's own, or Word-compatible ones), so LibreOffice lays them out as WordCraft does; list items keep their contextual spacing (gap 19). Readiness unchanged. - 2026-11-01: ODT: custom character styles stay styles on open and save (gap 19). Readiness unchanged. - 2026-11-01: ODT: custom paragraph styles (LibreOffice's Text body, your own) stay styles on open and save; their formatting used to become direct formatting (gap 19). Readiness unchanged. - 2026-11-01: ODT: equations are saved as LibreOffice formula objects (MathML), so they stay equations in LibreOffice; they were saved as plain text (gap 19). Readiness unchanged. diff --git a/crates/formats/src/model/from_doc.rs b/crates/formats/src/model/from_doc.rs index 3b2ffec492..b937ba57af 100644 --- a/crates/formats/src/model/from_doc.rs +++ b/crates/formats/src/model/from_doc.rs @@ -146,7 +146,6 @@ pub fn is_custom_style(doc: &Document, id: &str) -> bool { "Title", "Quote", super::types::CODE_STYLE, - "ListParagraph", "FootnoteText", "EndnoteText", "Standard", @@ -163,7 +162,7 @@ pub fn is_custom_style(doc: &Document, id: &str) -> bool { fn para_extra(doc: &Document, p: &wordcraft_doc::props::ParaProps) -> Option> { let tabs = p.tabs.clone().filter(|t| !t.is_empty()); let style = p.style.clone().filter(|id| is_custom_style(doc, id)); - let x = wordcraft_doc::props::ParaProps { tabs, shading: p.shading, style, ..Default::default() }; + let x = wordcraft_doc::props::ParaProps { tabs, shading: p.shading, style, contextual_spacing: p.contextual_spacing, ..Default::default() }; (x != wordcraft_doc::props::ParaProps::default()).then(|| Box::new(x)) } diff --git a/crates/formats/src/model/to_doc.rs b/crates/formats/src/model/to_doc.rs index 9993960c08..b35832bf80 100644 --- a/crates/formats/src/model/to_doc.rs +++ b/crates/formats/src/model/to_doc.rs @@ -143,6 +143,9 @@ fn para_props(p: &Para, list_num: Option) -> ParaProps { if let Some(st) = p.extra.as_ref().and_then(|x| x.style.clone()) { out.style = Some(st); } + if let Some(c) = p.extra.as_ref().and_then(|x| x.contextual_spacing) { + out.contextual_spacing = Some(c); + } if let Some(bg) = p.extra.as_ref().and_then(|x| x.shading) { out.shading = Some(bg); } diff --git a/crates/formats/src/odt/body.rs b/crates/formats/src/odt/body.rs index 0be2dd43b7..aad1b1b394 100644 --- a/crates/formats/src/odt/body.rs +++ b/crates/formats/src/odt/body.rs @@ -554,6 +554,9 @@ impl Body<'_> { if let Some(bg) = look.shading { p.extra.get_or_insert_with(Default::default).shading = Some(bg); } + if let Some(c) = look.contextual { + p.extra.get_or_insert_with(Default::default).contextual_spacing = Some(c); + } if let Some(mut tabs) = look.tabs { // LibreOffice measures tabs from the indent (its `TabsRelativeToIndent`); Word from // the margin. diff --git a/crates/formats/src/odt/import.rs b/crates/formats/src/odt/import.rs index e493b7aca1..6977f9c53b 100644 --- a/crates/formats/src/odt/import.rs +++ b/crates/formats/src/odt/import.rs @@ -245,6 +245,7 @@ fn add_custom_styles(doc: &mut Document, named: &[super::styles::NamedStyle], od borders: look.borders, shading: look.shading, tabs: look.tabs.clone(), + contextual_spacing: look.contextual, ..Default::default() }; let style = wordcraft_doc::styles::Style { @@ -279,6 +280,9 @@ fn apply_look(doc: &mut Document, kind: model::Kind, look: &super::styles::ParaL (p.indent_left, p.indent_right, p.indent_first) = (sp.left, sp.right, sp.first); p.align = look.align; p.keep_next = look.keep_next.then_some(true); + if look.contextual.is_some() { + p.contextual_spacing = look.contextual; + } } /// Number the headings as the outline style `levels` does (ODF 1.3 §16.34): one list whose @@ -366,6 +370,8 @@ struct Parsed { char_styles: Vec<(String, String)>, /// Their names, parents and own formatting, alongside. char_defs: Vec<(String, Option, model::Fmt)>, + /// The file's `settings.xml`, kept for the next save. + settings: Option>, /// The heading numbering (`text:outline-style`), level by level. outline: Option>, /// How the file's heading, title, quotation and preformatted styles look. @@ -397,7 +403,8 @@ fn parse_tracked(bytes: &[u8]) -> Result { pages = read_pages(s); } styles.read(&content, true); - styles.tabs_from_indent = read_entry(&mut z, "settings.xml").map(|s| setting(&s, "TabsRelativeToIndent")).unwrap_or(None).unwrap_or(true); + let settings = read_entry(&mut z, "settings.xml"); + styles.tabs_from_indent = settings.as_deref().and_then(|s| setting(s, "TabsRelativeToIndent")).unwrap_or(true); let meta = read_entry(&mut z, "meta.xml").map(|m| read_meta(&m)).unwrap_or_default(); let mut pictures = Pictures::new(MAX_ENTRY); let mut fetch = |path: &str| -> Option> { @@ -445,6 +452,7 @@ fn parse_tracked(bytes: &[u8]) -> Result { named_odt, char_styles, char_defs, + settings: settings.filter(|s| s.len() <= super::package::MAX_SETTINGS), outline: styles.outline.clone(), kern: styles.default_kern, default_tab: styles.default_tab, @@ -455,7 +463,7 @@ fn parse_tracked(bytes: &[u8]) -> Result { /// Parse an `.odt` package into a document. pub fn import(bytes: &[u8]) -> Result { model::begin_import(); - let Parsed { flow, last, track, font, spacing, looks, named, named_odt, char_styles, char_defs, outline, kern, default_tab, parts } = + let Parsed { flow, last, track, font, spacing, looks, named, named_odt, char_styles, char_defs, settings, outline, kern, default_tab, parts } = parse_tracked(bytes)?; let mut doc = model::to_doc(&flow); if font.is_some() { @@ -471,6 +479,9 @@ pub fn import(bytes: &[u8]) -> Result { for (kind, look) in &looks { apply_look(&mut doc, *kind, look); } + if let Some(s) = settings { + doc.passthrough.insert(super::package::SETTINGS_PART.into(), std::sync::Arc::new(s)); + } add_custom_styles(&mut doc, &named, &named_odt); add_char_styles(&mut doc, &char_styles, &char_defs); if let Some(levels) = &outline { diff --git a/crates/formats/src/odt/package.rs b/crates/formats/src/odt/package.rs index aef9275838..c797c3a808 100644 --- a/crates/formats/src/odt/package.rs +++ b/crates/formats/src/odt/package.rs @@ -43,6 +43,9 @@ fn kind_styles(doc: &Document) -> String { if pp.keep_next == Some(true) { para.push_str(" fo:keep-with-next=\"always\""); } + if let Some(c) = pp.contextual_spacing { + para.push_str(&format!(" style:contextual-spacing=\"{c}\"")); + } let outline = outline.map(|n| format!(" style:default-outline-level=\"{n}\"")).unwrap_or_default(); s.push_str(&format!( "", @@ -96,6 +99,9 @@ fn custom_styles(doc: &Document, named: &std::collections::BTreeSet) -> if pp.keep_next == Some(true) { attrs.push_str(" fo:keep-with-next=\"always\""); } + if let Some(c) = pp.contextual_spacing { + attrs.push_str(&format!(" style:contextual-spacing=\"{c}\"")); + } attrs.push_str(&super::writer::border_attrs(pp.borders)); if let Some(bg) = pp.shading { attrs.push_str(&format!(" fo:background-color=\"#{}\"", bg.hex().to_ascii_lowercase())); @@ -331,15 +337,105 @@ fn styles_xml( s } -/// `settings.xml` (ODF 1.3 §3.10): tab stops are measured from the margin, as WordCraft's and -/// Word's are (LibreOffice's own default measures them from the paragraph's indent). -const SETTINGS: &str = concat!( - "\n", - "", - "", - "false", - "\n" -); +/// `Document::passthrough` key of an ODT's own `settings.xml`, kept for the next save. +pub(super) const SETTINGS_PART: &str = "odt/settings.xml"; + +/// Largest `settings.xml` kept, in bytes. +pub(super) const MAX_SETTINGS: usize = 1 << 20; + +/// LibreOffice's layout compatibility switches (`ooo:configuration-settings`) for a document +/// laid out as Word lays it out, as LibreOffice sets them for Word files. +const WORD_COMPAT: &[(&str, bool)] = &[ + ("NoNumberingShowFollowBy", true), + ("HyphenateURLs", false), + ("FootnoteInColumnToPageEnd", true), + ("GutterAtTop", false), + ("ContinuousEndnotes", false), + ("FrameAutowidthWithMorePara", true), + ("SubtractFlysAnchoredAtFlys", false), + ("SurroundTextWrapSmall", true), + ("TreatSingleColumnBreakAsPageBreak", true), + ("TabOverSpacing", true), + ("AutoFirstLineIndentDisregardLineSpace", true), + ("TabOverMargin", false), + ("ApplyTextAttrToEmptyLineAtEndOfParagraph", true), + ("DisableOffPagePositioning", true), + ("BackgroundParaOverDrawings", true), + ("TabOverflow", true), + ("AddVerticalFrameOffsets", true), + ("AddFrameOffsets", false), + ("TableRowKeep", true), + ("ApplyParagraphMarkFormatToNumbering", true), + ("JustifyLinesWithShrinking", true), + ("CollapseEmptyCellPara", true), + ("UnbreakableNumberings", true), + ("MsWordCompTrailingBlanks", true), + ("AddParaTableSpacing", false), + ("OutlineLevelYieldsNumbering", false), + ("UseOldNumbering", false), + ("AddParaSpacingToTableCells", true), + ("PropLineSpacingShrinksFirstLine", true), + ("TabAtLeftIndentForParagraphsInList", true), + ("DoNotCaptureDrawObjsOnPage", false), + ("HeaderSpacingBelowLastPara", true), + ("ClippedPictures", true), + ("MathBaselineAlignment", true), + ("AlignTabStopPosition", true), + ("UseFormerLineSpacing", false), + ("DoNotMirrorRtlDrawObjs", true), + ("AddParaLineSpacingToTableCells", true), + ("IsKernAsianPunctuation", false), + ("DoNotJustifyLinesWithManualBreak", false), + ("UseVariableWidthNBSP", false), + ("AddParaTableSpacingAtStart", true), + ("InvertBorderSpacing", true), + ("AddExternalLeading", true), + ("UseFormerObjectPositioning", false), + ("UnxForceZeroExtLeading", false), + ("UseFormerTextWrapping", false), + ("ConsiderTextWrapOnObjPos", true), + ("StylesNoDefault", false), + ("IgnoreFirstLineIndentInNumbering", false), + ("NoGapAfterNoteNumber", true), + ("EmptyDbFieldHidesPara", false), + ("DoNotResetParaAttrsForNumFont", false), + ("IgnoreTabsAndBlanksForLineCalculation", true), + ("ClipAsCharacterAnchoredWriterFlyFrames", false), + ("DropCapPunctuation", true), + ("UseOldPrinterMetrics", false), + ("MsWordCompMinLineHeightByFly", false), +]; + +/// `settings.xml` (ODF 1.3 §3.10) for `doc`: an ODT's own, kept from opening it, or LibreOffice's +/// switches for Word's layout. Either way tab stops are measured from the margin, as WordCraft +/// writes them (LibreOffice's own default measures them from the paragraph's indent). +fn settings_xml(doc: &Document) -> String { + const TABS: &str = "false"; + if let Some(own) = doc.passthrough.get(SETTINGS_PART).filter(|b| b.len() <= MAX_SETTINGS).and_then(|b| std::str::from_utf8(b).ok()) { + let set = "config:name=\"ooo:configuration-settings\""; + let tabs = "config:name=\"TabsRelativeToIndent\""; + if let Some(at) = own.find(tabs) { + // The file's item, its value made false. + let rest = own.get(at..).unwrap_or(""); + if let (Some(gt), Some(lt)) = (rest.find('>'), rest.find("")) + && gt < lt + { + return format!("{}false{}", own.get(..at + gt + 1).unwrap_or(""), own.get(at + lt..).unwrap_or("")); + } + } else if let Some(at) = own.find(set).and_then(|at| own.get(at..)?.find('>').map(|gt| at + gt + 1)) { + return format!("{}{TABS}{}", own.get(..at).unwrap_or(""), own.get(at..).unwrap_or("")); + } + } + let mut s = String::from( + "\n", + ); + s.push_str(TABS); + for (name, on) in WORD_COMPAT { + s.push_str(&format!("{on}")); + } + s.push_str("\n"); + s +} fn meta_xml(m: &Meta) -> String { let mut s = @@ -484,7 +580,7 @@ pub fn export(doc: &Document) -> Result, String> { ("content.xml", content.as_bytes()), ("styles.xml", styles.as_bytes()), ("meta.xml", meta.as_bytes()), - ("settings.xml", SETTINGS.as_bytes()), + ("settings.xml", settings_xml(doc).as_bytes()), ] { z.start_file(name, deflated).map_err(err)?; z.write_all(data).map_err(ioerr)?; diff --git a/crates/formats/src/odt/styles.rs b/crates/formats/src/odt/styles.rs index 46541a2714..aa6e7b285c 100644 --- a/crates/formats/src/odt/styles.rs +++ b/crates/formats/src/odt/styles.rs @@ -185,6 +185,8 @@ struct StyleInfo { family: Option, /// Declared among automatic styles (of either file): never a custom style. declared_auto: bool, + /// `style:contextual-spacing` of a paragraph style. + contextual: Option, /// `fo:border*` of a paragraph style, each side's padding as its distance from the text. para_borders: Option, /// `fo:background-color` of a paragraph style (`Some(None)`: transparent, stated). @@ -304,6 +306,8 @@ pub(super) struct ParaLook { pub(super) spacing: Spacing, /// Tab stops, from where the document measures them. pub(super) tabs: Option>, + /// No spacing between paragraphs of one style (`style:contextual-spacing`). + pub(super) contextual: Option, /// Borders (when a side shows) and background. pub(super) borders: Option, pub(super) shading: Option, @@ -567,6 +571,9 @@ fn paragraph_properties(a: &Attrs, s: &mut StyleInfo) { if let Some(b) = border_sides(a) { s.para_borders = Some(b); } + if let Some(c) = get(a, "style:contextual-spacing") { + s.contextual = Some(c.trim() == "true"); + } if let Some(bg) = get(a, "fo:background-color") { s.para_shading = Some(if bg.trim() == "transparent" { None } else { model::parse_color(bg) }); } @@ -962,7 +969,8 @@ impl Styles { } let align = chain.iter().find_map(|(_, s)| s.align); let keep_next = chain.iter().find_map(|(_, s)| s.keep_next).unwrap_or(false); - (kind, ParaLook { kind, align, keep_next, fmt, spacing, ..Default::default() }) + let contextual = chain.iter().find_map(|(_, s)| s.contextual); + (kind, ParaLook { kind, align, keep_next, fmt, spacing, contextual, ..Default::default() }) }) .collect() } @@ -1006,6 +1014,7 @@ impl Styles { tabs: s.tabs.clone(), borders: s.para_borders.filter(|b| b.any_visible()), shading: s.para_shading.flatten(), + contextual: s.contextual, ..Default::default() }; let name = s.display.clone().unwrap_or_else(|| odt.replace("_20_", " ")); @@ -1062,6 +1071,7 @@ impl Styles { let own = || chain.iter().take(kind_at).filter(|(n, s)| s.auto || *n != "Standard"); let borders = own().find_map(|(_, s)| s.para_borders).filter(|b| b.any_visible()); let shading = own().find_map(|(_, s)| s.para_shading).flatten(); - ParaLook { kind, align, page_break: pb, rule, keep_next, fmt: f, spacing, tabs, borders, shading, named } + let contextual = own().find_map(|(_, s)| s.contextual); + ParaLook { kind, align, page_break: pb, rule, keep_next, fmt: f, spacing, tabs, borders, shading, named, contextual } } } diff --git a/crates/formats/src/odt/tests_more.rs b/crates/formats/src/odt/tests_more.rs index b45bf8ee6e..2682841223 100644 --- a/crates/formats/src/odt/tests_more.rs +++ b/crates/formats/src/odt/tests_more.rs @@ -13,6 +13,7 @@ mod named_styles; mod notes; mod outline; mod para_borders; +mod settings; mod spacing; mod style_look; mod tables; diff --git a/crates/formats/src/odt/tests_more/settings.rs b/crates/formats/src/odt/tests_more/settings.rs new file mode 100644 index 0000000000..1c65c5fea5 --- /dev/null +++ b/crates/formats/src/odt/tests_more/settings.rs @@ -0,0 +1,51 @@ +//! `settings.xml` (ODF 1.3 §3.10): LibreOffice's layout compatibility switches. A file's own are +//! kept through a save; a document from elsewhere gets those LibreOffice uses for Word files, as +//! WordCraft lays text out as Word does. Tabs are always written measured from the margin. + +use crate::odt::tests::{NS_T, package}; +use crate::odt::{export, import}; +use wordcraft_doc::Document; + +fn settings_of(bytes: &[u8]) -> String { + let mut z = zip::ZipArchive::new(std::io::Cursor::new(bytes)).unwrap(); + let mut s = String::new(); + std::io::Read::read_to_string(&mut z.by_name("settings.xml").unwrap(), &mut s).unwrap(); + s +} + +fn item(settings: &str, name: &str) -> Option { + let at = settings.find(&format!(r#"config:name="{name}""#))?; + let rest = &settings[at..]; + let v = rest.split_once('>')?.1; + Some(v.split('<').next()?.to_string()) +} + +#[test] +fn a_new_document_gets_word_compatible_layout() { + let s = settings_of(&export(&Document::new()).unwrap()); + assert_eq!(item(&s, "TabsRelativeToIndent").as_deref(), Some("false")); + assert_eq!(item(&s, "AddParaSpacingToTableCells").as_deref(), Some("true")); + assert_eq!(item(&s, "TabOverMargin").as_deref(), Some("false")); +} + +#[test] +fn a_files_own_settings_survive_a_save() { + let settings = r#"truetrue"#; + let content = format!( + r#"x"# + ); + let mut z = zip::ZipWriter::new(std::io::Cursor::new(Vec::new())); + let o = zip::write::SimpleFileOptions::default(); + for (n, d) in [("mimetype", "application/vnd.oasis.opendocument.text"), ("content.xml", content.as_str()), ("settings.xml", settings)] { + z.start_file(n, o).unwrap(); + std::io::Write::write_all(&mut z, d.as_bytes()).unwrap(); + } + let d = import(&z.finish().unwrap().into_inner()).unwrap(); + let s = settings_of(&export(&d).unwrap()); + assert_eq!(item(&s, "AddParaTableSpacing").as_deref(), Some("true"), "{s}"); + // Not Word's switches over the file's own. + assert_eq!(item(&s, "AddParaSpacingToTableCells"), None); + // Tabs are written from the margin, whatever the file said. + assert_eq!(item(&s, "TabsRelativeToIndent").as_deref(), Some("false")); + let _ = package; +} diff --git a/crates/formats/src/odt/tests_more/spacing.rs b/crates/formats/src/odt/tests_more/spacing.rs index aae3ff201a..1bf2a50932 100644 --- a/crates/formats/src/odt/tests_more/spacing.rs +++ b/crates/formats/src/odt/tests_more/spacing.rs @@ -144,3 +144,31 @@ fn the_document_defaults_round_trip() { let o = d.styles.resolve_para(&ParaProps::default()); assert_eq!((r.space_before, r.space_after, r.line_spacing), (o.space_before, o.space_after, o.line_spacing)); } + +#[test] +fn contextual_spacing_round_trips() { + // `style:contextual-spacing` (ODF 1.3 §20.255): no space between paragraphs of one style. + let auto = p_style("P1", "Standard", r#"fo:margin-bottom="10pt" style:contextual-spacing="true""#); + let d = import(&package(&content(&auto, r#"a"#), None)).unwrap(); + assert_eq!(props(&d)[0].contextual_spacing, Some(true)); + let back = import(&export(&d).unwrap()).unwrap(); + assert_eq!(props(&back)[0].contextual_spacing, Some(true)); +} + +#[test] +fn the_list_paragraph_style_is_written() { + // Its spacing (and contextual spacing) was dropped: list items were written in Standard. + let mut d = Document::new(); + let mut p = Paragraph::new(); + p.text = "item".into(); + p.runs = vec![wordcraft_doc::para::Run { len: 4, props: Default::default() }]; + p.props = ParaProps { style: Some("ListParagraph".into()), ..Default::default() }; + d.body = vec![para_block(p)]; + if let Some(st) = d.styles.get_mut("ListParagraph") { + st.para.contextual_spacing = Some(true); + st.para.space_after = Some(3.0); + } + let back = import(&export(&d).unwrap()).unwrap(); + let r = back.styles.resolve_para(&props(&back)[0]); + assert!(r.contextual_spacing && r.space_after == 3.0, "{r:?}"); +} diff --git a/crates/formats/src/odt/writer.rs b/crates/formats/src/odt/writer.rs index 4b0828bc58..0a3af5be86 100644 --- a/crates/formats/src/odt/writer.rs +++ b/crates/formats/src/odt/writer.rs @@ -520,6 +520,9 @@ impl Writer { if let Some(bg) = p.extra.as_ref().and_then(|x| x.shading) { props.push_str(&format!(" fo:background-color=\"#{}\"", bg.hex().to_ascii_lowercase())); } + if let Some(c) = p.extra.as_ref().and_then(|x| x.contextual_spacing) { + props.push_str(&format!(" style:contextual-spacing=\"{c}\"")); + } let master = start.map(|(m, _)| m.clone()).unwrap_or_default(); if props.is_empty() && master.is_empty() { return parent; diff --git a/docs/file-format-parity.md b/docs/file-format-parity.md index 367d219e1a..5d37973e49 100644 --- a/docs/file-format-parity.md +++ b/docs/file-format-parity.md @@ -1,6 +1,6 @@ # File-format parity with Microsoft Word -> **Last reviewed:** 2026-10-11 · **Last updated:** 2026-10-31 · **Change:** trivial (ODT custom character styles kept); previously trivial (ODT list level positions); previously trivial (ODT custom paragraph styles kept); previously trivial (ODT equations written as formula objects); previously trivial (ODT numbered headings written as headings); previously trivial (ODT floating pictures); previously trivial (ODT paragraph borders and background); previously trivial (ODT heading numbering); previously trivial (ODT font-face names); previously trivial (ODT table cell borders and padding); previously trivial (ODT heading, title, quote and preformatted styles keep their look); previously trivial (ODT tab stops read and written); previously trivial (ODT character formatting read and written); previously trivial (ODT lists keep their number formats, bullets and identity); previously trivial (ODT comments read and written); previously trivial (ODT footnotes and endnotes read and written); previously trivial (ODT headers, footers and text fields written; fields read); previously trivial (ODT paragraph spacing, indents and line spacing read and written); previously trivial (a paragraph naming an undefined style is formatted as Normal, as in Word, #5077); previously trivial (a hyperlinked TOC writes its page numbers as `PAGEREF _Toc… \h` fields, as Word does, #5097); previously trivial (HTML import ends the empty comments and at once, #5040); previously trivial (chart and SmartArt text the font lacks is drawn in a fallback face, so Chinese labels no longer show boxes, #4720); previously trivial (bibliography sources keep a corporate author (`b:Corporate`): read, written, cited and listed whole, #4848); previously trivial (custom-property bookmark-link preservation, #4767); previously trivial (note conversion preserves content with an ordered reference/run walk, #4750); previously trivial (DOCX comment-ID save lookups); previously trivial (built-in heading styles have their outline level without `w:outlineLvl`, #4696); previously trivial (DOCX comment ranges inside footnotes and endnotes are kept on read, #4548); previously trivial (RTF import and export keep Windows and Enhanced Metafile pictures (`\wmetafile`, `\emfblip`), #4259); previously trivial (#4658 bounds nested Markdown reference-label work); previously trivial (HTML import keeps preformatted lines with CR or CRLF input newlines, #4810); previously trivial (DOCX parts stored under another casing keep their embedded fonts through a save, and a private save of a kept glossary escapes the attribute values it rewrites; previously trivial: the `.doc` reader logs what its copy budget leaves out, once a kind per document; importers bound hostile expansion: font names, links, ODS repeats, LaTeX wrappers, Markdown delimiters, #3692/#3713; previously trivial: repeated DOCX style IDs: save/reopen regression; previously trivial: Markdown code spans keep line-broken text literal, #3738; previously trivial: Arabic list labels: `arabicAlpha` and `arabicAbjad` draw the 28 Arabic letters (alphabetical and abjad order), doubling past the last letter; Hebrew, Hindi, Thai and Vietnamese still show decimal (`doc::section::tests::arabic_letters_count_in_both_orders`); previously trivial: localized TOC style ids read as the TOC styles, and a TOC in columns keeps its layout through Update Table, #3889; previously trivial: cu20we: outline caps; previously trivial: a relationship the markup names without the prefix is read as it wrote: an unqualified `id` on an element that carries a relationship names that relationship, and the writer keeps the attribute with the id the new package holds the part under; an ordinary `id` — a VML shape's, a drawing's — names no part; previously trivial: the reader takes the relationship ids the markup refers to from the relationship attributes of the main document it has already parsed, so a document with many relationships opens in the time its part takes, #3411; previously trivial: a table cell span from a `.json` file stays within 63 columns through Insert Column and Merge Cells, #3637; previously trivial: the file commands that change the document are checked on a protected document, the protection of a protected document needs an explicit stop, the session author can't change through `file.setAuthor` under protection (the CLI's `--author` uses the same protection check), and the post-check compares the settings and the metadata; previously trivial: a document with many content controls saves in the time the controls take, #13; previously trivial: `majorBidi`/`minorBidi` theme fonts follow the settings' theme font language, as measured in Word; previously trivial: Word signature lines are kept on save, still signable; previously trivial: Times New Roman keeps Liberation Serif under the roman-font rule; previously trivial: shape gradients and transparency, #1500; previously trivial: a folder that keeps no Unix modes, such as a NAS share mounted by GVFS, still takes a save, #3003; previously trivial: a text frame in the paragraph defaults frames nothing, #2360; previously trivial: table style band sizes written, a style without them unbanded as in Word, #3415; previously trivial: HTML export writes ruby (furigana, phonetic guides) and HTML import reads it back, #1681; previously trivial: RTF import decodes the East Asian multibyte code pages, #1653; previously trivial: PDF export: lam-alef drawn as two glyphs at one x extracts in reading order, #2310; previously trivial: native .json stores pictures and kept parts as base64, #586 follow-up; previously trivial: ODT headers and footers read from each master page, #863; previously trivial: RTF import compares heading and code formatting with the file's stylesheet; previously trivial: text typed into a content control takes the control's formatting; localized placeholder styles recognised; previously trivial: forms protection keeps its content controls: no inserting, Properties or Remove Content Control; previously trivial: Word XML and web pages saved as `.doc` open by what they hold, #2853; previously trivial: a VML shape in a header cell is always placed on the page, user-checked in Word for Mac, #1775; previously trivial: `w:sym` characters keep their symbol font when the text's font changes and are written back as `w:sym`, #2036; previously trivial: RTF export writes sections (gap 19); previously trivial: ODT export writes sections (gap 19); previously trivial: two lines in one and horizontal in vertical (`w:eastAsianLayout`) kept on save; previously trivial: PDF outline targets follow leading page breaks; previously trivial: positional tabs `w:ptab` read and kept on save, #2367; previously trivial: DOCX: mixed right-to-left runs split and marked `w:rtl` with their language, #1543; previously trivial: `w:doNotTrackMoves` round-trips and turns move tracking off; previously trivial: legacy outline, shadow, emboss and imprint text effects drawn, #2534; previously trivial: DOCX glossary documents (building blocks) read, kept and written; previously trivial: cached field results keep their visible run formatting; previously trivial: cached REF results retain hyperlink destinations; previously trivial: CLI conversions can explicitly refresh fields; previously trivial: a copied equation also goes in the clipboard's MathML formats, #1297; previously trivial: a pasted HTML `
` is an indented paragraph, not the Quote style, #1270); previously trivial: every table style part round-trips, #714; previously trivial: VML freeforms read and kept on save; previously trivial: multi-paragraph field instructions no longer add blank lines; previously trivial: `flowChartOr` draws its circle and cross spokes, as in Word; previously trivial: RTF: Mac OS Roman and DOS text, #1653; previously trivial: VML text boxes keep their internal margins, fit to their text and vertical alignment; hidden drawings not shown; previously trivial: PDF export draws horizontal and vertical lines inside groups, #1474; previously trivial: symbol-font text exported as Unicode, #776; previously trivial: text-box margins, Resize shape to fit text and freeforms in groups, #743; previously trivial: formatted paste from the system clipboard's HTML and RTF, #687; previously trivial: independent complex-script formatting inheritance and round-trip regression tests; previously trivial: import/export fixes for TXT, RTF, ODT, HTML and LaTeX, #433–#440; previously major: first version; every format Word reads or writes, measured from the readers and writers on origin/main) · **Target:** Microsoft Word (Microsoft 365) for Mac 16.113.4, plus Word for Windows' extra formats +> **Last reviewed:** 2026-10-11 · **Last updated:** 2026-10-31 · **Change:** trivial (ODT contextual spacing and layout settings); previously trivial (ODT custom character styles kept); previously trivial (ODT list level positions); previously trivial (ODT custom paragraph styles kept); previously trivial (ODT equations written as formula objects); previously trivial (ODT numbered headings written as headings); previously trivial (ODT floating pictures); previously trivial (ODT paragraph borders and background); previously trivial (ODT heading numbering); previously trivial (ODT font-face names); previously trivial (ODT table cell borders and padding); previously trivial (ODT heading, title, quote and preformatted styles keep their look); previously trivial (ODT tab stops read and written); previously trivial (ODT character formatting read and written); previously trivial (ODT lists keep their number formats, bullets and identity); previously trivial (ODT comments read and written); previously trivial (ODT footnotes and endnotes read and written); previously trivial (ODT headers, footers and text fields written; fields read); previously trivial (ODT paragraph spacing, indents and line spacing read and written); previously trivial (a paragraph naming an undefined style is formatted as Normal, as in Word, #5077); previously trivial (a hyperlinked TOC writes its page numbers as `PAGEREF _Toc… \h` fields, as Word does, #5097); previously trivial (HTML import ends the empty comments and at once, #5040); previously trivial (chart and SmartArt text the font lacks is drawn in a fallback face, so Chinese labels no longer show boxes, #4720); previously trivial (bibliography sources keep a corporate author (`b:Corporate`): read, written, cited and listed whole, #4848); previously trivial (custom-property bookmark-link preservation, #4767); previously trivial (note conversion preserves content with an ordered reference/run walk, #4750); previously trivial (DOCX comment-ID save lookups); previously trivial (built-in heading styles have their outline level without `w:outlineLvl`, #4696); previously trivial (DOCX comment ranges inside footnotes and endnotes are kept on read, #4548); previously trivial (RTF import and export keep Windows and Enhanced Metafile pictures (`\wmetafile`, `\emfblip`), #4259); previously trivial (#4658 bounds nested Markdown reference-label work); previously trivial (HTML import keeps preformatted lines with CR or CRLF input newlines, #4810); previously trivial (DOCX parts stored under another casing keep their embedded fonts through a save, and a private save of a kept glossary escapes the attribute values it rewrites; previously trivial: the `.doc` reader logs what its copy budget leaves out, once a kind per document; importers bound hostile expansion: font names, links, ODS repeats, LaTeX wrappers, Markdown delimiters, #3692/#3713; previously trivial: repeated DOCX style IDs: save/reopen regression; previously trivial: Markdown code spans keep line-broken text literal, #3738; previously trivial: Arabic list labels: `arabicAlpha` and `arabicAbjad` draw the 28 Arabic letters (alphabetical and abjad order), doubling past the last letter; Hebrew, Hindi, Thai and Vietnamese still show decimal (`doc::section::tests::arabic_letters_count_in_both_orders`); previously trivial: localized TOC style ids read as the TOC styles, and a TOC in columns keeps its layout through Update Table, #3889; previously trivial: cu20we: outline caps; previously trivial: a relationship the markup names without the prefix is read as it wrote: an unqualified `id` on an element that carries a relationship names that relationship, and the writer keeps the attribute with the id the new package holds the part under; an ordinary `id` — a VML shape's, a drawing's — names no part; previously trivial: the reader takes the relationship ids the markup refers to from the relationship attributes of the main document it has already parsed, so a document with many relationships opens in the time its part takes, #3411; previously trivial: a table cell span from a `.json` file stays within 63 columns through Insert Column and Merge Cells, #3637; previously trivial: the file commands that change the document are checked on a protected document, the protection of a protected document needs an explicit stop, the session author can't change through `file.setAuthor` under protection (the CLI's `--author` uses the same protection check), and the post-check compares the settings and the metadata; previously trivial: a document with many content controls saves in the time the controls take, #13; previously trivial: `majorBidi`/`minorBidi` theme fonts follow the settings' theme font language, as measured in Word; previously trivial: Word signature lines are kept on save, still signable; previously trivial: Times New Roman keeps Liberation Serif under the roman-font rule; previously trivial: shape gradients and transparency, #1500; previously trivial: a folder that keeps no Unix modes, such as a NAS share mounted by GVFS, still takes a save, #3003; previously trivial: a text frame in the paragraph defaults frames nothing, #2360; previously trivial: table style band sizes written, a style without them unbanded as in Word, #3415; previously trivial: HTML export writes ruby (furigana, phonetic guides) and HTML import reads it back, #1681; previously trivial: RTF import decodes the East Asian multibyte code pages, #1653; previously trivial: PDF export: lam-alef drawn as two glyphs at one x extracts in reading order, #2310; previously trivial: native .json stores pictures and kept parts as base64, #586 follow-up; previously trivial: ODT headers and footers read from each master page, #863; previously trivial: RTF import compares heading and code formatting with the file's stylesheet; previously trivial: text typed into a content control takes the control's formatting; localized placeholder styles recognised; previously trivial: forms protection keeps its content controls: no inserting, Properties or Remove Content Control; previously trivial: Word XML and web pages saved as `.doc` open by what they hold, #2853; previously trivial: a VML shape in a header cell is always placed on the page, user-checked in Word for Mac, #1775; previously trivial: `w:sym` characters keep their symbol font when the text's font changes and are written back as `w:sym`, #2036; previously trivial: RTF export writes sections (gap 19); previously trivial: ODT export writes sections (gap 19); previously trivial: two lines in one and horizontal in vertical (`w:eastAsianLayout`) kept on save; previously trivial: PDF outline targets follow leading page breaks; previously trivial: positional tabs `w:ptab` read and kept on save, #2367; previously trivial: DOCX: mixed right-to-left runs split and marked `w:rtl` with their language, #1543; previously trivial: `w:doNotTrackMoves` round-trips and turns move tracking off; previously trivial: legacy outline, shadow, emboss and imprint text effects drawn, #2534; previously trivial: DOCX glossary documents (building blocks) read, kept and written; previously trivial: cached field results keep their visible run formatting; previously trivial: cached REF results retain hyperlink destinations; previously trivial: CLI conversions can explicitly refresh fields; previously trivial: a copied equation also goes in the clipboard's MathML formats, #1297; previously trivial: a pasted HTML `
` is an indented paragraph, not the Quote style, #1270); previously trivial: every table style part round-trips, #714; previously trivial: VML freeforms read and kept on save; previously trivial: multi-paragraph field instructions no longer add blank lines; previously trivial: `flowChartOr` draws its circle and cross spokes, as in Word; previously trivial: RTF: Mac OS Roman and DOS text, #1653; previously trivial: VML text boxes keep their internal margins, fit to their text and vertical alignment; hidden drawings not shown; previously trivial: PDF export draws horizontal and vertical lines inside groups, #1474; previously trivial: symbol-font text exported as Unicode, #776; previously trivial: text-box margins, Resize shape to fit text and freeforms in groups, #743; previously trivial: formatted paste from the system clipboard's HTML and RTF, #687; previously trivial: independent complex-script formatting inheritance and round-trip regression tests; previously trivial: import/export fixes for TXT, RTF, ODT, HTML and LaTeX, #433–#440; previously major: first version; every format Word reads or writes, measured from the readers and writers on origin/main) · **Target:** Microsoft Word (Microsoft 365) for Mac 16.113.4, plus Word for Windows' extra formats Every format Word opens or saves, what WordCraft does with it, and how it's tested. Fidelity is the share of a typical real-world file's content and formatting that survives (read: shows correctly; @@ -279,6 +279,7 @@ Custom document properties retain their bookmark link targets through DOCX saves | Date | Change | Summary | |---|---|---| +| 2026-11-01 | trivial | ODT: contextual spacing (`style:contextual-spacing`) is read and written and the List Paragraph style is written, so list items keep their spacing; a file's own `settings.xml` (LibreOffice's layout compatibility switches) is kept through a save, and a document from elsewhere gets the switches LibreOffice uses for Word files, as WordCraft lays text out as Word does (a Word-made document saved as ODT: 38,652 px apart in LibreOffice before, 3,302 now). `formats::odt::tests_more::{spacing, settings}` | | 2026-11-01 | trivial | ODT: custom character styles are kept: a common text style other than LibreOffice's link, note-mark and list-label styles (Emphasis, a user's own) opens as a document character style with its name, parent and own formatting, the text in it naming it; saving writes the character styles the text uses as common text styles, the spans' automatic styles based on them. `formats::odt::tests_more::char_styles` | | 2026-11-01 | trivial | ODT: each list level's indent, hanging and number alignment (`style:list-level-label-alignment`, `fo:text-align` of `style:list-level-properties`, ODF 1.3 §17.19–17.20) are read and written, for lists and heading numbering; every list was written 36 pt a level with left-aligned numbers. `formats::odt::tests_more::lists` | | 2026-11-01 | trivial | ODT: custom paragraph styles are kept: a common paragraph style other than Standard, the kinds' and the note texts' (LibreOffice's Text body, a user's own style) opens as a document style with its name, parent and own formatting, and its paragraphs stay in it instead of taking its formatting as direct formatting; saving writes the custom styles the paragraphs use, and those they are based on, as common styles. `formats::odt::tests_more::named_styles` |