Skip to main content

Convert HTML from TinyMCE (or other WYSIWYG editors) into .docx documents easily. Designed for developers looking to integrate rich text export functionality into their Python applications. Contributions welcome!

Project description

Super Tiny2Docx

PyPI Python Version License: MIT

Convert HTML from TinyMCE (or other WYSIWYG editors) into .docx documents easily. Designed for developers looking to integrate rich text export functionality into their Python applications. Supports tables, lists, styles, and more.

Contributions welcome!

✨ Features

  • Convert HTML to .docx with accurate formatting.
  • Supports paragraphs, headings, lists (ordered & unordered), tables, and inline styles.
  • Handles CSS-like styling (font, size, color, alignment, margins, borders, etc.).
  • Proper style inheritance for nested elements.
  • Preserves spaces and line breaks.
  • Extensible architecture for adding new features.

📦 Installation

pip install super_tiny2docx

🚀 Quick Start

from super_tiny2docx import SuperTiny2Docx

# Example HTML content
html_content = """
<h1>Welcome to Super Tiny2Docx</h1>
<p>This is a <strong>bold</strong> paragraph with <em>emphasis</em>.</p>
<ol>
    <li>First ordered list item</li>
    <li>Second ordered list item</li>
</ol>
<table border="1">
    <tr>
        <th>Header 1</th>
        <th>Header 2</th>
    </tr>
    <tr>
        <td>Data 1</td>
        <td>Data 2</td>
    </tr>
</table>
"""

# Convert to DOCX
converter = SuperTiny2Docx(html_content)
docx_bytes = converter.convert()

# Save to file
with open("output.docx", "wb") as f:
    f.write(docx_bytes.read())

print("Document saved as output.docx")

🛠️ Advanced Usage

Super Tiny2Docx automatically parses inline styles and <style> tags to apply formatting.

You can customize the default styles by extending the ComputedStyle class.

Contributing

We welcome contributions! Whether it's bug reports, feature suggestions, code improvements, or documentation fixes — your help is appreciated. Fork the repository. Create a new branch for your feature or bug fix. Add your changes and write tests if applicable. Submit a pull request.

🙏 Acknowledgements

Thanks to the community for support and inspiration. Special thanks to the maintainers of python-docx and beautifulsoup4.

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

super_tiny2docx-0.1.2.tar.gz (10.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

super_tiny2docx-0.1.2-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

Details for the file super_tiny2docx-0.1.2.tar.gz.

File metadata

  • Download URL: super_tiny2docx-0.1.2.tar.gz
  • Upload date:
  • Size: 10.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for super_tiny2docx-0.1.2.tar.gz
Algorithm Hash digest
SHA256 ce0acf688465119ed704519109f82d643964c5d1c088688cdf1eeabcea48186e
MD5 6ebe7133c7b339d45be47ce8c465e7fd
BLAKE2b-256 63addd22f38dcd89ecd2d2304153f4d145717f9393575dea3f645a4c663dfff9

See more details on using hashes here.

File details

Details for the file super_tiny2docx-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for super_tiny2docx-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e07c55dc409ce6aadcd6a28be924519bf31ae56e57696cfffbe19163362a01c5
MD5 570ab78aaa8b70e5e89d6498fb493fdf
BLAKE2b-256 29e9214065b599f8eeb982b1faea1bcfddff39f81057eac1d4e1eeeaec437381

See more details on using hashes here.

Supported by

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