Files
Dylan M. Taylor 42a5df5f94 chore: cut over image codecs and zip to craft-libs (#6661)
* chore: cut over image codecs and zip to craft-libs, fix main test regressions

* tests: store ODS mimetype and use standard ODF namespaces in mailings test

* Remove unused quick-xml workspace dependency

* fix: use standard ODF namespaces in file_dialogs test and preserve trailing line in markdown import_on_with_lines

* fix(geom): use png_chunks for PNG dimensions and p.fits(budget) in decode_for_drawing
2026-11-14 14:51:35 -05:00

21 lines
618 B
Rust

//! Rich Text Format (`.rtf`) import and export via `craft-rtf`.
use wordcraft_doc::Document;
pub fn import(bytes: &[u8]) -> Result<Document, String> {
let shared = craft_rtf::doc::import(bytes)?;
wordcraft_docx::from_shared_model(shared).map_err(|e| e.to_string())
}
pub fn parse(bytes: &[u8]) -> Result<crate::model::Flow, String> {
let shared = craft_rtf::doc::import(bytes)?;
Ok(craft_flow::from_doc(&shared))
}
pub fn export(doc: &Document) -> String {
let Ok(shared) = wordcraft_docx::to_shared_model(doc) else {
return String::new();
};
craft_rtf::doc::export(&shared)
}