ShapeCollection — Aspose.Slides FOSS for C++ API Reference
Properties ShapeCollection class تحتفظ بجميع الأشكال على الشريحة. يتم الوصول إليها عبر Slide::shapes().
Properties: Aspose::Slides::Foss
#include <Aspose/Slides/Foss/shape_collection.h>class ShapeCollectionProperties: include/Aspose/Slides/Foss/shape_collection.h
Properties
| Properties | Properties |
|---|---|
size() | عدد الأشكال في المجموعة. |
operator[](size_t index) | الوصول إلى الشكل عبر فهرس يبدأ من الصفر. |
to_array() | إرجاع جميع الأشكال كمصفوفة. |
to_array(int start, int count) | إرجاع نطاق فرعي من الأشكال. |
reorder(int old_index, int new_index) | نقل الشكل إلى موضع z-order جديد. |
index_of(const IShape& shape) | إرجاع الفهرس الذي يبدأ من الصفر لشكل. |
remove(IShape& shape) | إزالة شكل من المجموعة. |
remove_at(int index) | إزالة الشكل عند الفهرس المحدد. |
clear() | إزالة جميع الأشكال. |
begin() / end() | دعم المكررات للـ range-based for الحلقات. |
أمثلة الاستخدام
التكرار على الأشكال
#include <Aspose/Slides/Foss/presentation.h>
using namespace Aspose::Slides::Foss;
Presentation prs("deck.pptx");
auto& shapes = prs.slides()[0].shapes();
for (size_t i = 0; i < shapes.size(); ++i) {
auto& shape = shapes[i];
std::cout << "Shape at (" << shape.x() << ", " << shape.y() << ")" << std::endl;
}إزالة جميع الأشكال
prs.slides()[0].shapes().clear();
prs.save("empty.pptx", SaveFormat::PPTX);