Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fancydocx-0.1.0.tar.gz (46.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fancydocx-0.1.0-py3-none-any.whl (48.7 kB view details)

Uploaded Python 3

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

Hashes for fancydocx-0.1.0.tar.gz
Algorithm Hash digest
SHA256 bef03ca827407998259e22e4465d6e6f291eaf86e75a09a81d43b4367503eae7
MD5 2e5f107cc07d7861a24251c6dd93a4b1
BLAKE2b-256 7f063f41d20c1e34cf73e8458c748c40d8eb6716e3e5ddd6fb217afb6ed34816

See more details on using hashes here.

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

Hashes for fancydocx-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a2de43beb898a36979dff8375d8476a78c2b5d6500504051bc3e311c3157bbea
MD5 708ef17efadd8351672b35c7e39abcba
BLAKE2b-256 5435494423fb9fddee69ec23e16115a227cc18289623bf1b3268d4fcb75a860a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page