Reputation: 1105
Code to import data from table and text frame:
pres = Presentation(ppt_file)
for slide in pres.slides:
for shape in slide.shapes:
if(shape.has_text_frame):
for paragraph in shape.text_frame.paragraphs:
for run in paragraph.runs:
print run.text
I've a slide like this:
Output is: Running text
Text is being read from the left frame or the big box but not from the two right frames.
Upvotes: 0
Views: 1832
Reputation: 29021
The shapes that are reporting None
as their shape type are Group shapes. You can confirm this by printing out their XML:
print(shape._element) # should give something like 'CT_GroupShape'
print(shape._element.xml) # should show XML that starts with `<p:grpSp>`
Group shapes aren't yet supported in python-pptx
. If you can ungroup them in PowerPoint their text will be accessible.
UPDATE: A group shape has no text. However, you can use group_shape.shapes
to iterate over the shapes inside the group and access their text. Note that groups can contain other groups.
Upvotes: 2