Presentation

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

Properties Presentation class 是用于创建、加载和保存 PowerPoint 的根对象。 .pptx 文件在 Aspose.Slides FOSS for C++。.

Properties: Aspose::Slides::Foss

#include <Aspose/Slides/Foss/presentation.h>
class Presentation

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


Properties

PropertiesProperties
Presentation()创建一个包含一张空白幻灯片的新空白演示文稿。.
Presentation(std::string_view path)从文件路径加载演示文稿。.

Properties:

#include <Aspose/Slides/Foss/presentation.h>
using namespace Aspose::Slides::Foss;

// Create a new empty presentation
Presentation prs;

// Open an existing PPTX file
Presentation prs2("deck.pptx");

集合访问器

Properties返回类型Properties
slides()SlideCollection&有序的幻灯片集合。.
layout_slides()GlobalLayoutSlideCollection&所有母版的所有布局幻灯片。.
masters()MasterSlideCollection&母版幻灯片集合。.
images()ImageCollection&嵌入在演示文稿中的图像。.
notes_size()NotesSize&备注页尺寸设置。.
comment_authors()CommentAuthorCollection&评论作者集合。.
document_properties()DocumentProperties&内置和自定义文档元数据。.

Properties

PropertiesPropertiesProperties
source_format()Properties已加载演示文稿源的格式。.
first_slide_number()Properties演示文稿中的首张幻灯片编号。.
set_first_slide_number(int)Properties设置首张幻灯片编号。.
current_date_time()Properties用于日期时间占位符的日期和时间。.
set_current_date_time(...)Properties设置占位符的当前日期时间。.

Properties

save(std::string_view path, SaveFormat format)

将演示文稿保存到文件。.

PropertiesPropertiesProperties
pathstd::string_view目标文件路径。.
formatSaveFormat输出格式(例如,., SaveFormat::PPTX).
prs.save("output.pptx", SaveFormat::PPTX);

dispose()

释放演示文稿占用的资源。.

detect_source_format(std::string_view path)

在不完全加载的情况下检测演示文稿文件的源格式。.


使用示例

使用形状创建演示文稿

#include <Aspose/Slides/Foss/presentation.h>
using namespace Aspose::Slides::Foss;

Presentation prs;
auto& slide = prs.slides()[0];
auto& shapes = slide.shapes();
// Add shapes and save
prs.save("hello.pptx", SaveFormat::PPTX);

打开并检查

#include <Aspose/Slides/Foss/presentation.h>
using namespace Aspose::Slides::Foss;

Presentation prs("existing.pptx");
std::cout << "Slides: " << prs.slides().size() << std::endl;
prs.save("updated.pptx", SaveFormat::PPTX);

另见

 中文