Skip to main content

html2docx

html2docx converts valid HTML input to docx output. The project is distributed under the MIT license.

Installing

To install, use pip:

$ pip install html2docx

Usage

from html2docx import html2docx

with open("my.html") as fp:
    html = fp.read()

# html2docx() returns an io.BytesIO() object. The HTML must be valid.
buf = html2docx(html, title="My Document")

with open("my.docx", "wb") as fp:
    fp.write(buf.getvalue())

Testing

To run the test suite, use tox:

$ tox

Release files for html2docx 1.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for html2docx 1.6.0
File Size Uploaded
html2docx-1.6.0.tar.gz 47.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for html2docx 1.6.0
File Interpreter ABI Platform
html2docx-1.6.0-py3-none-any.whl Python 3 none any Details

Total release size: 82.7 kB

Release files / html2docx-1.6.0.tar.gz

Download URL html2docx-1.6.0.tar.gz
Size 47.0 kB
Tags Source
SHA-256 checksum
How to use checksums
13ef5653d7a3ffe625251705f15ae203938ce2f98be93e62f6fdf80630c33d2d
BLAKE2b-256 checksum
How to use checksums
c06ca1122f2fe5a772b0c63e0a4966c7ae093f81ff23aa8ee04bba6b69c54e40
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.9

Release files / html2docx-1.6.0-py3-none-any.whl

Download URL html2docx-1.6.0-py3-none-any.whl
Size 35.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ec7ceacb53eaf4ad5217d96f61dbd5cd62bc6f28d3830e4721e5428300255bdf
BLAKE2b-256 checksum
How to use checksums
97f2291d81ff6699c3874cd4143cd2815bd82f8d4129c6ef7bfdfcd410db6132
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.9

Release history Release notifications | RSS feed

This release

1.6.0 This release

2 release files

1.5.0

2 release files

1.4.1

2 release files

1.4.0

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page