.NET PowerPoint Examples
Create PowerPoint Animation Using Syncfusion .NET PowerPoint Library
Animations grab and keep the attention of your audience by emphasizing key points, controlling the focus of the presentation, and entertaining in ways that will make your message memorable. The Syncfusion® .NET PowerPoint Library allows you to add animation effects in PowerPoint presentations in C#, without relying on Microsoft PowerPoint or interop dependencies.
Add animations to PowerPoint using C#
Learn how to add animation effects to PowerPoint presentations programmatically using C# with the Syncfusion .NET PowerPoint Library. This guide demonstrates applying various animation effects to shapes and content within slides.
Step 1: Create a new project
Start by creating a new C# Console Application project.
Step 2: Install the NuGet package
Add the Syncfusion.Presentation.Net.Core package to your project from NuGet.org.
Step 3: Add required namespaces to add animations
Add the following namespaces to your Program.cs file:
using Syncfusion.Presentation;Step 4: Create a PowerPoint presentation
Create a new presentation and add a blank slide with a cube shape.
//Create a new instance of PowerPoint Presentation file
IPresentation pptxDoc = Presentation.Create();
//Add a blank slide to Presentation
ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.Blank);
//Add normal shape to slide
IShape cubeShape = slide.Shapes.AddShape(AutoShapeType.Cube, 100, 100, 300, 300);Step 5: Apply animation effects
Add a bounce animation effect to the shape on the slide.
//Access the animation sequence to create effects
ISequence sequence = slide.Timeline.MainSequence;
//Add bounce effect to the shape
IEffect bounceEffect = sequence.AddEffect(cubeShape, EffectType.Bounce, EffectSubtype.None, EffectTriggerType.OnClick);Step 6: Save the PowerPoint presentation
Save the presentation with animations to a file stream.
//Save the PowerPoint presentation
FileStream outputStream = new(Path.GetFullPath(@"Output/Result.pptx"), FileMode.Create, FileAccess.ReadWrite);
pptxDoc.Save(outputStream);
//Close streams and presentation
outputStream.Close();
pptxDoc.Close();GitHub project
NuGet installation
Get started quickly by downloading the installer and checking license information on the Downloads page.
Table of contents
Explore these resources for comprehensive guides, knowledge base articles, insightful blogs, and ebooks.
Learning
Technical Support