Read From PowerPoint Table in Python?

后端 未结 2 1844
旧巷少年郎
旧巷少年郎 2021-01-22 05:48

I am using the python pptx module to automatically update values in a powerpoint file. I am able to extract all the text in the file using the code below:

from          


        
2条回答
  •  心在旅途
    2021-01-22 05:52

    This works for me:

        def access_table(): 
                slide = prs.slides[0] #first slide
                table = slide.shapes[2].table # maybe 0..n
                for r in table.rows:
                        s = ""
                        for c in r.cells:
                                s += c.text_frame.text + " | "
                                #to write
                                #c.text_frame.text = "example"
                        print s
    

提交回复
热议问题