Skip to main content

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

Project description


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_converter.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 docxhtml_converter.htmldocx import docxifier

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

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

Example

Here’s an example script that shows how to use both functions:

from docxhtml_converter.docxhtml import htmlifier
from docxhtml_converter.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.1.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

docxhtml_converter-0.1.1-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: docxhtml-converter-0.1.1.tar.gz
  • Upload date:
  • Size: 6.4 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.1.tar.gz
Algorithm Hash digest
SHA256 74cd20db57bd6cf5d0d6fe50352016e4037b45add677810571cc361dfe7a85e6
MD5 c345ba36c7bf9e8aeedf14426ec04bd6
BLAKE2b-256 e6a35377d35fe878b04f2e02aa9dd3288da56ec84a0d3ccf1e05f03d54a7bfab

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for docxhtml_converter-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ea12c862dc7b369594243c06d0979a9fd2b2f05cf346076a1297a1003a5c1e6f
MD5 ebde8d962d3eae40201b98ee394552dd
BLAKE2b-256 c1942eb70fcd4bfdb7898aa5a62cd328532585c53f969d9e9a84effe5aaefd29

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