From f8046849f64f0917b7fb2006de0d6698c8e249cc Mon Sep 17 00:00:00 2001 From: venkateshwaransf5013 Date: Wed, 26 Aug 2026 12:14:10 +0530 Subject: [PATCH 1/2] Added the README.md for Edit Presentation sample --- .../Edit-PowerPoint-presentation/README.md | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 Read-and-save-PowerPoint-presentation/Edit-PowerPoint-presentation/.NET/Edit-PowerPoint-presentation/README.md diff --git a/Read-and-save-PowerPoint-presentation/Edit-PowerPoint-presentation/.NET/Edit-PowerPoint-presentation/README.md b/Read-and-save-PowerPoint-presentation/Edit-PowerPoint-presentation/.NET/Edit-PowerPoint-presentation/README.md new file mode 100644 index 00000000..155ef9e7 --- /dev/null +++ b/Read-and-save-PowerPoint-presentation/Edit-PowerPoint-presentation/.NET/Edit-PowerPoint-presentation/README.md @@ -0,0 +1,59 @@ +# Edit Presentation using C# + +The [.NET PowerPoint library](https://www.syncfusion.com/document-sdk/net-powerpoint-library) (Presentation) enables you to create, read, and edit PowerPoint files programmatically without Microsoft Office or interop dependencies. Using this library, you can modify an existing PowerPoint presentation in C# — such as updating slide content, changing layouts, editing text, images, charts, and applying new styles. + +## Steps to Edit an PowerPoint Presentation programmatically + +Step 1: Create a new .NET Core console application project. + +Step 2: Install the [Syncfusion.Presentation.Net.Core](https://www.nuget.org/packages/Syncfusion.Presentation.Net.Core) NuGet package as a reference to your project from [NuGet.org](https://www.nuget.org/). + +Step 3: Include the following namespaces in the Program.cs file. + +```csharp +using Syncfusion.Presentation; +using System.IO; +``` + +Step 4: Add the following code snippet in the Program.cs file to edit the PowerPoint presentation — update background, text, images, and table styles: + +```csharp +//Opens the PPTX document. +using IPresentation pptxDoc = Presentation.Open(Path.GetFullPath(@"Data/Template.pptx")); + +//Get the new background picture as a stream. +using FileStream bgPictureStream = new FileStream(Path.GetFullPath(@"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(Path.GetFullPath(@"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(Path.GetFullPath(@"Output/Output.pptx")); +``` + +More information about create an PowerPoint Presentation, you can be refer in this [documentation](https://help.syncfusion.com/document-processing/powerpoint/powerpoint-library/net/working-with-powerpoint-presentation) section. \ No newline at end of file From 4af8f5427d4b0153e89f4c718ec57013f60ca13f Mon Sep 17 00:00:00 2001 From: venkateshwaransf5013 Date: Wed, 26 Aug 2026 12:25:07 +0530 Subject: [PATCH 2/2] Added the README.md for split presentation sample --- .../Split-PowerPoint-by-sections/README.md | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 Sections/Split-PowerPoint-by-Sections/.NET/Split-PowerPoint-by-sections/README.md diff --git a/Sections/Split-PowerPoint-by-Sections/.NET/Split-PowerPoint-by-sections/README.md b/Sections/Split-PowerPoint-by-Sections/.NET/Split-PowerPoint-by-sections/README.md new file mode 100644 index 00000000..7a3194bd --- /dev/null +++ b/Sections/Split-PowerPoint-by-Sections/.NET/Split-PowerPoint-by-sections/README.md @@ -0,0 +1,58 @@ +# Split Presentation using C# + +The [.NET PowerPoint library](https://www.syncfusion.com/document-sdk/net-powerpoint-library) (Presentation) enables you to create, read, and edit PowerPoint files programmatically without Microsoft Office or interop dependencies. Using this library, you can **Split an PowerPoint Presentation** using C#. + +## Steps to Split an PowerPoint Presentation programmatically + +Step 1: Create a new .NET Core console application project. + +Step 2: Install the [Syncfusion.Presentation.Net.Core](https://www.nuget.org/packages/Syncfusion.Presentation.Net.Core) NuGet package as a reference to your project from [NuGet.org](https://www.nuget.org/). + +Step 3: Include the following namespaces in the Program.cs file. + +```csharp +using Syncfusion.Presentation; +using Syncfusion.Compression.Zip; +``` + +Step 4: Add the following code snippet in Program.cs file to Split in the PowerPoint Presentation. + +```csharp +ZipArchive zipArchive = new ZipArchive(); +zipArchive.DefaultCompressionLevel = Syncfusion.Compression.CompressionLevel.Best; + +// Open the source PowerPoint presentation. +IPresentation sourcePptx = Presentation.Open(Path.GetFullPath(@"Data/Template.pptx")); + +// Iterate through each section in the presentation. +foreach (ISection section in sourcePptx.Sections) +{ + // Create a new destination presentation for the current section. + IPresentation destinationPptx = Presentation.Create(); + + // Clone all slides from the current section and add them to the new presentation. + foreach (ISlide slide in section.Slides) + { + destinationPptx.Slides.Add(slide.Clone(), PasteOptions.SourceFormatting, sourcePptx); + } + // Save the section presentation to a memory stream. + MemoryStream memoryStream = new MemoryStream(); + destinationPptx.Save(memoryStream); + + // Add the generated presentation to the ZIP archive with the section name as the file name. + string outputPath = Path.Combine(section.Name + "_Slides.pptx"); + zipArchive.AddItem(outputPath, memoryStream, true, Syncfusion.Compression.FileAttributes.Normal); + + // Close the destination presentation. + destinationPptx.Close(); +} + +// Save the ZIP archive containing all section presentations. +zipArchive.Save(Path.GetFullPath(@"Output/Split-PowerPoint-by-sections.zip")); +// Close the ZIP archive. +zipArchive.Close(); +// Close the source presentation. +sourcePptx.Close(); +``` + +More information about create an PowerPoint Presentation, you can be refer in this [documentation](https://help.syncfusion.com/document-processing/powerpoint/powerpoint-library/net/working-with-powerpoint-presentation) section. \ No newline at end of file