Insert
MasterLayoutSlideCollection.Insert 方法
在集合的指定位置插入一个新的布局幻灯片。
public ILayoutSlide Insert(int index, SlideLayoutType layoutType, string layoutName)
参数 | 类型 | 描述 |
---|---|---|
index | Int32 | 新幻灯片的索引。 |
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 在此布局集合中已在使用,将抛出此异常。 |
注意事项
插入的布局对于值 SlideLayoutType.Custom 的 layoutType 不包含任何占位符和形状。