Insert

IMasterLayoutSlideCollection.Insert 方法

在集合的指定位置插入一个新的布局幻灯片。

public ILayoutSlide Insert(int index, SlideLayoutType layoutType, string layoutName)
参数类型描述
indexInt32新幻灯片的索引。
layoutTypeSlideLayoutType新布局的布局类型。支持的布局类型: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。
layoutNameString新布局的名称。如果通用名称已经被使用,将抛出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 不包含占位符和形状。

另请参见