【发布时间】:2017-04-06 23:23:35
【问题描述】:
在我的 C# 应用程序中,我调用了presentation.Slides.AddSlide,第二个参数显示为CustomLayout。我能找到的唯一布局是 PpSlideLayout,编译器说它无法转换为 CustomLayout。
我应该为第二个参数传递什么?
【问题讨论】:
标签: c# powerpoint office-interop
在我的 C# 应用程序中,我调用了presentation.Slides.AddSlide,第二个参数显示为CustomLayout。我能找到的唯一布局是 PpSlideLayout,编译器说它无法转换为 CustomLayout。
我应该为第二个参数传递什么?
【问题讨论】:
标签: c# powerpoint office-interop
第二个参数应该是自定义布局对象。
对象层次结构如下所示:
Presentation
Designs (collection)
Design(x)
SlideMaster
CustomLayouts (collection)
CustomLayout(x)
所以在 VBA 中,您会执行以下操作:
ActivePresentation.Slides.AddSlide 1, _
ActivePresentation.Designs(1).SlideMaster.CustomLayouts(2)
这将基于第一个设计中的第二个布局添加一个新的幻灯片 1(我们称之为幻灯片母版)。是的。对象模型有点扭曲。
【讨论】: