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(const std::string& file) | 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");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(const std::string& fname, SaveFormat format)
Save the presentation to a file.
| Parameter | Type | Description |
|---|---|---|
fname | const std::string& | 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(const std::string& file)
Static method. 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);