【问题标题】:PowerPoint interop PpSlideLayout to CustomLayoutPowerPoint 互操作 PpSlideLayout 到 CustomLayout
【发布时间】:2017-04-06 23:23:35
【问题描述】:

在我的 C# 应用程序中,我调用了presentation.Slides.AddSlide,第二个参数显示为CustomLayout。我能找到的唯一布局是 PpSlideLayout,编译器说它无法转换为 CustomLayout。

我应该为第二个参数传递什么?

【问题讨论】:

    标签: c# powerpoint office-interop


    【解决方案1】:

    第二个参数应该是自定义布局对象。

    对象层次结构如下所示:

    Presentation
      Designs (collection)
        Design(x)
          SlideMaster
            CustomLayouts (collection)
              CustomLayout(x)
    

    所以在 VBA 中,您会执行以下操作:

     ActivePresentation.Slides.AddSlide 1, _
     ActivePresentation.Designs(1).SlideMaster.CustomLayouts(2)
    

    这将基于第一个设计中的第二个布局添加一个新的幻灯片 1(我们称之为幻灯片母版)。是的。对象模型有点扭曲。

    【讨论】:

    • 谢谢!这正是我所需要的。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-12-06
    • 1970-01-01
    • 2023-03-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多