Microsoft PowerPoint lets you hide specific slides so they won’t appear during the slide show. You can also unhide the hidden slides at any time if you wish them to be visible in future presentations. In this article, you will learn how to hide or unhide slides in PowerPoint in C# and VB.NET using Spire.Presentation for .NET library.
Install Spire.Presentation for .NET
To begin with, you need to add the DLL files included in the Spire.Presentation for.NET package as references in your .NET project. The DLL files can be either downloaded from this link or installed via NuGet.
PM> Install-Package Spire.Presentation
Hide or Unhide Slides in PowerPoint in C# and VB.NET
The following are the steps to hide or unhide a slide in PowerPoint:
- Create an instance of Presentation class.
- Load a PowerPoint document using Presentation.LoadFromFile() method.
- Get the slide that you want to hide or unhide by its index using Presentation.Slides[index] property.
- Hide or unhide the slide by setting the ISlide.Hidden property as true or false.
- Save the result document using Presentation.SaveToFile() method.
- C#
- VB.NET
using Spire.Presentation; namespace HideOrUnhideSlides { class Program { static void Main(string[] args) { //Create a Presentation instance Presentation ppt = new Presentation(); //Load a PowerPoint document ppt.LoadFromFile("Sample.pptx"); //Get the first slide ISlide slide = ppt.Slides[0]; //Hide the slide slide.Hidden = true; //Unhide the slide //slide.Hidden = false; //Save the result document ppt.SaveToFile("Result.pptx", FileFormat.Pptx2013); } } }
The following is the result document after hiding the first slide:
Apply for a Temporary License
If you'd like to remove the evaluation message from the generated documents, or to get rid of the function limitations, please request a 30-day trial license for yourself.