我想使用图片占位符自动替换 powerpoint 中的图像
我使用 python 使其动态化,但我遇到了这样的错误:
Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'LayoutPlaceholder' object has no attribute 'insert_picture'
我使用的代码如下:
from pptx import Presentation from pptx.util import Inches from PIL import Image prs = Presentation(r'..\gambar\base_master_mod.pptx') slide = prs.slide_layouts[0] placeholder = slide.placeholders[1] # id key, not posisition placeholder.name placeholder.placeholder_format.type picture = placeholder.insert_picture("..\output_graphics\image_res.png")
这里是我使用的 powerpoint:这里
如何解决问题?
慕莱坞森
相关分类