Interface ILayoutSlides
Represents a collection of ILayoutSlide instance in a presentation
Namespace: Syncfusion.Presentation
Assembly: Syncfusion.Presentation.UWP.dll
Syntax
public interface ILayoutSlides : IEnumerable<ILayoutSlide>, IEnumerable
Properties
Count
Gets the number of elements in the layout slide collection. Read-only.
Declaration
int Count { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The total count of the slides in the layout slide collection. |
Examples
//Create a new presentation.
Presentation presentation = Presentation.Create() as Presentation;
//Retrieve the collection of layout Slide
ILayoutSlides layoutSlides = presentation.Masters[0].LayoutSlides;
//Create a new instance of layout slide
ILayoutSlide layoutSlide = layoutSlides[0];
//Add the layout slide to the collection
layoutSlides.Add(layoutSlide);
//Get the count of the layout slides in a presentation
int count = layoutSlides.Count;
//Save the presentation
presentation.Save("Sample.pptx");
//Close the presentation
presentation.Close();
'Create a new presentation.
Dim presentation__1 As Presentation = TryCast(Presentation.Create(), Presentation)
'Retrieve the collection of layout Slide
Dim layoutSlides As ILayoutSlides = presentation__1.Masters(0).LayoutSlides
'Create a new instance of layout slide
Dim layoutSlide As ILayoutSlide = layoutSlides(0)
'Add the layout slide to the collection
layoutSlides.Add(layoutSlide)
'Get the count of the layout slides in a presentation
Dim count As Integer = layoutSlides.Count
'Save the presentation
presentation__1.Save("Sample.pptx")
'Close the presentation
presentation__1.Close()
Item[Int32]
Gets a ILayoutSlide instance from the collection. Read-only.
Declaration
ILayoutSlide this[int index] { get; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | Index from the collection. |
Property Value
Type | Description |
---|---|
ILayoutSlide | Returns the particular layout slide based on the index. |
Examples
//Create a new presentation.
Presentation presentation = Presentation.Create() as Presentation;
//Retrieve the collection of layout Slide
ILayoutSlides layoutSlides = presentation.Masters[0].LayoutSlides;
//Create a new instance of layout slide
ILayoutSlide layoutSlide = layoutSlides[0];
//Set the fill type of background as solid
layoutSlide.Background.Fill.FillType = FillType.Solid;
//Set the color for solid fill
layoutSlide.Background.Fill.SolidFill.Color = ColorObject.Firebrick;
//Add the layout slide to the collection
layoutSlides.Add(layoutSlide);
//Save the presentation
presentation.Save("Sample.pptx");
//Close the presentation
presentation.Close();
'Create a new presentation.
Dim presentation__1 As Presentation = TryCast(Presentation.Create(), Presentation)
'Retrieve the collection of layout Slide
Dim layoutSlides As ILayoutSlides = presentation__1.Masters(0).LayoutSlides
'Create a new instance of layout slide
Dim layoutSlide As ILayoutSlide = layoutSlides(0)
'Set the fill type of background as solid
layoutSlide.Background.Fill.FillType = FillType.Solid
'Set the color for solid fill
layoutSlide.Background.Fill.SolidFill.Color = ColorObject.Firebrick
'Add the layout slide to the collection
layoutSlides.Add(layoutSlide)
'Save the presentation
presentation__1.Save("Sample.pptx")
'Close the presentation
presentation__1.Close()
Methods
Add(ILayoutSlide)
Adds a layout slide at the end of the collection.
Declaration
void Add(ILayoutSlide layoutSlide)
Parameters
Type | Name | Description |
---|---|---|
ILayoutSlide | layoutSlide | Represents an ILayoutSlide instance to be added. |
Examples
//Create a new presentation.
Presentation presentation = Presentation.Create() as Presentation;
//Retrieve the collection of layout Slide
ILayoutSlides layoutSlides = presentation.Masters[0].LayoutSlides;
//Create a new instance of layout slide
ILayoutSlide layoutSlide = layoutSlides[0];
//Set name to the layout slide
layoutSlide.Name = "Layout Slide";
//Add an auto shape - bentconnector5 to the layout slide
layoutSlide.Shapes.AddShape(AutoShapeType.BentConnector5, 123, 234, 200, 180);
//Add the layout slide to the collection
layoutSlides.Add(layoutSlide);
//Save the presentation
presentation.Save("Sample.pptx");
//Close the presentation
presentation.Close();
'Create a new presentation.
Dim presentation__1 As Presentation = TryCast(Presentation.Create(), Presentation)
'Retrieve the collection of layout Slide
Dim layoutSlides As ILayoutSlides = presentation__1.Masters(0).LayoutSlides
'Create a new instance of layout slide
Dim layoutSlide As ILayoutSlide = layoutSlides(0)
'Set name to the layout slide
layoutSlide.Name = "Layout Slide"
'Add an auto shape - bentconnector5 to the layout slide
layoutSlide.Shapes.AddShape(AutoShapeType.BentConnector5, 123, 234, 200, 180)
'Add the layout slide to the collection
layoutSlides.Add(layoutSlide)
'Save the presentation
presentation__1.Save("Sample.pptx")
'Close the presentation
presentation__1.Close()
Add(SlideLayoutType, String)
Creates an ILayoutSlide instance with the specified SlideLayoutType and layout name, then adds it to the ILayoutSlides collection.
Declaration
ILayoutSlide Add(SlideLayoutType layoutType, string layoutName)
Parameters
Type | Name | Description |
---|---|---|
SlideLayoutType | layoutType | The layout type to customize |
System.String | layoutName | The custom name of the layout slide |
Returns
Type | Description |
---|---|
ILayoutSlide | Returns the created layout slide with specified name and type |
Examples
//Create a new presentation.
IPresentation presentation = Presentation.Create();
//Retrieve the collection of layout Slide
ILayoutSlides layoutSlides = presentation.Masters[0].LayoutSlides;
//Add the layout slide to the collection
layoutSlides.Add(SlideLayoutType.Custom, "Custom Layout");
//Add the slide into the presentation.
ISlide slide = presentation.Slides.Add(SlideLayoutType.Custom);
//Get the count of the layout slides in a presentation
int count = layoutSlides.Count;
//Save the presentation
presentation.Save("Sample.pptx");
//Close the presentation
presentation.Close();
'Create a new presentation.
Dim pptxDoc As IPresentation = Presentation.Create()
'Retrieve the collection of layout Slide.
Dim layoutSlides As ILayoutSlides = pptxDoc.Masters(0).LayoutSlides
'Add the layout slide to the collection.
layoutSlides.Add(SlideLayoutType.Custom, "Custom Layout")
'Add the slide into the presentation.
Dim slide As ISlide = pptxDoc.Slides.Add(SlideLayoutType.Custom)
'Get the count of the layout slides in a presentation.
Dim count As Integer = layoutSlides.Count
'Saves the Presentation.
pptxDoc.Save("Sample.pptx")
'Close the presentation.
pptxDoc.Close()
Clear()
Removes all the elements from layout slide collection.
Declaration
void Clear()
Examples
//Create a new presentation.
Presentation presentation = Presentation.Create() as Presentation;
//Retrieve the collection of layout Slide
ILayoutSlides layoutSlides = presentation.Masters[0].LayoutSlides;
//Clear the layout slides
layoutSlides.Clear();
//Save the presentation
presentation.Save("Output.pptx");
//Close the presentation
presentation.Close();
'Create a new presentation.
Dim presentation__1 As Presentation = TryCast(Presentation.Create(), Presentation)
'Retrieve the collection of layout Slide
Dim layoutSlides As ILayoutSlides = presentation__1.Masters(0).LayoutSlides
'Clear the layout slides
layoutSlides.Clear()
'Save the presentation
presentation__1.Save("Output.pptx")
'Close the presentation
presentation__1.Close()
GetByType(SlideLayoutType)
Returns an ILayoutSlide instance with the specified SlideLayoutType item.
Declaration
ILayoutSlide GetByType(SlideLayoutType type)
Parameters
Type | Name | Description |
---|---|---|
SlideLayoutType | type | The type of the layout slide to find the ILayoutSlide instance. |
Returns
Type | Description |
---|---|
ILayoutSlide | Returns the layout slide with the specified slide layout type. |
Examples
//Create a new presentation.
Presentation presentation = Presentation.Create() as Presentation;
//Retrieve the collection of layout Slide
ILayoutSlides layoutSlides = presentation.Masters[0].LayoutSlides;
//Get the layout slide by specifying the slide layout type
ILayoutSlide layoutSlide = layoutSlides.GetByType(SlideLayoutType.Title);
//Set name to the layout slide
layoutSlide.Name = "Layout Slide";
//Add a text box to the layout slide
IShape shape = layoutSlide.Shapes.AddTextBox(200, 120, 345, 200);
//Add paragraph to the text body
shape.TextBody.Paragraphs.Add("This is a layout slide");
//Add the layout slide to the collection
layoutSlides.Add(layoutSlide);
//Save the presentation
presentation.Save("Output.pptx");
//Close the presentation
presentation.Close();
'Create a new presentation.
Dim presentation__1 As Presentation = TryCast(Presentation.Create(), Presentation)
'Retrieve the collection of layout Slide
Dim layoutSlides As ILayoutSlides = presentation__1.Masters(0).LayoutSlides
'Get the layout slide by specifying the slide layout type
Dim layoutSlide As ILayoutSlide = layoutSlides.GetByType(SlideLayoutType.Title)
'Set name to the layout slide
layoutSlide.Name = "Layout Slide"
'Add a text box to the layout slide
Dim shape As IShape = layoutSlide.Shapes.AddTextBox(200, 120, 345, 200)
'Add paragraph to the text body
shape.TextBody.Paragraphs.Add("This is a layout slide")
'Add the layout slide to the collection
layoutSlides.Add(layoutSlide)
'Save the presentation
presentation__1.Save("Output.pptx")
'Close the presentation
presentation__1.Close()
IndexOf(ILayoutSlide)
Returns the zero-based index of the first occurrence of the ILayoutSlide within the collection.
Declaration
int IndexOf(ILayoutSlide value)
Parameters
Type | Name | Description |
---|---|---|
ILayoutSlide | value | The ILayoutSlide instance to locate in the collection. |
Returns
Type | Description |
---|---|
System.Int32 | Returns the zero-based index of the first occurrence of object within the entire collection, if found; otherwise, –1. |
Examples
//Create a new presentation.
Presentation presentation = Presentation.Create() as Presentation;
//Retrieve the collection of layout Slide
ILayoutSlides layoutSlides = presentation.Masters[0].LayoutSlides;
//Create a new instance of layout slide
ILayoutSlide layoutSlide = layoutSlides[0];
//Set name to the layout slide
layoutSlide.Name = "Layout Slide";
//Add a text box to the layout slide
IShape shape = layoutSlide.Shapes.AddTextBox(200, 120, 345, 200);
//Add paragraph to the text body
shape.TextBody.Paragraphs.Add("This is a layout slide");
//Add the layout slide to the collection
layoutSlides.Add(layoutSlide);
//Get the index of layout slide
int index = layoutSlides.IndexOf(layoutSlide);
//Save the presentation
presentation.Save("Output.pptx");
//Close the presentation
presentation.Close();
'Create a new presentation.
Dim presentation__1 As Presentation = TryCast(Presentation.Create(), Presentation)
'Retrieve the collection of layout Slide
Dim layoutSlides As ILayoutSlides = presentation__1.Masters(0).LayoutSlides
'Create a new instance of layout slide
Dim layoutSlide As ILayoutSlide = layoutSlides(0)
'Set name to the layout slide
layoutSlide.Name = "Layout Slide"
'Add a text box to the layout slide
Dim shape As IShape = layoutSlide.Shapes.AddTextBox(200, 120, 345, 200)
'Add paragraph to the text body
shape.TextBody.Paragraphs.Add("This is a layout slide")
'Add the layout slide to the collection
layoutSlides.Add(layoutSlide)
'Get the index of layout slide
Dim index As Integer = layoutSlides.IndexOf(layoutSlide)
'Save the presentation
presentation__1.Save("Output.pptx")
'Close the presentation
presentation__1.Close()
Insert(Int32, ILayoutSlide)
Inserts an element into the layout slide collection at the specified index.
Declaration
void Insert(int index, ILayoutSlide value)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The zero-based index at which value should be inserted. |
ILayoutSlide | value | The layout slide item to insert. |
Examples
//Create a new presentation.
Presentation presentation = Presentation.Create() as Presentation;
//Retrieve the collection of layout Slide
ILayoutSlides layoutSlides = presentation.Masters[0].LayoutSlides;
//Create a new instance of layout slide
ILayoutSlide layoutSlide = layoutSlides[0];
//Set name to the layout slide
layoutSlide.Name = "Layout Slide";
//Add a text box to the layout slide
IShape shape = layoutSlide.Shapes.AddTextBox(200, 120, 345, 200);
//Add paragraph to the text body
shape.TextBody.Paragraphs.Add("This is a layout slide");
//Insert the layout slide at index 2
layoutSlides.Insert(2,layoutSlide);
//Save the presentation
presentation.Save("Output.pptx");
//Close the presentation
presentation.Close();
'Create a new presentation.
Dim presentation__1 As Presentation = TryCast(Presentation.Create(), Presentation)
'Retrieve the collection of layout Slide
Dim layoutSlides As ILayoutSlides = presentation__1.Masters(0).LayoutSlides
'Create a new instance of layout slide
Dim layoutSlide As ILayoutSlide = layoutSlides(0)
'Set name to the layout slide
layoutSlide.Name = "Layout Slide"
'Add a text box to the layout slide
Dim shape As IShape = layoutSlide.Shapes.AddTextBox(200, 120, 345, 200)
'Add paragraph to the text body
shape.TextBody.Paragraphs.Add("This is a layout slide")
'Insert the layout slide at index 2
layoutSlides.Insert(2, layoutSlide)
'Save the presentation
presentation__1.Save("Output.pptx")
'Close the presentation
presentation__1.Close()
Remove(ILayoutSlide)
Removes the first occurrence of a specified object from the layout slide collection.
Declaration
void Remove(ILayoutSlide value)
Parameters
Type | Name | Description |
---|---|---|
ILayoutSlide | value | The layout slide object to be removed from the collection. |
Examples
//Create a new presentation.
Presentation presentation = Presentation.Create() as Presentation;
//Retrieve the collection of layout Slide
ILayoutSlides layoutSlides = presentation.Masters[0].LayoutSlides;
//Create a new instance of layout slide
ILayoutSlide layoutSlide = layoutSlides[0];
//Set name to the layout slide
layoutSlide.Name = "Layout Slide";
//Add a text box to the layout slide
IShape shape = layoutSlide.Shapes.AddTextBox(200, 120, 345, 200);
//Add paragraph to the text body
shape.TextBody.Paragraphs.Add("This is a layout slide");
//Add the layout slide to the collection
layoutSlides.Add(layoutSlide);
//Remove a specific layout slide from the collection
layoutSlides.Remove(layoutSlide);
//Save the presentation
presentation.Save("Output.pptx");
//Close the presentation
presentation.Close();
'Create a new presentation.
Dim presentation__1 As Presentation = TryCast(Presentation.Create(), Presentation)
'Retrieve the collection of layout Slide
Dim layoutSlides As ILayoutSlides = presentation__1.Masters(0).LayoutSlides
'Create a new instance of layout slide
Dim layoutSlide As ILayoutSlide = layoutSlides(0)
'Set name to the layout slide
layoutSlide.Name = "Layout Slide"
'Add a text box to the layout slide
Dim shape As IShape = layoutSlide.Shapes.AddTextBox(200, 120, 345, 200)
'Add paragraph to the text body
shape.TextBody.Paragraphs.Add("This is a layout slide")
'Add the layout slide to the collection
layoutSlides.Add(layoutSlide)
'Remove a specific layout slide from the collection
layoutSlides.Remove(layoutSlide)
'Save the presentation
presentation__1.Save("Output.pptx")
'Close the presentation
presentation__1.Close()
RemoveAt(Int32)
Removes the element at the specified index of the layout slide collection.
Declaration
void RemoveAt(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The zero-based index of the element to be removed. |
Examples
//Create a new presentation.
Presentation presentation = Presentation.Create() as Presentation;
//Retrieve the collection of layout Slide
ILayoutSlides layoutSlides = presentation.Masters[0].LayoutSlides;
//Remove a specific layout slide using index position
layoutSlides.RemoveAt(1);
//Save the presentation
presentation.Save("Output.pptx");
//Close the presentation
presentation.Close();
'Create a new presentation.
Dim presentation__1 As Presentation = TryCast(Presentation.Create(), Presentation)
'Retrieve the collection of layout Slide
Dim layoutSlides As ILayoutSlides = presentation__1.Masters(0).LayoutSlides
'Remove a specific layout slide using index position
layoutSlides.RemoveAt(1)
'Save the presentation
presentation__1.Save("Output.pptx")
'Close the presentation
presentation__1.Close()