应用程序是基于C#的VSTO-AddIn for PowerPoint。
powerpoint中的每个SlideLayout都有一个类型。有没有办法在VSTO-AddIn中获取类型?到目前为止,我只知道如何从SlideLayout.xml中获取它
答案 0 :(得分:1)
是的,PowerPoint对象模型公开了枚举PpSlideLayout
,如
PowerPoint.PpSlideLayout theLayout = theSlide.Layout;
这是创建新幻灯片的代码段(需要指定CustomLayout),显示自定义布局和PpSlideLayout的字符串值,然后分配不同的PpSlideLayout
PowerPoint.Presentation p = this.Application.ActivePresentation;
PowerPoint.PpSlideLayout layoutBlank = PowerPoint.PpSlideLayout.ppLayoutBlank;
PowerPoint.CustomLayout custLayout = p.SlideMaster.CustomLayouts[1];
PowerPoint.Slide s = p.Slides.AddSlide(2, custLayout);
System.Windows.Forms.MessageBox.Show(s.CustomLayout.Name + ", " + s.Layout.ToString());
s.Layout = layoutBlank;