reckoner
reckoner

Reputation: 2981

Reading text values in a PowerPoint table using pptx?

Using the pptx module,

 tbl.cell(3,3).text

is a writable, but not a readable attribute. Is there a way to just read the text in a PowerPoint table? I'm trying to avoid COM and pptx is a great module, but lacks this particular feature.

Thanks!

Upvotes: 1

Views: 2544

Answers (1)

scanny
scanny

Reputation: 29031

At present, you'll need to go a level deeper to get text out of a cell using python-pptx. The cell.text 'getter' is on the roadmap.

Something like this should get it done:

cell = tbl.cell(3, 3)
paragraphs = cell.textframe.paragraphs
for paragraph in paragraphs:
    for run in paragraph.runs:
        print run.text

Let me know if you need more to go on.

Upvotes: 3

Related Questions