Skip to main content

Convert valid HTML input to docx.

Project description

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

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

html2docx-1.6.0.tar.gz (47.0 kB view details)

Uploaded Source

Built Distribution

html2docx-1.6.0-py3-none-any.whl (35.7 kB view details)

Uploaded Python 3

File details

Details for the file html2docx-1.6.0.tar.gz.

File metadata

  • Download URL: html2docx-1.6.0.tar.gz
  • Upload date:
  • Size: 47.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for html2docx-1.6.0.tar.gz
Algorithm Hash digest
SHA256 13ef5653d7a3ffe625251705f15ae203938ce2f98be93e62f6fdf80630c33d2d
MD5 a2065bada49f9541d3dd6e4f69bfd386
BLAKE2b-256 c06ca1122f2fe5a772b0c63e0a4966c7ae093f81ff23aa8ee04bba6b69c54e40

See more details on using hashes here.

File details

Details for the file html2docx-1.6.0-py3-none-any.whl.

File metadata

  • Download URL: html2docx-1.6.0-py3-none-any.whl
  • Upload date:
  • Size: 35.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for html2docx-1.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ec7ceacb53eaf4ad5217d96f61dbd5cd62bc6f28d3830e4721e5428300255bdf
MD5 db9c5a80b3d6db16c0dd7532919933e8
BLAKE2b-256 97f2291d81ff6699c3874cd4143cd2815bd82f8d4129c6ef7bfdfcd410db6132

See more details on using hashes here.

Supported by

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