将布局应用到来自特定母版的幻灯片 [英] Applying layout to a slide from specific Master

查看:21
本文介绍了将布局应用到来自特定母版的幻灯片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将特定布局应用到来自特定母版的幻灯片.

I need to apply a specific layout to a slide from a specific master.

假设我在甲板上有两个母版模板,我想应用第二个母版的仅标题"布局.

Suppose I have two master templates in the deck and I want to apply "Title Only" layout from the second master.

代码正在运行,但布局没有改变.

The code is running but layout is not changed.

ActivePresentation.Slides(11).Layout = ppLayoutTitleOnly
ActivePresentation.Slides(11).Select
Application.CommandBars.ExecuteMso ("SlideReset")

两张截图.

推荐答案

.Layout 属性仅对应用默认的 Microsoft 布局有用.在像您这样的大多数自定义演示文稿中,您不能指望这些布局中的任何一个都是标准化的.相反,请使用 .CustomLayout 属性,尽管它的名称如此,但它实际上应用了任何布局,无论是否自定义.

The .Layout property is only useful for applying default Microsoft layouts. In most customized presentations such as yours, you can't count on any of those layouts being that standardized. Instead, use the .CustomLayout property, which, despite its name, actually applies any layout, custom or not.

访问幻灯片母版的语法不直观:

The syntax for accessing a slide master is non-intuitive:

Sub PickSlideLayout()
  ActivePresentation.Slides(1).CustomLayout = ActivePresentation.Designs(2).SlideMaster.CustomLayouts(6)
End Sub

.Designs(2) 为您提供第二个幻灯片母版..CustomLayouts(6) 获取标准演示文稿中的仅标题"布局.CustomLayouts 不接受字符串,因此您不能使用布局名称.相反,您必须参考布局编号或索引.

.Designs(2) gets you the second slide master. .CustomLayouts(6) gets the Title Only layout in a standard presentation. CustomLayouts doesn't take a string, so you can't use the layout name. Instead you have to refer to the layout number or index.

这篇关于将布局应用到来自特定母版的幻灯片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆