所有幻灯片母版占位符默认为14

时间:2019-10-14 12:25:50

标签: python powerpoint-vba win32com

我正在玩使用win32com以编程方式创建电源点。偷看幻灯片母版时出现问题。

打开电源点,转到

主页->编辑->选择->选择窗格

然后做

查看->幻灯片母版

我删除了布局1的所有内容,并插入了图片占位符,如下所示

enter image description here

import win32com.client
pp = win32com.client.Dispatch("PowerPoint.Application")
pres = pp.Presentations.Open("<your pptx file name>.pptx")
design = pres.Designs
design = pres.Designs(1)
master = design.SlideMaster
layouts = master.CustomLayouts
>>> layouts(1).shapes(1).Type
14 
>>> layouts(1).shapes(1).Name
'Picture Placeholder 7

我的问题是我引用here,14的Type枚举用于ppPlaceholderHeader。为什么不是ppPlaceholderPicture?即类型为18。

也许我导航不正确并看着错误的物体?

1 个答案:

答案 0 :(得分:1)

所有占位符均为类型14对象。如果您想知道占位符的类型,请使用:

.PlaceholderFormat.Type