diff --git a/Read-and-save-PowerPoint-presentation/Edit-PowerPoint-presentation/.NET/Edit-PowerPoint-presentation.sln b/Read-and-save-PowerPoint-presentation/Edit-PowerPoint-presentation/.NET/Edit-PowerPoint-presentation.sln new file mode 100644 index 00000000..c9ad1fe0 --- /dev/null +++ b/Read-and-save-PowerPoint-presentation/Edit-PowerPoint-presentation/.NET/Edit-PowerPoint-presentation.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.14.37516.0 d17.14 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Edit-PowerPoint-presentation", "Edit-PowerPoint-presentation\Edit-PowerPoint-presentation.csproj", "{5E0312DA-CD15-0FEA-03F9-3360311A3365}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {5E0312DA-CD15-0FEA-03F9-3360311A3365}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5E0312DA-CD15-0FEA-03F9-3360311A3365}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5E0312DA-CD15-0FEA-03F9-3360311A3365}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5E0312DA-CD15-0FEA-03F9-3360311A3365}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {5EA7C348-3F16-4E37-BE1A-3E0E15993D9D} + EndGlobalSection +EndGlobal diff --git a/Read-and-save-PowerPoint-presentation/Edit-PowerPoint-presentation/.NET/Edit-PowerPoint-presentation/Data/AdventureCycles.png b/Read-and-save-PowerPoint-presentation/Edit-PowerPoint-presentation/.NET/Edit-PowerPoint-presentation/Data/AdventureCycles.png new file mode 100644 index 00000000..a9c8e9fc Binary files /dev/null and b/Read-and-save-PowerPoint-presentation/Edit-PowerPoint-presentation/.NET/Edit-PowerPoint-presentation/Data/AdventureCycles.png differ diff --git a/Read-and-save-PowerPoint-presentation/Edit-PowerPoint-presentation/.NET/Edit-PowerPoint-presentation/Data/Background.png b/Read-and-save-PowerPoint-presentation/Edit-PowerPoint-presentation/.NET/Edit-PowerPoint-presentation/Data/Background.png new file mode 100644 index 00000000..d0953385 Binary files /dev/null and b/Read-and-save-PowerPoint-presentation/Edit-PowerPoint-presentation/.NET/Edit-PowerPoint-presentation/Data/Background.png differ diff --git a/Read-and-save-PowerPoint-presentation/Edit-PowerPoint-presentation/.NET/Edit-PowerPoint-presentation/Data/Template.pptx b/Read-and-save-PowerPoint-presentation/Edit-PowerPoint-presentation/.NET/Edit-PowerPoint-presentation/Data/Template.pptx new file mode 100644 index 00000000..7a2e7400 Binary files /dev/null and b/Read-and-save-PowerPoint-presentation/Edit-PowerPoint-presentation/.NET/Edit-PowerPoint-presentation/Data/Template.pptx differ diff --git a/Read-and-save-PowerPoint-presentation/Edit-PowerPoint-presentation/.NET/Edit-PowerPoint-presentation/Edit-PowerPoint-presentation.csproj b/Read-and-save-PowerPoint-presentation/Edit-PowerPoint-presentation/.NET/Edit-PowerPoint-presentation/Edit-PowerPoint-presentation.csproj new file mode 100644 index 00000000..c36960f3 --- /dev/null +++ b/Read-and-save-PowerPoint-presentation/Edit-PowerPoint-presentation/.NET/Edit-PowerPoint-presentation/Edit-PowerPoint-presentation.csproj @@ -0,0 +1,22 @@ + + + + Exe + net8.0 + Edit_PowerPoint_presentation + + + + + + + + + Always + + + Always + + + + diff --git a/Read-and-save-PowerPoint-presentation/Edit-PowerPoint-presentation/.NET/Edit-PowerPoint-presentation/Output/.gitkeep b/Read-and-save-PowerPoint-presentation/Edit-PowerPoint-presentation/.NET/Edit-PowerPoint-presentation/Output/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/Read-and-save-PowerPoint-presentation/Edit-PowerPoint-presentation/.NET/Edit-PowerPoint-presentation/Program.cs b/Read-and-save-PowerPoint-presentation/Edit-PowerPoint-presentation/.NET/Edit-PowerPoint-presentation/Program.cs new file mode 100644 index 00000000..d7a1456f --- /dev/null +++ b/Read-and-save-PowerPoint-presentation/Edit-PowerPoint-presentation/.NET/Edit-PowerPoint-presentation/Program.cs @@ -0,0 +1,39 @@ +using Syncfusion.Presentation; +using System.IO; + +//Opens the PPTX document. +using IPresentation pptxDoc = Presentation.Open(@"Data/Template.pptx"); + +//Get the new background picture as a stream. +using FileStream bgPictureStream = new FileStream(@"Data/Background.png", FileMode.Open); +//Create an instance for memory stream +using MemoryStream bgMemoryStream = new MemoryStream(); +//Copy stream to memoryStream. +bgPictureStream.CopyTo(bgMemoryStream); + +//Set the master slide background fill as Picture fill in PPTX document. +pptxDoc.Masters[0].Background.Fill.FillType = FillType.Picture; +pptxDoc.Masters[0].Background.Fill.PictureFill.ImageBytes = bgMemoryStream.ToArray(); + +//Get the first shape of the first slide from the PPTX document. +IShape shape = pptxDoc.Slides[0].Shapes[0] as IShape; +//Change the text of the shape. +if (shape.TextBody.Text == "Company History") + shape.TextBody.Text = "Adventure Cycles History"; + +//Get the new picture as a stream. +using FileStream pictureStream = new FileStream(@"Data/AdventureCycles.png", FileMode.Open); +//Create an instance for memory stream +using MemoryStream picMemoryStream = new MemoryStream(); +//Copy stream to memoryStream. +pictureStream.CopyTo(picMemoryStream); + +//Replace the existing image with the new image. +pptxDoc.Slides[0].Pictures[0].ImageData = picMemoryStream.ToArray(); + +//Changes the built in style of the table. +ITable table = pptxDoc.Slides[2].Tables[0]; +table.BuiltInStyle = BuiltInTableStyle.ThemedStyle2Accent5; + +//Save the PPTX document +pptxDoc.Save(@"Output/Output.pptx"); \ No newline at end of file