Microsoft PowerPoint provides you with the option to add notes to your slides. These notes can be helpful for the presenter by providing additional information and context. You might find yourself in situations where you have to add or update such notes programmatically in your PowerPoint presentations. In light of that, this article will teach you how to work with notes in PowerPoint presentations programmatically using C++.
- C++ API for Working with Notes in PowerPoint Presentations
- Read Notes from a PowerPoint Slide using C++
- Add Notes to a PowerPoint Slide using C++
- Update Notes of a PowerPoint Slide using C++
- Remove Notes from a PowerPoint Slide using C++
- Get a Free License
C++ API for Working with Notes in PowerPoint Presentations
Aspose.Slides for C++ is a native C++ library that supports creating, reading, and manipulating PowerPoint files. The API also supports working with notes in PowerPoint presentations. You can either install the API through NuGet or download it directly from the Downloads section.
PM> Install-Package Aspose.Slides.Cpp
Read Notes from a PowerPoint Slide using C++
The following are the steps to read notes from a PowerPoint Slide.
- Load the PowerPoint presentation using the Presentation class.
- Access the INotesSlideManager for a specific slide using Presentation->get_Slides()->idx_get (int32_t index)->get_NotesSlideManager() method.
- Retrieve the slide notes using the INotesSlideManager->get_NotesSlide() method.
- Read the notes using the INotesSlide->get_NotesTextFrame()->get_Text() method.
The following is the sample code to read notes from a PowerPoint slide using C++.
Add Notes to a PowerPoint Slide using C++
Aspose.Slides for C++ provides you with the ability to add notes to PowerPoint slides. For that, access the INotesSlideManager for the required slide and then add the note. The following are the steps to add notes to a specific PowerPoint slide.
- Firstly, load the PowerPoint presentation using the Presentation class.
- Access the INotesSlideManager for a specific slide using Presentation->get_Slides()->idx_get (int32_t index)->get_NotesSlideManager() method.
- Add new slide notes using the INotesSlideManager->AddNotesSlide() method.
- Set the notes text using the INotesSlide->get_NotesTextFrame()->set_Text (System::String value) method.
- Finally, save the presentation with the note using the Presentation->Save (System::String name, Export::SaveFormat format) method.
The following is the sample code to add notes to a specific PowerPoint slide using C++.
Update Notes of PowerPoint Slides using C++
To update the notes, you retrieve the existing note with the INotesSlideManager and then update the note text. The following are the steps to update the notes of a PowerPoint slide.
- Firstly, load the PowerPoint presentation using the Presentation class.
- Access the INotesSlideManager for a specific slide using Presentation->get_Slides()->idx_get (int32_t index)->get_NotesSlideManager() method.
- Retrieve the slide notes using the INotesSlideManager->get_NotesSlide() method.
- Update the note text using the INotesSlide->get_NotesTextFrame()->set_Text (System::String value) method.
- Finally, save the presentation with the updated note using the Presentation->Save (System::String name, Export::SaveFormat format) method.
The following is the sample code to update the notes of a PowerPoint slide using C++.
Remove Notes from a PowerPoint Slide using C++
Remove the notes from a slide by retrieving the INotesSlideManager for that particular slide and then using the RemoveNotesSlide() method. The following are the steps to remove notes from a PowerPoint slide.
- Firstly, load the PowerPoint presentation using the Presentation class.
- Access the INotesSlideManager for a specific slide using Presentation->get_Slides()->idx_get (int32_t index)->get_NotesSlideManager() method.
- Remove the notes using the INotesSlideManager->RemoveNotesSlide() method.
- Finally, save the presentation file using the Presentation->Save (System::String name, Export::SaveFormat format) method.
The following is the sample code to remove notes from a PowerPoint slide using C++.
Get a Free License
You can request a free temporary license to try the API without evaluation limitations.
Conclusion
In this article, you have learned how to manage slide notes in PowerPoint presentations using C++. Specifically, you have learned how to read, add, update and remove notes from PowerPoint slides. Aspose.Slides for C++ also provides many additional features that aid you in your presentation-related tasks. You can explore the API in detail by visiting the official documentation. In case of any questions, please feel free to reach us on our free support forum.