Convert fancy .docx files into a single self-contained HTML file. Pure Python, no LibreOffice.
Project description
fancydocx
Convert fancy, design-heavy Word (.docx) files into a single, self-contained HTML file, with all styling, images and fonts inlined. It is a from-scratch reader for the Office Open XML format, written in pure Python. No LibreOffice, no Word, and no third-party dependencies.
Features
- Tables, columns, shapes, text boxes and floating images
- Theme colours, fonts and the full paragraph/run style cascade
- Bullet and numbered lists, hyperlinks, headers and footers
- Embedded fonts are recovered and inlined automatically
- Batch conversion from a simple command-line tool
Installation
pip install fancydocx
Usage
In Python:
import fancydocx
fancydocx.convert("resume.docx", "resume.html") # write a file
html = fancydocx.convert("resume.docx") # or return a string
From the command line:
fancydocx resume.docx -o resume.html
fancydocx ./documents -o ./html --workers 8 # convert a folder
Requirements
Python 3.8 or newer. The library uses only the standard library.
Notes
- Text renders with the document's own fonts when they are installed on the viewer's machine; pass --embed-fonts to inline them for portability.
- EMF/WMF vector images are shown as placeholders, as browsers cannot display them.
License
MIT. See the LICENSE file.
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 fancydocx-0.1.0.tar.gz.
File metadata
- Download URL: fancydocx-0.1.0.tar.gz
- Upload date:
- Size: 46.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bef03ca827407998259e22e4465d6e6f291eaf86e75a09a81d43b4367503eae7
|
|
| MD5 |
2e5f107cc07d7861a24251c6dd93a4b1
|
|
| BLAKE2b-256 |
7f063f41d20c1e34cf73e8458c748c40d8eb6716e3e5ddd6fb217afb6ed34816
|
File details
Details for the file fancydocx-0.1.0-py3-none-any.whl.
File metadata
- Download URL: fancydocx-0.1.0-py3-none-any.whl
- Upload date:
- Size: 48.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a2de43beb898a36979dff8375d8476a78c2b5d6500504051bc3e311c3157bbea
|
|
| MD5 |
708ef17efadd8351672b35c7e39abcba
|
|
| BLAKE2b-256 |
5435494423fb9fddee69ec23e16115a227cc18289623bf1b3268d4fcb75a860a
|