Learn how to add slide transitions in PowerPoint presentations using C#: https://blog.aspose.com/2021/08/06/add-slide-transition-in-powerpoint-using-csharp/
Last active
September 6, 2021 14:31
-
-
Save aspose-com-gists/f122aab627a2b7b58544894c52d9935b to your computer and use it in GitHub Desktop.
Add Slide Transition in PowerPoint using C#
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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; | |
// Save presentation | |
pres.Save("SampleTransition_out.pptx", SaveFormat.Pptx); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Load PowerPoint presentation | |
using (Presentation presentation = new Presentation("presentation.pptx")) | |
{ | |
// Add morph transition | |
presentation.Slides[0].SlideShowTransition.Type = TransitionType.Morph; | |
((IMorphTransition)presentation.Slides[0].SlideShowTransition.Value).MorphType = TransitionMorphType.ByWord; | |
// Save presentation | |
presentation.Save("presentation-out.pptx", SaveFormat.Pptx); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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; | |
// Save the presentation | |
presentation.Save("SampleTransition_out.pptx", SaveFormat.Pptx); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment