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.1.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.1-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: super_tiny2docx-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 a2887c754cc7af36ebc02fc78a35140147c92ad17b714c64f157186a1805d906
MD5 24ab2a7fde4ae199b74f611f5304e549
BLAKE2b-256 b04126bd674e3e4c7bbfcce152e09de481afe073d12b9ea742267d3f19b4ee58

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for super_tiny2docx-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7a85d606f6f29743007640c4c3a2e4938226c72ca62f9b20242aca6673f05639
MD5 4eda0b24467280fc3d03e1db3ad878b2
BLAKE2b-256 1d6f3f80146d858ba192572e4e40da7f51f9f13894dbaa1c064723edc9e9b3e4

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