scanny / python-pptx

Create Open XML PowerPoint documents in Python
MIT License
2.26k stars 498 forks source link

Cannot extract text from shape if it has equation #947

Open santibreo opened 4 months ago

santibreo commented 4 months ago

I have a Powepoint as simple as the attachment and I cannot extract the text using the code in Accessing the text frame.

It seems like, if the shape has an equation inside, it has not text_frame.

It is weird because if I check shape.part.blob the text is there. cannot_extract_text.pptx

scanny commented 4 months ago

Hmm, yeah, that's weird. The entire shape is "nested" in an <mc:AlternateContent> element which is why it doesn't appear in slide.shapes.

If the equation was a separate shape I expect this wouldn't happen (only the equation shape would be nested).