Animation is a feature provided by Microsoft PowerPoint that makes presentations more engaging and fun. It can also be used to highlight different elements on the slide to draw the audience’s attention. You can add animations to text, shapes, and other elements on the slides. In this article, you will learn how to apply animation to text in PowerPoint files using C++.
- C++ API for Applying Animation to Text in PowerPoint Files
- Apply Animation to Text in PowerPoint Files using C++
- Get Animation Effects from PowerPoint Files using C++
C++ API for Applying Animation to Text in PowerPoint Files
We will use the Aspose.Slides for C++ API to apply text animation in PowerPoint files. It is a robust and feature-rich API for creating, reading, and modifying PowerPoint PPTX/PPT files without requiring Microsoft PowerPoint to be installed. You can either install the API through NuGet or download it directly from the Downloads section.
PM> Install-Package Aspose.Slides.Cpp
Apply Animation to Text in PowerPoint Files using C++
Aspose.Slides for C++ supports over 150+ animation effects, such as Expand, Fade, Blink, Zoom, etc. Furthermore, it also provides specific animation effects such as OLEObjectShow and OLEObjectOpen. You can see the complete list of supported animation effects in the EffectType enumeration.
In order to apply animation to text in PowerPoint presentations, please follow the steps given below.
- Load the PowerPoint file using the Presentation class.
- Select the desired paragraph.
- Add the animation using the Presentation->get_Slides()->idx_get(int32_t index)->get_Timeline()->get_MainSequence()->AddEffect(System::SharedPtr<IParagraph> paragraph, EffectType effectType, EffectSubtype subtype, EffectTriggerType triggerType) method.
- Save the presentation using the Presentation->Save(System::String fname, Export::SaveFormat format) method.
The following sample code shows how to apply an animation effect to text in PowerPoint presentations using C++.
Get Animation Effects from PowerPoint Files using C++
You can retrieve the animation effects already applied to a text by following the steps given below.
- Firstly, load the PowerPoint file using the Presentation class.
- Get the sequence of the desired slide in an ISequence object.
- Access the shape from the selected slide in an IAutoShape object.
- Loop through the paragraphs.
- Finally, get the effects from the paragraph using the ISequence->GetEffectsByParagraph(System::SharedPtr<IParagraph> paragraph) method.
The following sample code shows how to get the animation effects from a text 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.
In this article, you have learned how to add animation effects to text in PowerPoint presentations using C++. Furthermore, you have seen how to retrieve animation effects from text in PowerPoint presentations. Aspose.Slides for C++ provides many additional features that you can explore in detail by visiting the official documentation. In case of any questions, please feel free to reach us at our free support forum.