Add
MasterLayoutSlideCollection.Add 方法
在集合的末尾添加一个新的布局幻灯片。
public ILayoutSlide Add(SlideLayoutType layoutType, string layoutName)
参数 | 类型 | 描述 |
---|---|---|
layoutType | SlideLayoutType | 新布局的布局类型。支持的布局类型:Title, TitleOnly, Blank, TitleAndObject, VerticalText, VerticalTitleAndText, TwoObjects, SectionHeader, TwoTextAndTwoObjects, TitleObjectAndCaption, PictureAndCaption, Custom。其他不支持的布局类型包括:Text, TwoColumnText, Table, TextAndChart, ChartAndText, Diagram, Chart, TextAndClipArt, ClipArtAndText, TextAndObject, ObjectAndText, Object, TextAndMedia, MediaAndText, ObjectOverText, TextOverObject, TextAndTwoObjects, TwoObjectsAndText, TwoObjectsOverText, FourObjects, ClipArtAndVerticalText, VerticalTitleAndTextOverChart, ObjectAndTwoObject, TwoObjectsAndObject。 |
layoutName | String | 新布局的名称。如果传入的名称已在使用,则会抛出 ArgumentException。如果传入 null 参数,则会根据传入的布局类型自动生成名称(例如 “Title Slide” 或 “1_Title Slide”, “2_..”, 等)。 |
返回值
添加的幻灯片。
异常
异常 | 条件 |
---|---|
NotImplementedException | 如果传入的参数 layoutType 的值不支持,则会抛出此异常。当前不支持的布局类型:Text, TwoColumnText, Table, TextAndChart, ChartAndText, Diagram, Chart, TextAndClipArt, ClipArtAndText, TextAndObject, ObjectAndText, Object, TextAndMedia, MediaAndText, ObjectOverText, TextOverObject, TextAndTwoObjects, TwoObjectsAndText, TwoObjectsOverText, FourObjects, ClipArtAndVerticalText, VerticalTitleAndTextOverChart, ObjectAndTwoObject, TwoObjectsAndObject。 |
ArgumentException | 如果布局名称值 layoutName 已在该布局集合中使用,则会抛出此异常。 |
备注
1)对于值 SlideLayoutType.Custom 的 layoutType,添加的布局不包含占位符和形状。 2)此方法的类似方法是通过 LayoutSlides
属性访问的 Add
方法。