Slide transitions are the visual effects that appear when you move from one slide to another in PowerPoint presentations. Moreover, you can set transition sound, speed, duration, and other effects as per your choice. In this article, you will learn how to add slide transitions in PowerPoint presentations programmatically using C#.

C# API to Add Slide Transitions in PowerPoint PPT

To add transitions to the slides in PowerPoint presentations, we will use Aspose.Slides for .NET. It is a .NET API to create and manipulate PowerPoint and OpenOffice documents. You can either download the API or install it using NuGet.

PM> Install-Package Aspose.Slides.NET 

Add Slide Transition in PPT using C#

The following are the steps to add slide transitions in a PowerPoint presentation using C#.

  1. First, load the PowerPoint presentation using Presentation class.
  2. Then, set a slide transition type using SlideShowTransition.Type property and TransitionType enum.
  3. Finally, save the updated presentation using Presentation.Save(String, SaveFormat) method.

The following code sample shows how to set the transition of a slide in a PowePoint presentation.

Add Advanced Slide Transitions in PowerPoint in C#

The following are the steps to set advanced slide transition options such as duration, sound, speed, etc.

  1. First, load the PowerPoint presentation using Presentation class.
  2. Set a slide transition type using SlideShowTransition.Type property and TransitionType enum.
  3. Set advanced effects such as SlideShowTransition.Sound, SlideShowTransition.AdvanceAfterTime, etc. (see list of effects).
  4. Finally, save the updated presentation using Presentation.Save(String, SaveFormat) method.

The following code sample shows how to set advanced slide transition options in a PowerPoint presentation.

C# Set Morph Transition in PowerPoint PPT

Using Aspose.Slides for .NET, you can also set the morph transitions, which are used to make smooth animations. The following morph transitions are supported by the API:

  • ByObject: Morph transition will be performed considering shapes as indivisible objects.
  • ByWord: Morph transition will be performed by transferring text by words where possible.
  • ByChar: Morph transition will be performed by transferring text by characters where possible.

The following are the steps to add morph transition in a PowerPoint presentation using C#.

  1. First, load the PowerPoint presentation using Presentation class.
  2. Set SlideShowTransition.Type property to TransitionType.Morph.
  3. Set morph transition type using ((IMorphTransition)presentation.Slides[0].SlideShowTransition.Value).MorphType property.
  4. Finally, save the updated presentation using Presentation.Save(String, SaveFormat) method.

The following code sample shows how to set morph transitions in a PowerPoint presentation.

C# PowerPoint API - Get a Free License

You can create slide transitions in PowerPoint PPT without evaluation limitations by getting a free temporary license.

Conclusion

In this article, you have learned how to add slide transitions in PowerPoint presentations using C#. Moreover, you have seen how to set morph transitions in the slides programmatically. In addition, you can visit the documentation to explore other features of API. Also, you can feel free to let us know about your queries via our forum.

See Also