Features and Capabilities
Features and Capabilities
Aspose.Slides FOSS for C++ provides a broad set of capabilities for working with PowerPoint .pptx files programmatically. This page lists all supported feature areas with representative code examples.
Presentation I/O
Open an existing .pptx file or create a new one, then save back to PPTX format.
#include <Aspose/Slides/Foss/presentation.h>
#include <Aspose/Slides/Foss/export/save_format.h>
#include <Aspose/Slides/Foss/slide.h>
#include <Aspose/Slides/Foss/slide_collection.h>
#include <iostream>
using namespace Aspose::Slides::Foss;
int main() {
// Open an existing presentation
{
Presentation pres("input.pptx");
std::cout << "Slide count: " << pres.slides().size() << std::endl;
pres.save("output.pptx", SaveFormat::PPTX);
}
// Create a new presentation (starts with one blank slide)
{
Presentation pres;
pres.save("new.pptx", SaveFormat::PPTX);
}
return 0;
}Note: PPTX is the only supported save format. Export to PDF, HTML, SVG, or images is not available.
Unknown XML parts in the source file are preserved verbatim on save, so opening and re-saving a .pptx will never strip content the library does not yet understand.
Slides Management
Add, remove, clone, and reorder slides.
#include <Aspose/Slides/Foss/presentation.h>
#include <Aspose/Slides/Foss/export/save_format.h>
#include <Aspose/Slides/Foss/layout_slide.h>
#include <Aspose/Slides/Foss/slide.h>
#include <Aspose/Slides/Foss/slide_collection.h>
#include <iostream>
using namespace Aspose::Slides::Foss;
int main() {
Presentation pres;
// Access the first slide
auto& slide = pres.slides()[0];
// Add an additional blank slide at the end
auto* layout = dynamic_cast<ILayoutSlide*>(&pres.layout_slides()[0]);
pres.slides().add_empty_slide(layout);
std::cout << "Total slides: " << pres.slides().size() << std::endl;
pres.save("multi-slide.pptx", SaveFormat::PPTX);
return 0;
}Shapes
Add AutoShapes, PictureFrames, Tables, and Connectors to a slide.
AutoShapes
#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>
using namespace Aspose::Slides::Foss;
int main() {
Presentation pres;
auto& slide = pres.slides()[0];
// Add a rectangle at (x=50, y=50) with width=300, height=100
auto& shape = slide.shapes().add_auto_shape(ShapeType::RECTANGLE, 50, 50, 300, 100);
shape.text_frame()->set_text("Aspose.Slides FOSS");
pres.save("shapes.pptx", SaveFormat::PPTX);
return 0;
}Tables
#include <Aspose/Slides/Foss/cell.h>
#include <Aspose/Slides/Foss/export/save_format.h>
#include <Aspose/Slides/Foss/presentation.h>
#include <Aspose/Slides/Foss/row.h>
#include <Aspose/Slides/Foss/row_collection.h>
#include <Aspose/Slides/Foss/shape_collection.h>
#include <Aspose/Slides/Foss/slide.h>
#include <Aspose/Slides/Foss/slide_collection.h>
#include <Aspose/Slides/Foss/table.h>
#include <Aspose/Slides/Foss/text_frame.h>
#include <vector>
using namespace Aspose::Slides::Foss;
int main() {
Presentation pres;
auto& slide = pres.slides()[0];
// Column widths and row heights in points
std::vector<double> col_widths = {120.0, 120.0, 120.0};
std::vector<double> row_heights = {40.0, 40.0, 40.0};
auto& table = slide.shapes().add_table(50, 50, col_widths, row_heights);
table.rows()[0][0].text_frame()->set_text("Product");
table.rows()[0][1].text_frame()->set_text("Quantity");
table.rows()[0][2].text_frame()->set_text("Price");
pres.save("table.pptx", SaveFormat::PPTX);
return 0;
}Connectors
#include <Aspose/Slides/Foss/auto_shape.h>
#include <Aspose/Slides/Foss/connector.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>
using namespace Aspose::Slides::Foss;
int main() {
Presentation pres;
auto& slide = pres.slides()[0];
auto& box1 = slide.shapes().add_auto_shape(ShapeType::RECTANGLE, 50, 100, 150, 60);
auto& box2 = slide.shapes().add_auto_shape(ShapeType::RECTANGLE, 350, 100, 150, 60);
auto& conn = slide.shapes().add_connector(ShapeType::BENT_CONNECTOR3, 0, 0, 10, 10);
conn.set_start_shape_connected_to(&box1);
conn.set_start_shape_connection_site_index(3); // right side
conn.set_end_shape_connected_to(&box2);
conn.set_end_shape_connection_site_index(1); // left side
pres.save("connector.pptx", SaveFormat::PPTX);
return 0;
}Text Formatting
Format text at paragraph and character level using PortionFormat.
#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 pres;
auto& slide = pres.slides()[0];
auto& shape = slide.shapes().add_auto_shape(ShapeType::RECTANGLE, 50, 50, 500, 150);
shape.text_frame()->set_text("Bold blue heading");
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));
pres.save("text.pptx", SaveFormat::PPTX);
return 0;
}NullableBool::TRUE sets the property explicitly; NullableBool::NOT_DEFINED inherits from the slide master.
Fill Types
Apply solid, gradient, pattern, or picture fills to shapes.
#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/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>
using namespace Aspose::Slides::Foss;
using namespace Aspose::Slides::Foss::Drawing;
int main() {
Presentation pres;
auto& slide = pres.slides()[0];
auto& shape = slide.shapes().add_auto_shape(ShapeType::RECTANGLE, 50, 50, 300, 150);
// Solid fill
shape.fill_format().set_fill_type(FillType::SOLID);
shape.fill_format().solid_fill_color().set_color(Color::from_argb(255, 30, 120, 200));
pres.save("fill.pptx", SaveFormat::PPTX);
return 0;
}Visual Effects
Apply outer shadow, glow, soft edge, blur, reflection, and inner shadow to shapes.
The effect properties are accessible through shape.effect_format(). The sub-objects returned by outer_shadow_effect(), glow_effect(), and similar methods are pointers — call them with ->.
#include <Aspose/Slides/Foss/auto_shape.h>
#include <Aspose/Slides/Foss/drawing/color.h>
#include <Aspose/Slides/Foss/effect_format.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/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>
using namespace Aspose::Slides::Foss;
using namespace Aspose::Slides::Foss::Drawing;
int main() {
Presentation pres;
auto& slide = pres.slides()[0];
auto& shape = slide.shapes().add_auto_shape(ShapeType::RECTANGLE, 100, 100, 200, 100);
auto& ef = shape.effect_format();
// Outer drop shadow
ef.enable_outer_shadow_effect();
auto* shadow = ef.outer_shadow_effect();
shadow->set_blur_radius(10);
shadow->set_direction(315);
shadow->set_distance(8);
shadow->shadow_color().set_color(Color::from_argb(128, 0, 0, 0));
// Glow effect
ef.enable_glow_effect();
auto* glow = ef.glow_effect();
glow->set_radius(15);
glow->color().set_color(Color::from_argb(200, 255, 200, 0));
pres.save("effects.pptx", SaveFormat::PPTX);
return 0;
}3D Formatting
Apply 3D bevel, camera, light rig, material, and extrusion depth via shape.three_d_format(). This controls the visual depth and lighting model for shape rendering in PPTX viewers that support 3D effects.
#include <Aspose/Slides/Foss/auto_shape.h>
#include <Aspose/Slides/Foss/bevel_preset_type.h>
#include <Aspose/Slides/Foss/camera_preset_type.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/drawing/color.h>
#include <Aspose/Slides/Foss/light_rig_preset_type.h>
#include <Aspose/Slides/Foss/lighting_direction.h>
#include <Aspose/Slides/Foss/material_preset_type.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/three_d_format.h>
using namespace Aspose::Slides::Foss;
using namespace Aspose::Slides::Foss::Drawing;
int main() {
Presentation pres;
auto& slide = pres.slides()[0];
auto& shape = slide.shapes().add_auto_shape(ShapeType::RECTANGLE, 100, 100, 200, 100);
shape.fill_format().set_fill_type(FillType::SOLID);
shape.fill_format().solid_fill_color().set_color(Color::from_argb(255, 20, 70, 160));
auto& tdf = shape.three_d_format();
tdf.bevel_top().set_bevel_type(BevelPresetType::CIRCLE);
tdf.bevel_top().set_width(10);
tdf.bevel_top().set_height(5);
tdf.camera().set_camera_type(CameraPresetType::PERSPECTIVE_ABOVE);
tdf.light_rig().set_light_type(LightRigPresetType::BALANCED);
tdf.light_rig().set_direction(LightingDirection::TOP);
tdf.set_depth(20);
tdf.set_material(MaterialPresetType::METAL);
pres.save("3d.pptx", SaveFormat::PPTX);
return 0;
}Speaker Notes
Attach notes to any slide using notes_slide_manager().
#include <Aspose/Slides/Foss/export/save_format.h>
#include <Aspose/Slides/Foss/i_notes_slide.h>
#include <Aspose/Slides/Foss/i_notes_slide_manager.h>
#include <Aspose/Slides/Foss/presentation.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;
int main() {
Presentation pres;
auto* notes = pres.slides()[0].notes_slide_manager().add_notes_slide();
notes->notes_text_frame().set_text("Key talking point: emphasize the ROI benefit.");
pres.save("notes.pptx", SaveFormat::PPTX);
return 0;
}Comments
Add threaded comments with author information and slide position.
#include <Aspose/Slides/Foss/comment.h>
#include <Aspose/Slides/Foss/comment_author.h>
#include <Aspose/Slides/Foss/comment_author_collection.h>
#include <Aspose/Slides/Foss/comment_collection.h>
#include <Aspose/Slides/Foss/drawing/point_f.h>
#include <Aspose/Slides/Foss/export/save_format.h>
#include <Aspose/Slides/Foss/presentation.h>
#include <Aspose/Slides/Foss/slide.h>
#include <Aspose/Slides/Foss/slide_collection.h>
#include <chrono>
using namespace Aspose::Slides::Foss;
using namespace Aspose::Slides::Foss::Drawing;
int main() {
Presentation pres;
auto& author = pres.comment_authors().add_author("Jane Smith", "JS");
auto& slide = pres.slides()[0];
author.comments().add_comment(
"Please verify this data before the presentation.",
slide,
PointF(2.0f, 2.0f),
std::chrono::system_clock::now()
);
pres.save("comments.pptx", SaveFormat::PPTX);
return 0;
}Embedded Images
Embed an image from a file into the presentation and add it to a slide as a PictureFrame.
#include <Aspose/Slides/Foss/export/save_format.h>
#include <Aspose/Slides/Foss/image_collection.h>
#include <Aspose/Slides/Foss/picture_frame.h>
#include <Aspose/Slides/Foss/pp_image.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 <fstream>
#include <iterator>
#include <vector>
using namespace Aspose::Slides::Foss;
int main() {
Presentation pres;
// Read image bytes from file
std::ifstream f("logo.png", std::ios::binary);
std::vector<std::uint8_t> data(
(std::istreambuf_iterator<char>(f)),
std::istreambuf_iterator<char>());
auto& img = pres.images().add_image(data);
pres.slides()[0].shapes().add_picture_frame(
ShapeType::RECTANGLE, 50, 50, 200, 150, img);
pres.save("with-image.pptx", SaveFormat::PPTX);
return 0;
}Document Properties
Read and write core, app, and custom document properties.
#include <Aspose/Slides/Foss/document_properties.h>
#include <Aspose/Slides/Foss/export/save_format.h>
#include <Aspose/Slides/Foss/presentation.h>
#include <any>
#include <string>
using namespace Aspose::Slides::Foss;
int main() {
Presentation pres;
auto& props = pres.document_properties();
// Core properties
props.set_title("Q1 Results");
props.set_author("Finance Team");
props.set_subject("Quarterly Review");
props.set_keywords("Q1, finance, results");
// Custom property
props.set_custom_property_value("ReviewedBy", std::any(std::string("Legal Team")));
pres.save("deck.pptx", SaveFormat::PPTX);
return 0;
}Known Limitations
The following areas are not available in this edition:
| Area | Status |
|---|---|
| Charts | Not implemented |
| SmartArt | Not implemented |
| Animations and transitions | Not implemented |
| PDF / HTML / SVG / image export | Not implemented (PPTX only) |
| VBA macros | Not implemented |
| Digital signatures | Not implemented |
| Hyperlinks and action settings | Not implemented |
| OLE objects | Not implemented |
| Mathematical text | Not implemented |
See Also
- Getting Started: Installation and first program
- API Reference: Class and method reference
- How-To Guides: Task-oriented articles