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.
This commit is contained in:
kiwi4boy committed 2026-11-16 17:52:40 -05:00
1 parent efd265563e
commit fb33e29bb6
9 files changed
+498 -132

No files matched your search

+2 -2
View File
@@ -7241,8 +7241,8 @@ milestone = "M10"
status = "shipped"
commands = ["export.rtf"]
tools = ["doc_export_office"]
evidence = ["crates/export/src/tests.rs::table_spans_do_not_consume_text_they_do_not_emit", "crates/export/src/tests.rs::rtf_escapes_and_sizes", "crates/export/src/tests.rs::text_colour_survives_every_format", "crates/export/src/tests.rs::word_opens_text_with_control_characters_and_long_pages", "crates/automation/tests/it/automation.rs::exporting_to_word_html_and_rtf", "crates/ui-egui/tests/it/compare.rs::export_to_word_html_and_rtf", "crates/export/src/tests.rs::a_sentence_that_wraps_after_a_style_change_is_one_paragraph", "crates/export/src/tests.rs::a_bulleted_list_is_paragraphs_not_a_table"]
notes = "Text in slots covered by a preceding table-cell span remains in paragraph flow instead of being discarded. Paragraphs with sizes, bold, italic, text colour (colortbl), Unicode; a block that continues another on its line is a formatted group inside that paragraph (#4158), and a paragraph that wraps onto the next line after a style change runs on there, with the same rules and limits as Word export; a list whose bullets are blocks of their own is a paragraph per item, not a table, as in Word export; page breaks. Images are left out."
evidence = ["crates/export/src/tests.rs::table_spans_do_not_consume_text_they_do_not_emit", "crates/export/src/tests.rs::rtf_escapes_and_sizes", "crates/export/src/tests.rs::text_colour_survives_every_format", "crates/export/src/tests.rs::word_opens_text_with_control_characters_and_long_pages", "crates/automation/tests/it/automation.rs::exporting_to_word_html_and_rtf", "crates/ui-egui/tests/it/compare.rs::export_to_word_html_and_rtf", "crates/export/src/tests.rs::a_sentence_that_wraps_after_a_style_change_is_one_paragraph", "crates/export/src/tests.rs::a_bulleted_list_is_paragraphs_not_a_table", "crates/export/src/tests.rs::rtf_keeps_pictures", "crates/export/src/tests.rs::rtf_keeps_pages_without_text", "crates/export/src/tests.rs::rtf_headings_have_heading_styles", "crates/export/src/tests.rs::rtf_keeps_hard_line_breaks_in_paragraphs_and_cells"]
notes = "Text in slots covered by a preceding table-cell span remains in paragraph flow instead of being discarded. Paragraphs with sizes, bold, italic, text colour (colortbl), Unicode; a block that continues another on its line is a formatted group inside that paragraph (#4158), and a paragraph that wraps onto the next line after a style change runs on there, with the same rules and limits as Word export; a list whose bullets are blocks of their own is a paragraph per item, not a table, as in Word export; written by craft-rtf's full writer from the word model: each page a section of its own size (blank pages kept), pictures inline, Heading 1 and 2 styles, tables that touch kept apart, hard line breaks kept inside their paragraph or cell, and the title. Not kept: the PDF's language (the writer names English), and positioned pages flow."
[[feature]]