现有的word文档中新增内容:https://www.jianshu.com/p/48b368a9ca3f
现有的excel文档中新增内容:https://www.jianshu.com/p/8a2fecb32e3d
现有的word文件转化成pdf:https://www.jianshu.com/p/b4c33b7044d0
1.安装插件
pip install python-pptx
pip install docx2pdf
2.具体方法:
from xlutils.copy import copy
from pptx import Presentation
def updatePPT():
filename = 'C:\\Users\\17546\\Desktop\\1.pptx'
prs = Presentation(filename)
slide = prs.slides.add_slide(prs.slide_layouts[0]) # 获取第一个母版
for shape in slide.placeholders: # 获取这一页的所有占位
# 要写入的内容 shape.text=字符串
shape.text = str(time.time())
prs.save(filename) # 保存文件路径
网友评论