In this topic, we will demonstrate how to hide a slide in Presentation using Java along with detailed steps to set up the environment. One doesn’t require to install PowerPoint or any third-party software for hiding a PPTX slide in Java. The developed application can be utilized in any of the Java configured environments inside Windows, Linux, or macOS to hide the desired slide or slides inside the presentation.
Steps to Hide a Slide in PPTX in Java
- Establish the application environment by installing Aspose.Slides for Java from the repository manager
- Access the desired presentation using the Presentation class to hide the slide inside the presentation
- Load the second slide inside the slides collection and hide the slide by passing True as an argument to Slide.setHidden() method
- Save the PPTX presentation having hidden slides on the disk
By using Java hiding a PPTX slide inside the presentation can be easily achieved using a few easy lines of code. The process commences by using a Presentation class object to access the source presentation file from the disk. The desired slide inside the slides collection will then be accessed and will be hidden by passing True as an argument to Slide.setHidden() method. In the end, the presentation having hidden slides will be saved on the disk.
Code to Hide a Slide in Presentation in Java
By using the aforementioned code, one can easily hide a slide in PPTX in Java using very simple API calls. You can hide or un-hide multiple slides individually by accessing them from the presentation slides collection. The API provides the provision to save the output presentation in different presentation formats including PPT, PPS, PPTX, PPSX or ODP either on the disk or inside a memory stream depending on your requirements.
This article focuses on how to hide a slide in Presentation in Java. If you want to learn about adding an image inside the table cell, refer to the article on How to Insert Image into PowerPoint Table using Java.