Skip to main content

ReadOnly python-docx fork lib

Project description

Docxray

A sophisticated DOCX analysis library — fork of python-docx with advanced parsing, styling intelligence, and deep ECMA-376 compliance.

Built for reading, inspecting, and transforming .docx (OOXML Transitional) documents with precision.


✨ Key Features

  • 🧠 Smart property resolution – inherits formatting from style hierarchies, following ECMA-376 rules (not just raw XML values)
  • 🖼️ Rich image support – works with Pillow or Wand (ImageMagick); handles modern formats plus legacy WMF/EMF
  • 🔄 HTML transformation – proxy objects (Paragraph, Table, etc.) include methods to convert content to HTML with rendering options
  • XSD soft validation – validates simple types against the official schema
  • 🔢 Intelligent list handling – numeral module correctly restores list-item text for most common cases

🚀 Quick Start

from docxray import Document

doc = Document("path/to/your/document.docx")

# Iterate through all inner content
for item in doc.iter_inner_content():
    # Process paragraphs, tables, runs, etc.
    pass

📦 Installation

pip install docxray

Additional Dependencies

ImageMagick is required for full image processing support when using the Wand library. Without ImageMagick, Docxray will fall back to using Pillow for image handling.

  • For Wand (recommended for advanced formats like WMF/EMF):
    • macOS: brew install imagemagick
    • Ubuntu/Debian: sudo apt-get install imagemagick libmagickwand-dev
    • Windows: Download and install from ImageMagick official site (ensure the development headers are included)

Note: If both Wand and ImageMagick are available, Docxray will use them for superior format support. If ImageMagick is missing, the library automatically falls back to Pillow for basic image operations.


📖 Documentation

Docxray is designed for read‑only document analysis. It provides:

  • Full access to document structure (paragraphs, runs, tables, images)
  • Styling attributes resolved through the complete OOXML style inheritance chain
  • Convenient proxies for manipulating content before export (e.g., to HTML)
  • Validation utilities to check document conformance

🧪 Example: Inspecting Run Properties

for item in doc.iter_inner_content():
    if isinstance(item, Paragraph):
        for p_item in item.iter_inner_content():
            if isinstance(p_item, Run) and p_item.italic:
                print(f"Italic text: {p_item.raw_text}")

📄 License

MIT — free for personal and commercial use.


🙏 Acknowledgements

Built as a fork of the excellent python-docx project, extended for deeper ECMA-376 compliance and analysis capabilities.

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

docxray-0.0.0a19.tar.gz (133.6 kB view details)

Uploaded Source

Built Distribution

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

docxray-0.0.0a19-py3-none-any.whl (172.1 kB view details)

Uploaded Python 3

File details

Details for the file docxray-0.0.0a19.tar.gz.

File metadata

  • Download URL: docxray-0.0.0a19.tar.gz
  • Upload date:
  • Size: 133.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.13

File hashes

Hashes for docxray-0.0.0a19.tar.gz
Algorithm Hash digest
SHA256 3e1cf1498879190e6b6e89dec3e65108633ff8a5f5aecae3a915b20ded4c5de4
MD5 a9248d1d4b411e6bf0bf251bd0388fd9
BLAKE2b-256 49ecf3cbd97f8ee018e476a42899cf9e0990eb6acaa3aed6b403f7df3359fba9

See more details on using hashes here.

File details

Details for the file docxray-0.0.0a19-py3-none-any.whl.

File metadata

  • Download URL: docxray-0.0.0a19-py3-none-any.whl
  • Upload date:
  • Size: 172.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.13

File hashes

Hashes for docxray-0.0.0a19-py3-none-any.whl
Algorithm Hash digest
SHA256 8473d49abe32b92d5be6788b6db5b7eab2de50256c8ad6b1cf104d796e65cfd3
MD5 820ee2fa7c1aa7e3c924387608c0acec
BLAKE2b-256 a91538d79a4792e7e1cedc0d0df28a74e9cccb74a105cab93be6d20fa3a532ba

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