Slide transitions are effects shown while navigating from one slide to another. These enhance the look and feel of the presentation and make them more attractive. There might be situations where you need to add slide transitions to PowerPoint files programmatically. To that end, this article will teach you how to add transitions to PowerPoint slides using C++.
- C++ API for Adding Transitions in PowerPoint Presentations
- Add Slide Transition using C++
- Add Advanced Slide Transitions using C++
- Setting Morph Transition Type in PowerPoint Presentations
C++ API for Adding Transitions in PowerPoint Presentations
Aspose.Slides for C++ is a C++ API for working with PowerPoint files. It enables you to create, read and update PowerPoint files without needing Microsoft PowerPoint to be installed. Furthermore, the API allows you to add slide transitions to PowerPoint presentations. You can either install the API through NuGet or download it directly from the Downloads section.
PM> Install-Package Aspose.Slides.Cpp
Add Slide Transition using C++
The following are the steps to add slide transition in PowerPoint presentations.
- Firstly, load the PowerPoint file using the Presentation class.
- Set the slide transition using the Presentation->get_Slides()->idx_get(0)->get_SlideShowTransition()->set_Type (SlideShow::TransitionType value) method.
- Finally, save the presentation using the Presentation->Save(System::String fname, Export::SaveFormat format) method.
The following sample code demonstrates how to add transitions to PowerPoint slides using C++.
Add Advanced Slide Transitions using C++
The following are the steps to add advanced transitions to slides using C++.
- Firstly, load the PowerPoint file using the Presentation class.
- Set the transition type and other transition effects using the ISlideShowTransition class.
- Finally, save the presentation using the Presentation->Save(System::String fname, Export::SaveFormat format) method.
The following sample code shows how to add advanced slide transitions using C++.
Setting Morph Transition Type in PowerPoint Presentations
Morph transitions are used in presentations to make smooth transition animation between slides. The following sections cover how to add morph transition in Microsoft PowerPoint and programmatically using C++.
Set Morph Transition in Microsoft PowerPoint
The following are the steps to add morph transition in Microsoft PowerPoint.
- Open the Transitions tab.
- Select the Morph transition type.
- To select the transition effects, select the Effect Options in the Transitions tab.
Set Morph Transition in PowerPoint Presentations using C++
Similar to Microsoft PowerPoint, Aspose.Slides for C++ API provides the following morph transition effects.
- 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 set morph transition in PowerPoint presentations using C++.
- Load the PowerPoint file using the Presentation class.
- Set the transition type to morph.
- Set the morph transition effect using the IMorphTransition->set_MorphType(TransitionMorphType value) method.
- Save the presentation using the Presentation->Save(System::String fname, Export::SaveFormat format) method.
The following sample code shows how to set morph transitions in PowerPoint presentations using C++.
Get a Free License
In order to try the API without evaluation limitations, you can request a free temporary license.
Conclusion
In this article, you have learned how to add slide transitions in PowerPoint presentations using C++. Furthermore, you have seen how to add morph transitions to PowerPoint slides using Aspose.Slides for C++ API. It is a robust and feature-rich API that provides a bunch of additional features for working with PowerPoint files. You can explore the API in detail by visiting the official documentation. In case of any queries, please feel free to reach us at our free support forum.