Animated text is used to make the PowerPoint presentations more attractive and draw the audience’s attention. Various types of animations are applied to the text and shapes according to the context of the presentation. Accordingly, in this article, you will learn how to apply animation to the text in PowerPoint using Java.
- API to Apply Animation to Text in PowerPoint
- Apply Animation to Text in PowerPoint
- Get Animation Effects from a Text in PowerPoint
Java API to Apply Animation to Text in PowerPoint
To apply animation to the text in PowerPoint presentations, we will use Aspose.Slides for Java. The API offers a wide range of features to create and manipulate PowerPoint and OpenOffice presentations. You can either download the API or install it using the following Maven configurations.
<repository>
<id>AsposeJavaAPI</id>
<name>Aspose Java API</name>
<url>http://repository.aspose.com/repo/</url>
</repository>
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-slides</artifactId>
<version>21.8</version>
<classifier>jdk16</classifier>
</dependency>
Apply Animation to Text in PowerPoint using Java
Aspose.Slides for Java supports 150+ animation effects, such as Bounce, PathFootball, Zoom, etc. In addition, it provides specific animation effects such as OLEObjectShow and OLEObjectOpen. You can view the complete list of supported animation effects in EffectType enumeration.
The following are the steps to apply animation to text in a PowerPoint presentation using Java.
- First, load the presentation using Presentation class.
- Then, select the desired paragraph in an IParagraph object from the desired slide.
- Apply animation effect to the text using Presentation.getSlides().get_Item(index).getTimeline().getMainSequence().addEffect() method.
- Finally, save the presentation using Presentation.save(String, SaveFormat) method.
The following code sample shows how to apply an animation effect to text in a PowerPoint presentation.
Get Animation Effects from a Text in PowerPoint
In some cases, you may need to retrieve the information about the animation effect used for a particular piece of text. For example, to use the same effect for some other text in the presentation.
The following are the steps to get information about the animation effect applied to a text.
- First, load the presentation using Presentation class.
- Then, get sequence of the desired slide in ISequence object.
- Access the shape from the selected slide in an IAutoShape object.
- Loop through each IParagraph in the collection using IAutoShape.getTextFrame().get_Item(index).getParagraphs() method.
- Finally, get the effects in an IEffect array using ISequence.getEffectsByParagraph(iParagraph) method.
The following code sample shows how to get the information about a text’s animation effect.
Get a Free API License
You can use Aspose.Slides for Java without evaluation limitations by requesting a temporary license.
Conclusion
In this article, you have learned how to use animation effects for text in PowerPoint presentations using Java. In addition, the article has also covered how to get animation effects from a text in a PowerPoint presentation. Besides, you can explore other features of Aspose.Slides for Java using documentation. Also, you can feel free to let us know about your queries via our forum.