Metadata-Version: 2.4
Name: docxray
Version: 0.0.0a18
Summary: ReadOnly python-docx fork lib
Requires-Python: >=3.13
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: homoglyphs>=2.0.4
Requires-Dist: jp-number>=0.1.1
Requires-Dist: lxml>=6.1.0
Requires-Dist: num2words>=0.5.14
Requires-Dist: officemath2latex>=0.1.1
Requires-Dist: pillow>=12.2.0
Requires-Dist: python-dateutil>=2.9.0.post0
Requires-Dist: unicode-rbnf>=2.4.0
Requires-Dist: wand>=0.7.1
Requires-Dist: webcolors>=25.10.0
Dynamic: license-file

# 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

```python
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

```bash
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](https://imagemagick.org/script/download.php) (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

```python
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`](https://github.com/python-openxml/python-docx) project, extended for deeper ECMA-376 compliance and analysis capabilities.
