Interface ISlides
Represents the slide collection.
Namespace: Syncfusion.Presentation
Assembly: Syncfusion.Presentation.UWP.dll
Syntax
public interface ISlides : IEnumerable<ISlide>, IEnumerable
Properties
Count
Gets the number of elements in the slide collection. Read-only.
Declaration
int Count { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The total count of the slides. |
Examples
//Create a new presentation.
IPresentation presentation = Presentation.Create();
//Create instance to hold the slide collection
ISlides slides = presentation.Slides;
//Add slide to presentation
slides.Add();
//Add a blank slide to the presentation.
slides.Add(SlideLayoutType.Blank);
//Add slide to the collection by passing the slide instance
slides.Add(slides.Add(SlideLayoutType.Title));
//Get the slide count, read only
int count = slides.Count;
//Save the presentation
presentation.Save("Sample.pptx");
//Close the presentation
presentation.Close();
'Create a new presentation.
Dim presentation__1 As IPresentation = Presentation.Create()
'Create instance to hold the slide collection
Dim slides As ISlides = presentation__1.Slides
'Add slide to presentation
slides.Add()
'Add a blank slide to the presentation.
slides.Add(SlideLayoutType.Blank)
'Add slide to the collection by passing the slide instance
slides.Add(slides.Add(SlideLayoutType.Title))
'Get the slide count, read only
Dim count As Integer = slides.Count
'Save the presentation
presentation__1.Save("Sample.pptx")
'Close the presentation
presentation__1.Close()
Item[Int32]
Gets the ISlide instance at the specified index in slide collection. Read-only.
Declaration
ISlide this[int index] { get; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index to locate the slide. |
Property Value
Type | Description |
---|---|
ISlide | Returns the slide at the specified index in slide collection. |
Examples
//Create a new presentation.
IPresentation presentation = Presentation.Create();
//Create instance to hold the slide collection
ISlides slides = presentation.Slides;
//Add slide to presentation
slides.Add();
//Add a blank slide to the presentation.
slides.Add(SlideLayoutType.Blank);
//Add slide to the collection by passing the slide instance
slides.Add(slides.Add(SlideLayoutType.Title));
//Retrieve the specific slide item, read only
ISlide _slide = slides[0];
//Set the slide name
_slide.Name = "My Slide";
//Save the presentation
presentation.Save("Sample.pptx");
//Close the presentation
presentation.Close();
'Create a new presentation.
Dim presentation__1 As IPresentation = Presentation.Create()
'Create instance to hold the slide collection
Dim slides As ISlides = presentation__1.Slides
'Add slide to presentation
slides.Add()
'Add a blank slide to the presentation.
slides.Add(SlideLayoutType.Blank)
'Add slide to the collection by passing the slide instance
slides.Add(slides.Add(SlideLayoutType.Title))
'Retrieve the specific slide item, read only
Dim _slide As ISlide = slides(0)
'Set the slide name
_slide.Name = "My Slide"
'Save the presentation
presentation__1.Save("Sample.pptx")
'Close the presentation
presentation__1.Close()
Methods
Add()
Adds a slide at the end of the slide collection.
Declaration
ISlide Add()
Returns
Type | Description |
---|---|
ISlide | Returns the newly created ISlide instance. |
Examples
//Create a new presentation.
IPresentation presentation = Presentation.Create();
//Create instance to hold the slide collection
ISlides slides = presentation.Slides;
//Add slide to presentation
slides.Add();
//Save the presentation
presentation.Save("Sample.pptx");
//Close the presentation
presentation.Close();
'Create a new presentation.
Dim presentation__1 As IPresentation = Presentation.Create()
'Create instance to hold the slide collection
Dim slides As ISlides = presentation__1.Slides
'Add slide to presentation
slides.Add()
'Save the presentation
presentation__1.Save("Sample.pptx")
'Close the presentation
presentation__1.Close()
Add(ILayoutSlide)
Creates an ISlide instance with relation to the specified ILayoutSlide instance and adds it to the ISlides collection.
Declaration
ISlide Add(ILayoutSlide layoutSlide)
Parameters
Type | Name | Description |
---|---|---|
ILayoutSlide | layoutSlide | Layout slide instance |
Returns
Type | Description |
---|---|
ISlide | Returns the slide with the specified slide layout. |
Add(ISlide)
Adds the specified slide at the end of the slide collection.
Declaration
int Add(ISlide value)
Parameters
Type | Name | Description |
---|---|---|
ISlide | value | Represents an ISlide instance to be added. |
Returns
Type | Description |
---|---|
System.Int32 | Returns the zero based index of the specified slide in the slide collection if found otherwise -1 |
Examples
//Create a new presentation.
IPresentation presentation = Presentation.Create();
//Create instance to hold the slide collection
ISlides slides = presentation.Slides;
//Add slide to collection
ISlide slide = slides.Add(SlideLayoutType.TwoContent);
//Retrieve the specific slide item, read only
ISlide _slide = slides[0];
slides.Add(_slide);
//Save the presentation
presentation.Save("Sample.pptx");
//Close the presentation
presentation.Close();
'Create a new presentation.
Dim presentation__1 As IPresentation = Presentation.Create()
'Create instance to hold the slide collection
Dim slides As ISlides = presentation__1.Slides
'Add slide to collection
Dim slide As ISlide = slides.Add(SlideLayoutType.TwoContent)
'Retrieve the specific slide item, read only
Dim _slide As ISlide = slides(0)
slides.Add(_slide)
'Save the presentation
presentation__1.Save("Sample.pptx")
'Close the presentation
presentation__1.Close()
Add(ISlide, PasteOptions, IPresentation)
Adds the specified cloned slide at the end of slide collection with specified paste options.
Declaration
void Add(ISlide clonedSlide, PasteOptions pasteOptions, IPresentation sourcePresentation = null)
Parameters
Type | Name | Description |
---|---|---|
ISlide | clonedSlide | An ISlide instance to be added to the destination presentation. |
PasteOptions | pasteOptions | Specifies the PasteOptions for merging the slide. |
IPresentation | sourcePresentation | Optional Parameter. An IPresentation instance of the source presentation from which the slide is cloned from. |
Remarks
The cloned slide can be added within the same presentation or this can be done between one presentation to another
Examples
//Open the source presentation
IPresentation sourcePresentation = Presentation.Open("Source.pptx");
//Open the destination presentation
IPresentation destinationPresentation = Presentation.Open("Destination.pptx");
//Clone the first slide of the source presentation.
ISlide clonedSlide = sourcePresentation.Slides[0].Clone();
//Merge the cloned slide to the destination presentation with paste option - Destination Them.
destinationPresentation.Slides.Add(clonedSlide, PasteOptions.UseDestinationTheme);
//Save the destination presentation.
destinationPresentation.Save("Output.pptx");
// Close the presentation
destinationPresentation.Close();
sourcePresentation.Close();
'Open the source presentation
Dim sourcePresentation As IPresentation = Presentation.Open("Source.pptx")
'Open the destination presentation
Dim destinationPresentation As IPresentation = Presentation.Open("Destination.pptx")
'Clone the first slide of the source presentation.
Dim clonedSlide As ISlide = sourcePresentation.Slides(0).Clone()
'Merge the cloned slide to the destination presentation with paste option - Destination Them.
destinationPresentation.Slides.Add(clonedSlide, PasteOptions.UseDestinationTheme)
'Save the destination presentation.
destinationPresentation.Save("Output.pptx")
'Closes the destination presentation.
destinationPresentation.Close()
sourcePresentation.Close()
Add(SlideLayoutType)
Creates a slide with the specified layout type and adds the new slide to the end of slide collection.
Declaration
ISlide Add(SlideLayoutType slideLayout)
Parameters
Type | Name | Description |
---|---|---|
SlideLayoutType | slideLayout | Specifies the slide layout type. |
Returns
Type | Description |
---|---|
ISlide | Returns the newly created ISlide instance. |
Examples
//Create a new presentation.
IPresentation presentation = Presentation.Create();
//Create instance to hold the slide collection
ISlides slides = presentation.Slides;
//Add slide to collection
ISlide slide = slides.Add(SlideLayoutType.TwoContent);
//Save the presentation
presentation.Save("Sample.pptx");
//Close the presentation
presentation.Close();
'Create a new presentation.
Dim presentation__1 As IPresentation = Presentation.Create()
'Create instance to hold the slide collection
Dim slides As ISlides = presentation__1.Slides
'Add slide to collection
Dim slide As ISlide = slides.Add(SlideLayoutType.TwoContent)
'Save the presentation
presentation__1.Save("Sample.pptx")
'Close the presentation
presentation__1.Close()
Clear()
Removes all the slides in the presentation.
Declaration
void Clear()
Examples
//Create a new presentation.
IPresentation presentation = Presentation.Create();
//Create instance to hold the slide collection
ISlides slides = presentation.Slides;
//Add slide to collection
ISlide slide = slides.Add(SlideLayoutType.TwoContent);
//Retrieve the specific slide item, read only
ISlide _slide = slides[0];
slides.Add(_slide);
//Clear the slide collection
slides.Clear();
//Save the presentation
presentation.Save("Sample.pptx");
//Close the presentation
presentation.Close();
'Create a new presentation.
Dim presentation__1 As IPresentation = Presentation.Create()
'Create instance to hold the slide collection
Dim slides As ISlides = presentation__1.Slides
'Add slide to collection
Dim slide As ISlide = slides.Add(SlideLayoutType.TwoContent)
'Retrieve the specific slide item, read only
Dim _slide As ISlide = slides(0)
slides.Add(_slide)
'Clear the slide collection
slides.Clear()
'Save the presentation
presentation__1.Save("Sample.pptx")
'Close the presentation
presentation__1.Close()
IndexOf(ISlide)
Returns the zero-based index of the first occurrence of the ISlide instance within the slide collection.
Declaration
int IndexOf(ISlide value)
Parameters
Type | Name | Description |
---|---|---|
ISlide | value | The ISlide instance to locate in the collection. |
Returns
Type | Description |
---|---|
System.Int32 | Returns the zero-based index of the first occurrence of slide within the collection, if found; otherwise, –1. |
Examples
//Create a new presentation.
IPresentation presentation = Presentation.Create();
//Create instance to hold the slide collection
ISlides slides = presentation.Slides;
//Add slide to collection
ISlide slide = slides.Add(SlideLayoutType.TwoContent);
//Get the index of the slide instance
int index = slides.IndexOf(slide);
//Save the presentation
presentation.Save("Sample.pptx");
//Close the presentation
presentation.Close();
'Create a new presentation.
Dim presentation__1 As IPresentation = Presentation.Create()
'Create instance to hold the slide collection
Dim slides As ISlides = presentation__1.Slides
'Add slide to collection
Dim slide As ISlide = slides.Add(SlideLayoutType.TwoContent)
'Get the index of the slide instance
Dim index As Integer = slides.IndexOf(slide)
'Save the presentation
presentation__1.Save("Sample.pptx")
'Close the presentation
presentation__1.Close()
Insert(Int32, ISlide)
Inserts the specified slide into the slide collection at specified index.
Declaration
void Insert(int index, ISlide value)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The zero-based index at which the slide should be inserted. |
ISlide | value | The slide value to insert. |
Examples
//Create a new presentation.
IPresentation presentation = Presentation.Create();
//Create instance to hold the slide collection
ISlides slides = presentation.Slides;
//Add slide to collection
ISlide slide = slides.Add(SlideLayoutType.TwoContent);
//Insert a slide at specific index in collection
slides.Insert(2, slides.Add());
//Save the presentation
presentation.Save("Sample.pptx");
//Close the presentation
presentation.Close();
'Create a new presentation.
Dim presentation__1 As IPresentation = Presentation.Create()
'Create instance to hold the slide collection
Dim slides As ISlides = presentation__1.Slides
'Add slide to collection
Dim slide As ISlide = slides.Add(SlideLayoutType.TwoContent)
'Insert a slide at specific index in collection
slides.Insert(2, slides.Add())
'Save the presentation
presentation__1.Save("Sample.pptx")
'Close the presentation
presentation__1.Close()
Insert(Int32, ISlide, PasteOptions, IPresentation)
Adds the specified cloned slide at the specified index of slide collection with specified paste options.
Declaration
void Insert(int index, ISlide clonedSlide, PasteOptions pasteOptions, IPresentation sourcePresentation = null)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | Specifies the index position of the slide in which the cloned slide should get added |
ISlide | clonedSlide | An ISlide instance to be added to the destination presentation. |
PasteOptions | pasteOptions | Specifies the PasteOptions for merging the slide. |
IPresentation | sourcePresentation | Optional Parameter. An IPresentation instance of the source presentation from which the slide is cloned from. |
Remarks
The cloned slide can be added within the same presentation or this can be done between one presentation to another
Examples
//Open the source presentation
IPresentation sourcePresentation = Presentation.Open("Source.pptx");
//Open the destination presentation
IPresentation destinationPresentation = Presentation.Open("Destination.pptx");
//Clone the first slide of the source presentation.
ISlide clonedSlide = sourcePresentation.Slides[0].Clone();
//Merge the cloned slide to the destination presentation with paste option - Destination Them.
destinationPresentation.Slides.Insert(1, clonedSlide, PasteOptions.UseDestinationTheme);
//Save the destination presentation.
destinationPresentation.Save("Output.pptx");
'Open the source presentation
Dim sourcePresentation As IPresentation = Presentation.Open("Source.pptx")
'Open the destination presentation
Dim destinationPresentation As IPresentation = Presentation.Open("Destination.pptx")
'Clone the first slide of the source presentation.
Dim clonedSlide As ISlide = sourcePresentation.Slides(0).Clone()
'Merge the cloned slide to the destination presentation with paste option - Destination Them.
destinationPresentation.Slides.Insert(1, clonedSlide, PasteOptions.UseDestinationTheme)
'Save the destination presentation.
destinationPresentation.Save("Output.pptx")
Remove(ISlide)
Removes the first occurrence of a specified slide from the slide collection.
Declaration
void Remove(ISlide value)
Parameters
Type | Name | Description |
---|---|---|
ISlide | value | The slide to be removed from the collection. |
Examples
//Create a new presentation.
IPresentation presentation = Presentation.Create();
//Create instance to hold the slide collection
ISlides slides = presentation.Slides;
//Add slide to collection
ISlide slide = slides.Add(SlideLayoutType.TwoContent);
//Remove a specific slide object
slides.Remove(slide);
//Save the presentation
presentation.Save("Sample.pptx");
//Close the presentation
presentation.Close();
'Create a new presentation.
Dim presentation__1 As IPresentation = Presentation.Create()
'Create instance to hold the slide collection
Dim slides As ISlides = presentation__1.Slides
'Add slide to collection
Dim slide As ISlide = slides.Add(SlideLayoutType.TwoContent)
'Remove a specific slide object
slides.Remove(slide)
'Save the presentation
presentation__1.Save("Sample.pptx")
'Close the presentation
presentation__1.Close()
RemoveAt(Int32)
Removes the slide at the specified index, from the 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.
IPresentation presentation = Presentation.Open("Sample.pptx");
//Create instance to hold the slide collection
ISlides slides = presentation.Slides;
//Remove slide from specific index
slides.RemoveAt(0);
//Save the presentation
presentation.Save("Sample.pptx");
//Close the presentation
presentation.Close();
'Create a new presentation.
Dim presentation__1 As IPresentation = Presentation.Open("Sample.pptx")
'Create instance to hold the slide collection
Dim slides As ISlides = presentation__1.Slides
'Remove slide from specific index
slides.RemoveAt(0)
'Save the presentation
presentation__1.Save("Sample.pptx")
'Close the presentation
presentation__1.Close()