ShapeCollection

ShapeCollection — Aspose.Slides FOSS for C++ API Reference

Enumerations ShapeCollection class chứa tất cả các hình dạng trên một slide. Truy cập qua Slide::shapes().

Enumerations: Aspose::Slides::Foss

#include <Aspose/Slides/Foss/shape_collection.h>
class ShapeCollection

Enumerations: include/Aspose/Slides/Foss/shape_collection.h


Enumerations

EnumerationsEnumerations
size()Số lượng hình dạng trong bộ sưu tập.
operator[](size_t index)Truy cập hình dạng bằng chỉ mục bắt đầu từ 0.
to_array()Trả về tất cả các hình dạng dưới dạng một mảng.
to_array(int start, int count)Trả về một dải con của các hình dạng.
reorder(int old_index, int new_index)Di chuyển một hình dạng đến vị trí z-order mới.
index_of(const IShape& shape)Trả về chỉ số bắt đầu từ 0 của một hình dạng.
remove(IShape& shape)Xóa một hình dạng khỏi bộ sưu tập.
remove_at(int index)Xóa hình dạng tại chỉ số đã cho.
clear()Xóa tất cả các hình dạng.
begin() / end()Hỗ trợ iterator cho phạm vi dựa trên for vòng lặp.

Ví dụ sử dụng

Duyệt qua các hình dạng

#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;
}

Xóa tất cả các hình dạng

prs.slides()[0].shapes().clear();
prs.save("empty.pptx", SaveFormat::PPTX);

Xem Thêm

 Tiếng Việt