The slide notes are used to add additional information as a reference in the presentations. The presenters add these notes to recall the essential points relevant to their presentations. In this article, you will learn how to manipulation of the slide notes in presentations programmatically. Particularly, the article will cover how to read, add, and remove the slide notes in PowerPoint presentations using Java.
- Java API to Work with PowerPoint Slide Notes
- Read Slide Notes in a PowerPoint Presentation
- Add Slide Notes to a PowerPoint Presentation
- Remove Slide Notes in a PowerPoint Presentation
- Get a Free API License
Java API to Work with PowerPoint Slide Notes
In order to work with slide notes, we’ll use Aspose.Slides for Java. It is a feature-rich API that lets you create, edit and convert PowerPoint presentations from within your Java applications. You can either download the API or install it using the following Maven configurations.
<repository>
<id>AsposeJavaAPI</id>
<name>Aspose Java API</name>
<url>http://repository.aspose.com/repo/</url>
</repository>
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-slides</artifactId>
<version>21.3</version>
<classifier>jdk16</classifier>
</dependency>
Read Slide Notes in a PowerPoint Presentation in Java
The following are the steps to read slide notes in PowerPoint presentations using Java.
- First, load the presentation using the Presentation class.
- Access the INotesSlideManager of the desired slide in the presentation using Presentation.getSlides().get_Item(index).getNotesSlideManager() method.
- Get slide notes in INotesSlide object using INotesSlideManager.getNotesSlide() method.
- Finally, access text of the notes using INotesSlide.getNotesTextFrame().getText() method.
The following code sample shows how to read slide notes in PowerPoint presentation using Java.
Add Slide Notes to a PowerPoint Presentation using Java
The following are the steps to add slide notes to a PowerPoint presentation using Java.
- First, load or create the presentation using the Presentation class.
- Access the INotesSlideManager of the desired slide in the presentation using Presentation.getSlides().get_Item(index).getNotesSlideManager() method.
- Get slide notes in INotesSlide object using INotesSlideManager.getNotesSlide() method.
- Set text of the notes using INotesSlide.getNotesTextFrame().setText(String) method.
- Finally, save the presentation using Presentation.save(String, SaveFormat.Pptx) method.
The following code sample shows how to add slide notes in a PowerPoint presentation using Java.
Remove Slide Notes in a PowerPoint Presentation
The following are the steps to remove the slides notes in PowerPoint presentations using Java.
- First, load or create the presentation using the Presentation class.
- Access the INotesSlideManager of the desired slide in the presentation using Presentation.getSlides().get_Item(index).getNotesSlideManager() method.
- Remove slide notes using INotesSlideManager.removeNotesSlide() method.
- Finally, save the presentation using Presentation.save(String, SaveFormat.Pptx) method.
The following code sample shows how to remove slide notes in a PowerPoint presentation using Java.
Get a Free API License
You can request a free temporary license to use the API without evaluation limitations.
Conclusion
In this article, you have learned how to work with slide notes in PowerPoint presentations using Java. The step-by-step guide and code samples have shown how to read, add, or remove slide notes. In addition, you can explore more about the API using the documentation. Alongside, you can post your queries to our forum.