Remove Section in PowerPoint in C#, VB.NET

2020-09-16 06:52:44 Written by  support iceblue
Rate this item
(0 votes)

This article demonstrates how to remove a specific section or all the sections but keep the slide(s) in the section(s) in PowerPoint by using Spire.Presentation for .NET.

Below is the screenshot of the input PowerPoint document which contains two sections:

Remove Section in PowerPoint in C#, VB.NET

C#
//Create a Presentation instance
Presentation ppt = new Presentation();
//Load a PowerPoint document
ppt.LoadFromFile("AddSection.pptx");

//Remove the second section
ppt.SectionList.RemoveAt(1);

//Remove all the sections
//ppt.SectionList.RemoveAll();

//Save the result document
ppt.SaveToFile("RemoveSection.pptx", FileFormat.Pptx2013);
VB.NET
'Create a Presentation instance
Dim ppt As Presentation = New Presentation
'Load a PowerPoint document
ppt.LoadFromFile("AddSection.pptx")
'Remove the second section
ppt.SectionList.RemoveAt(1)
'Remove all the sections
'ppt.SectionList.RemoveAll()
'Save the result document
ppt.SaveToFile("RemoveSection.pptx", FileFormat.Pptx2013)

The output PowerPoint document after removing the second section:

Remove Section in PowerPoint in C#, VB.NET

Additional Info

  • tutorial_title:
Last modified on Friday, 24 September 2021 09:12