Aspose.Slides for C++
Aspose.Slides for C++ is a native C++ library for creating, reading, editing and converting PowerPoint and OpenDocument presentations, without Microsoft PowerPoint or Office Automation.
It loads and saves PPT, PPTX, PPS, POT and ODP, including macro-enabled and template variants, and exports to PDF, XPS, HTML, SVG, TIFF, Markdown and images.
Get Started
GETTING STARTED
EVALUATE
Build with Slides
COMMON TASKS
SLIDES WORKFLOWS
EXAMPLES
Reference & Support
REFERENCE
SUPPORT
Your first presentation
On Windows, create a C++ Console App project in Visual Studio and install the NuGet package in the Package Manager Console (Tools > NuGet Package Manager > Package Manager Console):
Install-Package Aspose.Slides.Cpp
On Linux, download the Linux ZIP package and set up the CMake project described in Installation.
Then use this code as your program’s main source file. It creates a presentation with one text box and saves it:
#include <DOM/Presentation.h>
#include <DOM/ISlide.h>
#include <DOM/IShapeCollection.h>
#include <DOM/IAutoShape.h>
#include <DOM/ITextFrame.h>
#include <DOM/ShapeType.h>
#include <Export/SaveFormat.h>
#include <system/smart_ptr.h>
using namespace Aspose::Slides;
using namespace Aspose::Slides::Export;
using namespace System;
int main()
{
auto presentation = MakeObject<Presentation>();
auto slide = presentation->get_Slide(0);
auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 50, 50, 400, 100);
shape->get_TextFrame()->set_Text(u"Hello, Aspose.Slides!");
presentation->Save(u"hello.pptx", SaveFormat::Pptx);
presentation->Dispose();
return 0;
}
To run it on Windows, select the x64 platform in the toolbar and press Ctrl+F5. On Linux, save it as main.cpp in the project folder, then build and run it there:
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build
./build/hello
The program saves hello.pptx with one slide holding a text box. Without a license, the saved file carries an evaluation watermark — see Licensing. For more ways to create and fill a presentation, see Create Presentations.