Read the complete article on how to apply animation effects on text in PowerPoint using Java: https://blog.aspose.com/2021/09/13/apply-animation-to-text-in-powerpoint-using-java/
Last active
September 13, 2021 15:58
-
-
Save aspose-com-gists/720ed0500e080500089dacbb25cb4e4e to your computer and use it in GitHub Desktop.
Apply Animation Effects to Text in PowerPoint using Java
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 presentation | |
Presentation presentation = new Presentation("Presentation.pptx"); | |
try { | |
// Select paragraph to add effect | |
IAutoShape autoShape = (IAutoShape)presentation.getSlides().get_Item(0).getShapes().get_Item(0); | |
IParagraph paragraph = autoShape.getTextFrame().getParagraphs().get_Item(0); | |
// Add Fly animation effect to selected paragraph | |
IEffect effect = presentation.getSlides().get_Item(0).getTimeline().getMainSequence(). | |
addEffect(paragraph, EffectType.Fly, EffectSubtype.Left, EffectTriggerType.OnClick); | |
// Save presentation | |
presentation.save("AnimationEffectinParagraph.pptx", SaveFormat.Pptx); | |
} finally { | |
if (presentation != null) presentation.dispose(); | |
} |
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 presentation | |
Presentation presentation = new Presentation("Presentation.pptx"); | |
try { | |
// Get sequence and shape from slide | |
ISequence sequence = pres.getSlides().get_Item(0).getTimeline().getMainSequence(); | |
IAutoShape autoShape = (IAutoShape)pres.getSlides().get_Item(0).getShapes().get_Item(0); | |
// Loop through the paragraphs | |
for (IParagraph paragraph : autoShape.getTextFrame().getParagraphs()) | |
{ | |
// Access animation effects | |
IEffect[] effects = sequence.getEffectsByParagraph(paragraph); | |
if (effects.length > 0) | |
System.out.println("Paragraph \"" + paragraph.getText() + "\" has " + effects[0].getType() + " effect."); | |
} | |
} finally { | |
pres.dispose(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment