htmldocx
Convert html to docx
What it is and what it does
htmldocx bridges HTML and Microsoft Word by converting HTML markup into .docx documents using python-docx as its rendering engine and beautifulsoup4 for HTML parsing. It offers three main workflows: adding HTML snippets to an existing Document object, parsing a complete HTML file into a new document, or converting an HTML string directly to a docx object. You can also configure table styling, including applying built-in Word styles or adding borders via the TableGrid style.
The package is straightforward for simple HTML-to-Word conversions but is no longer actively maintained—the last release was in 2021 and development has been dormant since then. It works with Python 3.6 and later and depends only on two well-established libraries, making installation frictionless.
Use it for:
- Generate Word documents from HTML templates in web applications or report generators
- Convert HTML email content or web pages into downloadable .docx files for users
- Batch convert HTML files to Word documents as part of a document processing pipeline
- Add HTML-formatted content to existing Word documents programmatically
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Converts HTML content into Microsoft Word documents (.docx format), either by adding HTML to existing documents or parsing HTML files and strings directly into new documents.
Yes, if you need basic HTML-to-Word conversion and can accept dormant maintenance. The package is stable, has no known vulnerabilities, and handles common use cases well. However, if you require active bug fixes, new HTML feature support, or compatibility assurance with the latest python-docx versions, consider whether the lack of recent maintenance is acceptable for your project timeline.
Install
htmldocx on PyPI
pip
pip install htmldocxuv
uv add htmldocxpoetry
poetry add htmldocxInstalling htmldocx
Before you install
Low friction install with only two runtime dependencies (python-docx and beautifulsoup4). However, the package is dormant—last release was 2021-08-25 and last commit 2024-07-09, so maintenance is minimal despite the repository remaining active.
License in practice
Licensed under MIT (permissive), so you can use, modify, and distribute the package freely with minimal restrictions.
Quickstart
pip install htmldocx
from htmldocx import HtmlToDocx
from docx import Document
parser = HtmlToDocx()
document = Document()
parser.add_html_to_document('<p>Hello world</p>', document)
document.save('output.docx')
Verify before relying
- HTML feature coverage and limitations (which tags/attributes are supported or ignored)
- Performance characteristics with large HTML documents
- Compatibility with recent versions of python-docx and beautifulsoup4
Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (>=3.6) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — python-docx, beautifulsoup4 |
| Maintenance | dormant — 1,815 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,202,067/month — #4,229 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: htmldocx-0.0.6-py3-none-any.whl
Tags
More HTML packages
MarkupSafe provides a text object that escapes…
permissive · top 100 on PyPI
Jinja2Jinja2 is a templating engine that renders…
permissive · top 100 on PyPI
beautifulsoup4Beautiful Soup parses HTML and XML documents…
permissive · top 100 on PyPI
lxmllxml provides Python bindings to libxml2 and…
permissive · top 1,000 on PyPI
docutilsDocutils converts plaintext documentation in…
unclear · top 1,000 on PyPI
MarkdownConverts Markdown text to HTML using a Python…
permissive · top 1,000 on PyPI
docxcomposeConcatenates and merges multiple Microsoft Word…
permissive · top 5,000 on PyPI
html-for-docxConverts HTML content to Word documents…
permissive · top 15,000 on PyPI
docxtplGenerates Word documents (.docx) from templates…
copyleft · top 5,000 on PyPI
html2docxConverts valid HTML to Microsoft Word (.docx)…
permissive · top 15,000 on PyPI
mammothConverts Microsoft Word .docx documents to…
permissive · top 5,000 on PyPI
docxCreates, reads, and writes Microsoft Office…
unclear · top 15,000 on PyPI
python-docx-ml6Reads, creates, and updates Microsoft Word…
permissive · top 15,000 on PyPI
docx2txtExtracts text, headers, footers, hyperlinks,…
unclear · top 5,000 on PyPI
python-docxpython-docx reads, creates, and modifies…
permissive · top 1,000 on PyPI
docx2pythonExtracts text, images, headers, footers,…
permissive · top 15,000 on PyPI