forked from python-openxml/python-docx
-
Notifications
You must be signed in to change notification settings - Fork 0
Phase D.27: DrawingML shapes and text box content access #40
Copy link
Copy link
Open
Labels
Description
Add read access to text inside DrawingML shapes, text boxes, and other drawing elements.
Problem
Text inside shapes/text boxes/diagrams is currently invisible to python-docx. paragraph.text and document.paragraphs skip over drawing elements entirely.
API Design
- paragraph.drawings — list of Drawing objects found in the paragraph
- Drawing.text — concatenated text from all text frames in the drawing
- Drawing.paragraphs — list of Paragraph objects inside the drawing's text frame
- Drawing.type — shape, text_box, group, chart, diagram
XML
- w:drawing > wp:inline or wp:anchor > a:graphic > a:graphicData
- Text in shapes: wps:wsp > wps:txbx > w:txbxContent > w:p (regular paragraphs)
Read-only is sufficient for now. Write support would be a separate issue.
Upstream: python-openxml#380 (8 comments)
Reactions are currently unavailable