From b2a989d378f729b871b06311d7d932979a9f1efc Mon Sep 17 00:00:00 2001 From: Viswajith-SF4658 Date: Wed, 12 Aug 2026 16:00:34 +0530 Subject: [PATCH 1/2] Updated Github examples for split sections to ZIP Output files --- .../Split-PowerPoint-by-sections/Program.cs | 35 ++++++++++++++----- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/Sections/Split-PowerPoint-by-Sections/.NET/Split-PowerPoint-by-sections/Program.cs b/Sections/Split-PowerPoint-by-Sections/.NET/Split-PowerPoint-by-sections/Program.cs index 267190db..3a457d95 100644 --- a/Sections/Split-PowerPoint-by-Sections/.NET/Split-PowerPoint-by-sections/Program.cs +++ b/Sections/Split-PowerPoint-by-Sections/.NET/Split-PowerPoint-by-sections/Program.cs @@ -1,22 +1,39 @@ -using Syncfusion.Presentation; +// Create a ZIP archive and set the compression level to Best. +using Syncfusion.Presentation; +using Syncfusion.Compression.Zip; -//Opens the source PPTX document. +ZipArchive zipArchive = new ZipArchive(); +zipArchive.DefaultCompressionLevel = Syncfusion.Compression.CompressionLevel.Best; + +// Open the source PowerPoint presentation. IPresentation sourcePptx = Presentation.Open(Path.GetFullPath(@"Data/Template.pptx")); -//Iterates through each section. +// Iterate through each section in the presentation. foreach (ISection section in sourcePptx.Sections) { - //Creates a destination PPTX document. Existing presentations can also be used here. + // Create a new destination presentation for the current section. IPresentation destinationPptx = Presentation.Create(); - // Clone the slides from the section and move to new PPTX document. + + // 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); } - //Saves the destination PPTX document. - string outputPath = Path.Combine(Path.GetFullPath("Output"), section.Name + "_Slides.pptx"); - destinationPptx.Save(outputPath); + // 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(); } -//Closes the PPTX document. + +// 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(); \ No newline at end of file From beb6524a835fc67398063302b5ef834f7891d55a Mon Sep 17 00:00:00 2001 From: Viswajith-SF4658 Date: Wed, 12 Aug 2026 16:09:36 +0530 Subject: [PATCH 2/2] Modified output file path --- .../.NET/Split-PowerPoint-by-sections/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sections/Split-PowerPoint-by-Sections/.NET/Split-PowerPoint-by-sections/Program.cs b/Sections/Split-PowerPoint-by-Sections/.NET/Split-PowerPoint-by-sections/Program.cs index 3a457d95..4d7cc281 100644 --- a/Sections/Split-PowerPoint-by-Sections/.NET/Split-PowerPoint-by-sections/Program.cs +++ b/Sections/Split-PowerPoint-by-Sections/.NET/Split-PowerPoint-by-sections/Program.cs @@ -32,7 +32,7 @@ } // Save the ZIP archive containing all section presentations. -zipArchive.Save(Path.GetFullPath(@"../../../Output/Split-PowerPoint-by-sections.zip")); +zipArchive.Save(Path.GetFullPath(@"Output/Split-PowerPoint-by-sections.zip")); // Close the ZIP archive. zipArchive.Close(); // Close the source presentation.