SlideCollection

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

Properties SlideCollection class เป็นคอลเลกชันที่เรียงลำดับและสามารถวนซ้ำได้ของ Slide objects ในงานนำเสนอ. เข้าถึงผ่าน Presentation::slides().

Properties: Aspose::Slides::Foss

#include <Aspose/Slides/Foss/slide_collection.h>
class SlideCollection

Properties: include/Aspose/Slides/Foss/slide_collection.h


Properties

PropertiesProperties
size()คืนค่าจำนวนสไลด์.
operator[](size_t index)เข้าถึงสไลด์โดยใช้ดัชนีเริ่มจากศูนย์.
to_array()คืนค่าสไลด์ทั้งหมดเป็นอาเรย์.
to_array(int start, int count)คืนช่วงย่อยของสไลด์เป็นอาเรย์.
remove(Slide& slide)ลบสไลด์เฉพาะจากคอลเลกชัน.
remove_at(int index)ลบสไลด์ที่ตำแหน่งดัชนีที่กำหนด.
index_of(const Slide& slide)คืนค่าดัชนีเริ่มจากศูนย์ของสไลด์.
begin() / end()การสนับสนุน iterator สำหรับ range-based for ลูป.

ตัวอย่างการใช้งาน

วนซ้ำสไลด์

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

ลบสไลด์ตามดัชนี

Presentation prs("deck.pptx");
prs.slides().remove_at(2);
prs.save("trimmed.pptx", SaveFormat::PPTX);

ดูเพิ่มเติม

 ภาษาไทย