Files
Dylan M. Taylorandkiwi4boy d03b99ea54 Export: Word through craft-docx, from the shared word model (rebased #7592) (#7814)
* export: write RTF through craft-rtf's full writer, from the word model

The pages are mapped onto a craft_wordmodel::Document (as_word.rs, the
mapping the DOCX export will share), and craft_rtf::doc::export writes
it. Over the small writer this keeps, in RTF:
- pictures, inline (the engine no longer leaves them out for RTF);
- each page's size, as a section per page (blank pages kept);
- Heading 1 and 2 styles;
- the title;
- hard line breaks inside a paragraph or cell (storytold/pdfcraft#4723).
It also fixes two bugs: \cellx was the absolute page x, so every column
edge sat one left margin too far right, and tables that touched became
one (NIST CSF 2.0 came out with 28 tables instead of 68).

craft-rtf, craft-wordmodel, craft-docx and craft-mime are pinned together
at one craft-libs commit: doc::export takes its own revision's Document.

* export: pin craft-libs main with push_text, the header-row fix and the RTF generator name

craft-rtf, craft-wordmodel, craft-docx and craft-mime move to craft-libs
b8eaa8e2, which has storytold/craft-libs#1946, #1947 and #1950. The
mapping appends through Paragraph::push_text/push_object, tables keep
the default look, and the RTF names PdfCraft as its generator.

* export: write Word through craft-docx, from the shared word model

as_docx.rs no longer writes WordprocessingML itself: as_word::word_doc
maps the pages onto a craft_wordmodel::Document and craft_docx::write
writes it. The decisions stay the same: a page with rotated text or
overlapping text keeps its layout as positioned text boxes and pictures
(watermark-sized text behind, pictures over it, other text on top), the
other pages flow, each page is a section of its own size, a shared page
colour is the document's, the PDF's language goes in the slot Word keeps
for its script, and the media limits are unchanged.

Over the hand-written package this gains:
- a VML fallback for every text box, so Word 2007 opens positioned pages;
- rotated text as a turned text box Word draws as a line;
- the body font named (Arial), with a font table saying it is a sans;
- PdfCraft as the application in docProps/app.xml;
- a picture drawn many times stored once.

The tests that matched XML read the package back through craft-docx.

* parity: the Word export through craft-docx, checked in Word 16, Word 2007 and LibreOffice

* chore: update Cargo.lock after rebasing #7592

---------

Co-authored-by: kiwi4boy <kiwi4boy@gmail.com>
2026-11-18 17:11:01 -05:00
..