Skip to main content

Convert html to docx

Project description

htmldocx

Convert html to docx

Dependencies: python-docx & bs4 (if you want to fix html before converting or extract tables)

To install

pip install htmldocx

Usage

Add strings of html to an existing docx.Document object

from docx import Document
from htmldocx import HtmlToDocx

document = Document()
new_parser = HtmlToDocx()
# do stuff to document

html = '<h1>Hello world</h1>'
new_parser.add_html_to_document(html, document)

# do more stuff to document
document.save('your_file_name')

Convert files directly

new_parser.parse_html_file(input-html-file, output-docx-file)

Specify options: options default to True. Set to False before running to disable extraction

new_parser.options['tables'] = False

Currently available options: tables, images

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

htmldocx-0.0.3.tar.gz (5.7 kB view hashes)

Uploaded Source

Built Distribution

htmldocx-0.0.3-py3-none-any.whl (6.6 kB view hashes)

Uploaded Python 3

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