
修改为:
和删除文本变成下面:
请配详细解答,如各个函数,方法的作用,谢谢大家。
请问:如何使用python模块的pptx,对pptx里面文本框的内容进行修改?如将:我是大明星改为我是小明星,和把大明星删去的操作。
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-
2条回答 默认 最新
兰振lanzhen 2021-08-15 12:14关注from pptx import Presentation prs = Presentation('test1.pptx') #获取所有的幻灯片 for slide in prs.slides: #获取所有的占位符(文本框) for shape in slide.shapes: #判断是否有内容 if shape.has_text_frame: text_frame = shape.text_frame # 修改替换 if '大明星' in text_frame.text: text_frame.text='替换测试' if '文本框' in text_frame.text: text_frame.text='' prs.save('12.pptx')
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报