Read the complete article on how to apply animation effects on text in PowerPoint using C#: https://blog.aspose.com/2021/08/20/apply-animation-to-text-in-powerpoint-using-csharp/
Last active
August 21, 2021 03:48
-
-
Save aspose-com-gists/8f5af8ca6f64c4af2dc29674b5fb0e97 to your computer and use it in GitHub Desktop.
Apply Animation Effects to Text in PowerPoint using C#
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 | |
using (Presentation presentation = new Presentation("Presentation.pptx")) | |
{ | |
// Select paragraph to add effect | |
IAutoShape autoShape = (IAutoShape)presentation.Slides[0].Shapes[0]; | |
IParagraph paragraph = autoShape.TextFrame.Paragraphs[0]; | |
// Add Fly animation effect to selected paragraph | |
IEffect effect = presentation.Slides[0].Timeline.MainSequence.AddEffect(paragraph, EffectType.Fly, EffectSubtype.Left, EffectTriggerType.OnClick); | |
// Save presentation | |
presentation.Save("AnimationEffectinParagraph.pptx", SaveFormat.Pptx); | |
} |
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 | |
using (Presentation pres = new Presentation("Presentation.pptx")) | |
{ | |
// Get sequence and shape from slide | |
ISequence sequence = pres.Slides[0].Timeline.MainSequence; | |
IAutoShape autoShape = (IAutoShape)pres.Slides[0].Shapes[1]; | |
// Loop through the paragraphs | |
foreach (IParagraph paragraph in autoShape.TextFrame.Paragraphs) | |
{ | |
// Access animation effects | |
IEffect[] effects = sequence.GetEffectsByParagraph(paragraph); | |
if (effects.Length > 0) | |
Console.WriteLine("Paragraph \"" + paragraph.Text + "\" has " + effects[0].Type + " effect."); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment