Skip to content

Commit ebcc7ad

Browse files
committed
ES-930188-updated
1 parent cd15980 commit ebcc7ad

File tree

5 files changed

+81
-0
lines changed

5 files changed

+81
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.12.35707.178 d17.12
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Add-animation-effect-to-PowerPoint-image-shape-text", "Add-animation-effect-to-PowerPoint-image-shape-text\Add-animation-effect-to-PowerPoint-image-shape-text.csproj", "{A566D9E8-6923-46B8-A272-5FA9BABBB6DB}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{A566D9E8-6923-46B8-A272-5FA9BABBB6DB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{A566D9E8-6923-46B8-A272-5FA9BABBB6DB}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{A566D9E8-6923-46B8-A272-5FA9BABBB6DB}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{A566D9E8-6923-46B8-A272-5FA9BABBB6DB}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
EndGlobal
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net8.0</TargetFramework>
6+
<RootNamespace>Add-animation-effect-to-PowerPoint-image-shape-text</RootNamespace>
7+
<ImplicitUsings>enable</ImplicitUsings>
8+
<Nullable>enable</Nullable>
9+
</PropertyGroup>
10+
11+
<ItemGroup>
12+
<PackageReference Include="Syncfusion.Presentation.Net.Core" Version="*" />
13+
</ItemGroup>
14+
15+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
using Syncfusion.Presentation;
2+
3+
//Create an instance for PowerPoint
4+
IPresentation pptxDoc = Presentation.Create();
5+
//Add a blank slide to Presentation
6+
ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.Blank);
7+
8+
IShape textboxShape = slide.AddTextBox(200, 50, 150, 50);
9+
IParagraph paragraph = textboxShape.TextBody.AddParagraph();
10+
//Adds a TextPart to the paragraph
11+
ITextPart textPart = paragraph.AddTextPart();
12+
//Adds text to the TextPart
13+
textPart.Text = "Hello World!";
14+
//Access the animation sequence to create effects
15+
ISequence sequence = slide.Timeline.MainSequence;
16+
//Add bounce effect to the shape
17+
IEffect bounceEffect = sequence.AddEffect(textboxShape, EffectType.Bounce, EffectSubtype.None, EffectTriggerType.WithPrevious);
18+
19+
20+
IShape textboxShape1 = slide.AddTextBox(200, 150, 150, 50);
21+
//Adds paragraph to the textbody of textbox
22+
IParagraph paragraph1 = textboxShape1.TextBody.AddParagraph();
23+
//Adds a TextPart to the paragraph
24+
ITextPart textPart1 = paragraph1.AddTextPart();
25+
//Adds text to the TextPart
26+
textPart1.Text = "New Textbox Added";
27+
//Access the animation sequence to create effects
28+
ISequence sequence1 = slide.Timeline.MainSequence;
29+
//Add bounce effect to the shape
30+
IEffect bounceEffect1 = sequence1.AddEffect(textboxShape1, EffectType.Swivel, EffectSubtype.None, EffectTriggerType.WithPrevious);
31+
32+
33+
FileStream pictureStream = new FileStream(@"..\..\..\Data\Image.jpeg", FileMode.Open);
34+
//Adds the picture to a slide by specifying its size and position.
35+
IPicture picture = slide.Pictures.AddPicture(pictureStream, 200, 250, 300, 200);
36+
//Access the animation sequence to create effects
37+
ISequence sequence2 = slide.Timeline.MainSequence;
38+
//Add bounce effect to the shape
39+
IEffect bounceEffect2 = sequence2.AddEffect(picture as IShape, EffectType.Bounce, EffectSubtype.None, EffectTriggerType.WithPrevious);
40+
41+
42+
//Save the PowerPoint Presentation as stream
43+
FileStream outputStream = new FileStream(@"..\..\..\Data\Sample.pptx", FileMode.Create);
44+
pptxDoc.Save(outputStream);

0 commit comments

Comments
 (0)