SlideCollection — Aspose.Slides FOSS for C++ API Reference
The SlideCollection class is an ordered, iterable collection of Slide objects in a presentation. Accessed via Presentation::slides().
Namespace: Aspose::Slides::Foss
#include <Aspose/Slides/Foss/slide_collection.h>class SlideCollectionHeader: include/Aspose/Slides/Foss/slide_collection.h
Methods
| Method | Description |
|---|---|
size() | Returns the number of slides. |
operator[](size_t index) | Access a slide by zero-based index. |
to_array() | Returns all slides as an array. |
to_array(int start, int count) | Returns a sub-range of slides as an array. |
remove(Slide& slide) | Remove a specific slide from the collection. |
remove_at(int index) | Remove the slide at the given index. |
index_of(const Slide& slide) | Returns the zero-based index of a slide. |
begin() / end() | Iterator support for range-based for loops. |
Usage Examples
Iterate Over Slides
#include <Aspose/Slides/Foss/presentation.h>
using namespace Aspose::Slides::Foss;
Presentation prs("deck.pptx");
for (auto& slide : prs.slides()) {
std::cout << "Shapes: " << slide.shapes().size() << std::endl;
}Remove a Slide by Index
Presentation prs("deck.pptx");
prs.slides().remove_at(2);
prs.save("trimmed.pptx", SaveFormat::Pptx);