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 add, update and remove slide notes in PowerPoint PPT in C++.
- C++ Library to Add, Edit, and Remove Notes in PowerPoint PPT
- Read Notes from a PowerPoint Slide in C++
- Add Notes to a PPT Slide in C++
- Update Notes of a PPTX Slide in C++
- Remove Notes from a PPT Slide in C++
- Get a Free License
C++ Library to Add or Update Slide Notes in PowerPoint PPT
Aspose.Slides for C++ is a native C++ library that supports creating, reading, and manipulating PowerPoint files. The library also supports working with notes in PowerPoint presentations. You can either install the library through NuGet or download it directly from the Downloads section.
PM> Install-Package Aspose.Slides.Cpp
Read Slide Notes from a PowerPoint PPT in 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 PPTX slide using C++.
Add Notes to a PowerPoint PPT in 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 PPT slide using C++.
Update Slide Notes of PowerPoint PPTX in 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 PPT slide using C++.
Remove Slide Notes from a PowerPoint PPT in 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 PPT 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++.
Work with PowerPoint PPT Slide Notes in C++ - Get a Free License
You can request a free temporary license to try the library without evaluation limitations.
Conclusion
In this article, you have learned how to manage slide notes in PowerPoint PPT using C++. Specifically, you have learned how to read, add, update and remove notes from PowerPoint slides.
Aspose.Slides for C++ - Read More
Aspose.Slides for C++ also provides many additional features that aid you in your presentation-related tasks. You can explore the library in detail by visiting the official documentation. In case of any questions, please feel free to reach us on our free support forum.