Slides
Presentation.Slides property
Returns a list of all slides that are defined in the presentation. Read-only ISlideCollection
.
public ISlideCollection Slides { get; }
Examples
The following example shows how to set slides’ background color of PowerPoint Presentation.
[C#]
// Instantiate the Presentation class that represents the presentation file
using (Presentation pres = new Presentation())
{
// Set the background color of the first ISlide to Blue
pres.Slides[0].Background.Type = BackgroundType.OwnBackground;
pres.Slides[0].Background.FillFormat.FillType = FillType.Solid;
pres.Slides[0].Background.FillFormat.SolidFillColor.Color = Color.Blue;
pres.Save("ContentBG_out.pptx", SaveFormat.Pptx);
}
The following example shows how to set slides’ background image of PowerPoint Presentation.
[C#]
// Instantiate the Presentation class that represents the presentation file
using (Presentation pres = new Presentation("SetImageAsBackground.pptx"))
{
// Set the background with Image
pres.Slides[0].Background.Type = BackgroundType.OwnBackground;
pres.Slides[0].Background.FillFormat.FillType = FillType.Picture;
pres.Slides[0].Background.FillFormat.PictureFillFormat.PictureFillMode = PictureFillMode.Stretch;
// Set the picture
System.Drawing.Image img = (System.Drawing.Image)new Bitmap(dataDir + "Tulips.jpg");
// Add image to presentation's images collection
IPPImage imgx = pres.Images.AddImage(img);
pres.Slides[0].Background.FillFormat.PictureFillFormat.Picture.Image = imgx;
// Write the presentation to disk
pres.Save("ContentBG_Img_out.pptx", SaveFormat.Pptx);
}
The following example shows how to add slide transition Presentation.
[C#]
// Instantiate Presentation class to load the source presentation file
using (Presentation presentation = new Presentation("AccessSlides.pptx"))
{
// Apply circle type transition on slide 1
presentation.Slides[0].SlideShowTransition.Type = TransitionType.Circle;
// Apply comb type transition on slide 2
presentation.Slides[1].SlideShowTransition.Type = TransitionType.Comb;
// Write the presentation to disk
presentation.Save("SampleTransition_out.pptx", SaveFormat.Pptx);
}
The following example shows how to add advanced slide Transition.
[C#]
// Instantiate Presentation class that represents a presentation file
using (Presentation pres = new Presentation("BetterSlideTransitions.pptx"))
{
// Apply circle type transition on slide 1
pres.Slides[0].SlideShowTransition.Type = TransitionType.Circle;
// Set the transition time of 3 seconds
pres.Slides[0].SlideShowTransition.AdvanceOnClick = true;
pres.Slides[0].SlideShowTransition.AdvanceAfterTime = 3000;
// Apply comb type transition on slide 2
pres.Slides[1].SlideShowTransition.Type = TransitionType.Comb;
// Set the transition time of 5 seconds
pres.Slides[1].SlideShowTransition.AdvanceOnClick = true;
pres.Slides[1].SlideShowTransition.AdvanceAfterTime = 5000;
// Apply zoom type transition on slide 3
pres.Slides[2].SlideShowTransition.Type = TransitionType.Zoom;
// Set the transition time of 7 seconds
pres.Slides[2].SlideShowTransition.AdvanceOnClick = true;
pres.Slides[2].SlideShowTransition.AdvanceAfterTime = 7000;
// Write the presentation to disk
pres.Save("SampleTransition_out.pptx", SaveFormat.Pptx);
}
See Also
- interface ISlideCollection
- class Presentation
- namespace Aspose.Slides
- assembly Aspose.Slides