fix: add image notes to DOCX/DOCM import
Some checks failed
Syntax / Linting and Type Checking (push) Has been cancelled
Tests / Linux Python 3.11 (push) Has been cancelled
Tests / Linux Python 3.12 (push) Has been cancelled
Tests / Linux Python 3.13 (push) Has been cancelled
Tests / Linux Python 3.14 (push) Has been cancelled
Tests / Linux Python 3.15 (push) Has been cancelled
Tests / MacOS Python 3.14 (push) Has been cancelled
Tests / Windows Python 3.14 (push) Has been cancelled
Tests / PR Coverage Report (push) Has been cancelled
Tests / Action Coverage Report (push) Has been cancelled
Tests / Ubuntu 24.04 & Sys Packages (push) Has been cancelled
Tests / Fedora 44 & Sys Packages (push) Has been cancelled

- Add image notes for all images found in the Word document
- Images are stored with their binary data and MIME type in the notes
This commit is contained in:
B.D. Murphy
2026-11-05 09:26:09 -08:00
parent 096cb08e98
commit 84e87cc2cd

View File

@@ -368,6 +368,17 @@ class FromDocxDocument:
)
self._result.notes.append(note)
# Add image notes for images found in the document
for img in self._result.images:
note = ImportNote(
note_type="image",
source=f"image file: {img.filename}",
text=f"Image: {img.filename}",
data=img.data,
mime=img.mime,
)
self._result.notes.append(note)
def _parse_paragraph(self, para: ET.Element) -> dict | None:
"""Parse a single paragraph element and return its content."""
# Get paragraph style