套用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')

猜你喜欢

转载自www.cnblogs.com/tomhu/p/12342988.html
今日推荐