Skip to main content

A package to convert DOCX to HTML and HTML to DOCX with formatting preservation.

Project description

Updated README.md

DOCX-HTML Converter

This package provides tools to convert DOCX documents to HTML and HTML back to DOCX, while preserving formatting such as tables, lists, and paragraphs.

Features

  • Convert DOCX to HTML with support for paragraphs, lists, tables, and inline formatting.
  • Convert HTML to DOCX with support for lists, tables, inline styles (bold, italic), and more.

Installation

Install the package via pip after uploading it to PyPI:

pip install docxhtml-converter

Usage
Convert DOCX to HTML

Use the htmlifier function to convert a DOCX file into HTML:

from docxhtml import htmlifier

docx_path = "document.docx"
output_html = "output.html"
htmlifier(docx_path, output_html)

Convert HTML to DOCX

Use the docxifier function to convert an HTML file back into DOCX:

from htmldocx import docxifier

input_html = "output.html"
output_docx = "regenerated.docx"
docxifier(input_html, output_docx)

These scripts allow you to easily convert between DOCX and HTML formats while maintaining formatting such as tables, lists, and paragraphs.
Example

Here's an example of how you can use both functions in a complete script:

from docxhtml import htmlifier
from htmldocx import docxifier

# Convert DOCX to HTML
docx_path = "document.docx"
output_html = "output.html"
htmlifier(docx_path, output_html)

# Convert HTML back to DOCX
input_html = "output.html"
output_docx = "regenerated.docx"
docxifier(input_html, output_docx)

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

docxhtml-converter-0.1.0.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

docxhtml_converter-0.1.0-py3-none-any.whl (2.9 kB view details)

Uploaded Python 3

File details

Details for the file docxhtml-converter-0.1.0.tar.gz.

File metadata

  • Download URL: docxhtml-converter-0.1.0.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.11

File hashes

Hashes for docxhtml-converter-0.1.0.tar.gz
Algorithm Hash digest
SHA256 cf4a7ae6a6d587991a746b994e8e098f45b92987f654090678c14780c89355f5
MD5 f84e5fa740fffd11103427e8c6685441
BLAKE2b-256 ffb8c31696a699e4ad9a0927730a22badedf23e913d3222655996ca3f0aa8090

See more details on using hashes here.

File details

Details for the file docxhtml_converter-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for docxhtml_converter-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 98e96ac23a04e3c0ea24924ce40bff62f15404ab001cad7cb9c344191c8dab16
MD5 b857190630632e9044f21f1d8aeeee53
BLAKE2b-256 94ccfcaf9ce9097ae6615fbc8960f6dab50ba0a81743e91a3e48b00dcd195328

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