Convert legacy Microsoft Word .doc files (OLE/CFB format) to Markdown. Inspired by antiword.
Extracts body text with heading levels, page breaks, and textbox contents. No external dependencies (no LibreOffice, no COM).
cargo install unwordpip install unword
Requires maturin and a virtual environment:
uv venv .venv && source .venv/bin/activate
maturin developOr build a wheel:
maturin build --release
pip install target/wheels/unword-*.whl# Print to stdout
unword -i document.doc
# Write to file
unword -i document.doc -o output.mdimport unword
doc = unword.parse_doc(open("document.doc", "rb").read())
print(doc.body_text) # Markdown string with headings
print(doc.textboxes) # List of textbox stringslet data = std::fs::read("document.doc")?;
let doc = unword::parse_doc(&data)?;
println!("{}", doc.body_text);- Headings are rendered as
#,##,###, etc. based on Word styles - Paragraphs are separated by blank lines
- Page breaks become
--- - Textboxes are extracted separately
# Rust
cargo test
# Python
pytest tests/test_python.pyMIT
- antiword
- abiword
- tika
- libreoffice