其他分享
首页 > 其他分享> > 套用ppt格式填入内容

套用ppt格式填入内容

作者:互联网

from pptx import Presentation

ppt = Presentation(r'C:/Users/13375/Desktop/python/model.pptx')

shape = ppt.slides[0].shapes

# for i in shape:
#     print(i.text)
#     print('\n')
print(shape[1].text_frame.paragraphs[0].text)
# print(shape[1].text_frame.paragraphs[1].text)
print(shape[1].text_frame.paragraphs[1].runs[0].text)

shape[1].text_frame.paragraphs[0].runs[0].text = '更改后的新段落'
ppt.save(r'C:\Users\13375\Desktop\python\change.pptx')

标签:填入,text,frame,paragraphs,套用,shape,ppt,print
来源: https://www.cnblogs.com/tomhu/p/12342988.html