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 Presentation

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


Constructors

SignatureDescription
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

PropertyAccessorDescription
source_format()ReadFormat of the loaded presentation source.
first_slide_number()ReadFirst slide number in the presentation.
set_first_slide_number(int)WriteSet the first slide number.
current_date_time()ReadDate and time used for date-time placeholders.
set_current_date_time(...)WriteSet the current date-time for placeholders.

Methods

save(const std::string& fname, SaveFormat format)

Save the presentation to a file.

ParameterTypeDescription
fnameconst std::string&Destination file path.
formatSaveFormatOutput 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);

See Also