Presentation — Aspose.Slides FOSS for C++ API Reference
The Presentation class is the root object for creating, loading, and saving PowerPoint .pptx files in Aspose.Slides FOSS for C++.
Namespace: Aspose::Slides::Foss
#include <Aspose/Slides/Foss/presentation.h>class PresentationHeader: include/Aspose/Slides/Foss/presentation.h
Constructors
| Signature | Description |
|---|---|
Presentation() | Create a new empty presentation with one blank slide. |
Presentation(std::string_view path) | Load a presentation from a file path. |
Examples:
#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");Collection Accessors
| Accessor | Return Type | Description |
|---|---|---|
slides() | SlideCollection& | Ordered collection of slides. |
layout_slides() | GlobalLayoutSlideCollection& | All layout slides across all masters. |
masters() | MasterSlideCollection& | Master slide collection. |
images() | ImageCollection& | Images embedded in the presentation. |
notes_size() | NotesSize& | Notes page size settings. |
comment_authors() | CommentAuthorCollection& | Comment author collection. |
document_properties() | DocumentProperties& | Built-in and custom document metadata. |
Properties
| Property | Accessor | Description |
|---|---|---|
source_format() | Read | Format of the loaded presentation source. |
first_slide_number() | Read | First slide number in the presentation. |
set_first_slide_number(int) | Write | Set the first slide number. |
current_date_time() | Read | Date and time used for date-time placeholders. |
set_current_date_time(...) | Write | Set the current date-time for placeholders. |
Methods
save(std::string_view path, SaveFormat format)
Save the presentation to a file.
| Parameter | Type | Description |
|---|---|---|
path | std::string_view | Destination file path. |
format | SaveFormat | Output format (e.g., SaveFormat::PPTX). |
prs.save("output.pptx", SaveFormat::PPTX);dispose()
Release resources held by the presentation.
detect_source_format(std::string_view path)
Detect the source format of a presentation file without fully loading it.
Usage Examples
Create a Presentation with a Shape
#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);Open and Inspect
#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);