Pure Python Word (DOCX) ↔ HTML conversion with guaranteed round-trip fidelity
Project description
docwow
Pure Python Word (DOCX) ↔ HTML conversion with guaranteed round-trip fidelity.
docwow converts Word documents to a self-contained HTML representation and back again — without losing a single paragraph indent, table merge, list level, or inline image.
Why docwow?
Existing libraries solve half the problem:
| Library | DOCX → HTML | HTML → DOCX | Round-trip |
|---|---|---|---|
| mammoth | good | — | — |
| python-docx | — | basic | — |
| docwow | yes | yes | guaranteed |
The key insight: docwow embeds every piece of Word metadata into data-dw-* HTML attributes alongside the visual CSS. The browser renders the CSS; when you convert back to DOCX, docwow reads the data attributes and reconstructs the original Word XML exactly.
Install
pip install docwow
Quick Start
import docwow
# DOCX → HTML
html = docwow.to_html("document.docx")
# HTML → DOCX (round-trip)
docwow.to_docx(html, "output.docx")
# Or use the Document object
doc = docwow.open("document.docx")
html = doc.to_html()
doc.to_docx("output.docx")
Documentation
Full documentation at docwow.dev.
Requirements
- Python 3.10+
- lxml
- Pillow
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file docwow-0.1.0.tar.gz.
File metadata
- Download URL: docwow-0.1.0.tar.gz
- Upload date:
- Size: 40.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
914777efad7df270db869f9fa4de0c96cef149db412aa6c1dfd45529a1621093
|
|
| MD5 |
5d12d9430c10253bdb157fb77c23da0f
|
|
| BLAKE2b-256 |
6ad8b586eb7c7786f2331fe4433b396854b4b97926418b20b18bb5e5951144c9
|
File details
Details for the file docwow-0.1.0-py3-none-any.whl.
File metadata
- Download URL: docwow-0.1.0-py3-none-any.whl
- Upload date:
- Size: 48.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6b4ad4ccf3f77c09d84fb96787ddf7fb411568f9885fa28cace50c58a7924cb4
|
|
| MD5 |
6c68295f1c95f5d9bd8d5d8103695acf
|
|
| BLAKE2b-256 |
dc289dd3065cd4917817a6a826efcc9064beaba06880dd4ab153813619f518f3
|