Introduction
Aspose.Slides FOSS for C++ is now available: a free, MIT-licensed library for creating, reading, and editing PowerPoint .pptx files in native C++, with no dependency on Microsoft Office or any proprietary runtime.
The library is designed for developers who need to generate or manipulate presentation files programmatically: automating slide decks from data, extracting text and metadata from uploaded PPTX files, building presentation-based reporting pipelines, or embedding presentation creation into desktop and server applications. Because aspose_slides_foss is built with CMake, it compiles and deploys on Windows, macOS, and Linux.
Key Features
- Full round-trip PPTX support: Open any
.pptxfile, modify its content, and save it back without losing unknown XML parts that the library does not yet understand. - Slides management: Add, remove, and iterate slides using
prs.slides(); the presentation starts with one blank slide after constructing aPresentation. - AutoShapes, Tables, and Connectors: Insert shapes via
slide.shapes().add_auto_shape(), tabular data viaslide.shapes().add_table(), and visual connectors between shapes viaslide.shapes().add_connector(). - Rich text formatting: Format text at character level with
PortionFormat: font size, bold, italic, underline, and ARGB color viaFillType::SOLIDandColorFormat. - Fill types: Apply
FillType::SOLID,FillType::GRADIENT,FillType::PATTERN, orFillType::PICTUREfills to any shape. - Visual effects: Outer shadow, glow, soft edge, blur, reflection, and inner shadow via
shape.effect_format(). - 3D formatting: Bevel, camera, light rig, material, and extrusion depth via
shape.three_d_format(). - Speaker notes: Attach notes text to each slide via
notes_slide_manager().add_notes_slide(). - Threaded comments: Add comments with author metadata and slide position.
- Embedded images: Embed from file path, memory buffer, or stream.
- Document properties: Read and write core, app, and custom properties.
Getting Started
Add the library via CMake. A C++20 compiler is required.
include(FetchContent)
FetchContent_Declare(
aspose_slides_foss
GIT_REPOSITORY https://github.com/aspose-slides-foss/Aspose.Slides-FOSS-for-Cpp.git
GIT_TAG main
)
FetchContent_MakeAvailable(aspose_slides_foss)
target_link_libraries(your_target PRIVATE aspose_slides_foss)
Create your first presentation with a shape and save it:
#include <Aspose/Slides/Foss/auto_shape.h>
#include <Aspose/Slides/Foss/export/save_format.h>
#include <Aspose/Slides/Foss/presentation.h>
#include <Aspose/Slides/Foss/shape_collection.h>
#include <Aspose/Slides/Foss/shape_type.h>
#include <Aspose/Slides/Foss/slide.h>
#include <Aspose/Slides/Foss/slide_collection.h>
#include <Aspose/Slides/Foss/text_frame.h>
int main() {
using namespace Aspose::Slides::Foss;
Presentation prs;
auto& slide = prs.slides()[0];
auto& shape = slide.shapes().add_auto_shape(
ShapeType::RECTANGLE, 50, 50, 400, 120
);
shape.text_frame()->set_text("Hello from Aspose.Slides FOSS!");
prs.save("hello.pptx", SaveFormat::PPTX);
return 0;
}
The Presentation destructor releases all internal resources automatically when it goes out of scope.
Text Formatting Example
#include <Aspose/Slides/Foss/auto_shape.h>
#include <Aspose/Slides/Foss/drawing/color.h>
#include <Aspose/Slides/Foss/export/save_format.h>
#include <Aspose/Slides/Foss/fill_format.h>
#include <Aspose/Slides/Foss/fill_type.h>
#include <Aspose/Slides/Foss/nullable_bool.h>
#include <Aspose/Slides/Foss/paragraph.h>
#include <Aspose/Slides/Foss/paragraph_collection.h>
#include <Aspose/Slides/Foss/portion.h>
#include <Aspose/Slides/Foss/portion_collection.h>
#include <Aspose/Slides/Foss/portion_format.h>
#include <Aspose/Slides/Foss/presentation.h>
#include <Aspose/Slides/Foss/shape_collection.h>
#include <Aspose/Slides/Foss/shape_type.h>
#include <Aspose/Slides/Foss/slide.h>
#include <Aspose/Slides/Foss/slide_collection.h>
#include <Aspose/Slides/Foss/text_frame.h>
using namespace Aspose::Slides::Foss;
using namespace Aspose::Slides::Foss::Drawing;
int main() {
Presentation prs;
auto& shape = prs.slides()[0].shapes().add_auto_shape(
ShapeType::RECTANGLE, 50, 50, 500, 150
);
shape.text_frame()->set_text("Bold heading in corporate blue");
auto& fmt = shape.text_frame()->paragraphs()[0].portions()[0].portion_format();
fmt.set_font_height(28);
fmt.set_font_bold(NullableBool::TRUE);
fmt.fill_format().set_fill_type(FillType::SOLID);
fmt.fill_format().solid_fill_color().set_color(Color::from_argb(255, 0, 70, 127));
prs.save("formatted.pptx", SaveFormat::PPTX);
return 0;
}
Current Limitations
The following areas are not available in this edition:
- Charts, SmartArt, and OLE objects
- Animations and slide transitions
- Export to PDF, HTML, SVG, or image formats
- Hyperlinks, action settings, VBA macros, and digital signatures
Unknown XML parts encountered during load are preserved verbatim on save, so PPTX files produced by other tools round-trip safely.