# Aspose.Slides for C++ > Complete English documentation. Each page retains its canonical source URL. # Aspose.Slides for C++ > Start here: install Aspose.Slides for C++, create a first presentation, and find the guides for common tasks, the API reference and support. Source: https://docs.aspose.com/slides/cpp/ Updated: 2026-10-27 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.

Explore features and support — browse the library features and open their guides.

------

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**): ```powershell Install-Package Aspose.Slides.Cpp ``` On Linux, download the Linux ZIP package and set up the CMake project described in [Installation](https://docs.aspose.com/slides/cpp/installation/#linux). Then use this code as your program's main source file. It creates a presentation with one text box and saves it: ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; int main() { auto presentation = MakeObject(); 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: ```bash 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](https://docs.aspose.com/slides/cpp/licensing/). For more ways to create and fill a presentation, see [Create Presentations](https://docs.aspose.com/slides/cpp/create-presentation/). ## Related articles - [API Reference](https://docs.aspose.com/slides/cpp/api-reference/) - [Product Overview](https://docs.aspose.com/slides/cpp/product-overview/) # Customize 3D Charts in Presentations Using C++ > Create 3D charts in PowerPoint presentations with Aspose.Slides for C++. Adjust rotation, height proportions, chart depth, and spacing between series with C++ examples. Source: https://docs.aspose.com/slides/cpp/3d-chart/ Updated: 2026-11-09 ## **Overview** Aspose.Slides for C++ lets you customize the view of a 3D chart through [IChart::get_Rotation3D](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichart/get_rotation3d/). This article demonstrates how to adjust rotation, height proportions, depth, right-angle axes, and spacing between series, then save the presentation in PPTX format. ## **Set the Rotation and Depth of a 3D Chart** The example below creates a [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) and uses [IShapeCollection::AddChart](https://reference.aspose.com/slides/cpp/aspose.slides/ishapecollection/addchart/) to add a stacked 3D column chart to its first slide. It replaces the default series and categories with two series containing three values each. Worksheet index `0` identifies the chart's first data worksheet; row `0` holds series names, and column `0` holds category labels. The [set_RotationX](https://reference.aspose.com/slides/cpp/aspose.slides.charts/irotation3d/set_rotationx/) and [set_RotationY](https://reference.aspose.com/slides/cpp/aspose.slides.charts/irotation3d/set_rotationy/) methods set the chart's rotation to 40 and 270 degrees, respectively. [set_DepthPercents](https://reference.aspose.com/slides/cpp/aspose.slides.charts/irotation3d/set_depthpercents/) sets its depth to 150% of its width, while [set_RightAngleAxes](https://reference.aspose.com/slides/cpp/aspose.slides.charts/irotation3d/set_rightangleaxes/) enables right-angle axes instead of perspective. The resulting presentation contains the populated chart with these 3D view settings. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::StackedColumn3D, 0, 0, 500, 500); chart->get_ChartData()->get_Series()->Clear(); chart->get_ChartData()->get_Categories()->Clear(); auto workbook = chart->get_ChartData()->get_ChartDataWorkbook(); auto worksheetIndex = 0; double values[2][3] = { { 20, 50, 30 }, { 30, 10, 60 } }; for (auto categoryIndex = 0; categoryIndex < 3; categoryIndex++) { auto categoryName = String::Format(u"Category {0}", categoryIndex + 1); auto categoryCell = workbook->GetCell(worksheetIndex, categoryIndex + 1, 0, ObjectExt::Box(categoryName)); chart->get_ChartData()->get_Categories()->Add(categoryCell); } for (auto seriesIndex = 0; seriesIndex < 2; seriesIndex++) { auto seriesName = String::Format(u"Series {0}", seriesIndex + 1); auto seriesCell = workbook->GetCell(worksheetIndex, 0, seriesIndex + 1, ObjectExt::Box(seriesName)); auto series = chart->get_ChartData()->get_Series()->Add(seriesCell, chart->get_Type()); for (auto categoryIndex = 0; categoryIndex < 3; categoryIndex++) { auto valueCell = workbook->GetCell(worksheetIndex, categoryIndex + 1, seriesIndex + 1, ObjectExt::Box(values[seriesIndex][categoryIndex])); series->get_DataPoints()->AddDataPointForBarSeries(valueCell); } } chart->get_Rotation3D()->set_RightAngleAxes(true); chart->get_Rotation3D()->set_RotationX(40); chart->get_Rotation3D()->set_RotationY(270); chart->get_Rotation3D()->set_DepthPercents(150); presentation->Save(u"Rotation3D_out.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ## **Adjust the Height Proportions of a 3D Chart** Use [IRotation3D::set_HeightPercents](https://reference.aspose.com/slides/cpp/aspose.slides.charts/irotation3d/set_heightpercents/) to set the height of a 3D chart as a percentage of its width. This changes the proportions of the 3D scene without resizing the chart object on the slide. The following example creates a [Column3D](https://reference.aspose.com/slides/cpp/aspose.slides.charts/charttype/) chart with the default data: three series and four categories. It saves three presentations with height proportions of 50%, 100%, and 200%. The chart's position, width, and height remain fixed. The data, rotation, depth, series spacing, and formatting are identical in all three files; only the height percentage changes. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::Column3D, 40, 30, 620, 460); chart->get_Rotation3D()->set_RotationX(20); chart->get_Rotation3D()->set_RotationY(30); chart->get_Rotation3D()->set_RightAngleAxes(true); chart->get_Rotation3D()->set_DepthPercents(100); chart->get_ChartData()->get_Series()->idx_get(0)->get_ParentSeriesGroup()->set_GapDepth(150); for (uint16_t heightPercent : { 50, 100, 200 }) { chart->get_Rotation3D()->set_HeightPercents(heightPercent); auto fileName = String::Format(u"chart_height_{0}.pptx", heightPercent); presentation->Save(fileName, SaveFormat::Pptx); } presentation->Dispose(); ``` The following images from the equivalent .NET example were exported using Microsoft PowerPoint and illustrate the same height settings. A smaller percentage produces a flatter scene, while a larger percentage produces a taller scene within the same chart object. PowerPoint may also adjust axis tick intervals and label placement to fit the scene. | Height: 50% | Height: 100% | Height: 200% | | --- | --- | --- | | ![3D column chart with height set to 50 percent of its width](https://docs.aspose.com/slides/cpp/3d-chart/height_percent_50.png) | ![3D column chart with height set to 100 percent of its width](https://docs.aspose.com/slides/cpp/3d-chart/height_percent_100.png) | ![3D column chart with height set to 200 percent of its width](https://docs.aspose.com/slides/cpp/3d-chart/height_percent_200.png) | These methods control different aspects of the chart: | Method | Effect | | --- | --- | | [IRotation3D::set_HeightPercents](https://reference.aspose.com/slides/cpp/aspose.slides.charts/irotation3d/set_heightpercents/) | Height of the 3D scene as a percentage of its width. | | [IShape::set_Height](https://reference.aspose.com/slides/cpp/aspose.slides/ishape/set_height/) | Height of the chart object on the slide, in points. | | [IRotation3D::set_DepthPercents](https://reference.aspose.com/slides/cpp/aspose.slides.charts/irotation3d/set_depthpercents/) | Depth of the 3D scene as a percentage of its width. | | [IChartSeriesGroup::set_GapDepth](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartseriesgroup/set_gapdepth/) | Spacing between series along the depth axis, as a percentage of the marker width. | The height setting affects 3D column and bar charts, including cylinder, cone, and pyramid variants, as well as 3D line, area, pie, and surface charts. The comparison above uses the verified `Column3D` type. The setting does not change the appearance of a 2D `ClusteredColumn` chart or a `BubbleWith3D` chart; these names are members of the [ChartType](https://reference.aspose.com/slides/cpp/aspose.slides.charts/charttype/) enumeration. For other chart appearance settings, see [Chart Formatting](https://docs.aspose.com/slides/cpp/chart-formatting/). ## **Adjust the Gap Between Series** Use [IChartSeriesGroup::set_GapDepth](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartseriesgroup/set_gapdepth/) to control the distance between data series along the depth axis of a 3D chart, expressed as a percentage of the marker width. Use values from **0 to 500**, inclusive: `0` removes the gap, while larger values increase the spacing. With a fixed chart depth, increasing the gap makes the markers thinner along the depth axis. Access the group through [IChartSeries::get_ParentSeriesGroup](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartseries/get_parentseriesgroup/). The setting applies to every series in that group, not just the series used to access it. [IChartSeries::get_GapDepth](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartseries/get_gapdepth/) returns the parent group's setting. This setting affects 3D column and bar charts, including their cylinder, cone, and pyramid variants, as well as 3D line and area charts. The appearance depends on whether the series are arranged in depth, clustered, or stacked. For a clear comparison of gaps between separate series, use `ChartType::Column3D` from the [ChartType](https://reference.aspose.com/slides/cpp/aspose.slides.charts/charttype/) enumeration. These methods control different aspects of the chart: | Method | Effect | | --- | --- | | [IChartSeriesGroup::set_GapDepth](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartseriesgroup/set_gapdepth/) | Spacing between series along the depth axis, as a percentage of the marker width. | | [IChartSeriesGroup::set_GapWidth](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartseriesgroup/set_gapwidth/) | Spacing between adjacent bar or column clusters, as a percentage of the bar or column width. | | [IRotation3D::set_DepthPercents](https://reference.aspose.com/slides/cpp/aspose.slides.charts/irotation3d/set_depthpercents/) | Overall chart depth, as a percentage of the chart width. | The following self-contained example uses the default chart data, which contains three series and four categories. It saves two presentations with identical data, rotation, gap width, and chart depth; only the gap depth changes. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::Column3D, 40, 30, 620, 230); chart->get_Rotation3D()->set_RotationX(20); chart->get_Rotation3D()->set_RotationY(30); chart->get_Rotation3D()->set_DepthPercents(100); auto series = chart->get_ChartData()->get_Series()->idx_get(0); auto group = series->get_ParentSeriesGroup(); group->set_GapWidth(150); for (uint16_t gapDepth : { 0, 500 }) { group->set_GapDepth(gapDepth); auto fileName = String::Format(u"series_gap_depth_{0}.pptx", gapDepth); presentation->Save(fileName, SaveFormat::Pptx); } presentation->Dispose(); ``` The following images from the equivalent .NET example were exported using Microsoft PowerPoint and illustrate the same gap depth settings. | Gap depth: 0% | Gap depth: 500% | | --- | --- | | ![3D column chart with no gap between series along the depth axis](https://docs.aspose.com/slides/cpp/3d-chart/gap_depth_0.png) | ![3D column chart with a 500 percent gap between series along the depth axis](https://docs.aspose.com/slides/cpp/3d-chart/gap_depth_500.png) | ## **FAQ** **Which chart types support 3D mode in Aspose.Slides?** Aspose.Slides supports 3D variants of column charts, including Column 3D, Clustered Column 3D, Stacked Column 3D, and 100% Stacked Column 3D, along with related 3D types exposed through the [ChartType](https://reference.aspose.com/slides/cpp/aspose.slides.charts/charttype/) enumeration. For an exact, up-to-date list, check the [ChartType](https://reference.aspose.com/slides/cpp/aspose.slides.charts/charttype/) members in the API reference of your installed version. **Can I get a raster image of a 3D chart for a report or the web?** Yes. You can export a chart to an image with [Shape::GetImage](https://reference.aspose.com/slides/cpp/aspose.slides/shape/getimage/) or [render the entire slide](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-png/) to formats like PNG or JPEG. This is useful when you need a raster preview or want to embed the chart into documents, dashboards, or web pages without requiring PowerPoint. **How performant is building and rendering large 3D charts?** Performance depends on data volume and visual complexity. For best results, keep 3D effects minimal, avoid heavy textures on walls and plot areas, limit the number of data points per series when possible, and render to an appropriately sized output (resolution and dimensions) to match the target display or print needs. # Create 3D Effects in Presentations Using C++ > Apply and render 3D effects for PowerPoint shapes and text in C++ with Aspose.Slides. Configure camera, lighting, material, extrusion, fills, and 3D text. Source: https://docs.aspose.com/slides/cpp/3d-presentation/ Updated: 2026-09-25 ## **Overview** Aspose.Slides for C++ can create, edit, preserve, and render PowerPoint-style 3D formatting for shapes and text. This article covers 3D effects such as rotation, extrusion, bevels, lighting, material, gradient or picture fills, and 3D text. This article is about 3D formatting effects on PowerPoint shapes and text. It is not about inserting or editing standalone 3D model files. When you export a slide to an image, PDF, or HTML, Aspose.Slides renders those 3D effects into the exported 2D output. ## **3D Formatting Concepts** Use the [IShape::get_ThreeDFormat](https://reference.aspose.com/slides/cpp/aspose.slides/ishape/get_threedformat/) method to apply 3D formatting to a shape. The method returns [IThreeDFormat](https://reference.aspose.com/slides/cpp/aspose.slides/ithreedformat/), which controls the 3D scene for that shape. For text, use the [ITextFrameFormat::get_ThreeDFormat](https://reference.aspose.com/slides/cpp/aspose.slides/itextframeformat/get_threedformat/) method. This applies 3D formatting to the text frame instead of the shape body. The most important methods are: | Method | What it controls | When to use it | |---|---|---| | [get_Camera](https://reference.aspose.com/slides/cpp/aspose.slides/ithreedformat/get_camera/) | Viewpoint, preset camera type, rotation, zoom, and perspective. | Rotate the object in 3D space or match a PowerPoint 3D rotation preset. | | [get_LightRig](https://reference.aspose.com/slides/cpp/aspose.slides/ithreedformat/get_lightrig/) | Light preset, direction, and light rotation. | Change how highlights and shadows appear on the 3D surface. | | [set_Material](https://reference.aspose.com/slides/cpp/aspose.slides/ithreedformat/set_material/) | Surface material, such as flat, matte, plastic, or metal. | Make the same geometry look flatter, softer, glossy, or metallic. | | [set_ExtrusionHeight](https://reference.aspose.com/slides/cpp/aspose.slides/ithreedformat/set_extrusionheight/) | How far the shape extends backward from its front face. | Turn a flat shape into a visibly thick 3D object. | | [get_ExtrusionColor](https://reference.aspose.com/slides/cpp/aspose.slides/ithreedformat/get_extrusioncolor/) | Color of the extruded sides. | Make depth visible or coordinate the side color with the front fill. | | [set_Depth](https://reference.aspose.com/slides/cpp/aspose.slides/ithreedformat/set_depth/) | Additional 3D depth used by PowerPoint 3D formatting. | Fine-tune depth for shapes or text, especially together with bevel and material settings. | | [get_BevelTop](https://reference.aspose.com/slides/cpp/aspose.slides/ithreedformat/get_beveltop/) and [get_BevelBottom](https://reference.aspose.com/slides/cpp/aspose.slides/ithreedformat/get_bevelbottom/) | Raised or rounded edges on the front and back faces. | Add a softened or molded edge instead of a sharp flat face. | | [get_ContourColor](https://reference.aspose.com/slides/cpp/aspose.slides/ithreedformat/get_contourcolor/) and [set_ContourWidth](https://reference.aspose.com/slides/cpp/aspose.slides/ithreedformat/set_contourwidth/) | Outline around the 3D object. | Emphasize the object boundary in rendered output. | ## **Create a 3D Shape** A shape usually needs four kinds of settings before it looks convincingly 3D: - Camera settings, because the default front view may hide the extrusion. - Light settings, because lighting makes the faces and sides readable. - Material settings, because the surface affects how light is rendered. - Extrusion or depth settings, because a flat shape needs thickness. The following example creates a rectangle, adds text to its front face, and applies 3D formatting. The camera rotation values are in degrees, and the extrusion height is 100 points. The example renders the slide to a PNG image at twice its default dimensions and saves the presentation as PPTX. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System::Drawing; const auto imageScale = 2.0f; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 200.0f, 150.0f, 200.0f, 200.0f); shape->get_TextFrame()->set_Text(u"3D"); shape->get_TextFrame()->get_Paragraph(0)->get_ParagraphFormat()->get_DefaultPortionFormat()->set_FontHeight(64.0f); auto frontColor = Color::get_CornflowerBlue(); shape->get_FillFormat()->set_FillType(FillType::Solid); shape->get_FillFormat()->get_SolidFillColor()->set_Color(frontColor); auto extrusionColor = Color::get_Blue(); shape->get_ThreeDFormat()->get_Camera()->set_CameraType(CameraPresetType::OrthographicFront); shape->get_ThreeDFormat()->get_Camera()->SetRotation(20.0f, 30.0f, 40.0f); shape->get_ThreeDFormat()->get_LightRig()->set_LightType(LightRigPresetType::Flat); shape->get_ThreeDFormat()->get_LightRig()->set_Direction(LightingDirection::Top); shape->get_ThreeDFormat()->set_Material(MaterialPresetType::Flat); shape->get_ThreeDFormat()->set_ExtrusionHeight(100.0); shape->get_ThreeDFormat()->get_ExtrusionColor()->set_Color(extrusionColor); auto thumbnail = slide->GetImage(imageScale, imageScale); thumbnail->Save(u"shape_3d.png"); thumbnail->Dispose(); presentation->Save(u"shape_3d.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` The rendered slide image shows the rectangle as a thick 3D block: ![Rendered blue 3D rectangle with white 3D text on the front face](https://docs.aspose.com/slides/cpp/3d-presentation/img_01_01.png) ## **Rotate a Shape with the Camera** In PowerPoint, 3D rotation is configured from the 3-D Rotation pane. The X, Y, and Z rotation values correspond to the rotation you set through the camera API. ![PowerPoint 3-D Rotation pane with X, Y, and Z rotation values highlighted](https://docs.aspose.com/slides/cpp/3d-presentation/img_02_01.png) In Aspose.Slides, access the camera through [IThreeDFormat::get_Camera](https://reference.aspose.com/slides/cpp/aspose.slides/ithreedformat/get_camera/). This example creates a rectangle, selects an orthographic front view, and sets its X, Y, and Z rotations to 20, 30, and 40 degrees, respectively. It configures the shape in memory without saving a file: ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 200.0f, 150.0f, 200.0f, 200.0f); shape->get_ThreeDFormat()->get_Camera()->set_CameraType(CameraPresetType::OrthographicFront); shape->get_ThreeDFormat()->get_Camera()->SetRotation(20.0f, 30.0f, 40.0f); presentation->Dispose(); ``` Use the camera when you need to change how the viewer sees the object. It does not change the 2D shape geometry on the slide. It changes the 3D viewpoint used by PowerPoint and by Aspose.Slides when rendering. ## **Add Extrusion and Depth** Extrusion makes a shape look thick by extending it behind the front face. In PowerPoint, the depth control sets this visible thickness, and the color control sets the color of the side faces. ![PowerPoint depth controls mapped to extrusion color and extrusion height properties](https://docs.aspose.com/slides/cpp/3d-presentation/img_02_02.png) Set [IThreeDFormat::set_ExtrusionHeight](https://reference.aspose.com/slides/cpp/aspose.slides/ithreedformat/set_extrusionheight/) for the thickness and [IThreeDFormat::get_ExtrusionColor](https://reference.aspose.com/slides/cpp/aspose.slides/ithreedformat/get_extrusioncolor/) for the side color. This example gives a rectangle a 100-point extrusion with purple sides and rotates the camera to reveal its thickness. It configures the shape in memory without saving a file: ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System::Drawing; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 200.0f, 150.0f, 200.0f, 200.0f); shape->get_ThreeDFormat()->get_Camera()->set_CameraType(CameraPresetType::OrthographicFront); shape->get_ThreeDFormat()->get_Camera()->SetRotation(20.0f, 30.0f, 40.0f); shape->get_ThreeDFormat()->get_LightRig()->set_LightType(LightRigPresetType::Flat); shape->get_ThreeDFormat()->get_LightRig()->set_Direction(LightingDirection::Top); shape->get_ThreeDFormat()->set_Material(MaterialPresetType::Flat); shape->get_ThreeDFormat()->set_ExtrusionHeight(100.0); auto extrusionColor = Color::get_Purple(); shape->get_ThreeDFormat()->get_ExtrusionColor()->set_Color(extrusionColor); presentation->Dispose(); ``` The [IThreeDFormat::set_Depth](https://reference.aspose.com/slides/cpp/aspose.slides/ithreedformat/set_depth/) method sets the depth of a 3D shape. The [set_ExtrusionHeight](https://reference.aspose.com/slides/cpp/aspose.slides/ithreedformat/set_extrusionheight/) method controls the height of the extrusion effect, as shown in this example. ## **Use Gradient or Picture Fills with 3D Effects** 3D formatting is independent of the shape fill. You can apply a solid color, gradient, pattern, or picture fill to the front face and still use the same camera, light, material, and extrusion settings. This example applies a blue-to-orange gradient to the front face and a dark orange color to the 150-point extrusion. The gradient stops at 0 and 100 mark the start and end of the gradient. The camera rotation values are in degrees. The slide is rendered to a PNG image at twice its default dimensions: ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System::Drawing; const auto imageScale = 2.0f; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 200.0f, 150.0f, 250.0f, 250.0f); shape->get_TextFrame()->set_Text(u"3D Gradient"); shape->get_TextFrame()->get_Paragraph(0)->get_ParagraphFormat()->get_DefaultPortionFormat()->set_FontHeight(64.0f); auto firstGradientColor = Color::get_Blue(); auto secondGradientColor = Color::get_Orange(); shape->get_FillFormat()->set_FillType(FillType::Gradient); shape->get_FillFormat()->get_GradientFormat()->get_GradientStops()->Add(0.0f, firstGradientColor); shape->get_FillFormat()->get_GradientFormat()->get_GradientStops()->Add(100.0f, secondGradientColor); auto extrusionColor = Color::get_DarkOrange(); shape->get_ThreeDFormat()->get_Camera()->set_CameraType(CameraPresetType::OrthographicFront); shape->get_ThreeDFormat()->get_Camera()->SetRotation(10.0f, 20.0f, 30.0f); shape->get_ThreeDFormat()->get_LightRig()->set_LightType(LightRigPresetType::Flat); shape->get_ThreeDFormat()->get_LightRig()->set_Direction(LightingDirection::Top); shape->get_ThreeDFormat()->set_Material(MaterialPresetType::Flat); shape->get_ThreeDFormat()->set_ExtrusionHeight(150.0); shape->get_ThreeDFormat()->get_ExtrusionColor()->set_Color(extrusionColor); auto thumbnail = slide->GetImage(imageScale, imageScale); thumbnail->Save(u"gradient_3d.png"); thumbnail->Dispose(); presentation->Dispose(); ``` The rendered output keeps the gradient on the front face and renders the extrusion separately: ![Rendered 3D rectangle with a blue-to-orange gradient fill and orange extrusion](https://docs.aspose.com/slides/cpp/3d-presentation/img_02_03.png) To use a picture fill instead, add the image to the presentation and assign it to the shape fill. This example requires an existing file named "image.jpg" in the working directory. It stretches the picture to fill the rectangle, applies a 150-point extrusion, and sets the camera rotation in degrees. It configures the shape in memory without saving or rendering a file: ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System::Drawing; using namespace System::IO; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 200.0f, 150.0f, 250.0f, 250.0f); auto imageData = File::ReadAllBytes(u"image.jpg"); auto image = presentation->get_Images()->AddImage(imageData); shape->get_FillFormat()->set_FillType(FillType::Picture); shape->get_FillFormat()->get_PictureFillFormat()->get_Picture()->set_Image(image); shape->get_FillFormat()->get_PictureFillFormat()->set_PictureFillMode(PictureFillMode::Stretch); auto extrusionColor = Color::get_DarkOrange(); shape->get_ThreeDFormat()->get_Camera()->set_CameraType(CameraPresetType::OrthographicFront); shape->get_ThreeDFormat()->get_Camera()->SetRotation(10.0f, 20.0f, 30.0f); shape->get_ThreeDFormat()->get_LightRig()->set_LightType(LightRigPresetType::Flat); shape->get_ThreeDFormat()->get_LightRig()->set_Direction(LightingDirection::Top); shape->get_ThreeDFormat()->set_Material(MaterialPresetType::Flat); shape->get_ThreeDFormat()->set_ExtrusionHeight(150.0); shape->get_ThreeDFormat()->get_ExtrusionColor()->set_Color(extrusionColor); presentation->Dispose(); ``` The picture is rendered on the front face, while the extrusion is rendered as the 3D side surface: ![Rendered 3D rectangle with a photo fill on the front face and orange extrusion](https://docs.aspose.com/slides/cpp/3d-presentation/img_02_04.png) ## **Apply 3D Formatting to Text** Shape 3D formatting affects the shape body. Text 3D formatting affects the text frame. This is useful for WordArt-like effects where the letters themselves need extrusion, material, lighting, and camera settings. The following example creates text with an orange-and-white grid pattern, applies an upward arch, and configures 3D settings through [ITextFrameFormat::get_ThreeDFormat](https://reference.aspose.com/slides/cpp/aspose.slides/itextframeformat/get_threedformat/). The extrusion height and depth are in points, and the light rotation is in degrees. The shape fill and outline are hidden so that only the text is visible. The example renders a PNG image at twice the default slide dimensions and saves the presentation as PPTX: ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System::Drawing; const auto imageScale = 2.0f; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 200.0f, 150.0f, 250.0f, 250.0f); shape->get_FillFormat()->set_FillType(FillType::NoFill); shape->get_LineFormat()->get_FillFormat()->set_FillType(FillType::NoFill); shape->get_TextFrame()->set_Text(u"3D Text"); auto portion = shape->get_TextFrame()->get_Paragraph(0)->get_Portion(0); portion->get_PortionFormat()->get_FillFormat()->set_FillType(FillType::Pattern); auto foregroundColor = Color::get_DarkOrange(); auto backgroundColor = Color::get_White(); portion->get_PortionFormat()->get_FillFormat()->get_PatternFormat()->get_ForeColor()->set_Color(foregroundColor); portion->get_PortionFormat()->get_FillFormat()->get_PatternFormat()->get_BackColor()->set_Color(backgroundColor); portion->get_PortionFormat()->get_FillFormat()->get_PatternFormat()->set_PatternStyle(PatternStyle::LargeGrid); shape->get_TextFrame()->get_Paragraph(0)->get_ParagraphFormat()->get_DefaultPortionFormat()->set_FontHeight(128.0f); auto textFrameFormat = shape->get_TextFrame()->get_TextFrameFormat(); textFrameFormat->set_Transform(TextShapeType::ArchUp); textFrameFormat->get_ThreeDFormat()->set_ExtrusionHeight(3.5); textFrameFormat->get_ThreeDFormat()->set_Depth(3.0); textFrameFormat->get_ThreeDFormat()->set_Material(MaterialPresetType::Plastic); textFrameFormat->get_ThreeDFormat()->get_LightRig()->set_Direction(LightingDirection::Top); textFrameFormat->get_ThreeDFormat()->get_LightRig()->set_LightType(LightRigPresetType::Balanced); textFrameFormat->get_ThreeDFormat()->get_LightRig()->SetRotation(0.0f, 0.0f, 40.0f); textFrameFormat->get_ThreeDFormat()->get_Camera()->set_CameraType(CameraPresetType::PerspectiveContrastingRightFacing); auto thumbnail = slide->GetImage(imageScale, imageScale); thumbnail->Save(u"text_3d.png"); thumbnail->Dispose(); presentation->Save(u"text_3d.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` The text is rendered as curved, extruded 3D lettering: ![Rendered 3D text with an arched WordArt transform, orange pattern fill, and dark extrusion](https://docs.aspose.com/slides/cpp/3d-presentation/img_02_05.png) ## **Keep Text Flat on a 3D Shape** To keep text readable while preserving a shape's 3D appearance, call [ITextFrameFormat::set_KeepTextFlat](https://reference.aspose.com/slides/cpp/aspose.slides/itextframeformat/set_keeptextflat/) through [ITextFrame::get_TextFrameFormat](https://reference.aspose.com/slides/cpp/aspose.slides/itextframe/get_textframeformat/). When the value is `true`, the text stays out of the 3D scene. When it is `false`, the text participates in the scene and follows its 3D orientation. This setting does not remove the shape's 3D formatting: its camera, lighting, material, and extrusion remain configured through [IShape::get_ThreeDFormat](https://reference.aspose.com/slides/cpp/aspose.slides/ishape/get_threedformat/). It is also different from ordinary rotation. [IShape::set_Rotation](https://reference.aspose.com/slides/cpp/aspose.slides/ishape/set_rotation/) rotates the shape in the slide plane, while [ITextFrameFormat::set_RotationAngle](https://reference.aspose.com/slides/cpp/aspose.slides/itextframeformat/set_rotationangle/) controls the text's custom rotation within its bounding box. Keeping text out of the 3D scene does not reset either of those angles. The following self-contained example creates a blue rectangle with text and clones it beside the original. Both shapes have the same 3D formatting; only the text setting differs: `false` on the left and `true` on the right. The camera angles are in degrees, and the extrusion height is 40 points. The example saves the presentation as PPTX and renders the comparison slide to PNG at twice its default dimensions. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System::Drawing; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 70.0f, 160.0f, 240.0f, 140.0f); shape->get_TextFrame()->set_Text(u"Readable text"); shape->get_TextFrame()->get_Paragraph(0)->get_ParagraphFormat()->get_DefaultPortionFormat()->set_FontHeight(28.0f); shape->get_TextFrame()->get_Paragraph(0)->get_ParagraphFormat()->set_Alignment(TextAlignment::Center); shape->get_TextFrame()->get_TextFrameFormat()->set_AnchoringType(TextAnchorType::Center); shape->get_FillFormat()->set_FillType(FillType::Solid); shape->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_CornflowerBlue()); shape->get_ThreeDFormat()->get_Camera()->set_CameraType(CameraPresetType::OrthographicFront); shape->get_ThreeDFormat()->get_Camera()->SetRotation(30.0f, 30.0f, 0.0f); shape->get_ThreeDFormat()->get_LightRig()->set_LightType(LightRigPresetType::Flat); shape->get_ThreeDFormat()->get_LightRig()->set_Direction(LightingDirection::Top); shape->get_ThreeDFormat()->set_Material(MaterialPresetType::Flat); shape->get_ThreeDFormat()->set_ExtrusionHeight(40.0); shape->get_ThreeDFormat()->get_ExtrusionColor()->set_Color(Color::get_RoyalBlue()); shape->get_TextFrame()->get_TextFrameFormat()->set_KeepTextFlat(false); auto clonedShape = slide->get_Shapes()->AddClone(shape, 400.0f, 160.0f); auto flatTextShape = System::ExplicitCast(clonedShape); flatTextShape->get_TextFrame()->get_TextFrameFormat()->set_KeepTextFlat(true); presentation->Save(u"keep_text_flat.pptx", SaveFormat::Pptx); auto image = slide->GetImage(2.0f, 2.0f); image->Save(u"keep_text_flat.png"); image->Dispose(); presentation->Dispose(); ``` On the left, the text follows the 3D orientation. On the right, it stays flat and easier to read. Both rectangles retain the same visible extrusion and 3D orientation. ![Side-by-side 3D rectangles: KeepTextFlat is false on the left and true on the right](https://docs.aspose.com/slides/cpp/3d-presentation/keep_text_flat.png) ## **Export and Rendering Behavior** Aspose.Slides preserves 3D formatting when saving to PowerPoint formats such as PPTX. When rendering or exporting to fixed-layout formats, the 3D scene is rasterized or drawn into the output as a 2D result. This applies when you render slides to [PNG](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-png/), export to [PDF](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-pdf/), export to [HTML](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-html/), or generate frames for [video conversion](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/). Keep these points in mind: - Exported images and PDFs are not interactive. The object cannot be rotated by the viewer after export. - The final appearance depends on the combination of camera, light rig, material, extrusion, fill, and slide scaling. - If you need to inspect inherited or theme-based formatting values, read the [effective shape properties](https://docs.aspose.com/slides/cpp/shape-effective-properties/). - Some output formats cannot store editable PowerPoint 3D formatting. In those formats, the visual result is rendered rather than preserved as editable 3D settings. ## **FAQ** **Can Aspose.Slides create interactive 3D presentations?** Aspose.Slides creates and renders PowerPoint 3D effects for shapes and text. It does not make exported images, PDFs, or HTML pages interactive 3D scenes that a viewer can rotate. In PPTX, the 3D formatting remains editable in PowerPoint where the format supports it. **What is the difference between a 3D model and a 3D effect?** A 3D model is a separate 3D object inserted into a presentation. A 3D effect is formatting applied to a regular PowerPoint shape or text, such as rotation, extrusion, bevel, lighting, and material. This article covers 3D effects. **Which settings are required for a visible 3D shape?** At minimum, set a camera rotation and either extrusion or depth. In practice, also set a light rig and material so the rendered faces have clear highlights and shadows. **Can I apply 3D effects to both shapes and text?** Yes. Use [IShape::get_ThreeDFormat](https://reference.aspose.com/slides/cpp/aspose.slides/ishape/get_threedformat/) for the shape body and [ITextFrameFormat::get_ThreeDFormat](https://reference.aspose.com/slides/cpp/aspose.slides/itextframeformat/get_threedformat/) for text. **Will 3D effects appear when exporting to images, PDF, HTML, or video frames?** Yes. Aspose.Slides renders 3D effects when producing slide images, PDF output, HTML output, and frames used for video conversion. The exported output contains the rendered appearance, not an editable 3D object. **Can I read the final 3D values after inheritance and theme settings are applied?** Yes. Use the effective formatting APIs described in [Shape Effective Properties](https://docs.aspose.com/slides/cpp/shape-effective-properties/) to read final camera, light rig, bevel, and related 3D values. # Access Presentation Slides in C++ > Learn how to access and manage slides in PowerPoint and OpenDocument presentations with Aspose.Slides for C++. Boost productivity with code examples. Source: https://docs.aspose.com/slides/cpp/access-slide-in-presentation/ Updated: 2026-08-05 ## **Overview** This article explains how to access and manage slides in a presentation using Aspose.Slides. It shows how to retrieve slides by their zero-based index from the slides collection and how to access a slide by its unique ID using the `GetSlideById` method. You will also learn how to change a slide’s position by using the `set_SlideNumber` method and how to define the starting slide number for a presentation with the `set_FirstSlideNumber` method. The examples demonstrate loading a presentation, getting slide references, updating slide order or numbering, and saving the modified presentation. ## **Access a Slide by Index** All slides in a presentation are arranged numerically based on the slide position starting from 0. The first slide is accessible through index 0; the second slide is accessed through index 1; etc. The Presentation class, representing a presentation file, exposes all slides as an [ISlideCollection](https://reference.aspose.com/slides/cpp/aspose.slides/islidecollection/) collection (collection of [ISlide](https://reference.aspose.com/slides/cpp/aspose.slides/islide/) objects). This C++ code shows you how to access a slide through its index: ```c++ #include #include #include #include using namespace Aspose::Slides; using namespace System; // The path to the documents directory. const String templatePath = u"../templates/AddSlides.pptx"; // Instantiates the Presentation class SharedPtr pres = MakeObject(templatePath); // Get a slide's reference through its index SharedPtr slide = pres->get_Slides()->idx_get(0); ``` ## **Access a Slide by ID** Each slide in a presentation has a unique ID associated with it. You can use the [GetSlideById()](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/getslidebyid/) method (exposed by the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) class) to target that ID. This C++ code shows you how to provide a valid slide ID and access that slide through the [GetSlideById()](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/getslidebyid/) method: ```c++ #include #include #include #include #include using namespace Aspose::Slides; using namespace System; // The path to the documents directory. const String templatePath = u"../templates/AddSlides.pptx"; // Instantiates the Presentation class SharedPtr pres = MakeObject(templatePath); // Gets a slide ID int id = pres->get_Slides()->idx_get(0)->get_SlideId(); // Accesses the slide through its ID SharedPtr slide = pres->GetSlideById(id); ``` ## **Change Slide Position** Aspose.Slides allow you to change a slide position. For example, you can specify that the first slide should become the second slide. 1. Create an instance of the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) class. 1. Get the slide's reference (whose position you want to change) through its index 1. Set a new position for the slide through the [set_SlideNumber()](https://reference.aspose.com/slides/cpp/aspose.slides/islide/set_slidenumber/) property. 1. Save the modified presentation. This C++ code demonstrates an operation in which the slide in position 1 is moved to position 2: ```c++ #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; // The path to the documents directory. const String templatePath = u"../templates/AddSlides.pptx"; const String outPath = u"../out/ChangeSlidePosition.pptx"; // Instantiates the Presentation class SharedPtr pres = MakeObject(templatePath); // Gets the slide whose position will be changed SharedPtr slide = pres->get_Slides()->idx_get(0); // Sets the new position for the slide slide->set_SlideNumber(2); // Saves the modified presentation pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx); ``` The first slide became the second; the second slide became the first. When you change a slide's position, other slides are automatically adjusted. ## **Set the Slide Number** Using the [set_FirstSlideNumber()](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/set_firstslidenumber/) property (exposed by the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) class), you can specify a new number for the first slide in a presentation. This operation causes other slide numbers to be recalculated. 1. Create an instance of the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) class. 1. Get the slide number. 1. Set the slide number. 1. Save the modified presentation. This C++ code demonstrates an operation where the first slide number is set to 10: ```c++ #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; // The path to the documents directory. const String outPath = u"../out/SetSlideNumber_out.pptx"; const String templatePath = u"../templates/AccessSlides.pptx"; //Instantiates the Presentation class SharedPtr pres = MakeObject(templatePath); // Gets the slide number int firstSlideNumber = pres->get_FirstSlideNumber(); // Sets the slide number pres->set_FirstSlideNumber(2); // Saves the modified presentation pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx); ``` If you prefer to skip the first slide, you can start the numbering from the second slide (and hide the numbering for the first slide) this way: ```c++ #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(); auto layoutSlide = presentation->get_LayoutSlides()->GetByType(SlideLayoutType::Blank); auto slides = presentation->get_Slides(); slides->AddEmptySlide(layoutSlide); slides->AddEmptySlide(layoutSlide); slides->AddEmptySlide(layoutSlide); // Sets the number for the first presentation slide presentation->set_FirstSlideNumber(0); // Shows slide numbers for all slides presentation->get_HeaderFooterManager()->SetAllSlideNumbersVisibility(true); // Hides the slide number for the first slide slides->idx_get(0)->get_HeaderFooterManager()->SetSlideNumberVisibility(false); // Saves the modified presentation presentation->Save(u"output.pptx", SaveFormat::Pptx); ``` ## **FAQ** ### Does the slide number a user sees match the collection’s zero-based index? The number shown on a slide can start from an arbitrary value (e.g., 10) and does not have to match the index; the relationship is controlled by the presentation’s [first slide number](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/set_firstslidenumber/) setting. ### Do hidden slides affect indexing? Yes. A hidden slide remains in the collection and is counted in indexing; "hidden" refers to display, not its position in the collection. ### Does a slide’s index change when other slides are added or removed? Yes. Indexes always reflect the current order in slides and are recalculated upon insert, delete, and move operations. # Manage ActiveX Controls in Presentations Using C++ > Learn how Aspose.Slides for C++ leverages ActiveX to automate and enhance PowerPoint presentations, giving developers powerful control over slides. Source: https://docs.aspose.com/slides/cpp/activex/ Updated: 2026-08-05 ## **Introduction** ActiveX control are used in presentations. Aspose.Slides for C++ lets you manage ActiveX controls, but managing them is bit trickier and different from normal presentation shapes. From Aspose.Slides for C++ 18.1, the component supports managing ActiveX controls. At the moment, you can access already added ActiveX control in your presentation and modify or delete it by using its various properties. Remember, ActiveX controls are not shapes and are not part of the presentation's IShapeCollection but the separate IControlCollection. This article shows how to work with them. ## **Modify an ActiveX Control** To manage a simple ActiveX control like a text box and simple command button on a slide: 1. Create an instance of the Presentation class and load the presentation with ActiveX controls in it. 1. Obtain a slide reference by its index. 1. Access the ActiveX controls in the slide by accessing the IControlCollection. 1. Access the TextBox1 ActiveX control using the ControlEx object. 1. Change the different properties of the TextBox1 ActiveX control including text, font, font height and frame position. 1. Access the second access control called CommandButton1. 1. Change the button caption, font and position. 1. Shift the position of the ActiveX controls frames. 1. Write the modified presentation to a PPTX file. The code snippet below updates the ActiveX controls on the presentation slides to the slide as shown below. ``` cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::Drawing; using namespace System::IO; // Accessing the presentation with ActiveX controls auto presentation = System::MakeObject(u"ActiveX.pptm"); // Accessing the first slide in presentation auto slide = presentation->get_Slides()->idx_get(0); // changing TextBox text auto control = slide->get_Controls()->idx_get(0); if (control->get_Name() == u"TextBox1" && control->get_Properties() != nullptr) { String newText = u"Changed text"; control->get_Properties()->idx_set(u"Value", newText); // changing substitute image. Powerpoint will replace this image during activeX activation, so sometime it's OK to leave image unchanged. auto image = System::MakeObject((int32_t)control->get_Frame()->get_Width(), (int32_t)control->get_Frame()->get_Height()); auto graphics = Graphics::FromImage(image); auto brush = System::MakeObject(Color::FromKnownColor(KnownColor::Window)); graphics->FillRectangle(brush, 0, 0, image->get_Width(), image->get_Height()); auto font = System::MakeObject(control->get_Properties()->idx_get(u"FontName"), 14.0f); brush = System::MakeObject(Color::FromKnownColor(KnownColor::WindowText)); graphics->DrawString(newText, font, brush, 10.0f, 4.0f); auto pen = System::MakeObject(Color::FromKnownColor(KnownColor::ControlDark), 1.0f); graphics->DrawLines(pen, System::MakeArray({ System::Drawing::Point(0, image->get_Height() - 1), Point(0, 0), System::Drawing::Point(image->get_Width() - 1, 0) })); pen = System::MakeObject(Color::FromKnownColor(KnownColor::ControlDarkDark), 1.0f); graphics->DrawLines(pen, System::MakeArray({ System::Drawing::Point(1, image->get_Height() - 2), Point(1, 1), System::Drawing::Point(image->get_Width() - 2, 1) })); pen = System::MakeObject(Color::FromKnownColor(KnownColor::ControlLight), 1.0f); graphics->DrawLines(pen, System::MakeArray({ System::Drawing::Point(1, image->get_Height() - 1), System::Drawing::Point(image->get_Width() - 1, image->get_Height() - 1), System::Drawing::Point(image->get_Width() - 1, 1) })); pen = System::MakeObject(Color::FromKnownColor(KnownColor::ControlLightLight), 1.0f); graphics->DrawLines(pen, System::MakeArray({ System::Drawing::Point(0, image->get_Height()), System::Drawing::Point(image->get_Width(), image->get_Height()), System::Drawing::Point(image->get_Width(), 0) })); System::SharedPtr ms = System::MakeObject(); image->Save(ms, System::Drawing::Imaging::ImageFormat::get_Png()); ms->Seek(0, System::IO::SeekOrigin::Begin); control->get_SubstitutePictureFormat()->get_Picture()->set_Image(presentation->get_Images()->AddImage(ms)); } // changing Button caption control = slide->get_Controls()->idx_get(1); if (control->get_Name() == u"CommandButton1" && control->get_Properties() != nullptr) { String newCaption = u"MessageBox"; control->get_Properties()->idx_set(u"Caption", newCaption); // changing substitute auto image = System::MakeObject((int32_t)control->get_Frame()->get_Width(), (int32_t)control->get_Frame()->get_Height()); auto graphics = Graphics::FromImage(image); auto brush = System::MakeObject(Color::FromKnownColor(KnownColor::Control)); graphics->FillRectangle(brush, 0, 0, image->get_Width(), image->get_Height()); auto font = System::MakeObject(control->get_Properties()->idx_get(u"FontName"), 14.0f); brush = System::MakeObject(Color::FromKnownColor(KnownColor::WindowText)); SizeF textSize = graphics->MeasureString(newCaption, font, std::numeric_limits::max()); graphics->DrawString(newCaption, font, brush, (image->get_Width() - textSize.get_Width()) / 2, (image->get_Height() - textSize.get_Height()) / 2); auto pen = System::MakeObject(Color::FromKnownColor(KnownColor::ControlLightLight), 1.0f); graphics->DrawLines(pen, System::MakeArray({ System::Drawing::Point(0, image->get_Height() - 1), Point(0, 0), System::Drawing::Point(image->get_Width() - 1, 0) })); pen = System::MakeObject(Color::FromKnownColor(KnownColor::ControlLight), 1.0f); graphics->DrawLines(pen, System::MakeArray({ System::Drawing::Point(1, image->get_Height() - 2), Point(1, 1), System::Drawing::Point(image->get_Width() - 2, 1) })); pen = System::MakeObject(Color::FromKnownColor(KnownColor::ControlDark), 1.0f); graphics->DrawLines(pen, System::MakeArray({ System::Drawing::Point(1, image->get_Height() - 1), System::Drawing::Point(image->get_Width() - 1, image->get_Height() - 1), System::Drawing::Point(image->get_Width() - 1, 1) })); pen = System::MakeObject(Color::FromKnownColor(KnownColor::ControlDarkDark), 1.0f); graphics->DrawLines(pen, System::MakeArray({ System::Drawing::Point(0, image->get_Height()), System::Drawing::Point(image->get_Width(), image->get_Height()), System::Drawing::Point(image->get_Width(), 0) })); System::SharedPtr ms = System::MakeObject(); image->Save(ms, System::Drawing::Imaging::ImageFormat::get_Png()); ms->Seek(0, System::IO::SeekOrigin::Begin); control->get_SubstitutePictureFormat()->get_Picture()->set_Image(presentation->get_Images()->AddImage(ms)); } // Moving ActiveX frames 100 points down for (const auto& ctl : System::IterateOver(slide->get_Controls())) { SharedPtr frame = ctl->get_Frame(); ctl->set_Frame(System::MakeObject(frame->get_X(), frame->get_Y() + 100, frame->get_Width(), frame->get_Height(), frame->get_FlipH(), frame->get_FlipV(), frame->get_Rotation())); } // Save the presentation with Edited ActiveX Controls presentation->Save(u"withActiveX-edited_out.pptm", SaveFormat::Pptm); // Now removing controls slide->get_Controls()->Clear(); // Saving the presentation with cleared ActiveX controls presentation->Save(u"withActiveX.cleared_out.pptm", SaveFormat::Pptm); ``` ## **Add an Media Player ActiveX Control** ActiveX control are used in presentations. Aspose.Slides for C++ lets you add and manage ActiveX controls, but managing them is bit trickier and different from normal presentation shapes. From Aspose.Slides for C++ 18.1, the support for adding Media Player ActiveX control has been added in Aspose.Slides. Remember, ActiveX controls are not shapes and are not part of the presentation's IShapeCollection but the separate IControlExCollection. This article shows how to work with them. To manage a Media Player ActiveX control, please perform following steps: 1. Create an instance of the Presentation class and load the sample presentation with Media Player ActiveX controls in it. 1. Create an instance of target Presentation class and generate empty presentation instance. 1. Clone the slide with Media Player ActiveX control in template presentation to target Presentation. 1. Access the cloned slide in target Presentation. 1. Access the ActiveX controls in the slide by accessing the IControlCollection. 1. Access the Media Player ActiveX control and set the video path by using its properties. 1. Save the presentation to a PPTX file. ``` cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; // Instantiate Presentation class that represents PPTX file auto presentation = System::MakeObject(u"template.pptx"); // Create empty presentation instance auto newPresentation = System::MakeObject(); // Remove default slide newPresentation->get_Slides()->RemoveAt(0); // Clone slide with Media Player ActiveX Control newPresentation->get_Slides()->InsertClone(0, presentation->get_Slides()->idx_get(0)); // Access the Media Player ActiveX control and set the video path newPresentation->get_Slides()->idx_get(0)->get_Controls()->idx_get(0)->get_Properties()->idx_set(u"URL", u"Wildlife.mp4"); // Save the Presentation newPresentation->Save(u"LinkingVideoActiveXControl_out.pptx", SaveFormat::Pptx); ``` ## **FAQ** ### Does Aspose.Slides preserve ActiveX controls when reading and re-saving if they cannot be executed in the C++ runtime? Yes. Aspose.Slides treats them as part of the presentation and can read/modify their properties and frames; executing the controls themselves is not required to preserve them. ### How do ActiveX controls differ from OLE objects in a presentation? ActiveX controls are interactive managed controls (buttons, text boxes, media player), whereas [OLE](https://docs.aspose.com/slides/cpp/manage-ole/) refers to embedded application objects (for example, an Excel worksheet). They are stored and handled differently and have different property models. ### Do ActiveX events and VBA macros work if the file has been modified by Aspose.Slides? Aspose.Slides preserves the existing markup and metadata; however, events and macros run only inside PowerPoint on Windows when security allows it. The library does not execute VBA. ## Related articles - [ActiveX](https://docs.aspose.com/slides/cpp/examples/elements/activex/) # Add Slides to Presentations in C++ > Easily add slides to your PowerPoint and OpenDocument presentations using Aspose.Slides for C++ — seamless, efficient slide insertion in seconds. Source: https://docs.aspose.com/slides/cpp/add-slide-to-presentation/ Updated: 2026-08-02 ## **Overview** Aspose.Slides allows you to add slides to PowerPoint presentations programmatically. A presentation contains master/layout slides and normal slides, and normal slides are arranged by a zero-based index. Each slide has a unique ID, and presentation files without slides are not supported. This article explains how to create a `Presentation` object, access its slide collection, add an empty slide, work with the newly added slide, and save the updated presentation. It also covers related points such as inserting slides at a specific position, using layouts, and understanding the blank slide that exists in a newly created presentation. ## **Add a Slide to a Presentation** Before talking about adding slides to the presentation files, let us discuss some facts about the slides. Each PowerPoint presentation file contains Master / Layout slide and other Normal slides. It means that a presentation file contains at least one or more slides. It is important to know that presentation files without slides are not supported by Aspose.Slides for C++. Each slide has unique Id and all the Normal Slides are arranged in an order specified by the zero based index. Aspose.Slides for C++ allows developers to add empty slides to their presentation. To add an empty slide in the presentation, please follow the steps below: - Create an instance of [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) class. - Instantiate [ISlideCollection](https://reference.aspose.com/slides/cpp/aspose.slides/islidecollection/) class by setting a reference to the Slides (collection of content Slide objects) property exposed by the Presentation object. - Add an empty slide to the presentation at the end of the content slides collection by calling the AddEmptySlide methods exposed by ISlideCollection object - Do some work with the newly added empty slide. - Finally, write the presentation file using the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) object. ```cpp For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C // The path to the documents directory. const String outPath = u"../templates/AddSlides.pptx"; // Instantiate Presentation class that represents the presentation file SharedPtr pres = MakeObject(); // Instantiate SlideCollection calss SharedPtr slds = pres->get_Slides(); for (int i = 0; i < pres->get_LayoutSlides()->get_Count(); i++) { // Add an empty slide to the Slides collection slds->AddEmptySlide(pres->get_LayoutSlides()->idx_get(i)); } // Save the PPTX file to the Disk pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx); ``` [Source: Examples-SlidesCPP-AddSlides-AddSlides.cpp](https://gist.githubusercontent.com/aspose-slides/a690df625dc0b1fff869ab198affe7a4/raw/3e22c49035e4668fefecb08c34ab75b166e6ee22/Examples-SlidesCPP-AddSlides-AddSlides.cpp) ## **FAQ** ### Can I insert a new slide at a specific position, not just at the end? Yes. The library supports slide collections and [insert](https://reference.aspose.com/slides/cpp/aspose.slides/slidecollection/insertemptyslide/)/[clone](https://reference.aspose.com/slides/cpp/aspose.slides/slidecollection/insertclone/) operations, so you can add a slide at the required index rather than only at the end. ### Are the theme/styles preserved when adding a slide based on a layout? Yes. A layout inherits formatting from its master, and the new slide inherits from the selected layout and its associated master. ### Which slide is present in a new "empty" presentation before adding slides? A newly created presentation already contains one blank slide with index zero. This is important to consider when calculating insertion indices. ### How do I choose the "right" layout for a new slide if the master has many options? Generally choose the [LayoutSlide](https://reference.aspose.com/slides/cpp/aspose.slides/layoutslide/) that matches the required structure ([Title and Content, Two Content, etc.](https://reference.aspose.com/slides/cpp/aspose.slides/slidelayouttype/)). If such a layout is missing, you can [add it to the master](https://docs.aspose.com/slides/cpp/slide-layout/) and then use it. # Animate PowerPoint Charts in C++ > Create stunning animated charts in C++ with Aspose.Slides. Boost presentations with dynamic visuals in PPT and PPTX files—get started now. Source: https://docs.aspose.com/slides/cpp/animated-charts/ Updated: 2026-11-08 ## **Introduction** Aspose.Slides supports animating the chart elements. **Series**, **Categories**, **Series Elements**, **Categories Elements** can be animated with [ISequence::AddEffect](https://reference.aspose.com/slides/cpp/aspose.slides.animation/isequence/addeffect/) method and two enums [EffectChartMajorGroupingType](https://reference.aspose.com/slides/cpp/aspose.slides.animation/effectchartmajorgroupingtype/) and [EffectChartMinorGroupingType](https://reference.aspose.com/slides/cpp/aspose.slides.animation/effectchartminorgroupingtype/). [![Two-series, two-category grids compare grouping by series, category, element within series, and element within category.](https://docs.aspose.com/slides/cpp/animated-charts/visual-chart-animation-grouping-51704783a7c6.svg)](https://docs.aspose.com/slides/cpp/animated-charts/visual-chart-animation-grouping-51704783a7c6.svg) *Schematic comparison using two series and two categories. Numbers identify illustrative reveal steps, not data values: grouping selects which marks animate together. Actual order and triggers depend on the effects added to the sequence.* ## **Chart Series Animation** If you want to animate a chart series, write the code according to the steps listed below: 1. Load a presentation. 1. Get reference of the chart object. 1. Animate the series. 1. Write the presentation file to disk. In the example given below, we animated chart series. ```cpp For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C // The path to the documents directory. const String templatePath = u"../templates/ExistingChart.pptx"; const String outPath = u"../out/AnimatingSeries.pptx"; //Instantiate Presentation class that represents PPTX file SharedPtr pres = MakeObject(templatePath); //Access first slide SharedPtr slide = pres->get_Slides()->idx_get(0); // Add chart with default data auto chart = DynamicCast(slide->get_Shapes()->idx_get(0)); // Animate series slide->get_Timeline()->get_MainSequence()->AddEffect(chart, EffectType::Fade, EffectSubtype::None, EffectTriggerType::AfterPrevious); auto sequence = DynamicCast(slide->get_Timeline()->get_MainSequence()); sequence->AddEffect(chart,EffectChartMajorGroupingType::BySeries, 0,EffectType::Appear, EffectSubtype::None, EffectTriggerType::AfterPrevious); sequence->AddEffect(chart,EffectChartMajorGroupingType::BySeries, 1,EffectType::Appear, EffectSubtype::None, EffectTriggerType::AfterPrevious); sequence->AddEffect(chart,EffectChartMajorGroupingType::BySeries, 2,EffectType::Appear, EffectSubtype::None, EffectTriggerType::AfterPrevious); sequence->AddEffect(chart,EffectChartMajorGroupingType::BySeries, 3,EffectType::Appear, EffectSubtype::None, EffectTriggerType::AfterPrevious); // Write the presentation file to disk pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx); ``` [Source: Examples-SlidesCPP-AnimatingSeries-AnimatingSeries.cpp](https://gist.githubusercontent.com/aspose-slides/a690df625dc0b1fff869ab198affe7a4/raw/c9f4a456b4f9f0ad86611c81a56e8df342483857/Examples-SlidesCPP-AnimatingSeries-AnimatingSeries.cpp) ## **Animation in a Series Element** If you want to animate series elements, write the code according to the steps listed below: 1. Load a presentation. 1. Get reference of the chart object. 1. Animate series elements. 1. Write the presentation file to disk. In the example given below, we have animated series' elements. ```cpp For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C // The path to the documents directory. const String templatePath = u"../templates/ExistingChart.pptx"; const String outPath = u"../out/AnimatingSeriesElements.pptx"; //Instantiate Presentation class that represents PPTX file SharedPtr pres = MakeObject(templatePath); //Access first slide SharedPtr slide = pres->get_Slides()->idx_get(0); // Add chart with default data auto chart = DynamicCast(slide->get_Shapes()->idx_get(0)); // Animate series elements slide->get_Timeline()->get_MainSequence()->AddEffect(chart, EffectType::Fade, EffectSubtype::None, EffectTriggerType::AfterPrevious); auto sequence = DynamicCast(slide->get_Timeline()->get_MainSequence()); sequence->AddEffect(chart, EffectChartMinorGroupingType::ByElementInSeries, 0, 0, EffectType::Appear, EffectSubtype::None, EffectTriggerType::AfterPrevious); sequence->AddEffect(chart, EffectChartMinorGroupingType::ByElementInSeries, 0, 1, EffectType::Appear, EffectSubtype::None, EffectTriggerType::AfterPrevious); sequence->AddEffect(chart, EffectChartMinorGroupingType::ByElementInSeries, 0, 2, EffectType::Appear, EffectSubtype::None, EffectTriggerType::AfterPrevious); sequence->AddEffect(chart, EffectChartMinorGroupingType::ByElementInSeries, 0, 3, EffectType::Appear, EffectSubtype::None, EffectTriggerType::AfterPrevious); sequence->AddEffect(chart, EffectChartMinorGroupingType::ByElementInSeries, 1, 0, EffectType::Appear, EffectSubtype::None, EffectTriggerType::AfterPrevious); sequence->AddEffect(chart, EffectChartMinorGroupingType::ByElementInSeries, 1, 1, EffectType::Appear, EffectSubtype::None, EffectTriggerType::AfterPrevious); sequence->AddEffect(chart, EffectChartMinorGroupingType::ByElementInSeries, 1, 2, EffectType::Appear, EffectSubtype::None, EffectTriggerType::AfterPrevious); sequence->AddEffect(chart, EffectChartMinorGroupingType::ByElementInSeries, 1, 3, EffectType::Appear, EffectSubtype::None, EffectTriggerType::AfterPrevious); sequence->AddEffect(chart, EffectChartMinorGroupingType::ByElementInSeries, 2, 0, EffectType::Appear, EffectSubtype::None, EffectTriggerType::AfterPrevious); sequence->AddEffect(chart, EffectChartMinorGroupingType::ByElementInSeries, 2, 1, EffectType::Appear, EffectSubtype::None, EffectTriggerType::AfterPrevious); sequence->AddEffect(chart, EffectChartMinorGroupingType::ByElementInSeries, 2, 2, EffectType::Appear, EffectSubtype::None, EffectTriggerType::AfterPrevious); sequence->AddEffect(chart, EffectChartMinorGroupingType::ByElementInSeries, 2, 3, EffectType::Appear, EffectSubtype::None, EffectTriggerType::AfterPrevious); // Write the presentation file to disk pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx); ``` [Source: Examples-SlidesCPP-AnimatingSeriesElements-AnimatingSeriesElements.cpp](https://gist.githubusercontent.com/aspose-slides/a690df625dc0b1fff869ab198affe7a4/raw/055b12f2528a4cb08b3b4d50bedda62bf7738e59/Examples-SlidesCPP-AnimatingSeriesElements-AnimatingSeriesElements.cpp) ## **Chart Category Animation** If you want to animate a chart series, write the code according to the steps listed below: 1. Load a presentation. 1. Get reference of the chart object. 1. Animate the Category. 1. Write the presentation file to disk. In the example given below, we animated chart category. ```cpp For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C // The path to the documents directory. const String templatePath = u"../templates/ExistingChart.pptx"; const String outPath = u"../out/AnimatingSeries.pptx"; //Instantiate Presentation class that represents PPTX file SharedPtr pres = MakeObject(templatePath); //Access first slide SharedPtr slide = pres->get_Slides()->idx_get(0); // Add chart with default data auto chart = DynamicCast(slide->get_Shapes()->idx_get(0)); // Animate series slide->get_Timeline()->get_MainSequence()->AddEffect(chart, EffectType::Fade, EffectSubtype::None, EffectTriggerType::AfterPrevious); auto sequence = DynamicCast(slide->get_Timeline()->get_MainSequence()); sequence->AddEffect(chart,EffectChartMajorGroupingType::BySeries, 0,EffectType::Appear, EffectSubtype::None, EffectTriggerType::AfterPrevious); sequence->AddEffect(chart,EffectChartMajorGroupingType::BySeries, 1,EffectType::Appear, EffectSubtype::None, EffectTriggerType::AfterPrevious); sequence->AddEffect(chart,EffectChartMajorGroupingType::BySeries, 2,EffectType::Appear, EffectSubtype::None, EffectTriggerType::AfterPrevious); sequence->AddEffect(chart,EffectChartMajorGroupingType::BySeries, 3,EffectType::Appear, EffectSubtype::None, EffectTriggerType::AfterPrevious); // Write the presentation file to disk pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx); ``` [Source: Examples-SlidesCPP-AnimatingSeries-AnimatingSeries.cpp](https://gist.githubusercontent.com/aspose-slides/a690df625dc0b1fff869ab198affe7a4/raw/c9f4a456b4f9f0ad86611c81a56e8df342483857/Examples-SlidesCPP-AnimatingSeries-AnimatingSeries.cpp) ## **Animation in a Category Element** If you want to animate categories elements, write the code according to the steps listed below: 1. Load a presentation. 1. Get reference of the chart object. 1. Animate categories elements. 1. Write the presentation file to disk. In the example given below, we have animated categories elements. ```cpp For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C // The path to the documents directory. const String templatePath = u"../templates/ExistingChart.pptx"; const String outPath = u"../out/AnimatingCategoriesElements_out.pptx"; //Instantiate Presentation class that represents PPTX file SharedPtr pres = MakeObject(templatePath); //Access first slide SharedPtr slide = pres->get_Slides()->idx_get(0); // Add chart with default data auto chart = DynamicCast(slide->get_Shapes()->idx_get(0)); // Animate categories' elements slide->get_Timeline()->get_MainSequence()->AddEffect(chart, EffectType::Fade, EffectSubtype::None, EffectTriggerType::AfterPrevious); auto sequence = DynamicCast(slide->get_Timeline()->get_MainSequence()); sequence->AddEffect(chart, EffectChartMinorGroupingType::ByElementInCategory, 0, 0, EffectType::Appear, EffectSubtype::None, EffectTriggerType::AfterPrevious); sequence->AddEffect(chart, EffectChartMinorGroupingType::ByElementInCategory, 0, 1, EffectType::Appear, EffectSubtype::None, EffectTriggerType::AfterPrevious); sequence->AddEffect(chart, EffectChartMinorGroupingType::ByElementInCategory, 0, 2, EffectType::Appear, EffectSubtype::None, EffectTriggerType::AfterPrevious); sequence->AddEffect(chart, EffectChartMinorGroupingType::ByElementInCategory, 0, 3, EffectType::Appear, EffectSubtype::None, EffectTriggerType::AfterPrevious); sequence->AddEffect(chart, EffectChartMinorGroupingType::ByElementInCategory, 1, 0, EffectType::Appear, EffectSubtype::None, EffectTriggerType::AfterPrevious); sequence->AddEffect(chart, EffectChartMinorGroupingType::ByElementInCategory, 1, 1, EffectType::Appear, EffectSubtype::None, EffectTriggerType::AfterPrevious); sequence->AddEffect(chart, EffectChartMinorGroupingType::ByElementInCategory, 1, 2, EffectType::Appear, EffectSubtype::None, EffectTriggerType::AfterPrevious); sequence->AddEffect(chart, EffectChartMinorGroupingType::ByElementInCategory, 1, 3, EffectType::Appear, EffectSubtype::None, EffectTriggerType::AfterPrevious); sequence->AddEffect(chart, EffectChartMinorGroupingType::ByElementInCategory, 2, 0, EffectType::Appear, EffectSubtype::None, EffectTriggerType::AfterPrevious); sequence->AddEffect(chart, EffectChartMinorGroupingType::ByElementInCategory, 2, 1, EffectType::Appear, EffectSubtype::None, EffectTriggerType::AfterPrevious); sequence->AddEffect(chart, EffectChartMinorGroupingType:: ByElementInCategory, 2, 2, EffectType::Appear, EffectSubtype::None, EffectTriggerType::AfterPrevious); sequence->AddEffect(chart, EffectChartMinorGroupingType::ByElementInCategory, 2, 3, EffectType::Appear, EffectSubtype::None, EffectTriggerType::AfterPrevious); // Write the presentation file to disk pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx); ``` [Source: Examples-SlidesCPP-AnimatingCategoriesElements-AnimatingCategoriesElements.cpp](https://gist.githubusercontent.com/aspose-slides/a690df625dc0b1fff869ab198affe7a4/raw/775e01456fb83ba524b45f759a10049a835d214a/Examples-SlidesCPP-AnimatingCategoriesElements-AnimatingCategoriesElements.cpp) ## **FAQ** ### Are different effect types (e.g., entrance, emphasis, exit) supported for charts like for regular shapes? Yes. A chart is treated as a shape, so it supports the standard animation effect types, including entrance, emphasis, and exit, with full control via the slide's timeline and animation sequences. ### Can I combine chart animation with slide transitions? Yes. [Transitions](https://docs.aspose.com/slides/cpp/slide-transition/) apply to the slide, while animation effects apply to objects on the slide. You can use both together in the same presentation and control them independently. ### Are chart animations preserved when saving to PPTX? Yes. When you [save to PPTX](https://docs.aspose.com/slides/cpp/save-presentation/), all animation effects and their ordering are preserved because they are part of the presentation's native animation model. ### Can I read existing chart animations from a presentation and modify them? Yes. The [API](https://reference.aspose.com/slides/cpp/aspose.slides.animation/) provides access to the slide timeline, sequences, and effects, allowing you to inspect existing chart animations and adjust them without recreating everything from scratch. ### Can I produce a video that includes chart animations using Aspose.Slides? Yes. You can [export a presentation to video](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/) while preserving animations, configuring timings and other export settings so the resulting clip reflects the animated playback. ## Related articles - [Animate PowerPoint Text in C++](https://docs.aspose.com/slides/cpp/animated-text/) - [Enhance PowerPoint Presentations with Animations in C++](https://docs.aspose.com/slides/cpp/powerpoint-animation/) # Animate PowerPoint Text in C++ > Create dynamic animated text in PowerPoint and OpenDocument presentations using Aspose.Slides for C++, with easy-to-follow, optimized C++ code examples. Source: https://docs.aspose.com/slides/cpp/animated-text/ Updated: 2026-08-05 ## **Overview** This article explains how to work with animated text in Aspose.Slides by applying animation effects to individual paragraphs and retrieving the effects already assigned to paragraphs in a text frame. It focuses on the API methods used to add paragraph-level animation and inspect existing paragraph animation effects in a presentation. ## **Add Animation Effects to Paragraphs** We added the [**AddEffect()**](https://reference.aspose.com/slides/cpp/class/aspose.slides.animation.sequence#a255eb5aaf90861b01980047bc06ead4f) method to the [**Sequence**](https://reference.aspose.com/slides/cpp/class/aspose.slides.animation.sequence) and [**ISequence**](https://reference.aspose.com/slides/cpp/class/aspose.slides.animation.i_sequence) classes. This method allows you to add animation effects to a single paragraph. This sample code shows you how to add an animation effect to a single paragraph: ``` cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Animation; using namespace Aspose::Slides::Export; using namespace System; String dataDir = u"../data/"; auto presentation = System::MakeObject(dataDir + u"Presentation1.pptx"); // select paragraph to add effect auto autoShape = System::ExplicitCast(presentation->get_Slides()->idx_get(0)->get_Shapes()->idx_get(0)); auto paragraph = autoShape->get_TextFrame()->get_Paragraphs()->idx_get(0); // add Fly animation effect to selected paragraph auto sequence = presentation->get_Slides()->idx_get(0)->get_Timeline()->get_MainSequence(); auto effect = sequence->AddEffect(paragraph, EffectType::Fly, EffectSubtype::Left, EffectTriggerType::OnClick); presentation->Save(dataDir + u"AnimationEffectinParagraph.pptx", SaveFormat::Pptx); ``` ## **Get Animation Effects for Paragraphs** You may decide to find out the animation effects added to a paragraph for example, in one scenario, you want to get the animation effects in a paragraph because you plan to apply those effects to another paragraph or shape. Aspose.Slides for C++ allows you to get all the animation effects applied to paragraphs contained in a text frame (shape). This sample code shows you how to get the animation effects in a paragraph: ``` cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Animation; using namespace System; String dataDir = u"../data/"; auto pres = System::MakeObject(dataDir + u"Test.pptx"); auto sequence = pres->get_Slides()->idx_get(0)->get_Timeline()->get_MainSequence(); auto autoShape = System::ExplicitCast(pres->get_Slides()->idx_get(0)->get_Shapes()->idx_get(1)); for (auto paragraph : autoShape->get_TextFrame()->get_Paragraphs()) { auto effects = sequence->GetEffectsByParagraph(paragraph); if (effects->get_Length() > 0) { Console::WriteLine(String(u"Paragraph \"") + paragraph->get_Text() + u"\" has " + ObjectExt::ToString(effects[0]->get_Type()) + u" effect."); } } ``` ## **FAQ** ### How do text animations differ from slide transitions, and can they be combined? Text animations control object behavior over time on a slide, while [transitions](https://docs.aspose.com/slides/cpp/slide-transition/) control how slides change. They’re independent and can be used together; playback order is governed by the animation timeline and the transition settings. ### Are text animations preserved when exporting to PDF or images? No. PDF and raster images are static, so you’ll see a single state of the slide without motion. To keep movement, use [video](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/) or [HTML](https://docs.aspose.com/slides/cpp/export-to-html5/) export. ### Do text animations work in layouts and the slide master? Effects applied to layout/master objects are inherited by slides, but their timing and interaction with slide-level animations depend on the final sequence on the slide. ## Related articles - [Animation](https://docs.aspose.com/slides/cpp/examples/elements/animation/) - [Animate PowerPoint Charts in C++](https://docs.aspose.com/slides/cpp/animated-charts/) - [Enhance PowerPoint Presentations with Animations in C++](https://docs.aspose.com/slides/cpp/powerpoint-animation/) # API Limitations > Know Aspose.Slides for C++ limits: exports set fixed Application/Producer metadata in PPT, PPTX, ODP, and PDF—helping you plan integrations without surprises. Source: https://docs.aspose.com/slides/cpp/api-limitations/ Updated: 2026-05-13 ## **Overview** When presentations are created or exported with Aspose.Slides, certain technical metadata is written to the output file. This article explains the limitations related to the `Application`, `Creator`, and `Producer` metadata fields in PPTX and PDF files. ## **Application and Producer** When you create or export presentations with Aspose.Slides for C++, some technical metadata is written into the file. Two fields often raise questions: **Application** identifies the program that created or last saved a **PPTX** presentation. In Aspose.Slides for C++, this value is fixed and shows the library vendor rather than your app name, even if you use [DocumentProperties::set_NameOfApplication](https://reference.aspose.com/slides/cpp/aspose.slides/documentproperties/set_nameofapplication/). **Producer** identifies the rendering engine that generated the final file during export. In **PDF** exports, metadata uses **Creator** and **Producer** fields. With Aspose.Slides for C++, both of these are fixed and reflect the library and its version. **What’s restricted** You cannot override these fields through the API for the formats above. For **PPTX**, the Application property is written as "Aspose.Slides for C++". For **PDF**, the Creator and Producer properties are written as "Aspose.Slides for C++ x.x.x". This behavior is by design and applies regardless of how you load or save the file, and regardless of values assigned using [DocumentProperties::set_NameOfApplication](https://reference.aspose.com/slides/cpp/aspose.slides/documentproperties/set_nameofapplication/). # API Reference > Create, edit, and convert presentations in C++—no PowerPoint needed. Aspose.Slides supports PPT, PPTX, and ODP with fast SVG/PDF export. Source: https://docs.aspose.com/slides/cpp/api-reference/ Updated: 2026-08-13 Aspose.Slides for C++ is a class library that enables C++ applications to read and write presentation documents without using Microsoft PowerPoint® or others. Aspose.Slides for C++ allows to manage text, shapes, tables & animations, add audio and video to slides, preview slides, export slides to SVG, PDF format and more. Latest API Reference can be found at [Aspose.Slides for C++ API Reference](https://reference.aspose.com/slides/cpp/). ## Related articles - [Aspose.Slides for C++](https://docs.aspose.com/slides/cpp/) - [File Formats and Conversions - C++ PowerPoint API](https://docs.aspose.com/slides/cpp/file-formats-and-conversions/) - [Convert OpenDocument Presentations in C++](https://docs.aspose.com/slides/cpp/convert-openoffice-odp/) # Restrict Presentation Edits with Shape Locks in C++ > Learn how to lock and unlock shapes in PPTX presentations with Aspose.Slides for C++ to restrict selection, movement, resizing, and grouping. Source: https://docs.aspose.com/slides/cpp/applying-protection-to-presentation/ Updated: 2026-10-20 ## **Background** A common use for Aspose.Slides for C++ is to create, update, and save PowerPoint (PPTX) presentations as part of an automated workflow. When users receive these presentations, restricting changes to shapes can help preserve the intended layout and content. This article explains how shapes are organized on slides and how to apply and remove shape locks in a PPTX presentation. These locks let you restrict specific editing operations on individual shapes. ## **Composition of a Slide** A presentation slide is composed of components such as autoshapes, tables, OLE objects, grouped shapes, picture frames, video frames, connectors, and other elements used to build a presentation. In Aspose.Slides for C++, each element on a slide is represented by an object that implements the [IShape](https://reference.aspose.com/slides/cpp/aspose.slides/ishape/) interface or inherits from a class that does. Different shape types expose different locking options. The [IBaseShapeLock](https://reference.aspose.com/slides/cpp/aspose.slides/ibaseshapelock/) interface is the base interface for shape locks. Aspose.Slides for C++ provides the following lock interfaces: - [IAutoShapeLock](https://reference.aspose.com/slides/cpp/aspose.slides/iautoshapelock/) locks autoshapes. - [IConnectorLock](https://reference.aspose.com/slides/cpp/aspose.slides/iconnectorlock/) locks connector shapes. - [IGraphicalObjectLock](https://reference.aspose.com/slides/cpp/aspose.slides/igraphicalobjectlock/) locks graphical objects. - [IGroupShapeLock](https://reference.aspose.com/slides/cpp/aspose.slides/igroupshapelock/) locks group shapes. - [IPictureFrameLock](https://reference.aspose.com/slides/cpp/aspose.slides/ipictureframelock/) locks picture frames. To apply locks across a [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/), iterate through its slides and set the appropriate locks on each supported shape. ## **Apply and Remove Protection** Shape locks restrict operations such as selecting, moving, and resizing shapes. They do not make the entire presentation uneditable. ### **Apply Protection to PPTX Shapes** Aspose.Slides for C++ provides the [IShape](https://reference.aspose.com/slides/cpp/aspose.slides/ishape/) interface to work with shapes on a slide. The example passes `true` to [set_SelectLocked](https://reference.aspose.com/slides/cpp/aspose.slides/iautoshapelock/set_selectlocked/), [set_PositionLocked](https://reference.aspose.com/slides/cpp/aspose.slides/iautoshapelock/set_positionlocked/), and [set_SizeLocked](https://reference.aspose.com/slides/cpp/aspose.slides/iautoshapelock/set_sizelocked/) for autoshapes, with equivalent locks for group shapes, connectors, and picture frames. Connectors use [set_PositionMove](https://reference.aspose.com/slides/cpp/aspose.slides/iconnectorlock/set_positionmove/) for movement; groups also use [set_GroupingLocked](https://reference.aspose.com/slides/cpp/aspose.slides/igroupshapelock/set_groupinglocked/) to restrict grouping. The example loads an existing PPTX presentation, checks the shapes in each slide's shape collection, and saves a copy with these restrictions applied. Shapes outside the four handled types are left unchanged. The loop does not traverse the child shapes inside a group. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(u"Sample.pptx"); for (auto&& slide : System::IterateOver(presentation->get_Slides())) { for (auto&& shape : System::IterateOver(slide->get_Shapes())) { if (ObjectExt::Is(shape)) { auto autoShape = ExplicitCast(shape); auto autoShapeLock = ExplicitCast(autoShape->get_ShapeLock()); autoShapeLock->set_PositionLocked(true); autoShapeLock->set_SelectLocked(true); autoShapeLock->set_SizeLocked(true); } else if (ObjectExt::Is(shape)) { auto groupShape = ExplicitCast(shape); auto groupShapeLock = ExplicitCast(groupShape->get_ShapeLock()); groupShapeLock->set_GroupingLocked(true); groupShapeLock->set_PositionLocked(true); groupShapeLock->set_SelectLocked(true); groupShapeLock->set_SizeLocked(true); } else if (ObjectExt::Is(shape)) { auto connectorShape = ExplicitCast(shape); auto connectorShapeLock = ExplicitCast(connectorShape->get_ShapeLock()); connectorShapeLock->set_PositionMove(true); connectorShapeLock->set_SelectLocked(true); connectorShapeLock->set_SizeLocked(true); } else if (ObjectExt::Is(shape)) { auto pictureFrame = ExplicitCast(shape); auto pictureFrameLock = ExplicitCast(pictureFrame->get_ShapeLock()); pictureFrameLock->set_PositionLocked(true); pictureFrameLock->set_SelectLocked(true); pictureFrameLock->set_SizeLocked(true); } } } presentation->Save(u"ProtectedSample.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ### **Remove Protection** To remove a shape lock, set its value to `false`. The following example loads a presentation with shape locks and clears the selection, movement, and resizing restrictions through [IAutoShapeLock](https://reference.aspose.com/slides/cpp/aspose.slides/iautoshapelock/), [IGroupShapeLock](https://reference.aspose.com/slides/cpp/aspose.slides/igroupshapelock/), [IConnectorLock](https://reference.aspose.com/slides/cpp/aspose.slides/iconnectorlock/), and [IPictureFrameLock](https://reference.aspose.com/slides/cpp/aspose.slides/ipictureframelock/). It also clears [IGroupShapeLock::set_GroupingLocked](https://reference.aspose.com/slides/cpp/aspose.slides/igroupshapelock/set_groupinglocked/) and saves a copy of the presentation. Other lock settings are left unchanged. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(u"ProtectedSample.pptx"); for (auto&& slide : System::IterateOver(presentation->get_Slides())) { for (auto&& shape : System::IterateOver(slide->get_Shapes())) { if (ObjectExt::Is(shape)) { auto autoShape = ExplicitCast(shape); auto autoShapeLock = ExplicitCast(autoShape->get_ShapeLock()); autoShapeLock->set_PositionLocked(false); autoShapeLock->set_SelectLocked(false); autoShapeLock->set_SizeLocked(false); } else if (ObjectExt::Is(shape)) { auto groupShape = ExplicitCast(shape); auto groupShapeLock = ExplicitCast(groupShape->get_ShapeLock()); groupShapeLock->set_GroupingLocked(false); groupShapeLock->set_PositionLocked(false); groupShapeLock->set_SelectLocked(false); groupShapeLock->set_SizeLocked(false); } else if (ObjectExt::Is(shape)) { auto connectorShape = ExplicitCast(shape); auto connectorShapeLock = ExplicitCast(connectorShape->get_ShapeLock()); connectorShapeLock->set_PositionMove(false); connectorShapeLock->set_SelectLocked(false); connectorShapeLock->set_SizeLocked(false); } else if (ObjectExt::Is(shape)) { auto pictureFrame = ExplicitCast(shape); auto pictureFrameLock = ExplicitCast(pictureFrame->get_ShapeLock()); pictureFrameLock->set_PositionLocked(false); pictureFrameLock->set_SelectLocked(false); pictureFrameLock->set_SizeLocked(false); } } } presentation->Save(u"RemovedProtectionSample.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ### **Conclusion** Aspose.Slides for C++ lets you restrict specific editing operations on individual shapes or apply the same restrictions across slides. Choose the locks supported by each shape type, and set their values to `false` when you need to remove those restrictions. ## **FAQ** **Can I combine shape locks and password protection in the same presentation?** Yes. Shape locks restrict specific editing operations, while [password protection](https://docs.aspose.com/slides/cpp/password-protected-presentation/) can restrict opening or modifying the presentation. You can use both in the same file. **Can I restrict editing on specific slides without affecting others?** Yes. Apply locks only to shapes on the selected slides. This does not change the lock settings on other slides. **How can I apply locks to individual shapes inside a group?** Iterate through the collection returned by the group's [get_Shapes](https://reference.aspose.com/slides/cpp/aspose.slides/igroupshape/get_shapes/) method and apply the appropriate locks to each child shape. Repeat this for any nested groups. The examples above process only the slide's shape collection, so they do not set locks on individual group members. # Aspose.Slides for C++: Performance Metrics and Benchmarks > Compare Aspose.Slides for C++ performance with VSTO using real benchmarks and see how it speeds up working with PPT, PPTX and ODP presentations. Source: https://docs.aspose.com/slides/cpp/aspose-slides-for-c-performance-metrics-and-benchmarks/ Updated: 2026-08-13 ## **Purpose** Performance is often the first critical factor when choosing a component. This article measures the performance of Aspose.Slides for C++ and VSTO 2008. The simple tests are conducted across the similar operating system, hardware components, and configurations. This article presents performance measurements for products including **Aspose.Slides for C++** and **VSTO 2008**. Performance estimates presented here are intended to help you understand what to expect from different components in some commonly used scenarios under similar configurations on commodity hardware running widely used operating systems. Naturally, your application performance depends on your data, data access patterns, cache size, other configuration parameters, operating system and hardware etc. The benchmark aims to illustrate how the components perform under minimum hardware conditions, the faster the hardware, the faster the tasks will be processed by the components. ## **Declaration** This document is provided for information purposes only and the contents hereof are subjected to change without notice. This document is not warranted to be error-free, nor subject to any other warranties or conditions, whether exp ressed orally or implied in law including implied warranties and conditions of merchantability or fitness for a particular purpose. We specifically disclaim any liability with respect to this document and no contractual obligations are formed either directly or indirectly by this document. This document may not be reproduced or transmitted in any form or by any means, electronic or mechanical, for any purpose. Benchmarks provide guidelines and help to set basic operational expectations. The topic shows benchmark tes ts that have been performed against Aspose.Slides for C++ and VSTO 2008 . The Performance Measures *{*} allow even novice users to benchmark the performance of the component they are using. The tests will *{*} allow you to objectively benchmark a component using a variety of different speed tests. All the tasks are common and carefully chosen exploring the relevant features to make sure that both the components may complete the tasks with ease. Moreover, the APIs to perform a test by each component are carefully chosen and selected to get the best possible results that a component can produce while evaluating its performance and all the tasks were implemented twice / thrice to better judge the figures. ## **Testing Methodology** All the performance tests were conducted on a common hardware and operating system combinations, without customized configuration, tuning or any other performance enhancing techniques. All tests were run with the component insta llations on the same system those were otherwise quiescent. To get accurate readings, we performed all the tasks twice / thrice at a time to better evaluate a component and to get accurate readings. ## **Benchmark Setup** The following table enlists the Benchmark Setup: ![todo:image_alt_text](https://docs.aspose.com/plugins/servlet/confluence/placeholder/unknown-attachment) ### **Performance Results** The following table enlists the performance results: ![todo:image_alt_text](https://docs.aspose.com/plugins/servlet/confluence/placeholder/unknown-attachment) The exe cution time is taken after deploying the applications as it gives the exact time, otherwise time calculation in the Visual Studio Debugger results in unexpected and unrealistic results. For example, if the code snippets in the attached source code are executed in Visual Studio Debugger 3 – 5 times, there will be a marginal difference of the results in every attempt thus creating a situation with no conclusion. ## **Performance Results (Excel Chart)** # Manage Audio in Presentations Using C++ > Create and control audio frames in Aspose.Slides for C++—code examples to embed, trim, loop, and configure playback across PPT, PPTX, and ODP presentations. Source: https://docs.aspose.com/slides/cpp/audio-frame/ Updated: 2026-08-05 ## **Overview** This article explains how to work with audio frames in Aspose.Slides. It shows how to add embedded audio to slides, customize the audio frame thumbnail, configure playback options such as volume, looping, hiding, trimming, and fade durations, and extract audio used in slide show transitions. ## **Create Audio Frames** Aspose.Slides for C++ allows you to add audio files to slides. The audio files are embedded in slides as audio frames. 1. Create an instance of the [Presentation](https://reference.aspose.com/slides/cpp/class/aspose.slides.presentation) class. 2. Get a slide's reference through its index. 3. Load the audio file stream you want to embed in the slide. 4. Add the embedded audio frame (containing the audio file) to the slide. 5. Set [PlayMode](https://reference.aspose.com/slides/cpp/namespace/aspose.slides#a1e0dfa632c5498e693145d42f3cf8e4c) and `Volume` exposed by the [IAudioFrame](https://reference.aspose.com/slides/cpp/class/aspose.slides.i_audio_frame) object. 6. Save the modified presentation. This C++ code shows you how to add an embedded audio frame to a slide: ``` cpp #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System::IO; // Instantiates a Presentation class that represents a presentation file auto pres = System::MakeObject(); // Gets the first slide auto sld = pres->get_Slides()->idx_get(0); // Loads the wav sound file to stream auto fstr = System::MakeObject(u"sampleaudio.wav", FileMode::Open, FileAccess::Read); // Adds the Audio Frame auto audioFrame = sld->get_Shapes()->AddAudioFrameEmbedded(50.0f, 150.0f, 100.0f, 100.0f, fstr); // Sets the Play Mode and Volume of the Audio audioFrame->set_PlayMode(AudioPlayModePreset::Auto); audioFrame->set_Volume(AudioVolumeMode::Loud); // Writes the PowerPoint file to disk pres->Save(u"AudioFrameEmbed_out.pptx", SaveFormat::Pptx); ``` ## **Change the Audio Frame Thumbnail** When you add an audio file to a presentation, the audio appears as a frame with a standard default image (see the image in the section below). You change the audio frame's thumbnail (set your preferred image). This C++ code shows you how to change an audio frame's thumbnail or preview image: ```cpp #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System::IO; auto presentation = System::MakeObject(); auto slide = presentation->get_Slides()->idx_get(0); // Adds an audio frame to the slide with a specified position and size. auto audioStream = System::MakeObject(u"sample2.mp3", System::IO::FileMode::Open, System::IO::FileAccess::Read); auto audioFrame = slide->get_Shapes()->AddAudioFrameEmbedded(150.0f, 100.0f, 50.0f, 50.0f, audioStream); // Adds an image to presentation resources. auto imageStream = System::IO::File::OpenRead(u"eagle.jpeg"); auto audioImage = presentation->get_Images()->AddImage(imageStream); // Sets the image for the audio frame. audioFrame->get_PictureFormat()->get_Picture()->set_Image(audioImage); // <----- //Saves the modified presentation to disk presentation->Save(u"example_out.pptx", Aspose::Slides::Export::SaveFormat::Pptx); ``` ## **Change Audio Play Options** Aspose.Slides for C++ allows you to change options that control an audio's playback or properties. For example, you can adjust an audio's volume, set the audio to play looped, or even hide the audio icon. The **Audio Options** pane in Microsoft PowerPoint: ![example1_image](https://docs.aspose.com/slides/cpp/audio-frame/audio_frame_0.png) PowerPoint **Audio Options** that correspond to Aspose.Slides [AudioFrame](https://reference.aspose.com/slides/cpp/aspose.slides/audioframe/) methods: - **Start** drop-down list matches the [AudioFrame::set_PlayMode](https://reference.aspose.com/slides/cpp/aspose.slides/audioframe/set_playmode/) method - **Volume** matches the [AudioFrame::set_Volume](https://reference.aspose.com/slides/cpp/aspose.slides/audioframe/set_volume/) method - **Play Across Slides** matches the [AudioFrame::set_PlayAcrossSlides](https://reference.aspose.com/slides/cpp/aspose.slides/audioframe/set_playacrossslides/) method - **Loop until Stopped** matches the [AudioFrame::set_PlayLoopMode](https://reference.aspose.com/slides/cpp/aspose.slides/audioframe/set_playloopmode/) method - **Hide During Show** matches the [AudioFrame::set_HideAtShowing](https://reference.aspose.com/slides/cpp/aspose.slides/audioframe/set_hideatshowing/) method - **Rewind after Playing** matches the [AudioFrame::set_RewindAudio](https://reference.aspose.com/slides/cpp/aspose.slides/audioframe/set_rewindaudio/) method PowerPoint **Editing** options that correspond to Aspose.Slides [AudioFrame](https://reference.aspose.com/slides/cpp/aspose.slides/audioframe/) properties: - **Fade In** matches the [AudioFrame.set_FadeInDuration](https://reference.aspose.com/slides/cpp/aspose.slides/audioframe/set_fadeinduration/) method - **Fade Out** matches the [AudioFrame.set_FadeOutDuration](https://reference.aspose.com/slides/cpp/aspose.slides/audioframe/set_fadeoutduration/) method - **Trim Audio Start Time** matches the [AudioFrame.set_TrimFromStart](https://reference.aspose.com/slides/cpp/aspose.slides/audioframe/set_trimfromstart/) method - **Trim Audio End Time** value equals the audio duration minus the value of [AudioFrame.set_TrimFromEnd](https://reference.aspose.com/slides/cpp/aspose.slides/audioframe/set_trimfromend/) method The PowerPoint **Volume controll** on the audio control panel corresponds to the [AudioFrame.set_VolumeValue](https://reference.aspose.com/slides/cpp/aspose.slides/audioframe/set_volumevalue/) method. It lets you change the audio volume as a percentage. This is how you change the Audio Play options: 1. [Сreate](https://docs.aspose.com/slides/cpp/audio-frame/#creating-audio-frame) or get the Audio Frame. 2. Set new values for the Audio Frame properties you want to adjust. 3. Save the modified PowerPoint file. This C++ code demonstrates an operation in which an audio's options are adjusted: ``` cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto pres = System::MakeObject(u"AudioFrameEmbed_out.pptx"); // GetS a shape auto shape = pres->get_Slides()->idx_get(0)->get_Shapes()->idx_get(0); // Casts the shape to an AudioFrame shape auto audioFrame = System::ExplicitCast(shape); // Sets the Play mode to play on click audioFrame->set_PlayMode(AudioPlayModePreset::OnClick); // Sets the Volume to Low audioFrame->set_Volume(AudioVolumeMode::Low); // Sets the audio to play across slides audioFrame->set_PlayAcrossSlides(true); // Disables loop for the audio audioFrame->set_PlayLoopMode(false); // Hides the AudioFrame during the slide show audioFrame->set_HideAtShowing(true); // Rewinds the audio to start after playing audioFrame->set_RewindAudio(true); // Saves the PowerPoint file to disk pres->Save(u"AudioFrameEmbed_changed.pptx", SaveFormat::Pptx); ``` This C++ example shows how to add a new audio frame with embedded audio, trim it, and set the fade durations: ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::IO; auto pres = MakeObject(); auto slide = pres->get_Slide(0); auto audioData = File::ReadAllBytes(u"sampleaudio.mp3"); auto audio = pres->get_Audios()->AddAudio(audioData); auto audioFrame = slide->get_Shapes()->AddAudioFrameEmbedded(50, 50, 100, 100, audio); // Sets the trimming start offset to 1.5 seconds audioFrame->set_TrimFromStart(1500); // Sets the trimming end offset to 2 seconds audioFrame->set_TrimFromEnd(2000); // Sets the fade-in duration to 200 ms audioFrame->set_FadeInDuration(200); // Sets the fade-out duration to 500 ms audioFrame->set_FadeOutDuration(500); pres->Save(u"AudioFrameTrimFade_out.pptx", SaveFormat::Pptx); pres->Dispose(); ``` The following code sample shows how to retrieve an audio frame with embedded audio and set its volume to 85%: ```cpp #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto pres = MakeObject(u"AudioFrameEmbed_out.pptx"); // Gets an audio frame shape auto audioFrame = ExplicitCast(pres->get_Slide(0)->get_Shape(0)); // Sets the audio volume to 85% audioFrame->set_VolumeValue(85); pres->Save(u"AudioFrameValue_out.pptx", SaveFormat::Pptx); pres->Dispose(); ``` ## **Manage Audio Captions** Aspose.Slides allows you to add closed captions to an audio frame through the [get_CaptionTracks](https://reference.aspose.com/slides/cpp/aspose.slides/iaudioframe/get_captiontracks/) method. This method returns an [ICaptionsCollection](https://reference.aspose.com/slides/cpp/aspose.slides/icaptionscollection/), which lets you add WebVTT caption tracks, iterate through existing tracks, and remove them when necessary. **Add Audio Captions** Use the [get_CaptionTracks](https://reference.aspose.com/slides/cpp/aspose.slides/iaudioframe/get_captiontracks/) method to attach one or more caption tracks to an audio frame. In the following example, an audio file is added to a slide, and then a new caption track is loaded from a `.vtt` file. ```cpp #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::IO; auto presentation = MakeObject(); auto audioData = File::ReadAllBytes(u"audio.mp3"); auto audio = presentation->get_Audios()->AddAudio(audioData); auto slide = presentation->get_Slide(0); auto audioFrame = slide->get_Shapes()->AddAudioFrameEmbedded(10, 10, 50, 50, audio); // Add a new caption track from a WebVTT file. audioFrame->get_CaptionTracks()->Add(u"New track", u"track.vtt"); presentation->Save(u"audio_with_captions.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` **Extract Audio Captions** You can iterate through the caption tracks associated with an audio frame and save them as `.vtt` files. Each caption track exposes its binary data and unique identifier, which can be used when exporting captions. ```cpp #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; using namespace System::IO; auto presentation = MakeObject(u"audio_with_captions.pptx"); auto slide = presentation->get_Slide(0); for (auto&& shape : IterateOver(slide->get_Shapes())) { if (ObjectExt::Is(shape)) { auto audioFrame = ExplicitCast(shape); for (auto&& captionTrack : IterateOver(audioFrame->get_CaptionTracks())) { // Save each caption track as a .vtt file. auto fileName = captionTrack->get_CaptionId().ToString() + u".vtt"; File::WriteAllBytes(fileName, captionTrack->get_BinaryData()); } } } presentation->Dispose(); ``` **Remove Audio Captions** To remove captions from an audio frame, use the methods provided by [ICaptionsCollection](https://reference.aspose.com/slides/cpp/aspose.slides/icaptionscollection/), such as [Clear](https://reference.aspose.com/slides/cpp/aspose.slides/icaptionscollection/clear/), [Remove](https://reference.aspose.com/slides/cpp/aspose.slides/icaptionscollection/remove/), or [RemoveAt](https://reference.aspose.com/slides/cpp/aspose.slides/icaptionscollection/removeat/). The following example removes all caption tracks from an audio frame. ```cpp #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(u"audio_with_captions.pptx"); auto slide = presentation->get_Slide(0); auto audioFrame = ExplicitCast(slide->get_Shape(0)); // Remove all caption tracks from the audio frame. audioFrame->get_CaptionTracks()->Clear(); presentation->Save(u"audio_without_captions.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ## **Extract Audio** Aspose.Slides allows you to extract the sound used in slide show transitions. For example, you can extract the sound used in a specific slide. 1. Create an instance of the [Presentation](https://reference.aspose.com/slides/cpp/class/aspose.slides.presentation) class and load the presentation containing the audio. 2. Get the relevant slide's reference through its index. 3. Access the slideshow transitions for the slide. 4. Extract the sound in byte data. This C++ code shows you how to extract the audio used in a slide: ``` cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; String presName = u"AudioSlide.pptx"; // Instantiates a Presentation class that represents a presentation file auto pres = System::MakeObject(presName); // Accesses the desired slide auto slide = pres->get_Slides()->idx_get(0); // Gets the slideshow transition effects for the slide auto transition = slide->get_SlideShowTransition(); // Extracts the sound in byte array auto audio = transition->get_Sound()->get_BinaryData(); Console::WriteLine(String(u"Length: ") + audio->get_Length()); ``` ## **FAQ** ### Can I reuse the same audio asset across multiple slides without inflating the file size? Yes. Add the audio once to the presentation’s shared [audio collection](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/get_audios/) and create additional audio frames that reference that existing asset. This avoids duplicating media data and keeps the presentation size under control. ### Can I replace the sound in an existing audio frame without recreating the shape? Yes. For a linked sound, update the [link path](https://reference.aspose.com/slides/cpp/aspose.slides/audioframe/set_linkpathlong/) to point to the new file. For an embedded sound, swap the [embedded audio](https://reference.aspose.com/slides/cpp/aspose.slides/audioframe/set_embeddedaudio/) object with another one from the presentation’s [audio collection](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/get_audios/). The frame’s formatting and most playback settings remain intact. ### Does trimming change the underlying audio data stored in the presentation? No. Trimming adjusts only the playback boundaries. The original audio bytes remain untouched and accessible through the embedded audio or the presentation’s audio collection. ## Related articles - [Audio](https://docs.aspose.com/slides/cpp/examples/elements/audio/) - [Manage Video Frames in Presentations Using C++](https://docs.aspose.com/slides/cpp/video-frame/) # Automating PowerPoint Generation in C++: Create Dynamic Presentations Easily > Automate slide creation on cloud platforms with Aspose.Slides for C++—generate, edit, and convert PowerPoint and OpenDocument files fast and reliably. Source: https://docs.aspose.com/slides/cpp/automating-powerpoint-generation-on-cloud-platforms/ Updated: 2026-08-05 ## **Introduction** Creating PowerPoint presentations manually can be a time-consuming and repetitive task—especially when the content is based on dynamic data that frequently changes. Whether it's generating weekly business reports, assembling educational material, or producing client-ready sales decks, automation can save countless hours and ensure consistency across teams. For C++ developers, automating the creation of PowerPoint presentations opens up powerful possibilities. You can integrate slide generation into web portals, deskt op tools, backend services, or cloud platforms to dynamically convert data into professional, branded presentations—on-demand. In this article, we’ll explore the common use cases for automated PowerPoint generation in C++ apps (including deployments on cloud platforms) and why it's becoming an essential feature in modern solutions. From pulling real-time business data to converting text or images into slides, the goal is to transform raw content into structured, visual formats your audience can instantly understand. ## **Common Use Cases for PowerPoint Automation in C++** Automating PowerPoint generation is especially useful in scenarios where presentation content needs to be dynamically assembled, personalized, or frequently updated. Some of the most common real-world use cases include: - **Business Reports & Dashboards** Generate sales summaries, KPIs, or financial performance reports by pulling live data from databases or APIs. - **Personalized Sales & Marketing Decks** Automatically create client-specific pitch decks using CRM or form data, ensuring quick turnaround and brand consistency. - **Educational Content** Convert learning material, quizzes, or course summaries into structured slide decks for e-learning platforms. - **Data & AI-Powered Insights** Use natural language processing or analytics engines to transform raw data or long-form text into summarized presentations. - **Media-Based Slides** Assemble presentations from uploaded images, annotated screenshots, or video keyframes with supporting descriptions. - **Document Conversion** Automatically convert Word documents, PDFs, or form inputs into visual presentations with minimal manual effort. - **Developer and Technical Tools** Create tech demos, documentation overviews, or changelogs in slide format directly from code or markdown content. By automating these workflows, organizations can scale their content creation, maintain consistency, and free up time for more strategic work. ## **Let's Code** For this example, we’ve chosen **[Aspose.Slides for C++](https://products.aspose.com/slides/cpp/)** to demonstrate PowerPoint automation due to its comprehensive feature set and ease of use when working with presentations programmatically. Unlike lower-level libraries, which require developers to work directly with the Open XML structure (often resulting in verbose and less readable code), Aspose.Slides provides a higher-level API. It abstracts away the complexity, allowing developers to focus on presentation logic—such as layout, formatting, and data binding—without needing to understand the PowerPoint file format in detail. Although Aspose.Slides is a commercial library, it offers a [free trial](https://releases.aspose.com/slides/cpp/) version that is fully capable of running the examples provided in this article. For the purpose of demonstrating ideas, testing features, or building a proof of concept like the one we’re covering here, the trial is more than sufficient. This makes it a convenient option for experimenting with automated PowerPoint generation without needing to commit to a license upfront. Ok, let’s walk through building a sample presentation using real-world content. ### **Create a Title Slide** We'll begin by creating a new presentation and adding a title slide with a main heading and subtitle. ```cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto presentation = MakeObject(); auto slide0 = presentation->get_Slide(0); auto layoutSlide = presentation->get_LayoutSlides()->GetByType(SlideLayoutType::Title); slide0->set_LayoutSlide(layoutSlide); auto titleShape = ExplicitCast(slide0->get_Shape(0)); auto subtitleShape = ExplicitCast(slide0->get_Shape(1)); titleShape->get_TextFrame()->set_Text(u"Quarterly Business Review – Q1 2025"); subtitleShape->get_TextFrame()->set_Text(u"Prepared for Executive Team"); ``` ![The title slide](https://docs.aspose.com/slides/cpp/automating-powerpoint-generation-on-cloud-platforms/slide_0.png) ### **Add a Slide with a Column Chart** Next, we’ll create a slide showing regional sales performance as a column chart. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace System; auto presentation = MakeObject(); auto layoutSlide1 = presentation->get_LayoutSlides()->GetByType(SlideLayoutType::Blank); auto slide1 = presentation->get_Slides()->AddEmptySlide(layoutSlide1); auto chart = slide1->get_Shapes()->AddChart(ChartType::ClusteredColumn, 100, 100, 500, 350, false); chart->get_Legend()->set_Position(LegendPositionType::Bottom); chart->set_HasTitle(true); chart->get_ChartTitle()->AddTextFrameForOverriding(u"Data from January – March 2025"); chart->get_ChartTitle()->set_Overlay(false); auto workbook = chart->get_ChartData()->get_ChartDataWorkbook(); auto worksheetIndex = 0; chart->get_ChartData()->get_Categories()->Add(workbook->GetCell(worksheetIndex, 1, 0, ObjectExt::Box(u"North America"))); chart->get_ChartData()->get_Categories()->Add(workbook->GetCell(worksheetIndex, 2, 0, ObjectExt::Box(u"Europe"))); chart->get_ChartData()->get_Categories()->Add(workbook->GetCell(worksheetIndex, 3, 0, ObjectExt::Box(u"Asia Pacific"))); chart->get_ChartData()->get_Categories()->Add(workbook->GetCell(worksheetIndex, 4, 0, ObjectExt::Box(u"Latin America"))); chart->get_ChartData()->get_Categories()->Add(workbook->GetCell(worksheetIndex, 5, 0, ObjectExt::Box(u"Middle East"))); auto series = chart->get_ChartData()->get_Series()->Add(workbook->GetCell(worksheetIndex, 0, 1, ObjectExt::Box(u"Sales ($K)")), chart->get_Type()); series->get_DataPoints()->AddDataPointForBarSeries(workbook->GetCell(worksheetIndex, 1, 1, ObjectExt::Box(480))); series->get_DataPoints()->AddDataPointForBarSeries(workbook->GetCell(worksheetIndex, 2, 1, ObjectExt::Box(365))); series->get_DataPoints()->AddDataPointForBarSeries(workbook->GetCell(worksheetIndex, 3, 1, ObjectExt::Box(290))); series->get_DataPoints()->AddDataPointForBarSeries(workbook->GetCell(worksheetIndex, 4, 1, ObjectExt::Box(150))); series->get_DataPoints()->AddDataPointForBarSeries(workbook->GetCell(worksheetIndex, 5, 1, ObjectExt::Box(120))); ``` ![The slide with the chart](https://docs.aspose.com/slides/cpp/automating-powerpoint-generation-on-cloud-platforms/slide_1.png) ### **Add a Slide with a Table** We’ll now add a slide that presents key performance metrics in table format. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto presentation = MakeObject(); auto layoutSlide2 = presentation->get_LayoutSlides()->GetByType(SlideLayoutType::Blank); auto slide2 = presentation->get_Slides()->AddEmptySlide(layoutSlide2); auto columnWidths = MakeArray({ 200, 100 }); auto rowHeights = MakeArray({ 40, 40, 40, 40, 40 }); auto table = slide2->get_Shapes()->AddTable(200, 200, columnWidths, rowHeights); table->get_Column(0)->idx_get(0)->get_TextFrame()->set_Text(u"Metric"); table->get_Column(1)->idx_get(0)->get_TextFrame()->set_Text(u"Value"); table->get_Column(0)->idx_get(1)->get_TextFrame()->set_Text(u"Total Revenue"); table->get_Column(1)->idx_get(1)->get_TextFrame()->set_Text(u"$1.4M"); table->get_Column(0)->idx_get(2)->get_TextFrame()->set_Text(u"Gross Margin"); table->get_Column(1)->idx_get(2)->get_TextFrame()->set_Text(u"54%"); table->get_Column(0)->idx_get(3)->get_TextFrame()->set_Text(u"New Customers"); table->get_Column(1)->idx_get(3)->get_TextFrame()->set_Text(u"340"); table->get_Column(0)->idx_get(4)->get_TextFrame()->set_Text(u"Customer Retention"); table->get_Column(1)->idx_get(4)->get_TextFrame()->set_Text(u"87%"); ``` ![The slide with the table](https://docs.aspose.com/slides/cpp/automating-powerpoint-generation-on-cloud-platforms/slide_2.png) ### **Add a Summary Slide with Bullet Points** Lastly, we’ll include a summary and action plan using a simple bullet list. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; using namespace System::Drawing; static SharedPtr CreateBulletParagraph(String text) { auto paragraph = MakeObject(); paragraph->get_ParagraphFormat()->get_Bullet()->set_Type(BulletType::Symbol); paragraph->get_ParagraphFormat()->set_Indent(15); paragraph->get_ParagraphFormat()->get_DefaultPortionFormat()->get_FillFormat()->set_FillType(FillType::Solid); paragraph->get_ParagraphFormat()->get_DefaultPortionFormat()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Black()); paragraph->set_Text(text); return paragraph; } ``` ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; // Defined in the previous step. SharedPtr CreateBulletParagraph(String text); auto presentation = MakeObject(); auto layoutSlide3 = presentation->get_LayoutSlides()->GetByType(SlideLayoutType::Blank); auto slide3 = presentation->get_Slides()->AddEmptySlide(layoutSlide3); auto bulletList = slide3->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 100, 50, 600, 200); bulletList->get_FillFormat()->set_FillType(FillType::NoFill); bulletList->get_LineFormat()->get_FillFormat()->set_FillType(FillType::NoFill); bulletList->get_TextFrame()->get_Paragraphs()->Clear(); bulletList->get_TextFrame()->get_Paragraphs()->Add(CreateBulletParagraph(u"Strong performance in North America; growth opportunity in Asia Pacific")); bulletList->get_TextFrame()->get_Paragraphs()->Add(CreateBulletParagraph(u"Improve marketing outreach in underperforming regions")); bulletList->get_TextFrame()->get_Paragraphs()->Add(CreateBulletParagraph(u"Prepare new campaign strategy for Q2")); bulletList->get_TextFrame()->get_Paragraphs()->Add(CreateBulletParagraph(u"Schedule follow-up review in early July")); ``` ![The slide with the text](https://docs.aspose.com/slides/cpp/automating-powerpoint-generation-on-cloud-platforms/slide_3.png) ### **Save the Presentation** Finally, we save the presentation to disk: ```java presentation->Save(u"presentation.pptx", SaveFormat::Pptx); ``` ## **Conclusion** Automating PowerPoint generation in C++ applications offers clear benefits in saving time and reducing manual effort. By integrating dynamic content such as charts, tables, and text, developers can quickly produce consistent, professional presentations—ideal for business reports, client meetings, or educational content. In this article, we've demonstrated how to automate the creation of a presentation from scratch, including adding a title slide, charts, and tables. This approach can be applied across various use cases where automated, data-driven presentations are needed. By leveraging the right tools, C++ developers can efficiently automate PowerPoint creation, enhancing productivity and ensuring consistency across presentations. # Customize Bubble Charts in Presentations Using C++ > Create and customize powerful bubble charts in PowerPoint with Aspose.Slides for C++ to enhance your data visualization easily. Source: https://docs.aspose.com/slides/cpp/bubble-chart/ Updated: 2026-11-08 ## **Overview** This article shows how to work with bubble charts in Aspose.Slides. It covers two specific customization options: scaling bubble sizes through the `set_BubbleSizeScale` method and controlling how bubble size values are represented through the `set_BubbleSizeRepresentation` method. The examples demonstrate how to create a bubble chart, adjust its size scaling, and switch the bubble size representation to use width. The article also includes a short FAQ section that clarifies support for the “Bubble with 3-D” chart type, notes that practical chart limits depend on performance and the target PowerPoint version, and explains that export preserves the chart’s appearance through the Aspose.Slides rendering engine. ## **Bubble Chart Size Scaling** Aspose.Slides for C++ provides support for Bubble chart size scaling. In Aspose.Slides for **C++ IChartSeries.BubbleSizeScale** and **IChartSeriesGroup.BubbleSizeScale** properties have been added. Below sample example is given. ```cpp For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C // The path to the documents directory. const String outPath = u"../out/SettingBubbleChartScaling_out.pptx"; //Instantiate Presentation class that represents PPTX file SharedPtr pres = MakeObject(); //Access first slide SharedPtr slide = pres->get_Slides()->idx_get(0); // Add chart with default data SharedPtr chart = slide->get_Shapes()->AddChart(Aspose::Slides::Charts::ChartType::Bubble, 0, 0, 500, 500); chart->get_ChartData()->get_SeriesGroups()->idx_get(0)->set_BubbleSizeScale(150); // Write the presentation file to disk pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx); ``` [Source: Examples-SlidesCPP-SettingBubbleChartScaling-SettingBubbleChartScaling.cpp](https://gist.githubusercontent.com/aspose-slides/a690df625dc0b1fff869ab198affe7a4/raw/b44ce96b9fb2e82e1ff3d47a1f162705df901714/Examples-SlidesCPP-SettingBubbleChartScaling-SettingBubbleChartScaling.cpp) ## **Represent Data as Bubble Chart Sizes** New **get_BubbleSizeRepresentation()** method has been added to **IChartSeries** and **ChartSeries** classes. **BubbleSizeRepresentation** specifies how the bubble size values are represented in the bubble chart. Possible values are: **BubbleSizeRepresentationType.Area** and **BubbleSizeRepresentationType.Width**. Accordingly, **BubbleSizeRepresentationType** enum has been added to specify the possible ways to represent data as bubble chart sizes. Sample code is given below. ```cpp System::SharedPtr pres = System::MakeObject(); System::SharedPtr chart = pres->get_Slides()->idx_get(0)->get_Shapes()->AddChart(Aspose::Slides::Charts::ChartType::Bubble, 50.0f, 50.0f, 600.0f, 400.0f, true); chart->get_ChartData()->get_SeriesGroups()->idx_get(0)->set_BubbleSizeRepresentation(Aspose::Slides::Charts::BubbleSizeRepresentationType::Width); pres->Save(u"../out/Presentation.pptx", Aspose::Slides::Export::SaveFormat::Pptx); ``` [Source: Examples-SlidesCPP-SupportOfBubbleSizeRepresentation-SupportOfBubbleSizeRepresentation.cpp](https://gist.githubusercontent.com/aspose-com-gists/81aeb05e6d3a070aa76fdea22ed53bc7/raw/e8361990aaf916bf4dd81d2ade57e656982f3b8d/Examples-SlidesCPP-SupportOfBubbleSizeRepresentation-SupportOfBubbleSizeRepresentation.cpp) [![Two plots use identical X and Y coordinates and size values 1, 4 and 9. In Area mode their circle areas follow 1 to 4 to 9. In Width mode their diameters follow that ratio.](https://docs.aspose.com/slides/cpp/bubble-chart/visual-bubble-chart-bf890435c020.svg)](https://docs.aspose.com/slides/cpp/bubble-chart/visual-bubble-chart-bf890435c020.svg) *Illustrative comparison at the same scale. Area uses the circle’s area, while Width uses its diameter.* ## **FAQ** ### Is a "bubble chart with 3-D effect" supported, and how does it differ from a regular one? Yes. There is a separate chart type, "Bubble with 3-D." It applies 3-D styling to the bubbles but does not add an additional axis; the data remain X-Y-S (size). The type is available in the [chart type](https://reference.aspose.com/slides/cpp/aspose.slides.charts/charttype/) enumeration. ### Is there a limit on the number of series and points in a bubble chart? There is no hard limit at the API level; constraints are determined by performance and the target PowerPoint version. It is recommended to keep the number of points reasonable for readability and rendering speed. ### How will export affect the appearance of a bubble chart (PDF, images)? Export to supported formats preserves the chart’s appearance; rendering is performed by the Aspose.Slides engine. For raster/vector formats, general chart-graphics rendering rules apply (resolution, anti-aliasing), so choose sufficient DPI for printing. # Manage Callouts in Presentation Charts Using C++ > Create and style callouts in Aspose.Slides for C++ with concise code examples, compatible with PPT and PPTX to automate presentation workflows. Source: https://docs.aspose.com/slides/cpp/callout/ Updated: 2026-08-02 ## **Overview** This article explains how to work with callouts for chart data labels in Aspose.Slides. It shows how to use the `set_ShowLabelAsDataCallout` method to display labels as callouts, how to configure callout-related label settings for a doughnut chart, and notes that callouts and their appearance are preserved when presentations are exported to PDF, HTML5, SVG, and raster image formats. ## **Using Callouts** New property **ShowLabelAsDataCallout** has been added to **DataLabelFormat** class and **IDataLabelFormat** interface, which determines either specified chart's data label will be displayed as data callout or as data label. In the example given below, we have set the Callouts. ```cpp For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C // The path to the documents directory. const String outPath = u"../out/DisplayChartLabels_out.pptx"; //Instantiate Presentation class that represents PPTX file SharedPtr pres = MakeObject(); //Access first slide SharedPtr slide = pres->get_Slides()->idx_get(0); // Add chart with default data SharedPtr chart = slide->get_Shapes()->AddChart(Aspose::Slides::Charts::ChartType::Pie, 0, 0, 500, 500); chart->get_ChartData()->get_Series()->idx_get(0)->get_Labels()->get_DefaultDataLabelFormat()->set_ShowValue ( true); chart->get_ChartData()->get_Series()->idx_get(0)->get_Labels()->get_DefaultDataLabelFormat()->set_ShowLabelAsDataCallout( true); chart->get_ChartData()->get_Series()->idx_get(0)->get_Labels()->idx_get(2)->get_DataLabelFormat()->set_ShowLabelAsDataCallout ( false); // Write the presentation file to disk pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx); ``` [Source: Examples-SlidesCPP-DisplayChartLabels-DisplayChartLabels.cpp](https://gist.githubusercontent.com/aspose-slides/a690df625dc0b1fff869ab198affe7a4/raw/a36e038a941d7e0eaa17ab741e54bf37b843710d/Examples-SlidesCPP-DisplayChartLabels-DisplayChartLabels.cpp) ## **Set a Callout for a Doughnut Chart** Aspose.Slides for C++ provides support for setting series data label callout shape for a Doughnut chart. Below sample example is given. ```cpp For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C // The path to the documents directory. const String outPath = u"../out/AddDoughnutCallout_out.pptx"; //Instantiate Presentation class that represents PPTX file SharedPtr pres = MakeObject(); //Access first slide SharedPtr slide = pres->get_Slides()->idx_get(0); // Add chart with default data SharedPtr chart = slide->get_Shapes()->AddChart(Aspose::Slides::Charts::ChartType::Doughnut, 0, 0, 500, 500); int seriesIndex = 0; // Setting the index of chart data sheet int defaultWorksheetIndex = 0; // Getting the chart data worksheet SharedPtr fact = chart->get_ChartData()->get_ChartDataWorkbook(); // Delete default generated series and categories chart->get_ChartData()->get_Series()->Clear(); chart->get_ChartData()->get_Categories()->Clear(); chart->set_HasLegend(false); //////////// while (seriesIndex < 15) { SharedPtr series = chart->get_ChartData()->get_Series()->Add(fact->GetCell(0, 0, seriesIndex + 1, ObjectExt::Box(u"SERIES" + seriesIndex)), chart->get_Type()); series->set_Explosion(0); series->get_ParentSeriesGroup()->set_DoughnutHoleSize (20); series->get_ParentSeriesGroup()->set_FirstSliceAngle ( 351); seriesIndex++; } int categoryIndex = 0; while (categoryIndex < 15) { chart->get_ChartData()->get_Categories()->Add(fact->GetCell(0, categoryIndex + 1, 0, ObjectExt::Box(u"CATEGORY" + categoryIndex))); int i = 0; while (i < chart->get_ChartData()->get_Series()->get_Count()) { SharedPtr iCS = chart->get_ChartData()->get_Series()->idx_get(i); SharedPtr dataPoint = iCS->get_DataPoints()->AddDataPointForDoughnutSeries(fact->GetCell(0, categoryIndex + 1, i + 1, ObjectExt::Box(1))); dataPoint->get_Format()->get_Fill()->set_FillType (FillType::Solid); dataPoint->get_Format()->get_Line()->get_FillFormat()->set_FillType(FillType::Solid); dataPoint->get_Format()->get_Line()->get_FillFormat()->get_SolidFillColor()->set_Color(System::Drawing::Color::get_White()); dataPoint->get_Format()->get_Line()->set_Width( 1); dataPoint->get_Format()->get_Line()->set_Style (LineStyle::Single); dataPoint->get_Format()->get_Line()->set_DashStyle(LineDashStyle::Solid); if (i == chart->get_ChartData()->get_Series()->get_Count() - 1) { SharedPtr lbl = dataPoint->get_Label(); lbl->get_TextFormat()->get_TextBlockFormat()->set_AutofitType (TextAutofitType::Shape); lbl->get_DataLabelFormat()->get_TextFormat()->get_PortionFormat()->set_FontBold (NullableBool::True); lbl->get_DataLabelFormat()->get_TextFormat()->get_PortionFormat()->set_LatinFont(MakeObject(u"DINPro-Bold")); lbl->get_DataLabelFormat()->get_TextFormat()->get_PortionFormat()->set_FontHeight ( 12); lbl->get_DataLabelFormat()->get_TextFormat()->get_PortionFormat()->get_FillFormat()->set_FillType (FillType::Solid); lbl->get_DataLabelFormat()->get_TextFormat()->get_PortionFormat()->get_FillFormat()->get_SolidFillColor()->set_Color (System::Drawing::Color::get_LightGray()); lbl->get_DataLabelFormat()->get_Format()->get_Line()->get_FillFormat()->get_SolidFillColor()->set_Color(System::Drawing::Color::get_White()); lbl->get_DataLabelFormat()->set_ShowValue ( false); lbl->get_DataLabelFormat()->set_ShowCategoryName ( true); lbl->get_DataLabelFormat()->set_ShowSeriesName(false); //lbl.DataLabelFormat.ShowLabelAsDataCallout = true; lbl->get_DataLabelFormat()->set_ShowLeaderLines (true); lbl->get_DataLabelFormat()->set_ShowLabelAsDataCallout ( false); chart->ValidateChartLayout(); lbl->set_X((float)lbl->get_X() + (float)0.5); lbl->set_Y((float)lbl->get_Y() + (float)0.5); } i++; } categoryIndex++; } // Write the presentation file to disk pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx); ``` [Source: Examples-SlidesCPP-AddDoughnutCallout-AddDoughnutCallout.cpp](https://gist.githubusercontent.com/aspose-slides/a690df625dc0b1fff869ab198affe7a4/raw/f0bd10c83e60f49de1eb974370003f964b44ad3d/Examples-SlidesCPP-AddDoughnutCallout-AddDoughnutCallout.cpp) ## **FAQ** ### Are callouts preserved when converting a presentation to PDF, HTML5, SVG, or images? Yes. Callouts are part of the chart rendering, so when you export to [PDF](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-pdf/), [HTML5](https://docs.aspose.com/slides/cpp/export-to-html5/), [SVG](https://docs.aspose.com/slides/cpp/render-a-slide-as-an-svg-image/), or [raster images](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-png/), they are preserved together with the slide’s formatting. ### Do custom fonts work in callouts, and can their appearance be preserved on export? Yes. Aspose.Slides supports [embedding fonts](https://docs.aspose.com/slides/cpp/embedded-font/) into the presentation and controls font embedding during exports such as [PDF](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-pdf/), ensuring the callouts look the same across different systems. # Customize Chart Axes in Presentations Using C++ > Discover how to use Aspose.Slides for C++ to customize chart axes in PowerPoint presentations for reports and visualizations. Source: https://docs.aspose.com/slides/cpp/chart-axis/ Updated: 2026-10-30 ## **Overview** This article explains how to customize chart axes with Aspose.Slides for C++. It covers calculated axis values, switching chart rows and columns, axis visibility, category label and tick-mark intervals, date categories and formatting, title rotation, axis positioning, display units, and logarithmic scaling. ## **Get the Max Values on the Vertical Axis on Charts** Create a [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) and add an area chart with default data. Call [ValidateChartLayout](https://reference.aspose.com/slides/cpp/aspose.slides.charts/chart/validatechartlayout/) before reading calculated axis values so that the chart layout is up to date. Read [get_ActualMaxValue](https://reference.aspose.com/slides/cpp/aspose.slides.charts/axis/get_actualmaxvalue/) and [get_ActualMinValue](https://reference.aspose.com/slides/cpp/aspose.slides.charts/axis/get_actualminvalue/) for the axis limits, and [get_ActualMajorUnit](https://reference.aspose.com/slides/cpp/aspose.slides.charts/axis/get_actualmajorunit/) and [get_ActualMinorUnit](https://reference.aspose.com/slides/cpp/aspose.slides.charts/axis/get_actualminorunit/) for the tick intervals. [get_ActualMajorUnitScale](https://reference.aspose.com/slides/cpp/aspose.slides.charts/axis/get_actualmajorunitscale/) and [get_ActualMinorUnitScale](https://reference.aspose.com/slides/cpp/aspose.slides.charts/axis/get_actualminorunitscale/) provide time-unit scales, which are relevant to date axes. The example stores these values in local variables and saves the chart. ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::Area, 100, 100, 500, 350); chart->ValidateChartLayout(); auto maxValue = chart->get_Axes()->get_VerticalAxis()->get_ActualMaxValue(); auto minValue = chart->get_Axes()->get_VerticalAxis()->get_ActualMinValue(); auto majorUnit = chart->get_Axes()->get_VerticalAxis()->get_ActualMajorUnit(); auto minorUnit = chart->get_Axes()->get_VerticalAxis()->get_ActualMinorUnit(); auto majorUnitScale = chart->get_Axes()->get_VerticalAxis()->get_ActualMajorUnitScale(); auto minorUnitScale = chart->get_Axes()->get_VerticalAxis()->get_ActualMinorUnitScale(); presentation->Save(u"AxisValues_out.pptx", SaveFormat::Pptx); ``` ## **Swap the Data between Axes** Use [SwitchRowColumn](https://reference.aspose.com/slides/cpp/aspose.slides.charts/chartdata/switchrowcolumn/) to exchange the roles of series and categories in chart data. Each former category becomes a series, and each former series becomes a category. This changes how the data is grouped; it does not exchange the horizontal and vertical axes. The example uses [SetRange](https://reference.aspose.com/slides/cpp/aspose.slides.charts/chartdata/setrange/) to bind the default data to `Sheet1!A1:D5`, including the header row and category column, before switching rows and columns. It saves a chart with four series and three categories. ```cpp #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::ClusteredColumn, 100, 100, 400, 300); chart->get_ChartData()->SetRange(u"Sheet1!A1:D5"); chart->get_ChartData()->SwitchRowColumn(); presentation->Save(u"SwitchChartRowColumns_out.pptx", SaveFormat::Pptx); ``` ## **Reverse the Plotting Order of an Axis** Use [set_IsPlotOrderReversed](https://reference.aspose.com/slides/cpp/aspose.slides.charts/axis/set_isplotorderreversed/) to reverse a category or value axis. For example, a horizontal bar chart can show project stages from top to bottom in the same order as the worksheet: Planning, Development, Testing. Reversing an axis changes the plotting direction; it does not sort or rearrange the workbook data. By comparison, [SwitchRowColumn](https://reference.aspose.com/slides/cpp/aspose.slides.charts/chartdata/switchrowcolumn/) exchanges the roles of series and categories. The following example creates a horizontal bar chart with three stages and one series. It saves a presentation with three slides: normal order, reversed categories, and reversed values. Each copy uses the same dataset, and only one axis is reversed on each copy. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::ClusteredBar, 50, 40, 620, 320); chart->set_HasLegend(false); chart->get_ChartData()->get_Categories()->Clear(); chart->get_ChartData()->get_Series()->Clear(); auto workbook = chart->get_ChartData()->get_ChartDataWorkbook(); workbook->Clear(0); auto series = chart->get_ChartData()->get_Series()->Add(ChartType::ClusteredBar); auto stages = std::array{u"Planning", u"Development", u"Testing"}; auto values = std::array{10, 30, 20}; for (auto i = 0; i < stages.size(); i++) { auto categoryCell = workbook->GetCell(0, i + 1, 0, System::ObjectExt::Box(stages[i])); chart->get_ChartData()->get_Categories()->Add(categoryCell); auto valueCell = workbook->GetCell(0, i + 1, 1, System::ObjectExt::Box(values[i])); series->get_DataPoints()->AddDataPointForBarSeries(valueCell); } // Slide 2: display the first category at the top. auto categorySlide = presentation->get_Slides()->AddClone(slide); auto categoryChart = System::ExplicitCast(categorySlide->get_Shape(0)); categoryChart->get_Axes()->get_VerticalAxis()->set_IsPlotOrderReversed(true); // Keep the horizontal value axis at the bottom. categoryChart->get_Axes()->get_VerticalAxis()->set_CrossType(CrossesType::Maximum); // Slide 3: reverse only the horizontal numeric scale. auto valueSlide = presentation->get_Slides()->AddClone(slide); auto valueChart = System::ExplicitCast(valueSlide->get_Shape(0)); valueChart->get_Axes()->get_HorizontalAxis()->set_IsPlotOrderReversed(true); presentation->Save(u"ReversedAxes.pptx", SaveFormat::Pptx); ``` Reversing an axis can also move the perpendicular axis to the opposite side of the plot. [set_CrossType](https://reference.aspose.com/slides/cpp/aspose.slides.charts/axis/set_crosstype/) controls where the other axis crosses the axis being configured. In slide 2, setting it to `Maximum` on the reversed category axis keeps the horizontal value axis at the bottom. For a specific crossing point, use [set_CrossAt](https://reference.aspose.com/slides/cpp/aspose.slides.charts/axis/set_crossat/). Check the crossing settings when changing direction, especially if the chart already has a custom crossing point. Call `set_IsPlotOrderReversed` with `false` to restore the normal plotting direction; crossing settings are separate. | Normal order (slide 1) | Reversed categories (slide 2) | Reversed values (slide 3) | | --- | --- | --- | | ![Horizontal bar chart with normal category and value axis order](https://docs.aspose.com/slides/cpp/chart-axis/axis-order-normal.png) | ![Horizontal bar chart with categories displayed from top to bottom](https://docs.aspose.com/slides/cpp/chart-axis/axis-order-categories-reversed.png) | ![Horizontal bar chart with a reversed value axis and zero on the right](https://docs.aspose.com/slides/cpp/chart-axis/axis-order-values-reversed.png) | | Categories run from bottom to top; values increase from left to right. | Planning, Development, and Testing run from top to bottom. Values and workbook row order are unchanged. | Categories retain their normal order; values increase from right to left. The category axis crosses at zero on the right. | ## **Disable the Vertical Axis for Line Charts** Use [set_IsVisible](https://reference.aspose.com/slides/cpp/aspose.slides.charts/axis/set_isvisible/) with `false` on the vertical axis to hide it. The example creates a line chart with default data and saves it with the vertical axis hidden. ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::Line, 100, 100, 400, 300); chart->get_Axes()->get_VerticalAxis()->set_IsVisible(false); presentation->Save(u"HiddenVerticalAxis.pptx", SaveFormat::Pptx); ``` ## **Disable the Horizontal Axis for Line Charts** Use [set_IsVisible](https://reference.aspose.com/slides/cpp/aspose.slides.charts/axis/set_isvisible/) with `false` on the horizontal axis to hide it. The example creates a line chart with default data and saves it with the horizontal axis hidden. ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::Line, 100, 100, 400, 300); chart->get_Axes()->get_HorizontalAxis()->set_IsVisible(false); presentation->Save(u"HiddenHorizontalAxis.pptx", SaveFormat::Pptx); ``` ## **Change a Category Axis** Use [set_CategoryAxisType](https://reference.aspose.com/slides/cpp/aspose.slides.charts/axis/set_categoryaxistype/) to choose a date or text category axis. This example requires `ExistingChart.pptx`, with a chart as the first shape on the first slide and category cells containing numeric Excel date values. It changes the horizontal axis to a date axis. Calling [set_IsAutomaticMajorUnit](https://reference.aspose.com/slides/cpp/aspose.slides.charts/axis/set_isautomaticmajorunit/) with `false`, [set_MajorUnit](https://reference.aspose.com/slides/cpp/aspose.slides.charts/axis/set_majorunit/) with `1`, and [set_MajorUnitScale](https://reference.aspose.com/slides/cpp/aspose.slides.charts/axis/set_majorunitscale/) with months places major ticks at one-month intervals. ```cpp #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(u"ExistingChart.pptx"); auto slide = presentation->get_Slide(0); auto chart = System::ExplicitCast(slide->get_Shape(0)); chart->get_Axes()->get_HorizontalAxis()->set_CategoryAxisType(CategoryAxisType::Date); chart->get_Axes()->get_HorizontalAxis()->set_IsAutomaticMajorUnit(false); chart->get_Axes()->get_HorizontalAxis()->set_MajorUnit(1); chart->get_Axes()->get_HorizontalAxis()->set_MajorUnitScale(TimeUnitType::Months); presentation->Save(u"ChangeChartCategoryAxis_out.pptx", SaveFormat::Pptx); ``` ### **Determine the Category Axis Type from Data** Call [SetCategoryAxisTypeAutomatically](https://reference.aspose.com/slides/cpp/aspose.slides.charts/iaxis/setcategoryaxistypeautomatically/) after populating the categories, then call [get_CategoryAxisType](https://reference.aspose.com/slides/cpp/aspose.slides.charts/iaxis/get_categoryaxistype/) to inspect the selection. This is useful when the same chart receives either text labels or numeric date values. The method determines the type when called; it does not enable a persistent mode that reevaluates later data changes. Call it again after replacing the categories. The following example creates a chart with text categories and prints `Text`. It then replaces the category cell values with dates and calls the method again, which prints `Date`. Dates are stored as numeric OLE Automation values returned by [System::DateTime::ToOADate](https://reference.aspose.com/slides/cpp/system/datetime/tooadate/), rather than date strings. [set_CustomNumberFormat](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdatacell/set_customnumberformat/) controls how those values are displayed; it does not convert text into numeric dates. For more on category cells, see [Chart Workbook](https://docs.aspose.com/slides/cpp/chart-workbook/). Use automatic determination when the input is known to contain text categories or numeric dates, as in this example. For ordinary numeric labels, mixed categories, or empty data, explicitly call [set_CategoryAxisType](https://reference.aspose.com/slides/cpp/aspose.slides.charts/iaxis/set_categoryaxistype/) to match the intended meaning. Numeric values alone do not establish that the categories represent dates. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::ClusteredColumn, 30, 40, 660, 320); chart->get_ChartData()->get_Categories()->Clear(); chart->get_ChartData()->get_Series()->Clear(); auto workbook = chart->get_ChartData()->get_ChartDataWorkbook(); workbook->Clear(0); auto seriesName = workbook->GetCell(0, 0, 1, System::ObjectExt::Box(System::String(u"Sales"))); auto series = chart->get_ChartData()->get_Series()->Add(seriesName, chart->get_Type()); auto labels = std::array{u"First", u"Second", u"Third"}; for (auto i = 0; i < labels.size(); i++) { auto categoryCell = workbook->GetCell(0, i + 1, 0, System::ObjectExt::Box(labels[i])); chart->get_ChartData()->get_Categories()->Add(categoryCell); auto valueCell = workbook->GetCell(0, i + 1, 1, System::ObjectExt::Box((i + 1) * 10)); series->get_DataPoints()->AddDataPointForBarSeries(valueCell); } auto axis = chart->get_Axes()->get_HorizontalAxis(); axis->SetCategoryAxisTypeAutomatically(); System::Console::WriteLine(System::Enum::GetName(axis->get_CategoryAxisType())); // Text auto dates = std::array{System::DateTime(2026, 1, 1), System::DateTime(2026, 1, 2), System::DateTime(2026, 2, 1)}; for (auto i = 0; i < dates.size(); i++) { auto categoryCell = workbook->GetCell(0, i + 1, 0); categoryCell->set_Value(System::ObjectExt::Box(dates[i].ToOADate())); categoryCell->set_CustomNumberFormat(u"yyyy-mm-dd"); } axis->SetCategoryAxisTypeAutomatically(); System::Console::WriteLine(System::Enum::GetName(axis->get_CategoryAxisType())); // Date presentation->Save(u"AutomaticCategoryAxis.pptx", SaveFormat::Pptx); ``` ## **Control Category Axis Label Intervals** When a chart has many categories, reduce the number of visible axis labels without removing categories or data points. Use [set_IsAutomaticTickLabelSpacing](https://reference.aspose.com/slides/cpp/aspose.slides.charts/iaxis/set_isautomaticticklabelspacing/) with `false`, then use [set_TickLabelSpacing](https://reference.aspose.com/slides/cpp/aspose.slides.charts/iaxis/set_ticklabelspacing/) with the desired category interval. For text categories in their normal order, counting starts at the first category: | Interval | Labels displayed in the example | | --- | --- | | `1` | Category 1, Category 2, Category 3, ... Category 24 | | `2` | Category 1, Category 3, Category 5, ... Category 23 | | `3` | Category 1, Category 4, Category 7, ... Category 22 | An interval of `3` displays every third label, leaving two labels hidden between displayed labels. It does not remove the corresponding columns. Automatic spacing chooses an interval based on the available space; it does not necessarily display every label. Tick marks have separate controls. Use [set_IsAutomaticTickMarksSpacing](https://reference.aspose.com/slides/cpp/aspose.slides.charts/iaxis/set_isautomatictickmarksspacing/) with `false` and use [set_TickMarksSpacing](https://reference.aspose.com/slides/cpp/aspose.slides.charts/iaxis/set_tickmarksspacing/) to set their interval. For example, `1` keeps a tick mark at every category interval while labels appear only every third category. Use [set_MajorTickMark](https://reference.aspose.com/slides/cpp/aspose.slides.charts/iaxis/set_majortickmark/) with a visible style so you can see the result. Setting either automatic-spacing property back to `true` lets the chart choose that interval again. The following self-contained example creates 24 categories and one series, then saves three slides in `CategoryAxisIntervals.pptx`: automatic spacing, manual label spacing with independent tick marks, and restored automatic spacing. The two copies retain the original chart data. No input presentation is required. Horizontal label text makes the difference in density easy to see. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::ClusteredColumn, 30, 40, 660, 320); chart->set_HasLegend(false); chart->get_ChartData()->get_Categories()->Clear(); chart->get_ChartData()->get_Series()->Clear(); auto workbook = chart->get_ChartData()->get_ChartDataWorkbook(); workbook->Clear(0); auto series = chart->get_ChartData()->get_Series()->Add(ChartType::ClusteredColumn); for (auto i = 0; i < 24; i++) { auto categoryName = System::String::Format(u"Category {0}", i + 1); auto categoryCell = workbook->GetCell(0, i + 1, 0, System::ObjectExt::Box(categoryName)); chart->get_ChartData()->get_Categories()->Add(categoryCell); auto valueCell = workbook->GetCell(0, i + 1, 1, System::ObjectExt::Box(10 + i % 6 * 5)); series->get_DataPoints()->AddDataPointForBarSeries(valueCell); } auto axis = chart->get_Axes()->get_HorizontalAxis(); axis->set_CategoryAxisType(CategoryAxisType::Text); axis->get_TextFormat()->get_TextBlockFormat()->set_RotationAngle(0); axis->get_TextFormat()->get_PortionFormat()->set_FontHeight(12); axis->set_MajorTickMark(TickMarkType::Outside); axis->set_IsAutomaticTickLabelSpacing(true); axis->set_IsAutomaticTickMarksSpacing(true); // Slide 2: show every third label, but keep a tick mark for every category. auto manualSlide = presentation->get_Slides()->AddClone(slide); auto manualChart = System::ExplicitCast(manualSlide->get_Shape(0)); auto manualAxis = manualChart->get_Axes()->get_HorizontalAxis(); manualAxis->set_IsAutomaticTickLabelSpacing(false); manualAxis->set_TickLabelSpacing(3); manualAxis->set_IsAutomaticTickMarksSpacing(false); manualAxis->set_TickMarksSpacing(1); // Slide 3: let the chart choose both intervals again. auto restoredSlide = presentation->get_Slides()->AddClone(manualSlide); auto restoredChart = System::ExplicitCast(restoredSlide->get_Shape(0)); restoredChart->get_Axes()->get_HorizontalAxis()->set_IsAutomaticTickLabelSpacing(true); restoredChart->get_Axes()->get_HorizontalAxis()->set_IsAutomaticTickMarksSpacing(true); presentation->Save(u"CategoryAxisIntervals.pptx", SaveFormat::Pptx); ``` **Automatic spacing (slide 1):** In this rendering, every second category label is displayed and wraps onto two lines. The automatic result can vary with chart size, fonts, and the renderer. ![Automatic category label spacing with all 24 columns visible](https://docs.aspose.com/slides/cpp/chart-axis/category-axis-automatic.png) **Manual spacing (slide 2):** Every third label is displayed on one line, while tick marks remain at every category interval. All 24 columns, including those without labels, remain visible with the same values. Slide 3 restores the automatic appearance shown above. ![Manual category label interval of three with all 24 columns visible](https://docs.aspose.com/slides/cpp/chart-axis/category-axis-manual.png) ### **Choose the Correct Axis and Interval** Use this category-count interval for a text category axis, such as the category axis of a column, line, area, or bar chart. In a column chart, it is the horizontal axis. In a horizontal bar chart, the category axis is vertical, so apply these settings to [get_VerticalAxis](https://reference.aspose.com/slides/cpp/aspose.slides.charts/iaxesmanager/get_verticalaxis/). Tick-mark spacing also applies to a series axis in charts that have one. Do not use category label spacing to set the numeric scale of a value axis. On a value axis, [set_MajorUnit](https://reference.aspose.com/slides/cpp/aspose.slides.charts/iaxis/set_majorunit/) specifies a difference in values: for example, a major unit of `10` produces ticks at 0, 10, 20, and so on when the axis starts at zero. A category label interval of `3` instead counts category positions, regardless of their data values. Scatter and bubble charts use value axes rather than a text category axis. For a date axis, use time-based major units and scales as described in [Change a Category Axis](https://docs.aspose.com/slides/cpp/chart-axis/#change-a-category-axis). ## **Set the Date Format for Category Axis Values** The example replaces the default chart data with four annual values. Dates are stored as OLE Automation serial numbers in the first worksheet (index `0`). Use [set_CategoryAxisType](https://reference.aspose.com/slides/cpp/aspose.slides.charts/axis/set_categoryaxistype/) to select a date axis, disable source-linked formatting with [set_IsNumberFormatLinkedToSource](https://reference.aspose.com/slides/cpp/aspose.slides.charts/axis/set_isnumberformatlinkedtosource/), and assign `yyyy` with [set_NumberFormat](https://reference.aspose.com/slides/cpp/aspose.slides.charts/axis/set_numberformat/) so the category labels display four-digit years independently of the cell formatting. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::Line, 50, 50, 450, 300); chart->get_ChartData()->get_Categories()->Clear(); chart->get_ChartData()->get_Series()->Clear(); auto workbook = chart->get_ChartData()->get_ChartDataWorkbook(); workbook->Clear(0); auto series = chart->get_ChartData()->get_Series()->Add(ChartType::Line); for (auto i = 0; i < 4; i++) { auto date = System::DateTime(2015 + i, 1, 1); auto categoryCell = workbook->GetCell(0, i + 1, 0, System::ObjectExt::Box(date.ToOADate())); chart->get_ChartData()->get_Categories()->Add(categoryCell); auto valueCell = workbook->GetCell(0, i + 1, 1, System::ObjectExt::Box(i + 1)); series->get_DataPoints()->AddDataPointForLineSeries(valueCell); } chart->get_Axes()->get_HorizontalAxis()->set_CategoryAxisType(CategoryAxisType::Date); chart->get_Axes()->get_HorizontalAxis()->set_IsNumberFormatLinkedToSource(false); chart->get_Axes()->get_HorizontalAxis()->set_NumberFormat(u"yyyy"); presentation->Save(u"DateAxisFormat.pptx", SaveFormat::Pptx); ``` ## **Set a Rotation Angle for a Chart Axis Title** Enable the vertical-axis title with [set_HasTitle](https://reference.aspose.com/slides/cpp/aspose.slides.charts/axis/set_hastitle/), provide title text, and use [set_RotationAngle](https://reference.aspose.com/slides/cpp/aspose.slides.charts/icharttextblockformat/set_rotationangle/) to rotate the title. The angle is measured in degrees; this example saves a column chart with its value-axis title rotated by 90 degrees. ```cpp #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::ClusteredColumn, 50, 50, 450, 300); chart->get_Axes()->get_VerticalAxis()->set_HasTitle(true); chart->get_Axes()->get_VerticalAxis()->get_Title()->AddTextFrameForOverriding(u"Value"); chart->get_Axes()->get_VerticalAxis()->get_Title()->get_TextFormat()->get_TextBlockFormat()->set_RotationAngle(90); presentation->Save(u"RotatedAxisTitle.pptx", SaveFormat::Pptx); ``` ## **Set the Axis Position on a Category or Value Axis** Use [set_AxisBetweenCategories](https://reference.aspose.com/slides/cpp/aspose.slides.charts/axis/set_axisbetweencategories/) to control whether the value axis crosses the category axis between categories or at category tick marks. This property applies to category axes. The example sets it to `true` on the horizontal category axis of a column chart and saves the result. ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::ClusteredColumn, 50, 50, 450, 300); chart->get_Axes()->get_HorizontalAxis()->set_AxisBetweenCategories(true); presentation->Save(u"AxisBetweenCategories.pptx", SaveFormat::Pptx); ``` ## **Set the Display Unit on a Chart Value Axis** Use [set_DisplayUnit](https://reference.aspose.com/slides/cpp/aspose.slides.charts/axis/set_displayunit/) to scale the labels on a value axis without changing the underlying data. With [DisplayUnitType](https://reference.aspose.com/slides/cpp/aspose.slides.charts/displayunittype/) set to `Millions`, a value of 60,000,000 is displayed as 60. The example creates a column chart and applies the millions display unit to its vertical axis. ```cpp #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::ClusteredColumn, 50, 50, 450, 300); chart->get_Axes()->get_VerticalAxis()->set_DisplayUnit(DisplayUnitType::Millions); presentation->Save(u"Result.pptx", SaveFormat::Pptx); ``` ## **Configure a Logarithmic Value Axis** A logarithmic value axis is useful when positive values span several orders of magnitude. For example, a service might receive 10, 100, 1,000, 10,000, and 100,000 requests over five periods. On a linear scale, the smaller values appear close together near zero. A logarithmic scale makes their relative growth easier to compare: equal distances represent equal ratios rather than equal differences. Call [set_IsLogarithmic](https://reference.aspose.com/slides/cpp/aspose.slides.charts/axis/set_islogarithmic/) with `true` on the value axis and use [set_LogBase](https://reference.aspose.com/slides/cpp/aspose.slides.charts/axis/set_logbase/) to choose the base. This changes how the existing values are displayed; it does not change the data or add a logarithmic trend line. A trend line represents a fitted relationship in the data and is a separate feature. ### **Choose the Value Axis and Base** For a line or column chart, the value axis is [get_VerticalAxis](https://reference.aspose.com/slides/cpp/aspose.slides.charts/iaxesmanager/get_verticalaxis/). For a horizontal bar chart, it is [get_HorizontalAxis](https://reference.aspose.com/slides/cpp/aspose.slides.charts/iaxesmanager/get_horizontalaxis/). Scatter and bubble charts have two value axes, so choose the horizontal axis for X values, the vertical axis for Y values, or both. Do not apply logarithmic scaling to a category axis. The default logarithmic base is `10`. For PPTX charts, use a base from `2` through `1000`, inclusive; fractional bases such as `2.5` are also supported. With base `10`, successive powers such as 10, 100, 1,000, and 10,000 are equally spaced. ### **Compare Linear and Logarithmic Scaling** The following self-contained example creates a line chart with the five request counts on the first slide, then clones that slide and enables a base-10 logarithmic value axis on the second. Both slides retain the same data. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::Line, 30, 40, 660, 200); chart->set_HasLegend(false); chart->get_ChartData()->get_Categories()->Clear(); chart->get_ChartData()->get_Series()->Clear(); auto workbook = chart->get_ChartData()->get_ChartDataWorkbook(); workbook->Clear(0); auto series = chart->get_ChartData()->get_Series()->Add(ChartType::Line); auto values = std::array{10, 100, 1000, 10000, 100000}; for (auto i = 0; i < values.size(); i++) { auto categoryName = System::String::Format(u"Period {0}", i + 1); auto categoryCell = workbook->GetCell(0, i + 1, 0, System::ObjectExt::Box(categoryName)); chart->get_ChartData()->get_Categories()->Add(categoryCell); auto valueCell = workbook->GetCell(0, i + 1, 1, System::ObjectExt::Box(values[i])); series->get_DataPoints()->AddDataPointForLineSeries(valueCell); } // Keep the first slide linear and change only the copy's value-axis scale. auto logarithmicSlide = presentation->get_Slides()->AddClone(slide); auto logarithmicChart = System::ExplicitCast(logarithmicSlide->get_Shape(0)); auto valueAxis = logarithmicChart->get_Axes()->get_VerticalAxis(); valueAxis->set_IsLogarithmic(true); valueAxis->set_LogBase(10); presentation->Save(u"LogarithmicAxis.pptx", SaveFormat::Pptx); ``` **Linear scale (slide 1):** Equal vertical distances represent equal differences in request counts. The largest value dominates the chart, making the smaller values difficult to distinguish. ![Line chart in PowerPoint showing five request counts on a linear value axis](https://docs.aspose.com/slides/cpp/chart-axis/value-axis-linear.png) **Logarithmic scale (slide 2):** Equal vertical distances represent equal ratios. Each period has ten times as many requests as the previous one, so the points form a straight rising line on the base-10 scale. The axis labels still show the original request counts. ![The same five request counts in PowerPoint on a base-10 logarithmic value axis](https://docs.aspose.com/slides/cpp/chart-axis/value-axis-logarithmic.png) ### **Handle Zero and Negative Values** A logarithmic scale can display only strictly positive values. Check the data before enabling it. If zero or negative values are meaningful, keep a linear scale or show them separately. If excluding those values is appropriate for the analysis, explain the omission. Do not silently replace them with small positive numbers, as this changes the meaning of the data. Any manually configured minimum or maximum for a logarithmic axis must also be positive. ## **FAQ** **How do I set the value at which one axis crosses the other (axis crossing)?** Use [set_CrossType](https://reference.aspose.com/slides/cpp/aspose.slides.charts/axis/set_crosstype/) to select the crossing behavior. To specify a numeric crossing value, use [set_CrossAt](https://reference.aspose.com/slides/cpp/aspose.slides.charts/axis/set_crossat/). These settings let you move the axis crossing to a suitable baseline. **How can I position tick labels relative to the axis?** Use [set_TickLabelPosition](https://reference.aspose.com/slides/cpp/aspose.slides.charts/axis/set_ticklabelposition/) with a value from [TickLabelPositionType](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ticklabelpositiontype/): `Low`, `High`, `NextTo`, or `None`. To control the tick marks themselves, use [set_MajorTickMark](https://reference.aspose.com/slides/cpp/aspose.slides.charts/axis/set_majortickmark/) or [set_MinorTickMark](https://reference.aspose.com/slides/cpp/aspose.slides.charts/axis/set_minortickmark/); these are separate from label positioning. ## Related articles - [Format Presentation Charts in C++](https://docs.aspose.com/slides/cpp/chart-formatting/) # Optimize Chart Calculations for Presentations in C++ > Understand chart calculations, data updates, and precision control in Aspose.Slides for C++ for PPT and PPTX, with practical C++ code examples. Source: https://docs.aspose.com/slides/cpp/chart-calculations/ Updated: 2026-08-05 ## **Overview** Aspose.Slides provides APIs for working with chart calculations and layout data in presentations. This article shows how to retrieve the actual values of chart elements, including the real position and size of elements that implement `IActualLayout` and the actual values of chart axes. It also explains that these values are populated after chart layout validation. In addition, the article demonstrates how to get the actual position of parent chart elements and how to hide chart components such as the title, axes, legend, and grid lines. Together, these examples help you inspect chart layout information and control the visibility of chart elements in PowerPoint presentations programmatically. ## **Calculate Actual Values of Chart Elements** Aspose.Slides for C++ provides a simple API for getting these properties. This will help you to calculate actual values of chart elements. The actual values include position of elements that implement IActualLayout interface (IActualLayout::get_ActualX(), IActualLayout::get_ActualY(), IActualLayout::get_ActualWidth(), IActualLayout::get_ActualHeight()) and actual axes values (IAxis::get_ActualMaxValue(), IAxis::get_ActualMinValue(), IAxis::get_ActualMajorUnit(), IAxis::get_ActualMinorUnit(), IAxis::get_ActualMajorUnitScale(), IAxis::get_ActualMinorUnitScale()). ``` cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; auto pres = System::MakeObject(u"test.pptx"); auto chart = System::ExplicitCast(pres->get_Slides()->idx_get(0)->get_Shapes()->AddChart(ChartType::ClusteredColumn, 100.0f, 100.0f, 500.0f, 350.0f)); chart->ValidateChartLayout(); double x = chart->get_PlotArea()->get_ActualX(); double y = chart->get_PlotArea()->get_ActualY(); double w = chart->get_PlotArea()->get_ActualWidth(); double h = chart->get_PlotArea()->get_ActualHeight(); // Saving presentation pres->Save(u"Result.pptx", SaveFormat::Pptx); ``` ## **Calculate the Actual Position of Parent Chart Elements** Aspose.Slides for C++ provides a simple API for getting these properties. Methods of IActualLayout provide information about actual position of parent chart element. It is necessary to call method IChart::ValidateChartLayout() previously to fill properties with actual values. ``` cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; // Creating empty presentation auto pres = System::MakeObject(); auto chart = System::ExplicitCast(pres->get_Slides()->idx_get(0)->get_Shapes()->AddChart(ChartType::ClusteredColumn, 100.0f, 100.0f, 500.0f, 350.0f)); chart->ValidateChartLayout(); double x = chart->get_PlotArea()->get_ActualX(); double y = chart->get_PlotArea()->get_ActualY(); double w = chart->get_PlotArea()->get_ActualWidth(); double h = chart->get_PlotArea()->get_ActualHeight(); ``` ## **Hide Chart Elements** This topic helps you to understand how to hide information from chart. Using Aspose.Slides for C++ you can hide **Title, Vertical Axis, Horizontal Axis** and **Grid Lines** from chart. Below code example shows how to use these properties. ```cpp // The path to the documents directory. const String outPath = u"../out/HideInformationFromChart.pptx"; // Load the desired the presentation SharedPtr pres = MakeObject(); SharedPtr chart = pres->get_Slides()->idx_get(0)->get_Shapes()->AddChart(ChartType::LineWithMarkers, 140, 118, 320, 370); //Hiding chart Title chart->set_HasTitle(false); ///Hiding Values axis chart->get_Axes()->get_VerticalAxis()->set_IsVisible(false); //Category Axis visibility chart->get_Axes()->get_HorizontalAxis()->set_IsVisible(false); //Hiding Legend chart->set_HasLegend(false); //Hiding MajorGridLines chart->get_Axes()->get_HorizontalAxis()->get_MajorGridLinesFormat()->get_Line()->get_FillFormat()->set_FillType(FillType::NoFill); for (int i = 0; i < chart->get_ChartData()->get_Series()->get_Count(); i++) { chart->get_ChartData()->get_Series()->RemoveAt(i); } SharedPtr series = chart->get_ChartData()->get_Series()->idx_get(0); series->get_Marker()->set_Symbol(MarkerStyleType::Circle); series->get_Labels()->get_DefaultDataLabelFormat()->set_ShowValue(true); series->get_Labels()->get_DefaultDataLabelFormat()->set_Position(LegendDataLabelPosition::Top); series->get_Marker()->set_Size(15); //Setting series line color series->get_Format()->get_Line()->get_FillFormat()->set_FillType(FillType::Solid); series->get_Format()->get_Line()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Magenta()); series->get_Format()->get_Line()->set_DashStyle(LineDashStyle::Solid); //Write the PPTX to Disk pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx); ``` [Source: Examples-SlidesCPP-HideInformationFromChart-HideInformationFromChart.cpp](https://gist.githubusercontent.com/aspose-com-gists/81aeb05e6d3a070aa76fdea22ed53bc7/raw/e299c076a90f54b74f22104d4e109d75efef6b63/Examples-SlidesCPP-HideInformationFromChart-HideInformationFromChart.cpp) ## **Set a Data Range for a Chart** Aspose.Slides for C++ has provided the simplest API to set the data range for chart in an easiest way. To set the data range for chart: - Open an instance of Presentation class containing chart. - Obtain the reference of a slide by using its Index. - Traverse through all shapes to find desired chart. - Access the chart data and set the range. - Save the modified presentation as a PPTX file. The code examples that follow how to update a chart. ```cpp For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C // The path to the documents directory. const String templatePath = u"../templates/ExistingChart.pptx"; const String outPath = u"../out/DataRange_out.pptx"; //Instantiate Presentation class that represents PPTX file SharedPtr pres = MakeObject(templatePath); //Access first slide SharedPtr slide = pres->get_Slides()->idx_get(0); // Add chart with default data // SharedPtr chart = DynamicCast(slide->get_Shapes()->idx_get(0)); auto chart = DynamicCast(slide->get_Shapes()->idx_get(0)); //Not working //Set data range // chart->get_ChartData()->SetRange("Sheet1!A1:B4"); // Write the presentation file to disk pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx); ``` [Source: Examples-SlidesCPP-SetDataRange-SetDataRange.cpp](https://gist.githubusercontent.com/aspose-slides/a690df625dc0b1fff869ab198affe7a4/raw/5862954587db1a857ba7513d6a3963c56bf0c20e/Examples-SlidesCPP-SetDataRange-SetDataRange.cpp) ## **FAQ** ### Do external Excel workbooks work as a data source, and how does that affect recalculation? Yes. A chart can reference an external workbook: when you connect or refresh the external source, formulas and values are taken from that workbook, and the chart reflects the updates during open/edit operations. The API lets you [specify the external workbook](https://reference.aspose.com/slides/cpp/aspose.slides.charts/chartdata/setexternalworkbook/) path and manage the linked data. ### Can I compute and display trendlines without implementing regression myself? Yes. [Trendlines](https://docs.aspose.com/slides/cpp/trend-line/) (linear, exponential, and others) are added and updated by Aspose.Slides; their parameters are recalculated from the series data automatically, so you don’t need to implement your own calculations. ### If a presentation has multiple charts with external links, can I control which workbook each chart uses for computed values? Yes. Each chart can point to its own [external workbook](https://reference.aspose.com/slides/cpp/aspose.slides.charts/chartdata/setexternalworkbook/), or you can create/replace an external workbook per chart independently of the others. # Manage Chart Data Labels in Presentations Using C++ > Learn to add and format chart data labels in PowerPoint presentations using Aspose.Slides for C++ for more engaging slides. Source: https://docs.aspose.com/slides/cpp/chart-data-label/ Updated: 2026-11-06 ## **Introduction** Data labels display information about chart series and individual data points, helping readers identify values and understand the chart. This article explains how to format values, display percentages, read label text, control labels beyond the axis maximum, adjust category axis label spacing, and position pie chart labels. ## **Count Visible Data Labels** Use [get_CountOfVisibleDataLabels](https://reference.aspose.com/slides/cpp/aspose.slides.charts/idatalabelcollection/get_countofvisibledatalabels/) to check how many data labels are enabled for display before publishing a presentation. Unlike [get_Count](https://reference.aspose.com/slides/cpp/aspose.slides.charts/idatalabelcollection/get_count/), which returns the total number of labels in the collection, it takes the series defaults and individual label settings into account. This example creates a column chart with one series and three data points. It accesses the series' [get_Labels](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartseries/get_labels/) collection and prints the visible count as the settings change: **0, 3, 2, 3**. The total count remains **3**. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::ClusteredColumn, 50, 50, 500, 300); chart->get_ChartData()->get_Series()->Clear(); chart->get_ChartData()->get_Categories()->Clear(); auto workbook = chart->get_ChartData()->get_ChartDataWorkbook(); auto seriesCell = workbook->GetCell(0, 0, 1, ObjectExt::Box(u"Values")); auto series = chart->get_ChartData()->get_Series()->Add(seriesCell, chart->get_Type()); for (auto i = 0; i < 3; i++) { auto categoryCell = workbook->GetCell(0, i + 1, 0, ObjectExt::Box(String::Format(u"Category {0}", i + 1))); chart->get_ChartData()->get_Categories()->Add(categoryCell); auto valueCell = workbook->GetCell(0, i + 1, 1, ObjectExt::Box((i + 1) * 10)); series->get_DataPoints()->AddDataPointForBarSeries(valueCell); } auto labels = series->get_Labels(); Console::WriteLine(String::Format(u"Total: {0}; visible: {1}", labels->get_Count(), labels->get_CountOfVisibleDataLabels())); // Total: 3; visible: 0 labels->get_DefaultDataLabelFormat()->set_ShowValue(true); Console::WriteLine(String::Format(u"Visible: {0}", labels->get_CountOfVisibleDataLabels())); // Visible: 3 labels->idx_get(1)->get_DataLabelFormat()->set_ShowValue(false); Console::WriteLine(String::Format(u"Visible: {0}", labels->get_CountOfVisibleDataLabels())); // Visible: 2 labels->idx_get(1)->get_DataLabelFormat()->set_ShowLegendKey(true); Console::WriteLine(String::Format(u"Visible: {0}", labels->get_CountOfVisibleDataLabels())); // Visible: 3 ``` The series' [get_DefaultDataLabelFormat](https://reference.aspose.com/slides/cpp/aspose.slides.charts/idatalabelcollection/get_defaultdatalabelformat/) supplies the default settings. Calling [set_ShowValue](https://reference.aspose.com/slides/cpp/aspose.slides.charts/idatalabelformat/set_showvalue/) with `true` there displays values for all three labels. Passing `false` through one label's [get_DataLabelFormat](https://reference.aspose.com/slides/cpp/aspose.slides.charts/idatalabel/get_datalabelformat/) overrides that setting for the selected label. Calling [set_ShowLegendKey](https://reference.aspose.com/slides/cpp/aspose.slides.charts/idatalabelformat/set_showlegendkey/) with `true` makes that label count as visible again, even though its value remains hidden. The visible count reflects visibility settings. It does not measure whether labels overlap, are clipped, or are readable in the rendered chart. ## **Set Data Precision in Chart Data Labels** Use [set_NumberFormatOfValues](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartseries/set_numberformatofvalues/) to format series values. This example creates a line chart with default data, displays its data table, and enables value labels for the first series. The format `#,##0.00` displays a thousands separator and two decimal places without changing the underlying values. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::Line, 50, 50, 450, 300); chart->set_HasDataTable(true); auto series = chart->get_ChartData()->get_Series()->idx_get(0); series->set_NumberFormatOfValues(u"#,##0.00"); series->get_Labels()->get_DefaultDataLabelFormat()->set_ShowValue(true); presentation->Save(u"PrecisionOfDatalabels_out.pptx", SaveFormat::Pptx); ``` To format the numeric cells in a chart's embedded workbook, see [Set Custom Number Formats for Workbook Cells](https://docs.aspose.com/slides/cpp/chart-workbook/#set-custom-number-formats-for-workbook-cells). That example also shows value labels following their source cell formats while preserving the stored numeric values. ## **Display Percentage as Labels** For a stacked column chart, calculate each value as a percentage of its category total and assign the text to the text frame returned by [get_TextFrameForOverriding](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ioverridabletext/get_textframeforoverriding/). This example uses the default chart data and displays percentages with two decimal places in an 8-point font. Categories with a total of zero are skipped to avoid division by zero. Recalculate the custom label text if the chart data changes. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::StackedColumn, 20, 20, 400, 400); auto categoryTotals = std::vector(chart->get_ChartData()->get_Categories()->get_Count(), 0.0); for (auto k = 0; k < chart->get_ChartData()->get_Categories()->get_Count(); k++) { for (auto i = 0; i < chart->get_ChartData()->get_Series()->get_Count(); i++) { auto series = chart->get_ChartData()->get_Series()->idx_get(i); auto pointValue = Convert::ToDouble(series->get_DataPoint(k)->get_Value()->get_Data()); categoryTotals[k] += pointValue; } } for (auto x = 0; x < chart->get_ChartData()->get_Series()->get_Count(); x++) { auto series = chart->get_ChartData()->get_Series()->idx_get(x); series->get_Labels()->get_DefaultDataLabelFormat()->set_ShowLegendKey(false); for (auto j = 0; j < series->get_DataPoints()->get_Count(); j++) { auto label = series->get_DataPoint(j)->get_Label(); if (categoryTotals[j] == 0) { continue; } auto pointValue = Convert::ToDouble(series->get_DataPoint(j)->get_Value()->get_Data()); auto dataPointPercent = (pointValue / categoryTotals[j]) * 100; auto portion = MakeObject(); portion->set_Text(String::Format(u"{0:F2} %", dataPointPercent)); portion->get_PortionFormat()->set_FontHeight(8.0f); label->get_TextFrameForOverriding()->set_Text(u""); auto paragraph = label->get_TextFrameForOverriding()->get_Paragraphs()->idx_get(0); paragraph->get_Portions()->Add(portion); label->get_DataLabelFormat()->set_ShowValue(true); label->get_DataLabelFormat()->set_ShowSeriesName(false); label->get_DataLabelFormat()->set_ShowPercentage(false); label->get_DataLabelFormat()->set_ShowLegendKey(false); label->get_DataLabelFormat()->set_ShowCategoryName(false); label->get_DataLabelFormat()->set_ShowBubbleSize(false); } } presentation->Save(u"DisplayPercentageAsLabels_out.pptx", SaveFormat::Pptx); ``` ## **Set Percentage Sign with Chart Data Labels** When values are stored as fractions, use [set_NumberFormat](https://reference.aspose.com/slides/cpp/aspose.slides.charts/idatalabelformat/set_numberformat/) to display percentages. Pass `false` to [set_IsNumberFormatLinkedToSource](https://reference.aspose.com/slides/cpp/aspose.slides.charts/idatalabelformat/set_isnumberformatlinkedtosource/) to apply the label format independently of the source cells. This example creates a 100% stacked column chart with red and blue series across four categories. Each pair of values adds up to 1. The label format `0.0%` displays 0.30 as 30.0%, while the vertical axis uses two decimal places. Both series use white, 10-point label text. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; using namespace System; using namespace System::Drawing; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::PercentsStackedColumn, 20, 20, 500, 400); chart->get_Axes()->get_VerticalAxis()->set_IsNumberFormatLinkedToSource(false); chart->get_Axes()->get_VerticalAxis()->set_NumberFormat(u"0.00%"); chart->get_ChartData()->get_Series()->Clear(); chart->get_ChartData()->get_Categories()->Clear(); auto workbook = chart->get_ChartData()->get_ChartDataWorkbook(); auto worksheetIndex = 0; for (auto i = 0; i < 4; i++) { auto categoryCell = workbook->GetCell(worksheetIndex, i + 1, 0, ObjectExt::Box(String::Format(u"Category {0}", i + 1))); chart->get_ChartData()->get_Categories()->Add(categoryCell); } String seriesNames[] = { u"Reds", u"Blues" }; Color seriesColors[] = { Color::get_Red(), Color::get_Blue() }; double values[2][4] = { { 0.30, 0.50, 0.80, 0.65 }, { 0.70, 0.50, 0.20, 0.35 } }; for (auto i = 0; i < 2; i++) { auto seriesCell = workbook->GetCell(worksheetIndex, 0, i + 1, ObjectExt::Box(seriesNames[i])); auto series = chart->get_ChartData()->get_Series()->Add(seriesCell, chart->get_Type()); for (auto j = 0; j < 4; j++) { auto valueCell = workbook->GetCell(worksheetIndex, j + 1, i + 1, ObjectExt::Box(values[i][j])); series->get_DataPoints()->AddDataPointForBarSeries(valueCell); } series->get_Format()->get_Fill()->set_FillType(FillType::Solid); series->get_Format()->get_Fill()->get_SolidFillColor()->set_Color(seriesColors[i]); auto labelFormat = series->get_Labels()->get_DefaultDataLabelFormat(); labelFormat->set_ShowValue(true); labelFormat->set_IsNumberFormatLinkedToSource(false); labelFormat->set_NumberFormat(u"0.0%"); labelFormat->get_TextFormat()->get_PortionFormat()->set_FontHeight(10); labelFormat->get_TextFormat()->get_PortionFormat()->get_FillFormat()->set_FillType(FillType::Solid); labelFormat->get_TextFormat()->get_PortionFormat()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_White()); } presentation->Save(u"SetDataLabelsPercentageSign_out.pptx", SaveFormat::Pptx); ``` ## **Read the Actual Text of Data Labels** Use [GetActualLabelText](https://reference.aspose.com/slides/cpp/aspose.slides.charts/idatalabel/getactuallabeltext/) to retrieve the text produced by a data label's settings. This is useful when extracting labels for reports, searching presentation content, or validating generated charts. In the example below, the default [data label format](https://reference.aspose.com/slides/cpp/aspose.slides.charts/idatalabelformat/) combines each category name, series name, and value. One point formats its value as a percentage, and another uses custom text from [get_TextFrameForOverriding](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ioverridabletext/get_textframeforoverriding/). ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::ClusteredColumn, 20, 20, 500, 300); chart->get_ChartData()->get_Series()->Clear(); chart->get_ChartData()->get_Categories()->Clear(); auto workbook = chart->get_ChartData()->get_ChartDataWorkbook(); auto firstCategoryCell = workbook->GetCell(0, 1, 0, ObjectExt::Box(u"Q1")); chart->get_ChartData()->get_Categories()->Add(firstCategoryCell); auto secondCategoryCell = workbook->GetCell(0, 2, 0, ObjectExt::Box(u"Q2")); chart->get_ChartData()->get_Categories()->Add(secondCategoryCell); auto northSeriesCell = workbook->GetCell(0, 0, 1, ObjectExt::Box(u"North")); auto north = chart->get_ChartData()->get_Series()->Add(northSeriesCell, chart->get_Type()); auto northFirstValueCell = workbook->GetCell(0, 1, 1, ObjectExt::Box(0.25)); north->get_DataPoints()->AddDataPointForBarSeries(northFirstValueCell); auto northSecondValueCell = workbook->GetCell(0, 2, 1, ObjectExt::Box(0.75)); north->get_DataPoints()->AddDataPointForBarSeries(northSecondValueCell); auto southSeriesCell = workbook->GetCell(0, 0, 2, ObjectExt::Box(u"South")); auto south = chart->get_ChartData()->get_Series()->Add(southSeriesCell, chart->get_Type()); auto southFirstValueCell = workbook->GetCell(0, 1, 2, ObjectExt::Box(0.40)); south->get_DataPoints()->AddDataPointForBarSeries(southFirstValueCell); auto southSecondValueCell = workbook->GetCell(0, 2, 2, ObjectExt::Box(0.60)); south->get_DataPoints()->AddDataPointForBarSeries(southSecondValueCell); for (auto i = 0; i < chart->get_ChartData()->get_Series()->get_Count(); i++) { auto series = chart->get_ChartData()->get_Series()->idx_get(i); auto format = series->get_Labels()->get_DefaultDataLabelFormat(); format->set_ShowCategoryName(true); format->set_ShowSeriesName(true); format->set_ShowValue(true); } north->get_Label(1)->get_DataLabelFormat()->set_IsNumberFormatLinkedToSource(false); north->get_Label(1)->get_DataLabelFormat()->set_NumberFormat(u"0%"); south->get_Label(0)->get_TextFrameForOverriding()->set_Text(u"Reviewed"); for (auto i = 0; i < chart->get_ChartData()->get_Series()->get_Count(); i++) { auto series = chart->get_ChartData()->get_Series()->idx_get(i); for (auto j = 0; j < series->get_DataPoints()->get_Count(); j++) { auto point = series->get_DataPoint(j); auto label = point->get_Label(); if (!label->get_IsVisible()) { continue; } Console::WriteLine(String::Format(u"Value: {0}; label: {1}", point->get_Value()->get_Data(), label->GetActualLabelText())); } } ``` The number stored in a data point remains `0.75`, even when its label shows `75%` along with the category and series names. Custom text replaces the generated label text. [GetActualLabelText](https://reference.aspose.com/slides/cpp/aspose.slides.charts/idatalabel/getactuallabeltext/) returns the resulting label string in either case. Check [get_IsVisible](https://reference.aspose.com/slides/cpp/aspose.slides.charts/idatalabel/get_isvisible/) separately, as shown above, when you want to extract only visible labels. ## **Control Data Labels Beyond the Axis Maximum** When you limit an axis range manually, some data points may exceed its maximum. Use [set_ShowDataLabelsOverMaximum](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichart/set_showdatalabelsovermaximum/) to control whether their data labels are shown. This setting changes label visibility; it does not change the axis range or the underlying data values. The example below creates a 2D clustered column chart with values of 60 and 120. It sets [set_IsAutomaticMaxValue](https://reference.aspose.com/slides/cpp/aspose.slides.charts/iaxis/set_isautomaticmaxvalue/) to `false` and [set_MaxValue](https://reference.aspose.com/slides/cpp/aspose.slides.charts/iaxis/set_maxvalue/) to 100 on the vertical axis. The first slide allows labels beyond the maximum; a copy of that slide disables them. Both slides are saved in `DataLabelsOverMaximum.pptx`. Enable value labels with [set_ShowValue](https://reference.aspose.com/slides/cpp/aspose.slides.charts/idatalabelformat/set_showvalue/). The chart-level setting does not enable value display by itself or override an individual label's disabled value display. This example enables values for the entire series and uses [set_Position](https://reference.aspose.com/slides/cpp/aspose.slides.charts/idatalabelformat/set_position/) to place labels at the outside end of each column. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::ClusteredColumn, 50, 50, 600, 400); chart->set_HasLegend(false); chart->get_ChartData()->get_Series()->Clear(); chart->get_ChartData()->get_Categories()->Clear(); auto workbook = chart->get_ChartData()->get_ChartDataWorkbook(); auto firstCategory = workbook->GetCell(0, 1, 0, ObjectExt::Box(u"Within range")); auto secondCategory = workbook->GetCell(0, 2, 0, ObjectExt::Box(u"Above maximum")); chart->get_ChartData()->get_Categories()->Add(firstCategory); chart->get_ChartData()->get_Categories()->Add(secondCategory); auto seriesName = workbook->GetCell(0, 0, 1, ObjectExt::Box(u"Values")); auto series = chart->get_ChartData()->get_Series()->Add(seriesName, chart->get_Type()); auto firstValue = workbook->GetCell(0, 1, 1, ObjectExt::Box(60)); auto secondValue = workbook->GetCell(0, 2, 1, ObjectExt::Box(120)); series->get_DataPoints()->AddDataPointForBarSeries(firstValue); series->get_DataPoints()->AddDataPointForBarSeries(secondValue); series->get_Labels()->get_DefaultDataLabelFormat()->set_ShowValue(true); series->get_Labels()->get_DefaultDataLabelFormat()->set_Position(LegendDataLabelPosition::OutsideEnd); chart->get_Axes()->get_VerticalAxis()->set_IsAutomaticMaxValue(false); chart->get_Axes()->get_VerticalAxis()->set_MaxValue(100); chart->set_ShowDataLabelsOverMaximum(true); auto secondSlide = presentation->get_Slides()->AddClone(slide); auto secondChart = ExplicitCast(secondSlide->get_Shape(0)); secondChart->set_ShowDataLabelsOverMaximum(false); presentation->Save(u"DataLabelsOverMaximum.pptx", SaveFormat::Pptx); ``` The following images show the saved slides rendered by Microsoft PowerPoint. With `true`, the label **120** is visible at the upper boundary; with `false`, it is hidden. The label **60** remains visible, the axis maximum stays at **100**, and the second data point remains **120** in both cases. | ShowDataLabelsOverMaximum = true | ShowDataLabelsOverMaximum = false | | --- | --- | | ![PowerPoint chart showing the value label 120 with an axis maximum of 100](https://docs.aspose.com/slides/cpp/chart-data-label/data-labels-over-maximum-true.png) | ![PowerPoint chart hiding the value label 120 with an axis maximum of 100](https://docs.aspose.com/slides/cpp/chart-data-label/data-labels-over-maximum-false.png) | This example uses a 2D column chart with a value axis. Charts without a value axis, such as pie and doughnut charts, do not have an axis maximum to limit in this way. ## **Set Label Distance from an Axis** Use [set_LabelOffset](https://reference.aspose.com/slides/cpp/aspose.slides.charts/iaxis/set_labeloffset/) to control the distance between category axis labels and the axis. The value is a percentage of the maximum font size of the axis labels. This example creates a clustered column chart and sets the horizontal axis label offset to 500. This setting affects category axis labels rather than labels attached to individual data points. ```cpp #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::ClusteredColumn, 20, 20, 500, 300); chart->get_Axes()->get_HorizontalAxis()->set_LabelOffset(500); presentation->Save(u"SetCategoryAxisLabelDistance_out.pptx", SaveFormat::Pptx); ``` ## **Adjust Label Location** On a pie chart, adjust data label positions to improve spacing and make room for leader lines. This example displays the value of the first data point, places its label outside the slice, and uses [set_X](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ilayoutable/set_x/) and [set_Y](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ilayoutable/set_y/) to adjust its offsets. These offsets are relative to the chart width and height, respectively. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::Pie, 50, 50, 200, 200); auto series = chart->get_ChartData()->get_Series(); auto label = series->idx_get(0)->get_Label(0); label->get_DataLabelFormat()->set_ShowValue(true); label->get_DataLabelFormat()->set_Position(LegendDataLabelPosition::OutsideEnd); label->set_X(0.71f); label->set_Y(0.04f); presentation->Save(u"presentation.pptx", SaveFormat::Pptx); ``` ![Pie chart with an adjusted data label position](https://docs.aspose.com/slides/cpp/chart-data-label/pie-chart-adjusted-label.png) ## **Format Leader Lines** When pie chart labels sit outside their slices, leader lines help readers match each value to the correct slice. A contrasting color and a slightly thicker line can make these connections easier to follow, while transparency and a dashed style keep the lines visually unobtrusive. Use [get_LeaderLinesFormat](https://reference.aspose.com/slides/cpp/aspose.slides.charts/idatalabelcollection/get_leaderlinesformat/) to format leader lines at the series' data label collection level. The settings in `series->get_Labels()->get_LeaderLinesFormat()->get_Line()` apply to the collection, rather than to an individual label. This example creates a pie chart with default data, displays values outside the slices, and enables leader lines with [set_ShowLeaderLines](https://reference.aspose.com/slides/cpp/aspose.slides.charts/idatalabelformat/set_showleaderlines/). It moves two labels farther from their slices using [set_X](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ilayoutable/set_x/) and [set_Y](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ilayoutable/set_y/) offsets, expressed as fractions of the chart width and height. No input presentation is required. The fill format returned by [get_FillFormat](https://reference.aspose.com/slides/cpp/aspose.slides/ilineformat/get_fillformat/) is used to set a solid blue color with an alpha value of 191 out of 255, giving approximately 25% transparency. [set_Width](https://reference.aspose.com/slides/cpp/aspose.slides/ilineformat/set_width/) sets the thickness to 2 points, and [set_DashStyle](https://reference.aspose.com/slides/cpp/aspose.slides/ilineformat/set_dashstyle/) makes the line dashed. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; using namespace System; using namespace System::Drawing; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::Pie, 80, 50, 560, 400); chart->set_HasLegend(false); auto series = chart->get_ChartData()->get_Series()->idx_get(0); auto labelFormat = series->get_Labels()->get_DefaultDataLabelFormat(); labelFormat->set_ShowValue(true); labelFormat->set_Position(LegendDataLabelPosition::OutsideEnd); labelFormat->set_ShowLeaderLines(true); // Move two labels farther away from their slices. series->get_Label(0)->set_X(0.10f); series->get_Label(0)->set_Y(-0.05f); series->get_Label(1)->set_X(-0.10f); series->get_Label(1)->set_Y(0.05f); auto line = series->get_Labels()->get_LeaderLinesFormat()->get_Line(); line->get_FillFormat()->set_FillType(FillType::Solid); line->get_FillFormat()->get_SolidFillColor()->set_Color(Color::FromArgb(191, 30, 90, 160)); line->set_Width(2); line->set_DashStyle(LineDashStyle::Dash); presentation->Save(u"FormattedLeaderLines.pptx", SaveFormat::Pptx); ``` Enabling leader lines does not guarantee that a line will appear for every label. Visibility depends on label placement and the chart's layout behavior. In this example, the two displaced labels have visible leader lines; the labels that remain close to their slices do not need them. The following image shows the saved `FormattedLeaderLines.pptx` rendered with Aspose.Slides: ![Pie chart with blue, semitransparent dashed leader lines connecting two outside labels to their slices](https://docs.aspose.com/slides/cpp/chart-data-label/formatted-leader-lines.png) ## **Add Multiple Rows of Data Labels Above a Column Chart** This example creates a column chart with two rows of data labels above the plot area. Series A displays the visible columns, while Series B and Series C provide the additional labels. Their columns are hidden by removing the fill and outline. The [set_Overlap](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartseriesgroup/set_overlap/) method aligns all three series with the same category centers. The [get_PlotArea](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichart/get_plotarea/) settings reserve space for the label rows. After [ValidateChartLayout](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichart/validatechartlayout/) calculates the default positions, [set_X](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ilayoutable/set_x/) and [set_Y](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ilayoutable/set_y/) preserve the horizontal alignment and apply vertical offsets to arrange the labels in two rows. The numbers remain data labels linked to the series values; only the row headings are separate text shapes. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; using namespace System; using namespace System::Drawing; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::ClusteredColumn, 40, 40, 640, 200); chart->set_HasTitle(false); chart->set_HasLegend(false); chart->get_TextFormat()->get_PortionFormat()->set_FontHeight(12); chart->get_ChartData()->get_Series()->Clear(); chart->get_ChartData()->get_Categories()->Clear(); auto workbook = chart->get_ChartData()->get_ChartDataWorkbook(); workbook->Clear(0); String categories[] = { u"North", u"South", u"East", u"West" }; String seriesNames[] = { u"Series A", u"Series B", u"Series C" }; double seriesValues[3][4] = { { 35, 42, 28, 47 }, { 22, 31, 19, 26 }, { 12, 16, 14, 18 } }; for (auto categoryIndex = 0; categoryIndex < 4; categoryIndex++) { auto categoryCell = workbook->GetCell(0, categoryIndex + 1, 0, ObjectExt::Box(categories[categoryIndex])); chart->get_ChartData()->get_Categories()->Add(categoryCell); } for (auto seriesIndex = 0; seriesIndex < 3; seriesIndex++) { auto seriesCell = workbook->GetCell(0, 0, seriesIndex + 1, ObjectExt::Box(seriesNames[seriesIndex])); auto series = chart->get_ChartData()->get_Series()->Add(seriesCell, ChartType::ClusteredColumn); for (auto categoryIndex = 0; categoryIndex < 4; categoryIndex++) { auto valueCell = workbook->GetCell(0, categoryIndex + 1, seriesIndex + 1, ObjectExt::Box(seriesValues[seriesIndex][categoryIndex])); series->get_DataPoints()->AddDataPointForBarSeries(valueCell); } if (seriesIndex > 0) { // Hide the columns of B and C, but keep their data labels. series->get_Format()->get_Fill()->set_FillType(FillType::NoFill); series->get_Format()->get_Line()->get_FillFormat()->set_FillType(FillType::NoFill); auto labelFormat = series->get_Labels()->get_DefaultDataLabelFormat(); labelFormat->set_ShowValue(true); labelFormat->get_TextFormat()->get_PortionFormat()->set_FontHeight(12); auto labelFill = labelFormat->get_TextFormat()->get_PortionFormat()->get_FillFormat(); labelFill->set_FillType(FillType::Solid); labelFill->get_SolidFillColor()->set_Color(Color::get_Black()); labelFormat->set_Position(LegendDataLabelPosition::InsideBase); } } // Align all three series with the same category centers. chart->get_ChartData()->get_Series()->idx_get(0)->get_ParentSeriesGroup()->set_Overlap(100); // Use fewer gridlines for this compact example. chart->get_Axes()->get_VerticalAxis()->set_IsAutomaticMajorUnit(false); chart->get_Axes()->get_VerticalAxis()->set_MajorUnit(10); // Reserve space above the plot for two rows of data labels. chart->get_PlotArea()->set_LayoutTargetType(LayoutTargetType::Inner); chart->get_PlotArea()->set_X(0.15f); chart->get_PlotArea()->set_Y(0.32f); chart->get_PlotArea()->set_Width(0.80f); chart->get_PlotArea()->set_Height(0.48f); chart->ValidateChartLayout(); for (auto seriesIndex = 1; seriesIndex < 3; seriesIndex++) { auto series = chart->get_ChartData()->get_Series()->idx_get(seriesIndex); auto rowTop = seriesIndex == 1 ? 0.15f : 0.03f; for (auto categoryIndex = 0; categoryIndex < 4; categoryIndex++) { auto dataLabel = series->get_DataPoint(categoryIndex)->get_Label(); // Keep the default horizontal position. Y is an offset from // the default label position, expressed as a chart-height fraction. dataLabel->set_X(0); dataLabel->set_Y(rowTop - dataLabel->get_ActualY() / chart->get_Height()); } // Only the row heading is a separate text shape. auto rowHeading = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, chart->get_X(), chart->get_Y() + rowTop * chart->get_Height(), 85, 18); rowHeading->get_FillFormat()->set_FillType(FillType::NoFill); rowHeading->get_LineFormat()->get_FillFormat()->set_FillType(FillType::NoFill); rowHeading->AddTextFrame(seriesNames[seriesIndex]); rowHeading->get_TextFrame()->get_TextFrameFormat()->set_MarginTop(0); rowHeading->get_TextFrame()->get_TextFrameFormat()->set_MarginBottom(0); auto headingFormat = rowHeading->get_TextFrame()->get_Paragraphs()->idx_get(0)->get_Portions()->idx_get(0)->get_PortionFormat(); headingFormat->set_FontHeight(12); headingFormat->get_FillFormat()->set_FillType(FillType::Solid); headingFormat->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Black()); } presentation->Save(u"multiple-rows-of-labels.pptx", SaveFormat::Pptx); ``` ![Column chart with two rows of data labels above the plot area](https://docs.aspose.com/slides/cpp/chart-data-label/multiple-rows-of-labels.png) ## **FAQ** **How can I prevent data labels from overlapping on dense charts?** Combine automatic label placement, leader lines, and reduced font size; if necessary, hide some fields (for example, the category) or show labels only for extreme values or key points. **How can I disable labels only for zero, negative, or empty values?** Filter data points before enabling labels and turn off display for values of 0, negative values, or missing values according to a defined rule. **How can I ensure a consistent label style when exporting to PDF/images?** Explicitly set the font family and size and verify that the font is available in the rendering environment to avoid fallback. # Manage Chart Data Markers in Presentations Using C++ > Learn how to customize chart data markers in Aspose.Slides for C++, boosting presentation impact across PPT and PPTX formats with clear C++ code examples. Source: https://docs.aspose.com/slides/cpp/chart-data-marker/ Updated: 2026-08-05 ## **Overview** This article explains how to work with chart data markers in Aspose.Slides. It shows how to create a chart, access a series and its data points, apply picture fills to markers at the data-point level, adjust marker size, and save the updated presentation. It also notes that standard marker shapes are available through the `MarkerStyleType` enumeration and that marker appearance is preserved when exporting charts to raster formats or SVG. ## **Set Chart Markers** Aspose.Slides for C++ provides a simple API to set the chart series marker automatically. In the following feature, every chart series will get different default marker symbol automatically. Below code example shows how to set the chart series marker automatically. ```cpp // The path to the documents directory. const String outPath = u"../out/DefaultMarkersInChart.pptx"; //Instantiate Presentation class that represents PPTX file SharedPtr pres = MakeObject(); // Accessing the first slide in presentation SharedPtr slide = pres->get_Slides()->idx_get(0); SharedPtr chart = slide->get_Shapes()->AddChart(Aspose::Slides::Charts::ChartType::LineWithMarkers, 10, 10, 400, 400); chart->get_ChartData()->get_Series()->Clear(); chart->get_ChartData()->get_Categories()->Clear(); System::SharedPtr fact = chart->get_ChartData()->get_ChartDataWorkbook(); chart->get_ChartData()->get_Series()->Add(fact->GetCell(0,0,1, System::ObjectExt::Box(u"Category 1")),chart->get_Type()); SharedPtr series = chart->get_ChartData()->get_Series()->idx_get(0); chart->get_ChartData()->get_Categories()->Add(fact->GetCell(0, 1, 0, ObjectExt::Box(u"C1"))); series->get_DataPoints()->AddDataPointForLineSeries(fact->GetCell(0, 1, 1, System::ObjectExt::Box(24))); chart->get_ChartData()->get_Categories()->Add(fact->GetCell(0, 2, 0, ObjectExt::Box(u"C2"))); series->get_DataPoints()->AddDataPointForLineSeries(fact->GetCell(0, 2, 1, System::ObjectExt::Box(23))); chart->get_ChartData()->get_Categories()->Add(fact->GetCell(0, 3, 0, ObjectExt::Box(u"C3"))); series->get_DataPoints()->AddDataPointForLineSeries(fact->GetCell(0, 3, 1, System::ObjectExt::Box(-10))); chart->get_ChartData()->get_Categories()->Add(fact->GetCell(0, 4, 0, ObjectExt::Box(u"C4"))); series->get_DataPoints()->AddDataPointForLineSeries(fact->GetCell(0, 4, 1, nullptr)); chart->get_ChartData()->get_Series()->Add(fact->GetCell(0, 0, 2, ObjectExt::Box(u"Series 2")), chart->get_Type()); //Take second chart series SharedPtr series2 = chart->get_ChartData()->get_Series()->idx_get(1); //Now populating series data series2->get_DataPoints()->AddDataPointForLineSeries(fact->GetCell(0, 1, 2, System::ObjectExt::Box(30))); series2->get_DataPoints()->AddDataPointForLineSeries(fact->GetCell(0, 2, 2, System::ObjectExt::Box(10))); series2->get_DataPoints()->AddDataPointForLineSeries(fact->GetCell(0, 3, 2, System::ObjectExt::Box(60))); series2->get_DataPoints()->AddDataPointForLineSeries(fact->GetCell(0, 4, 2, System::ObjectExt::Box(40))); chart->set_HasLegend(true); chart->get_Legend()->set_Overlay(false); pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx); ``` [Source: Examples-SlidesCPP-DefaultMarkersInChart-DefaultMarkersInChart.cpp](https://gist.githubusercontent.com/aspose-com-gists/81aeb05e6d3a070aa76fdea22ed53bc7/raw/722802314a3d96e16575943a91bb515a8622cfcc/Examples-SlidesCPP-DefaultMarkersInChart-DefaultMarkersInChart.cpp) ## **Set Chart Marker Options** The markers can be set on chart data points inside a particular series. In order to set chart marker options. Please follow the steps below: - Instantiate [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) class. - Creating the default chart. - Set the picture. - Take the first chart series. - Add a new data point. - Write a presentation to disk. In the example given below, we have set the chart marker options on data points level. ```cpp For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C // The path to the documents directory. const String outPath = u"../out/MarkerOptions_out.pptx"; //Instantiate Presentation class that represents PPTX file SharedPtr pres = MakeObject(); //Access first slide SharedPtr slide = pres->get_Slides()->idx_get(0); // Add chart with default data SharedPtr chart = slide->get_Shapes()->AddChart(Aspose::Slides::Charts::ChartType::LineWithMarkers, 0, 0, 500, 500); // Setting Chart Titile chart->set_HasTitle(true); chart->get_ChartTitle()->AddTextFrameForOverriding(u""); SharedPtr chartTitle = chart->get_ChartTitle()->get_TextFrameForOverriding()->get_Paragraphs()->idx_get(0)->get_Portions()->idx_get(0); chartTitle->set_Text(u"Sample Chart"); chartTitle->get_PortionFormat()->get_FillFormat()->set_FillType(FillType::Solid); chartTitle->get_PortionFormat()->get_FillFormat()->get_SolidFillColor()->set_Color(System::Drawing::Color::get_Gray()); chartTitle->get_PortionFormat()->set_FontHeight(20); chartTitle->get_PortionFormat()->set_FontBold(NullableBool::True); chartTitle->get_PortionFormat()->set_FontItalic(NullableBool::True); // Setting Major grid lines format for value axis chart->get_Axes()->get_VerticalAxis()->get_MajorGridLinesFormat()->get_Line()->get_FillFormat()->set_FillType(FillType::Solid); chart->get_Axes()->get_VerticalAxis()->get_MajorGridLinesFormat()->get_Line()->get_FillFormat()->get_SolidFillColor()->set_Color(System::Drawing::Color::get_Blue()); chart->get_Axes()->get_VerticalAxis()->get_MajorGridLinesFormat()->get_Line()->set_Width(5); chart->get_Axes()->get_VerticalAxis()->get_MajorGridLinesFormat()->get_Line()->set_DashStyle(LineDashStyle::DashDot); // Setting Minor grid lines format for value axis chart->get_Axes()->get_VerticalAxis()->get_MinorGridLinesFormat()->get_Line()->get_FillFormat()->set_FillType(FillType::Solid); chart->get_Axes()->get_VerticalAxis()->get_MinorGridLinesFormat->get_Line()->get_FillFormat()->get_SolidFillColor()->set_Color(System::Drawing::Color::get_Red()); chart->get_Axes()->get_VerticalAxis()->get_MinorGridLinesFormat->get_Line()->set_Width(3); // Setting value axis number format chart->get_Axes()->get_VerticalAxis()->set_IsNumberFormatLinkedToSource(false); chart->get_Axes()->get_VerticalAxis()->set_DisplayUnit(DisplayUnitType::Thousands); chart->get_Axes()->get_VerticalAxis()->set_NumberFormat(u"0.0%"); // Setting chart maximum, minimum values chart->get_Axes()->get_VerticalAxis()->set_IsAutomaticMajorUnit(false); chart->get_Axes()->get_VerticalAxis()->set_IsAutomaticMaxValue(false); chart->get_Axes()->get_VerticalAxis()->set_IsAutomaticMinorUnit(false); chart->get_Axes()->get_VerticalAxis()->set_IsAutomaticMinValue(false); chart->get_Axes()->get_VerticalAxis()->set_MaxValue(15); chart->get_Axes()->get_VerticalAxis()->set_MinValue(-2); chart->get_Axes()->get_VerticalAxis()->set_MinorUnit(0.5); chart->get_Axes()->get_VerticalAxis()->set_MajorUnit(2.0); // Setting Value Axis Text Properties SharedPtr txtVal = chart->get_Axes()->get_VerticalAxis()->get_TextFormat()->get_PortionFormat(); txtVal->set_FontBold(NullableBool::True); txtVal->set_FontHeight(16); txtVal->set_FontItalic(NullableBool::True); txtVal->get_FillFormat()->set_FillType(FillType::Solid); txtVal->get_FillFormat.SolidFillColor.Color(System::Drawing::Color::get_DarkGreen()); //SharedPtr fontData = MakeObject(L"Times New Roman"); txtVal->set_LatinFont(MakeObject(u"Times New Roman")); // Setting value axis title chart->get_Axes()->get_VerticalAxis()->set_HasTitle(true); chart->get_Axes()->get_VerticalAxis()->get_Title->AddTextFrameForOverriding(u""); SharedPtr valtitle = chart->get_Axes()->get_VerticalAxis()->get_Title()->get_TextFrameForOverriding()->get_Paragraphs()->idx_get(0)->get_Portions()->idx_get(0); valtitle->set_Text(u"Primary Axis"); valtitle->get_PortionFormat()->get_FillFormat()->set_FillType(FillType::Solid); valtitle->get_PortionFormat()->get_FillFormat()->get_SolidFillColor()->set_Color(System::Drawing::Color::get_Gray()); valtitle->get_PortionFormat()->set_FontHeight(20); valtitle->get_PortionFormat()->set_FontBold(NullableBool::True); valtitle->get_PortionFormat()->set_FontItalic(NullableBool::True); // Setting Major grid lines format for Category axis chart->get_Axes()->get_HorizontalAxis()->get_MajorGridLinesFormat()->get_Line()->get_FillFormat()->set_FillType(FillType::Solid); chart->get_Axes()->get_HorizontalAxis()->get_MajorGridLinesFormat()->get_Line()->get_FillFormat()->get_SolidFillColor()->set_Color(System::Drawing::Color::get_Green()); chart->get_Axes()->get_HorizontalAxis()->get_MajorGridLinesFormat()->get_Line()->set_Width(5); // Setting Minor grid lines format for Category axis chart->get_Axes()->get_HorizontalAxis()->get_MinorGridLinesFormat()->get_Line()->get_FillFormat()->set_FillType(FillType::Solid); chart->get_Axes()->get_HorizontalAxis()->get_MinorGridLinesFormat->get_Line()->get_FillFormat()->get_SolidFillColor()->set_Color(System::Drawing::Color::get_Yellow()); chart->get_Axes()->get_HorizontalAxis()->get_MinorGridLinesFormat->get_Line()->set_Width(3); // Setting Category Axis Text Properties SharedPtr txtCat = chart->get_Axes()->get_HorizontalAxis()->get_TextFormat()->get_PortionFormat(); txtCat->set_FontBold(NullableBool::True); txtCat->set_FontHeight(16); txtCat->set_FontItalic(NullableBool::True); txtCat->get_FillFormat->se_FillType(FillType::Solid); txtCat->get_FillFormat.get_SolidFillColor()->set_Color(System::Drawing::Color::get_Blue()); txtCat->set_LatinFont(MakeObject(u"Arial")); // Setting Category Titile chart->get_Axes()->get_HorizontalAxis()->set_HasTitle(true); chart->get_Axes()->get_HorizontalAxis()->get_Title()->AddTextFrameForOverriding(u""); SharedPtr catTitle = chart->get_Axes()->get_HorizontalAxis()->get_Title()->get_TextFrameForOverriding()->get_Paragraphs()->idx_get(0)->get_Portions()->idx_get(0); catTitle->set_Text(u"Sample Category"); catTitle->get_PortionFormat->get_FillFormat->set_FillType(FillType::Solid); catTitle->get_PortionFormat->get_FillFormat->get_SolidFillColor->set_Color(System::Drawing::Color::get_Gray()); catTitle->get_PortionFormat->set_FontHeight(20); catTitle->get_PortionFormat->set_FontBold(NullableBool::True); catTitle->get_PortionFormat->set_FontItalic(NullableBool::True); // Setting category axis lable position chart->get_Axes()->get_HorizontalAxis()->set_TickLabelPosition(TickLabelPositionType::Low); // Setting category axis lable rotation angle chart->get_Axes()->get_HorizontalAxis()->set_TickLabelRotationAngle(45); // Setting Legends Text Properties SharedPtr txtleg = chart->get_Legend->get_TextFormat()->get_PortionFormat(); txtleg->set_FontBold(NullableBool::True); txtleg->set_FontHeight(16); txtleg->set_FontItalic = NullableBool::True; txtleg->get_FillFormat->set_FillType(FillType::Solid); txtleg->get_FillFormat->get_SolidFillColor->set_Color(System::Drawing::Color::get_DarkRed()); // Set show chart legends without overlapping chart chart->get_Legend()->set_Overlay(true); // Ploting first series on secondary value axis // Chart.ChartData.Series[0].PlotOnSecondAxis = true; // Setting chart back wall color chart->get_BackWall->set_Thickness(1); chart->get_BackWall()->get_Format()->get_Fill()->set_FillType(FillType::Solid); chart->get_BackWall.Format.Fill->get_SolidFillColor->set_Color(System::Drawing::Color::get_Orange()); chart->get_Floor->get_Format()->get_Fill()->set_FillType(FillType::Solid); chart->get_Floor.Format.Fill->get_SolidFillColor->set_Color(System::Drawing::Color::get_Red()); // Setting Plot area color chart->get_PlotArea->get_Format()->get_Fill()->set_FillType(FillType::Solid); chart->get_PlotArea.Format.Fill->get_SolidFillColor->set_Color(System::Drawing::Color::get_LightCyan()); // Write the presentation file to disk pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx); ``` [Source: Examples-SlidesCPP-SetMarkerOptions-SetMarkerOptions.cpp](https://gist.githubusercontent.com/aspose-slides/a690df625dc0b1fff869ab198affe7a4/raw/6cd76784328ed9c9bd819b30199478910df43590/Examples-SlidesCPP-SetMarkerOptions-SetMarkerOptions.cpp) ## **Set Chart Markers on the Series Data Point Level** Now, the markers can be set on chart data points inside a particular series. In order to set chart marker options. Please follow the steps below: - Instantiate Presentation class. - Creating the default chart. - Set the picture. - Take the first chart series. - Add a new data point. - Write a presentation to disk. In the example given below, we have set the chart marker options on data points level. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; using namespace System; const String outPath = u"../out/SetMarkerOptionsonSeries_out.pptx"; const String ImagePath = u"../templates/Tulips.jpg"; const String ImagePath2 = u"../templates/aspose - logo.jpg"; //Instantiate Presentation class that represents PPTX file SharedPtr pres = MakeObject(); //Access first slide SharedPtr slide = pres->get_Slides()->idx_get(0); // Add chart with default data SharedPtr chart = slide->get_Shapes()->AddChart(Aspose::Slides::Charts::ChartType::LineWithMarkers, 0, 0, 500, 500); // Setting the index of chart data sheet int defaultWorksheetIndex = 0; // Getting the chart data worksheet SharedPtr fact = chart->get_ChartData()->get_ChartDataWorkbook(); // Delete default generated series and categories chart->get_ChartData()->get_Series()->Clear(); // Now, Adding a new series SharedPtr series = chart->get_ChartData()->get_Series()->Add(fact->GetCell(defaultWorksheetIndex, 1, 1, ObjectExt::Box(u"Series 1")), chart->get_Type()); // Get the picture SharedPtr image = Images::FromFile(ImagePath); SharedPtr image2 = Images::FromFile(ImagePath2); // Add image to presentation's images collection SharedPtr imgx1 = pres->get_Images()->AddImage(image); SharedPtr imgx2 = pres->get_Images()->AddImage(image2); image->Dispose(); image2->Dispose(); // Add new point (1:3) there. SharedPtr point = series->get_DataPoints()->AddDataPointForLineSeries(fact->GetCell(defaultWorksheetIndex, 1, 1, ObjectExt::Box(4.5))); point->get_Marker()->get_Format()->get_Fill()->set_FillType(FillType::Picture); point->get_Marker()->get_Format()->get_Fill()->get_PictureFillFormat()->get_Picture()->set_Image(imgx1); point = series->get_DataPoints()->AddDataPointForLineSeries(fact->GetCell(defaultWorksheetIndex, 2, 1, ObjectExt::Box(2.5))); point->get_Marker()->get_Format()->get_Fill()->set_FillType(FillType::Picture); point->get_Marker()->get_Format()->get_Fill()->get_PictureFillFormat()->get_Picture()->set_Image(imgx2); point = series->get_DataPoints()->AddDataPointForLineSeries(fact->GetCell(defaultWorksheetIndex, 3, 1, ObjectExt::Box(3.5))); point->get_Marker()->get_Format()->get_Fill()->set_FillType(FillType::Picture); point->get_Marker()->get_Format()->get_Fill()->get_PictureFillFormat()->get_Picture()->set_Image(imgx1); point = series->get_DataPoints()->AddDataPointForLineSeries(fact->GetCell(defaultWorksheetIndex, 4, 1, ObjectExt::Box(4.5))); point->get_Marker()->get_Format()->get_Fill()->set_FillType(FillType::Picture); point->get_Marker()->get_Format()->get_Fill()->get_PictureFillFormat()->get_Picture()->set_Image(imgx2); // Changing the chart series marker series->get_Marker()->set_Size(15); // Write the presentation file to disk pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx); pres->Dispose(); ``` ## **Apply a Color to Data Points** You can apply color to data points in the chart using Aspose.Slides for C++. [**IChartDataPointLevelsManager**](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdatapointlevelsmanager/) and **[IChartDataPointLevel](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdatapointlevel/)** classes have been added to get access to properties of data point levels. This article demonstrates how you can access and apply color to data points in a chart. ```cpp const String outPath = u"../out/AddColorToDataPoints.pptx"; System::SharedPtr pres = System::MakeObject(); System::SharedPtr chart = pres->get_Slides()->idx_get(0)->get_Shapes()->AddChart(Aspose::Slides::Charts::ChartType::Sunburst, 100.0f, 100.0f, 450.0f, 400.0f); System::SharedPtr dataPoints = chart->get_ChartData()->get_Series()->idx_get(0)->get_DataPoints(); dataPoints->idx_get(3)->get_DataPointLevels()->idx_get(0)->get_Label()->get_DataLabelFormat()->set_ShowValue(true); System::SharedPtr branch1Label = dataPoints->idx_get(0)->get_DataPointLevels()->idx_get(2)->get_Label(); branch1Label->get_DataLabelFormat()->set_ShowCategoryName(false); branch1Label->get_DataLabelFormat()->set_ShowSeriesName(true); branch1Label->get_DataLabelFormat()->get_TextFormat()->get_PortionFormat()->get_FillFormat()->set_FillType(Aspose::Slides::FillType::Solid); branch1Label->get_DataLabelFormat()->get_TextFormat()->get_PortionFormat()->get_FillFormat()->get_SolidFillColor()->set_Color(System::Drawing::Color::get_Yellow()); System::SharedPtr steam4Format = dataPoints->idx_get(9)->get_DataPointLevels()->idx_get(1)->get_Format(); steam4Format->get_Fill()->set_FillType(Aspose::Slides::FillType::Solid); steam4Format->get_Fill()->get_SolidFillColor()->set_Color(System::Drawing::Color::FromArgb(255, 0, 176, 240)); pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx); ``` [Source: Examples-SlidesCPP-AddColorToDataPoints-AddColorToDataPoints.cpp](https://gist.githubusercontent.com/aspose-com-gists/81aeb05e6d3a070aa76fdea22ed53bc7/raw/1b30a5e7b64116c4e7e7fca5778221528b43e45a/Examples-SlidesCPP-AddColorToDataPoints-AddColorToDataPoints.cpp) ## **FAQ** ### Which marker shapes are available out of the box? Standard shapes are available (circle, square, diamond, triangle, etc.); the list is defined by the [MarkerStyleType](https://reference.aspose.com/slides/cpp/aspose.slides.charts/markerstyletype/) enumeration. If you need a non-standard shape, use a marker with a picture fill to emulate custom visuals. ### Are markers preserved when exporting a chart to an image or SVG? Yes. When rendering charts to [raster formats](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-png/) or saving [shapes as SVG](https://docs.aspose.com/slides/cpp/render-a-slide-as-an-svg-image/), markers retain their appearance and settings, including size, fill, and outline. # Customize Chart Data Tables in Presentations Using C++ > Customize chart data table fonts, borders, and legend keys in PowerPoint presentations using Aspose.Slides for C++. Source: https://docs.aspose.com/slides/cpp/chart-data-table/ Updated: 2026-09-24 ## **Overview** Aspose.Slides for C++ lets you display a chart's data table and customize its text formatting, borders, and legend keys. This article explains how to enable the table, format its text, control each type of border, and show or hide legend keys. The examples save the configured charts in PPTX files. ## **Set Font Properties** To display a chart's data table, pass `true` to [IChart::set_HasDataTable](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichart/set_hasdatatable/). Use [IChart::get_ChartDataTable](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichart/get_chartdatatable/) to access the table and configure its text formatting. 1. Load the presentation using the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) class. 1. Add a clustered column chart to the first slide. 1. Enable the chart's data table. 1. Enable bold text with [IBasePortionFormat::set_FontBold](https://reference.aspose.com/slides/cpp/aspose.slides/ibaseportionformat/set_fontbold/) and pass `20` to [IBasePortionFormat::set_FontHeight](https://reference.aspose.com/slides/cpp/aspose.slides/ibaseportionformat/set_fontheight/) for 20-point text. 1. Save the modified presentation. The following example requires `test.pptx` in the working directory with at least one slide. It adds a chart with default data at position (50, 50), with a width of 600 points and a height of 400 points. The saved `output.pptx` contains the chart with its data table enabled and the specified font settings applied. ```cpp #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(u"test.pptx"); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::ClusteredColumn, 50.0f, 50.0f, 600.0f, 400.0f); chart->set_HasDataTable(true); auto portionFormat = chart->get_ChartDataTable()->get_TextFormat()->get_PortionFormat(); portionFormat->set_FontBold(NullableBool::True); portionFormat->set_FontHeight(20.0f); presentation->Save(u"output.pptx", SaveFormat::Pptx); ``` ## **Customize Data Table Borders** Enable the table with [IChart::set_HasDataTable](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichart/set_hasdatatable/) and access it through [IChart::get_ChartDataTable](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichart/get_chartdatatable/). You can control three types of borders independently: - [IDataTable::set_HasBorderHorizontal](https://reference.aspose.com/slides/cpp/aspose.slides.charts/idatatable/set_hasborderhorizontal/) controls horizontal cell borders. - [IDataTable::set_HasBorderVertical](https://reference.aspose.com/slides/cpp/aspose.slides.charts/idatatable/set_hasbordervertical/) controls vertical cell borders. - [IDataTable::set_HasBorderOutline](https://reference.aspose.com/slides/cpp/aspose.slides.charts/idatatable/set_hasborderoutline/) controls the outer border of the table. Pass `true` to each setter to display its borders or `false` to hide them. The following example creates a clustered column chart with default data, displays horizontal borders and the outer border, and hides vertical borders. It requires no input file. The chart's position and size are specified in points. ```cpp #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::ClusteredColumn, 50.0f, 50.0f, 600.0f, 400.0f); chart->set_HasDataTable(true); auto dataTable = chart->get_ChartDataTable(); dataTable->set_HasBorderHorizontal(true); dataTable->set_HasBorderVertical(false); dataTable->set_HasBorderOutline(true); presentation->Save(u"data-table-borders.pptx", SaveFormat::Pptx); ``` The comparison below uses the same chart data and legend key setting in all four cases. Starting with all borders enabled, each remaining variant disables just one border setting. The lower-left variant matches the border settings in the example. ![Chart data tables with all borders enabled, no horizontal borders, no vertical borders, and no outer border](https://docs.aspose.com/slides/cpp/chart-data-table/data-table-borders.png) ## **Show or Hide Legend Keys** Legend keys are small colored markers beside the series names in the data table. They help readers match each table row to a chart series. Pass `true` to [IDataTable::set_ShowLegendKey](https://reference.aspose.com/slides/cpp/aspose.slides.charts/idatatable/set_showlegendkey/) to show these markers or `false` to hide them. The chart's separate legend is controlled by [IChart::set_HasLegend](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichart/set_haslegend/). These settings are independent: hiding the separate legend does not hide the keys inside the data table, and hiding the table's keys does not hide the separate legend. The following example creates a chart with default data, enables its data table, and shows legend keys inside it while hiding the separate legend. All table borders are explicitly enabled. No input presentation is required. To hide only the table's keys, pass `false` to [IDataTable::set_ShowLegendKey](https://reference.aspose.com/slides/cpp/aspose.slides.charts/idatatable/set_showlegendkey/). ```cpp #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::ClusteredColumn, 50.0f, 50.0f, 600.0f, 400.0f); chart->set_HasDataTable(true); chart->set_HasLegend(false); auto dataTable = chart->get_ChartDataTable(); dataTable->set_HasBorderHorizontal(true); dataTable->set_HasBorderVertical(true); dataTable->set_HasBorderOutline(true); dataTable->set_ShowLegendKey(true); presentation->Save(u"data-table-legend-keys.pptx", SaveFormat::Pptx); ``` The comparison below shows the same table with legend keys enabled and disabled. All borders remain enabled, and the separate chart legend is hidden in both cases. ![Chart data tables with legend keys shown on the left and hidden on the right](https://docs.aspose.com/slides/cpp/chart-data-table/data-table-legend-keys.png) ## **FAQ** **Can I show legend keys in a chart's data table?** Yes. Pass `true` to [IDataTable::set_ShowLegendKey](https://reference.aspose.com/slides/cpp/aspose.slides.charts/idatatable/set_showlegendkey/) to display legend keys or `false` to hide them. **Will the data table be preserved when exporting the presentation to PDF, HTML, or images?** Yes. Aspose.Slides renders the chart and its displayed data table as part of the slide when exporting to [PDF](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-pdf/), [HTML](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-html/), or [images](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-png/). **Can I work with data tables in charts loaded from a template?** Yes. For a chart loaded from an existing presentation or template, use [IChart::get_HasDataTable](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichart/get_hasdatatable/) to check whether its data table is displayed and [IChart::set_HasDataTable](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichart/set_hasdatatable/) to change its visibility. **How can I find charts that have a data table enabled?** Iterate through the shapes on each slide, identify the charts, and check their [IChart::get_HasDataTable](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichart/get_hasdatatable/) result. A value of `true` indicates that the data table is enabled. # Customize Presentation Chart Entities in C++ > Understand chart entities in Aspose.Slides for C++ and learn to manage series, categories, data points and axes in PowerPoint PPT and PPTX using C++. Source: https://docs.aspose.com/slides/cpp/chart-entities/ Updated: 2026-07-31 --- lastmod: 2026-07-31T17:58:11+04:00 title: Customize Presentation Chart Entities in C++ linktitle: Chart Entities type: docs weight: 30 url: /cpp/chart-entities/ keywords: - callout - axis - data label - data marker - data table - legend - plot area - data series - error bar - trend line - PowerPoint - presentation - C++ - Aspose.Slides description: "Understand chart entities in Aspose.Slides for C++ and learn to manage series, categories, data points and axes in PowerPoint PPT and PPTX using C++." --- ## Related articles - [Create and Customize PowerPoint Charts in C++](https://docs.aspose.com/slides/cpp/powerpoint-charts/) - [Format Presentation Charts in C++](https://docs.aspose.com/slides/cpp/chart-formatting/) - [Customize Plot Areas of Presentation Charts in C++](https://docs.aspose.com/slides/cpp/chart-plot-area/) # Format Presentation Charts in C++ > Learn chart formatting in Aspose.Slides for C++ and elevate your PowerPoint presentation with custom axes, fonts, number formats, and rounded chart borders. Source: https://docs.aspose.com/slides/cpp/chart-formatting/ Updated: 2026-11-09 ## **Overview** This article explains how to format charts in PowerPoint presentations by using Aspose.Slides. It shows how to customize key chart elements such as axes, grid lines, titles, legends, the plot area, and wall fills to improve the appearance and readability of chart data. It also demonstrates how to set font properties for chart text, apply preset numeric formats to chart data, and enable rounded corners for the chart area. Together, these examples show how to control both the visual style and data presentation of charts in a presentation. For separate fills and outlines on rising and falling intervals, see the [stock chart example](https://docs.aspose.com/slides/cpp/create-chart/#create-stock-charts). ## **Format Chart Entities** Use [IChart](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichart/) to format chart titles, axes, grid lines, legends, and the plot area. This example creates a line chart with markers and default data, then applies separate text and line styles to its value and category axes. Font sizes and line widths are specified in points; category labels are rotated by 45 degrees. The value axis uses [get_NumberFormat](https://reference.aspose.com/slides/cpp/aspose.slides.charts/iaxis/get_numberformat/) independently of the source cells. Its scale runs from -2 to 15, with major intervals of 2 and minor intervals of 0.5. The example also combines percentage formatting with [get_DisplayUnit](https://reference.aspose.com/slides/cpp/aspose.slides.charts/iaxis/get_displayunit/) set to thousands, so adapt these settings to the meaning and magnitude of your data. The legend stays outside the plot area because [get_Overlay](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ilegend/get_overlay/) is disabled. Back-wall and floor fills are configured through [get_BackWall](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichart/get_backwall/) and [get_Floor](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichart/get_floor/), but these surfaces are only visible in 3D charts. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::LineWithMarkers, 50, 50, 500, 400); chart->set_HasTitle(true); chart->get_ChartTitle()->AddTextFrameForOverriding(u""); auto chartTitle = chart->get_ChartTitle()->get_TextFrameForOverriding()->get_Paragraphs()->idx_get(0)->get_Portions()->idx_get(0); chartTitle->set_Text(u"Sample Chart"); chartTitle->get_PortionFormat()->get_FillFormat()->set_FillType(FillType::Solid); chartTitle->get_PortionFormat()->get_FillFormat()->get_SolidFillColor()->set_Color(System::Drawing::Color::get_Gray()); chartTitle->get_PortionFormat()->set_FontHeight(20); chartTitle->get_PortionFormat()->set_FontBold(NullableBool::True); chartTitle->get_PortionFormat()->set_FontItalic(NullableBool::True); chart->get_Axes()->get_VerticalAxis()->get_MajorGridLinesFormat()->get_Line()->get_FillFormat()->set_FillType(FillType::Solid); chart->get_Axes()->get_VerticalAxis()->get_MajorGridLinesFormat()->get_Line()->get_FillFormat()->get_SolidFillColor()->set_Color(System::Drawing::Color::get_Blue()); chart->get_Axes()->get_VerticalAxis()->get_MajorGridLinesFormat()->get_Line()->set_Width(5); chart->get_Axes()->get_VerticalAxis()->get_MajorGridLinesFormat()->get_Line()->set_DashStyle(LineDashStyle::DashDot); chart->get_Axes()->get_VerticalAxis()->get_MinorGridLinesFormat()->get_Line()->get_FillFormat()->set_FillType(FillType::Solid); chart->get_Axes()->get_VerticalAxis()->get_MinorGridLinesFormat()->get_Line()->get_FillFormat()->get_SolidFillColor()->set_Color(System::Drawing::Color::get_Red()); chart->get_Axes()->get_VerticalAxis()->get_MinorGridLinesFormat()->get_Line()->set_Width(3); chart->get_Axes()->get_VerticalAxis()->set_IsNumberFormatLinkedToSource(false); chart->get_Axes()->get_VerticalAxis()->set_DisplayUnit(DisplayUnitType::Thousands); chart->get_Axes()->get_VerticalAxis()->set_NumberFormat(u"0.0%"); chart->get_Axes()->get_VerticalAxis()->set_IsAutomaticMajorUnit(false); chart->get_Axes()->get_VerticalAxis()->set_IsAutomaticMaxValue(false); chart->get_Axes()->get_VerticalAxis()->set_IsAutomaticMinorUnit(false); chart->get_Axes()->get_VerticalAxis()->set_IsAutomaticMinValue(false); chart->get_Axes()->get_VerticalAxis()->set_MaxValue(15.0f); chart->get_Axes()->get_VerticalAxis()->set_MinValue(-2.0f); chart->get_Axes()->get_VerticalAxis()->set_MinorUnit(0.5f); chart->get_Axes()->get_VerticalAxis()->set_MajorUnit(2.0f); auto valueAxisText = chart->get_Axes()->get_VerticalAxis()->get_TextFormat()->get_PortionFormat(); valueAxisText->set_FontBold(NullableBool::True); valueAxisText->set_FontHeight(16); valueAxisText->set_FontItalic(NullableBool::True); valueAxisText->get_FillFormat()->set_FillType(FillType::Solid); valueAxisText->get_FillFormat()->get_SolidFillColor()->set_Color(System::Drawing::Color::get_DarkGreen()); auto valueAxisFont = System::MakeObject(u"Times New Roman"); valueAxisText->set_LatinFont(valueAxisFont); chart->get_Axes()->get_VerticalAxis()->set_HasTitle(true); chart->get_Axes()->get_VerticalAxis()->get_Title()->AddTextFrameForOverriding(u""); auto valueAxisTitle = chart->get_Axes()->get_VerticalAxis()->get_Title()->get_TextFrameForOverriding()->get_Paragraphs()->idx_get(0)->get_Portions()->idx_get(0); valueAxisTitle->set_Text(u"Primary Axis"); valueAxisTitle->get_PortionFormat()->get_FillFormat()->set_FillType(FillType::Solid); valueAxisTitle->get_PortionFormat()->get_FillFormat()->get_SolidFillColor()->set_Color(System::Drawing::Color::get_Gray()); valueAxisTitle->get_PortionFormat()->set_FontHeight(20); valueAxisTitle->get_PortionFormat()->set_FontBold(NullableBool::True); valueAxisTitle->get_PortionFormat()->set_FontItalic(NullableBool::True); chart->get_Axes()->get_HorizontalAxis()->get_MajorGridLinesFormat()->get_Line()->get_FillFormat()->set_FillType(FillType::Solid); chart->get_Axes()->get_HorizontalAxis()->get_MajorGridLinesFormat()->get_Line()->get_FillFormat()->get_SolidFillColor()->set_Color(System::Drawing::Color::get_Green()); chart->get_Axes()->get_HorizontalAxis()->get_MajorGridLinesFormat()->get_Line()->set_Width(5); chart->get_Axes()->get_HorizontalAxis()->get_MinorGridLinesFormat()->get_Line()->get_FillFormat()->set_FillType(FillType::Solid); chart->get_Axes()->get_HorizontalAxis()->get_MinorGridLinesFormat()->get_Line()->get_FillFormat()->get_SolidFillColor()->set_Color(System::Drawing::Color::get_Yellow()); chart->get_Axes()->get_HorizontalAxis()->get_MinorGridLinesFormat()->get_Line()->set_Width(3); auto categoryAxisText = chart->get_Axes()->get_HorizontalAxis()->get_TextFormat()->get_PortionFormat(); categoryAxisText->set_FontBold(NullableBool::True); categoryAxisText->set_FontHeight(16); categoryAxisText->set_FontItalic(NullableBool::True); categoryAxisText->get_FillFormat()->set_FillType(FillType::Solid); categoryAxisText->get_FillFormat()->get_SolidFillColor()->set_Color(System::Drawing::Color::get_Blue()); auto categoryAxisFont = System::MakeObject(u"Arial"); categoryAxisText->set_LatinFont(categoryAxisFont); chart->get_Axes()->get_HorizontalAxis()->set_HasTitle(true); chart->get_Axes()->get_HorizontalAxis()->get_Title()->AddTextFrameForOverriding(u""); auto categoryAxisTitle = chart->get_Axes()->get_HorizontalAxis()->get_Title()->get_TextFrameForOverriding()->get_Paragraphs()->idx_get(0)->get_Portions()->idx_get(0); categoryAxisTitle->set_Text(u"Sample Category"); categoryAxisTitle->get_PortionFormat()->get_FillFormat()->set_FillType(FillType::Solid); categoryAxisTitle->get_PortionFormat()->get_FillFormat()->get_SolidFillColor()->set_Color(System::Drawing::Color::get_Gray()); categoryAxisTitle->get_PortionFormat()->set_FontHeight(20); categoryAxisTitle->get_PortionFormat()->set_FontBold(NullableBool::True); categoryAxisTitle->get_PortionFormat()->set_FontItalic(NullableBool::True); chart->get_Axes()->get_HorizontalAxis()->set_TickLabelPosition(TickLabelPositionType::Low); chart->get_Axes()->get_HorizontalAxis()->set_TickLabelRotationAngle(45); auto legendText = chart->get_Legend()->get_TextFormat()->get_PortionFormat(); legendText->set_FontBold(NullableBool::True); legendText->set_FontHeight(16); legendText->set_FontItalic(NullableBool::True); legendText->get_FillFormat()->set_FillType(FillType::Solid); legendText->get_FillFormat()->get_SolidFillColor()->set_Color(System::Drawing::Color::get_DarkRed()); chart->get_Legend()->set_Overlay(false); chart->get_BackWall()->set_Thickness(1); chart->get_BackWall()->get_Format()->get_Fill()->set_FillType(FillType::Solid); chart->get_BackWall()->get_Format()->get_Fill()->get_SolidFillColor()->set_Color(System::Drawing::Color::get_Orange()); chart->get_Floor()->get_Format()->get_Fill()->set_FillType(FillType::Solid); chart->get_Floor()->get_Format()->get_Fill()->get_SolidFillColor()->set_Color(System::Drawing::Color::get_Red()); chart->get_PlotArea()->get_Format()->get_Fill()->set_FillType(FillType::Solid); chart->get_PlotArea()->get_Format()->get_Fill()->get_SolidFillColor()->set_Color(System::Drawing::Color::get_LightCyan()); presentation->Save(u"FormattedChart_out.pptx", SaveFormat::Pptx); ``` ## **Set Font Properties for a Chart** Set the default font size for chart text through [Chart::get_TextFormat](https://reference.aspose.com/slides/cpp/aspose.slides.charts/chart/get_textformat/). The example creates a clustered column chart with a 20-point font and enables value labels for the first series through [set_ShowValue](https://reference.aspose.com/slides/cpp/aspose.slides.charts/idatalabelformat/set_showvalue/). Text elements with their own explicit font settings can override the chart default. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::ClusteredColumn, 100, 100, 500, 400); chart->get_TextFormat()->get_PortionFormat()->set_FontHeight(20); chart->get_ChartData()->get_Series()->idx_get(0)->get_Labels()->get_DefaultDataLabelFormat()->set_ShowValue(true); presentation->Save(u"FontPropertiesForChart.pptx", SaveFormat::Pptx); ``` ## **Set the Numeric Format** Use [IChartDataCell::set_PresetNumberFormat](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdatacell/set_presetnumberformat/) to apply a built-in number format to chart workbook cells. This example creates a clustered column chart with default, cell-backed data and applies format index 10 (`0.00%`) to each series value cell. This changes how the values are displayed in the workbook without changing the underlying numbers; for example, 0.25 is displayed as 25.00%. Axis and data-label formats can be configured separately. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::ClusteredColumn, 50, 50, 500, 400); auto series = chart->get_ChartData()->get_Series(); for (auto chartSeries : series) { for (auto dataPoint : chartSeries->get_DataPoints()) { dataPoint->get_Value()->get_AsCell()->set_PresetNumberFormat(10); // 0.00% } } presentation->Save(u"PresetNumberFormat_out.pptx", SaveFormat::Pptx); ``` The following table lists built-in number format indices with representative Excel formats for the English (United States) locale. The exact format strings and their display can vary by application and locale, particularly for currency and dates. Some Excel formats also differ from the defaults in the OOXML standard, as described in [Microsoft's number format implementation notes](https://learn.microsoft.com/en-us/openspecs/office_standards/ms-oi29500/17d11129-219b-4e2c-88db-45844d21e528). | Index | Format | | --- | --- | | 0 | `General` | | 1 | `0` | | 2 | `0.00` | | 3 | `#,##0` | | 4 | `#,##0.00` | | 5 | `"$"#,##0_);("$"#,##0)` | | 6 | `"$"#,##0_);[Red]("$"#,##0)` | | 7 | `"$"#,##0.00_);("$"#,##0.00)` | | 8 | `"$"#,##0.00_);[Red]("$"#,##0.00)` | | 9 | `0%` | | 10 | `0.00%` | | 11 | `0.00E+00` | | 12 | `# ?/?` | | 13 | `# ??/??` | | 14 | `m/d/yyyy` | | 15 | `d-mmm-yy` | | 16 | `d-mmm` | | 17 | `mmm-yy` | | 18 | `h:mm AM/PM` | | 19 | `h:mm:ss AM/PM` | | 20 | `h:mm` | | 21 | `h:mm:ss` | | 22 | `m/d/yyyy h:mm` | | 37 | `#,##0_);(#,##0)` | | 38 | `#,##0_);[Red](#,##0)` | | 39 | `#,##0.00_);(#,##0.00)` | | 40 | `#,##0.00_);[Red](#,##0.00)` | | 41 | `_(* #,##0_);_(* (#,##0);_(* "-"_);_(@_)` | | 42 | `_("$"* #,##0_);_("$"* (#,##0);_("$"* "-"_);_(@_)` | | 43 | `_(* #,##0.00_);_(* (#,##0.00);_(* "-"??_);_(@_)` | | 44 | `_("$"* #,##0.00_);_("$"* (#,##0.00);_("$"* "-"??_);_(@_)` | | 45 | `mm:ss` | | 46 | `[h]:mm:ss` | | 47 | `mm:ss.0` | | 48 | `##0.0E+0` | | 49 | `@` | ## **Set Chart Area Rounded Borders** Enable [IChart::set_HasRoundedCorners](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichart/set_hasroundedcorners/) to round the corners of the chart area. The example creates a clustered column chart and uses [get_LineFormat](https://reference.aspose.com/slides/cpp/aspose.slides/ishape/get_lineformat/) to give its outline a solid gray color and a single-line style before saving the presentation. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::ClusteredColumn, 20, 100, 600, 400); chart->get_LineFormat()->get_FillFormat()->set_FillType(FillType::Solid); chart->get_LineFormat()->get_FillFormat()->get_SolidFillColor()->set_Color(System::Drawing::Color::get_Gray()); chart->get_LineFormat()->set_Style(LineStyle::Single); chart->set_HasRoundedCorners(true); presentation->Save(u"out.pptx", SaveFormat::Pptx); ``` ## **Edit Existing Chart Annotations** A chart can contain custom shapes, such as a text annotation explaining the status of a report. Access these shapes through [IChart::get_UserShapes](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichart/get_usershapes/), also listed under [Chart::get_UserShapes](https://reference.aspose.com/slides/cpp/aspose.slides.charts/chart/get_usershapes/) in the Chart API Reference. Its [get_Shapes](https://reference.aspose.com/slides/cpp/aspose.slides/igroupshape/get_shapes/) collection contains the chart-owned shapes. An ordinary text box placed over a chart belongs to the slide, even if it looks like part of the chart. Iterating through [Slide::get_Shapes](https://reference.aspose.com/slides/cpp/aspose.slides/baseslide/get_shapes/) finds the chart and ordinary slide shapes, but does not enumerate the individual shapes inside the chart. Chart titles and data labels are separate chart elements, not custom annotations in this collection. Download [chart-annotations.pptx](https://docs.aspose.com/slides/cpp/chart-formatting/chart-annotations.pptx) and place it in the application's working directory. Its first slide contains a chart with an ungrouped annotation reading "Preliminary results", a chart-owned line, and an ordinary slide text box reading "Slide overlay". The example finds the first chart on that slide and changes the annotation to "Final results" when the report is ready to publish. It checks for an empty collection and only edits an [IAutoShape](https://reference.aspose.com/slides/cpp/aspose.slides/iautoshape/) with a non-null [get_TextFrame](https://reference.aspose.com/slides/cpp/aspose.slides/iautoshape/get_textframe/) and the expected text. ```cpp #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(u"chart-annotations.pptx"); auto slide = presentation->get_Slide(0); System::SharedPtr chart; for (auto shape : slide->get_Shapes()) { auto candidate = System::DynamicCast(shape); if (candidate != nullptr) { chart = candidate; break; } } if (chart == nullptr || chart->get_UserShapes()->get_Shapes()->get_Count() == 0) { System::Console::WriteLine(u"No chart or chart-owned shapes found."); return; } auto updated = false; for (auto shape : chart->get_UserShapes()->get_Shapes()) { auto annotation = System::DynamicCast(shape); if (annotation != nullptr && annotation->get_TextFrame() != nullptr && annotation->get_TextFrame()->get_Text() == u"Preliminary results") { annotation->get_TextFrame()->set_Text(u"Final results"); updated = true; break; } } if (updated) { presentation->Save(u"chart-annotations-updated.pptx", SaveFormat::Pptx); } else { System::Console::WriteLine(u"No matching text annotation found."); } ``` The line and the slide text box remain unchanged. The following images show the input and the saved, reopened result: | Before editing | After editing | | --- | --- | | ![Chart annotation reading Preliminary results](https://docs.aspose.com/slides/cpp/chart-formatting/chart-annotations-before.png) | ![Chart annotation reading Final results](https://docs.aspose.com/slides/cpp/chart-formatting/chart-annotations-after.png) | The example inspects only the top-level chart-owned shapes. If an annotation is inside an [IGroupShape](https://reference.aspose.com/slides/cpp/aspose.slides/igroupshape/), inspect that group's [get_Shapes](https://reference.aspose.com/slides/cpp/aspose.slides/igroupshape/get_shapes/) collection as well. Repeat this recursively for nested groups, applying the same text checks to their child shapes. A group itself is a container; do not treat it as a text box. ## **FAQ** **Can I set semi-transparent fills for columns/areas while keeping the border opaque?** Yes. Fill transparency and the outline are configured separately. This is useful for improving the readability of the grid and data in dense visualizations. **How can I deal with data labels when they overlap?** Reduce the font size, disable nonessential label components (for example, categories), adjust the label position, show labels only for selected points if necessary, or switch the format to "value + legend". **Can I apply gradient or pattern fills to series?** Yes. Series support solid, gradient, and pattern fills. In practice, use gradients sparingly and avoid combinations that reduce contrast with the grid and text. ## Related articles - [Customize Chart Axes in Presentations Using C++](https://docs.aspose.com/slides/cpp/chart-axis/) - [Customize Presentation Chart Entities in C++](https://docs.aspose.com/slides/cpp/chart-entities/) # Customize Chart Legends in Presentations Using C++ > Customize chart legends with Aspose.Slides for C++ to optimize PowerPoint presentations with tailored legend formatting. Source: https://docs.aspose.com/slides/cpp/chart-legend/ Updated: 2026-09-30 ## **Overview** Aspose.Slides for C++ provides options for customizing chart legends in PowerPoint presentations. This article shows how to position and size a legend, set the font size for the whole legend, format an individual legend entry, and hide or restore selected entries. The FAQ covers related behaviors, including reserving space for the legend, displaying multiline labels, and inheriting formatting from the presentation theme. ## **Legend Positioning** Use the legend's [set_X](https://reference.aspose.com/slides/cpp/aspose.slides.charts/legend/set_x/), [set_Y](https://reference.aspose.com/slides/cpp/aspose.slides.charts/legend/set_y/), [set_Width](https://reference.aspose.com/slides/cpp/aspose.slides.charts/legend/set_width/), and [set_Height](https://reference.aspose.com/slides/cpp/aspose.slides.charts/legend/set_height/) methods to specify its position and size as fractions of the chart's dimensions. This example creates a presentation and adds a clustered column chart with default data to the first slide. Dividing the desired legend offsets and dimensions by the chart's width and height converts them to relative values: the legend is offset by 50 points from the chart's top-left corner and sized to 100 by 100 points. ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::ClusteredColumn, 50, 50, 500, 500); // Express the legend's position and size relative to the chart. chart->get_Legend()->set_X(50 / chart->get_Width()); chart->get_Legend()->set_Y(50 / chart->get_Height()); chart->get_Legend()->set_Width(100 / chart->get_Width()); chart->get_Legend()->set_Height(100 / chart->get_Height()); presentation->Save(u"legend_position.pptx", SaveFormat::Pptx); ``` ## **Set the Font Size of a Legend** Use the legend's [get_TextFormat](https://reference.aspose.com/slides/cpp/aspose.slides.charts/legend/get_textformat/) to access its text formatting and use [set_FontHeight](https://reference.aspose.com/slides/cpp/aspose.slides/baseportionformat/set_fontheight/) to set the font size in points. This example creates a chart with default data and sets the legend text to 20 points. It also disables automatic bounds for the vertical axis and sets its range to -5 through 10. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::ClusteredColumn, 50, 50, 600, 400); chart->get_Legend()->get_TextFormat()->get_PortionFormat()->set_FontHeight(20); chart->get_Axes()->get_VerticalAxis()->set_IsAutomaticMinValue(false); chart->get_Axes()->get_VerticalAxis()->set_MinValue(-5); chart->get_Axes()->get_VerticalAxis()->set_IsAutomaticMaxValue(false); chart->get_Axes()->get_VerticalAxis()->set_MaxValue(10); presentation->Save(u"legend_font_size.pptx", SaveFormat::Pptx); ``` ## **Set the Font Size of an Individual Legend Entry** Use the collection returned by the legend's [get_Entries](https://reference.aspose.com/slides/cpp/aspose.slides.charts/legend/get_entries/) method to access formatting for a specific entry. Entry indices are zero-based, so index `1` refers to the second entry. This example creates a clustered column chart whose default data includes at least two series. It formats the second legend entry with bold, italic, and 20-point blue text. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::ClusteredColumn, 50, 50, 600, 400); auto textFormat = chart->get_Legend()->get_Entries()->idx_get(1)->get_TextFormat(); textFormat->get_PortionFormat()->set_FontBold(NullableBool::True); textFormat->get_PortionFormat()->set_FontHeight(20); textFormat->get_PortionFormat()->set_FontItalic(NullableBool::True); textFormat->get_PortionFormat()->get_FillFormat()->set_FillType(FillType::Solid); textFormat->get_PortionFormat()->get_FillFormat()->get_SolidFillColor()->set_Color(System::Drawing::Color::get_Blue()); presentation->Save(u"legend_entry_format.pptx", SaveFormat::Pptx); ``` ## **Hide Individual Legend Entries** To exclude an auxiliary series from the legend while keeping its data visible, call [ILegendEntryProperties::set_Hide](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ilegendentryproperties/set_hide/) with `true` through [IChartSeries::get_RelatedLegendEntry](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartseries/get_relatedlegendentry/). This hides only the selected legend entry; it does not remove the series or its data points. Calling [IChart::set_HasLegend](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichart/set_haslegend/) with `false`, in contrast, hides the entire legend. The example below creates a clustered column chart with multiple series using default data. It hides the second series' legend entry (index `1`) and saves the presentation. It then restores the entry by calling `set_Hide` with `false` and saves a second copy. The columns remain visible in both files. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::ClusteredColumn, 50, 50, 600, 400); chart->set_HasLegend(true); auto legendEntry = chart->get_ChartData()->get_Series()->idx_get(1)->get_RelatedLegendEntry(); legendEntry->set_Hide(true); presentation->Save(u"hidden_legend_entry.pptx", SaveFormat::Pptx); // Restore the same entry without changing the chart data. legendEntry->set_Hide(false); presentation->Save(u"restored_legend_entry.pptx", SaveFormat::Pptx); ``` The comparison below shows the same chart with all entries visible and with the second entry hidden. The second series' columns remain unchanged. ![Comparison of a chart with all legend entries visible and with Series 2 hidden from the legend; all columns remain visible.](https://docs.aspose.com/slides/cpp/chart-legend/hide-legend-entry.png) In column, bar, and line charts, legend entries identify series. For pie charts, they identify individual data points (slices), so use [IChartDataPoint::get_RelatedLegendEntry](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdatapoint/get_relatedlegendentry/) on the selected slice instead. The API documents this data-point method for the `Pie`, `Pie3D`, `ExplodedPie`, `ExplodedPie3D`, `PieOfPie`, and `BarOfPie` chart types. Do not assume it applies to doughnut charts, which are not included in that list. ## **FAQ** **Can I make the chart allocate space for the legend instead of overlaying it?** Yes. Call [set_Overlay](https://reference.aspose.com/slides/cpp/aspose.slides.charts/legend/set_overlay/) with `false` to reserve space for the legend instead of allowing it to overlap the plot area. **Can I make multiline legend labels?** Yes. Long labels can wrap when the available width is insufficient. You can also use newline characters in series names to request line breaks. **How do I make the legend follow the presentation theme's color scheme?** Leave the legend's colors, fills, and fonts unset so that it can inherit theme formatting. Explicit formatting overrides the corresponding theme settings. # Customize Plot Areas of Presentation Charts in C++ > Discover how to customize chart plot areas in PowerPoint presentations with Aspose.Slides for C++. Improve your slide visuals effortlessly. Source: https://docs.aspose.com/slides/cpp/chart-plot-area/ Updated: 2026-11-08 ## **Overview** This article shows how to work with a chart’s plot area in Aspose.Slides. It explains how to get the actual position and size of the plot area by validating the chart layout and then reading its X, Y, width, and height values. It also demonstrates how to configure the plot area’s layout mode when the layout is set manually, using `LayoutTargetType` to define whether the plot area is calculated by its inner region or by its outer region together with axes and axis labels. ## **Get Width and Height of a Chart Plot Area** Aspose.Slides for C++ provides a simple API for .  1. Create an instance of the [Presentation](https://reference.aspose.com/slides/cpp/class/aspose.slides.presentation) class. 1. Access first slide. 1. Add chart with default data. 1. Call method IChart::ValidateChartLayout() before to get actual values. 1. Gets actual X location (left) of the chart element relative to the left top corner of the chart. 1. Gets actual top of the chart element relative to the left top corner of the chart. 1. Gets actual width of the chart element. 1. Gets actual height of the chart element. ``` cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; auto pres = System::MakeObject(u"test.Pptx"); auto chart = System::ExplicitCast(pres->get_Slides()->idx_get(0)->get_Shapes()->AddChart(ChartType::ClusteredColumn, 100.0f, 100.0f, 500.0f, 350.0f)); chart->ValidateChartLayout(); double x = chart->get_PlotArea()->get_ActualX(); double y = chart->get_PlotArea()->get_ActualY(); double w = chart->get_PlotArea()->get_ActualWidth(); double h = chart->get_PlotArea()->get_ActualHeight(); // Save presentation with chart pres->Save(u"Chart_out.pptx", SaveFormat::Pptx); ``` ## **Set the Layout Mode of a Chart Plot Area** Aspose.Slides for C++ provides a simple API to set the layout mode of the chart plot area. Property **LayoutTargetType** has been added to **ChartPlotArea** and **IChartPlotArea** classes. If the layout of the plot area defined manually this property specifies whether to layout the plot area by its inside (not including axis and axis labels) or outside (including axis and axis labels). There are two possible values which are defined in **LayoutTargetType** enum. - **LayoutTargetType.Inner** - specifies that the plot area size shall determine the size of the plot area, not including the tick marks and axis labels. - **LayoutTargetType.Outer** - specifies that the plot area size shall determine the size of the plot area, the tick marks, and the axis labels. [![The same chart frame and manual rectangle are used in both renders. In Inner mode the target follows the grid, leaving ticks and labels outside. In Outer mode they take up room inside the target.](https://docs.aspose.com/slides/cpp/chart-plot-area/visual-chart-plot-area-2345b90e2bdf.svg)](https://docs.aspose.com/slides/cpp/chart-plot-area/visual-chart-plot-area-2345b90e2bdf.svg) *The dashed outline marks the same manual rectangle in both renders. Inner leaves room for ticks and labels outside it. Outer fits them inside it.* Sample code is given below. ```cpp // The path to the documents directory. const String outPath = u"../out/SetLayoutMode_out.pptx"; System::SharedPtr presentation = System::MakeObject(); System::SharedPtr slide = presentation->get_Slides()->idx_get(0); System::SharedPtr chart = slide->get_Shapes()->AddChart(Aspose::Slides::Charts::ChartType::ClusteredColumn, 20.0f, 100.0f, 600.0f, 400.0f); chart->get_PlotArea()->set_X(0.2f); chart->get_PlotArea()->set_Y(0.2f); chart->get_PlotArea()->set_Width(0.7f); chart->get_PlotArea()->set_Height(0.7f); chart->get_PlotArea()->set_LayoutTargetType(Aspose::Slides::Charts::LayoutTargetType::Inner); presentation->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx); ``` [Source: Examples-SlidesCPP-SetLayoutMode-SetLayoutMode.cpp](https://gist.githubusercontent.com/aspose-com-gists/81aeb05e6d3a070aa76fdea22ed53bc7/raw/e8361990aaf916bf4dd81d2ade57e656982f3b8d/Examples-SlidesCPP-SetLayoutMode-SetLayoutMode.cpp) ## **FAQ** ### In what units are ActualX, ActualY, ActualWidth, and ActualHeight returned? In points; 1 inch = 72 points. These are Aspose.Slides coordinate units. ### How does the Plot Area differ from the Chart Area in terms of content? The Plot Area is the data drawing region (series, gridlines, trendlines, etc.); the Chart Area includes the surrounding elements (title, legend, etc.). In 3D charts, the Plot Area also includes the walls/floor and the axes. ### How are the Plot Area’s X, Y, Width, and Height interpreted when layout is manual? They are fractions (0–1) of the chart’s overall size; in this mode, auto-positioning is disabled and the fractions you set are used. ### Why did the Plot Area position change after adding/moving the legend? The legend sits in the chart area outside the Plot Area but affects layout and available space, so the Plot Area may shift when auto-positioning is in effect. (This is standard behavior for PowerPoint charts.) ## Related articles - [Customize Presentation Chart Entities in C++](https://docs.aspose.com/slides/cpp/chart-entities/) # Manage Chart Data Series in Presentations in C++ > Learn how to manage chart series, data points, workbook cells, formatting, overlap, gap width, and negative values in presentations with C++. Source: https://docs.aspose.com/slides/cpp/chart-series/ Updated: 2026-10-26 ## **Overview** A chart can store its plotted values in workbook cells or directly as numeric literals. An [IChartSeries](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartseries/) represents one set of related values, and each [IChartDataPoint](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdatapoint/) represents a point in that series. [IChartCategory](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartcategory/) objects provide the labels or grouping values shared by the series. In charts created with default data, series names, categories, and point values use [IChartDataCell](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdatacell/) objects from the chart workbook. For a typical category chart, the default workbook uses row 0 for series names, column 0 for category names, and the remaining cells for series values. Worksheet, row, and column indexes passed to [IChartDataWorkbook::GetCell](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdataworkbook/getcell/) are zero-based. This layout is useful when you create a chart with default data, but do not assume that every existing chart uses it. For a loaded presentation, inspect the cells referenced by the series, categories, and data points before changing workbook values. Chart settings have three different scopes: - Series-level settings, such as [IChartSeries::get_Format](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartseries/get_format/), provide the default appearance for all points in one series. - Data-point settings, such as [IChartDataPoint::get_Format](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdatapoint/get_format/), override the series appearance for one point. - Group settings apply to compatible series that belong to the same [IChartSeriesGroup](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartseriesgroup/). Access the group through [IChartSeries::get_ParentSeriesGroup](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartseries/get_parentseriesgroup/) when you need to set options such as overlap or gap width. When no explicit point or series fill is set, the chart style and theme determine the automatic appearance. When both series and point formatting are present, the point formatting takes precedence for that point. ![chart-series-powerpoint](https://docs.aspose.com/slides/cpp/chart-series/chart-series-powerpoint.png) ## **Set Series Values Using Numeric Literals** Use numeric literals when series values come from application data or calculations and do not need worksheet cell references. Call [set_DataSourceTypeForValues](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdatapointcollection/set_datasourcetypeforvalues/) with [DataSourceType::DoubleLiterals](https://reference.aspose.com/slides/cpp/aspose.slides.charts/datasourcetype/) before assigning the value returned by each point's [get_Value](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdatapoint/get_value/) through [set_AsLiteralDouble](https://reference.aspose.com/slides/cpp/aspose.slides.charts/idoublechartvalue/set_asliteraldouble/). The collection setting controls the source type of all point values in that series. Each point's [IBaseChartValue::get_DataSourceType](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ibasechartvalue/get_datasourcetype/) reports the selected type; change it through the collection setting. With `Worksheet`, use [get_AsCell](https://reference.aspose.com/slides/cpp/aspose.slides.charts/isinglecellchartvalue/get_ascell/) to access the referenced cell. With `DoubleLiterals`, use [get_AsLiteralDouble](https://reference.aspose.com/slides/cpp/aspose.slides.charts/idoublechartvalue/get_asliteraldouble/) or `set_AsLiteralDouble` to read or write the number directly. The following example creates a column chart with default series and categories, then assigns calculated values of 10, 20, and so on to the existing points of its first series. It saves the presentation, reopens it, and prints the stored values. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::ClusteredColumn, 20, 20, 500, 300); auto series = chart->get_ChartData()->get_Series()->idx_get(0); series->get_DataPoints()->set_DataSourceTypeForValues(DataSourceType::DoubleLiterals); for (auto i = 0; i < series->get_DataPoints()->get_Count(); i++) { series->get_DataPoints()->idx_get(i)->get_Value()->set_AsLiteralDouble((i + 1) * 10); } presentation->Save(u"numeric_literals.pptx", SaveFormat::Pptx); presentation->Dispose(); auto reopenedPresentation = MakeObject(u"numeric_literals.pptx"); auto reopenedSlide = reopenedPresentation->get_Slide(0); auto reopenedChart = ExplicitCast(reopenedSlide->get_Shape(0)); auto reopenedSeries = reopenedChart->get_ChartData()->get_Series()->idx_get(0); for (auto i = 0; i < reopenedSeries->get_DataPoints()->get_Count(); i++) { auto point = reopenedSeries->get_DataPoints()->idx_get(i); Console::WriteLine(point->get_Value()->get_AsLiteralDouble()); } reopenedPresentation->Dispose(); ``` The point value source type is separate from [IChartData::get_DataSourceType](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdata/get_datasourcetype/), which identifies the chart's internal or external workbook configuration. Using numeric literals does not, by itself, remove the embedded workbook. In this example, the workbook remains available for category labels, series names, and the other series. See [Chart Workbook](https://docs.aspose.com/slides/cpp/chart-workbook/) for workbook management. For scatter and bubble charts, call [set_DataSourceTypeForXValues](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdatapointcollection/set_datasourcetypeforxvalues/) and [set_DataSourceTypeForYValues](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdatapointcollection/set_datasourcetypeforyvalues/) to choose the sources for [get_XValue](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdatapoint/get_xvalue/) and [get_YValue](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdatapoint/get_yvalue/). Bubble charts also use [set_DataSourceTypeForBubbleSizes](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdatapointcollection/set_datasourcetypeforbubblesizes/) for [get_BubbleSize](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdatapoint/get_bubblesize/). Set each applicable source to `DoubleLiterals` before assigning numbers through that value's `set_AsLiteralDouble` method. ## **Set the Chart Series Overlap** [IChartSeries::get_Overlap](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartseries/get_overlap/) reports how much bars or columns overlap in a 2D chart, from -100 through 100 percent. It is a read-only projection of the setting on the parent series group. Call [IChartSeriesGroup::set_Overlap](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartseriesgroup/set_overlap/) to update every compatible series in that group. This option applies to chart types that display grouped bars or columns; it does not affect unrelated series groups in a combination chart. The following example sets the overlap for the group that contains the first series: ```cpp #include #include #include #include #include #include #include #include #include #include #include #include using Aspose::Slides::Charts::ChartType; using Aspose::Slides::Export::SaveFormat; using Aspose::Slides::Presentation; const int firstSlideIndex = 0; const int firstSeriesIndex = 0; const int8_t overlapPercent = 30; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(firstSlideIndex); // The new chart contains sample series, categories, and values. auto chart = slide->get_Shapes()->AddChart(ChartType::ClusteredColumn, 20.0f, 20.0f, 500.0f, 200.0f); auto seriesCollection = chart->get_ChartData()->get_Series(); auto series = seriesCollection->idx_get(firstSeriesIndex); series->get_ParentSeriesGroup()->set_Overlap(overlapPercent); presentation->Save(u"series_overlap.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` The result: ![The series overlap](https://docs.aspose.com/slides/cpp/chart-series/series_overlap.png) ## **Change the Series Fill Color** Use [IChartSeries::get_Format](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartseries/get_format/) to set the default fill for an entire series. If a point already has an explicit fill, its [IChartDataPoint::get_Format](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdatapoint/get_format/) setting overrides the series fill for that point. The following example applies a solid blue fill to the first series: ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using Aspose::Slides::Charts::ChartType; using Aspose::Slides::Export::SaveFormat; using Aspose::Slides::FillType; using Aspose::Slides::Presentation; using System::Drawing::Color; const int firstSlideIndex = 0; const int firstSeriesIndex = 0; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(firstSlideIndex); auto chart = slide->get_Shapes()->AddChart(ChartType::ClusteredColumn, 20.0f, 20.0f, 500.0f, 200.0f); auto seriesCollection = chart->get_ChartData()->get_Series(); auto series = seriesCollection->idx_get(firstSeriesIndex); auto seriesColor = Color::get_Blue(); series->get_Format()->get_Fill()->set_FillType(FillType::Solid); series->get_Format()->get_Fill()->get_SolidFillColor()->set_Color(seriesColor); presentation->Save(u"series_color.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` The result: ![The color of the series](https://docs.aspose.com/slides/cpp/chart-series/series_color.png) ## **Change the Series Name** A series name is stored in the chart data workbook and is normally displayed in the legend. In the default workbook created for a clustered column chart, cell B1 is at row 0, column 1 and contains the name of the first series. The named constants in the following example make that structure explicit: ```cpp #include #include #include #include #include #include #include #include #include #include #include #include using Aspose::Slides::Charts::ChartType; using Aspose::Slides::Export::SaveFormat; using Aspose::Slides::Presentation; using System::ObjectExt; using System::String; const int firstSlideIndex = 0; const int worksheetIndex = 0; const int seriesNameRowIndex = 0; const int firstSeriesColumnIndex = 1; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(firstSlideIndex); auto chart = slide->get_Shapes()->AddChart(ChartType::ClusteredColumn, 20.0f, 20.0f, 500.0f, 200.0f); auto workbook = chart->get_ChartData()->get_ChartDataWorkbook(); auto seriesNameCell = workbook->GetCell(worksheetIndex, seriesNameRowIndex, firstSeriesColumnIndex); auto seriesName = ObjectExt::Box(u"Revenue"); seriesNameCell->set_Value(seriesName); presentation->Save(u"series_name.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` You can also update the cell already referenced by [IChartSeries::get_Name](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartseries/get_name/). This approach avoids assuming a particular row and column in an existing chart: ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using Aspose::Slides::Charts::ChartType; using Aspose::Slides::Export::SaveFormat; using Aspose::Slides::Presentation; using System::ObjectExt; using System::String; const int firstSlideIndex = 0; const int firstSeriesIndex = 0; const int firstNameCellIndex = 0; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(firstSlideIndex); auto chart = slide->get_Shapes()->AddChart(ChartType::ClusteredColumn, 20.0f, 20.0f, 500.0f, 200.0f); auto seriesCollection = chart->get_ChartData()->get_Series(); auto series = seriesCollection->idx_get(firstSeriesIndex); auto seriesNameCells = series->get_Name()->get_AsCells(); auto seriesNameCell = seriesNameCells->idx_get(firstNameCellIndex); auto seriesName = ObjectExt::Box(u"Revenue"); seriesNameCell->set_Value(seriesName); presentation->Save(u"series_name.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` The result: ![The series name](https://docs.aspose.com/slides/cpp/chart-series/series_name.png) ### **Create a Series with a Name from Multiple Cells** A composite series name is useful when a product name and a reporting period are stored in separate workbook cells. For example, you can combine `Product A` in B1 and `2026` in C1 into a single series name while keeping both parts linked to their source cells. Use [IChartDataWorkbook::GetCellCollection](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdataworkbook/getcellcollection/) to retrieve the name range, then pass that collection to [IChartSeriesCollection::Add](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartseriescollection/add/). The `skipHiddenCells` argument controls whether hidden cells are included: `true` excludes them, while `false` includes them. This example uses `false` to include every cell in the name range. The following example creates a presentation with one series and two data points. Cells B1:C1 supply only the series name; A2:A3 supply the category labels, and B2:B3 supply the numeric values. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; using System::ObjectExt; using System::String; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::ClusteredColumn, 50.0f, 50.0f, 620.0f, 180.0f); auto chartData = chart->get_ChartData(); chartData->get_Series()->Clear(); chartData->get_Categories()->Clear(); chart->set_HasLegend(true); auto workbook = chartData->get_ChartDataWorkbook(); workbook->Clear(0); // These two cells supply the series name. auto productName = ObjectExt::Box(u"Product A"); auto reportingPeriod = ObjectExt::Box(u"2026"); workbook->GetCell(0, 0, 1, productName); workbook->GetCell(0, 0, 2, reportingPeriod); auto nameCells = workbook->GetCellCollection(u"Sheet1!$B$1:$C$1", false); auto series = chartData->get_Series()->Add(nameCells, ChartType::ClusteredColumn); // Separate cells supply the categories and numeric data points. auto northLabel = ObjectExt::Box(u"North"); auto southLabel = ObjectExt::Box(u"South"); auto northCategory = workbook->GetCell(0, 1, 0, northLabel); auto southCategory = workbook->GetCell(0, 2, 0, southLabel); chartData->get_Categories()->Add(northCategory); chartData->get_Categories()->Add(southCategory); auto northAmount = ObjectExt::Box(120); auto southAmount = ObjectExt::Box(150); auto northValue = workbook->GetCell(0, 1, 1, northAmount); auto southValue = workbook->GetCell(0, 2, 1, southAmount); series->get_DataPoints()->AddDataPointForBarSeries(northValue); series->get_DataPoints()->AddDataPointForBarSeries(southValue); presentation->Save(u"composite_series_name.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` The resulting series name is `Product A 2026`, with a space between the two cell values. The legend displays this as one entry for both columns. The image below illustrates the result: ![Column chart with North and South values and the composite series name Product A 2026 in the legend](https://docs.aspose.com/slides/cpp/chart-series/composite_series_name.png) ## **Get the Automatic Series Fill Color** [IChartSeries::GetAutomaticSeriesColor](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartseries/getautomaticseriescolor/) returns the color calculated from the series index and the chart style. This is the color used when the series fill has not been explicitly defined. Calling the method reads the calculated color; it does not assign a new fill. The following example prints the automatic color of each default series: ```cpp #include #include #include #include #include #include #include #include #include #include #include #include using Aspose::Slides::Charts::ChartType; using Aspose::Slides::Presentation; using System::Console; using System::String; const int firstSlideIndex = 0; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(firstSlideIndex); auto chart = slide->get_Shapes()->AddChart(ChartType::ClusteredColumn, 20.0f, 20.0f, 500.0f, 200.0f); auto seriesCollection = chart->get_ChartData()->get_Series(); const int seriesCount = seriesCollection->get_Count(); for (int seriesIndex = 0; seriesIndex < seriesCount; seriesIndex++) { auto series = seriesCollection->idx_get(seriesIndex); auto automaticColor = series->GetAutomaticSeriesColor(); auto colorName = automaticColor.get_Name(); auto outputLine = String::Format(u"Series {0}: {1}", seriesIndex, colorName); Console::WriteLine(outputLine); } presentation->Dispose(); ``` Example output for the default chart style: ```text Series 0: ff4f81bd Series 1: ffc0504d Series 2: ff9bbb59 ``` The exact colors depend on the chart style and theme. ## **Set Invert Fill Color for a Chart Series** For bar, column, and bubble series, [IChartSeries::set_InvertIfNegative](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartseries/set_invertifnegative/) can display negative values with a different fill. Set the regular series fill to solid, enable inversion, and assign the negative-value color through [IChartSeries::get_InvertedSolidFillColor](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartseries/get_invertedsolidfillcolor/). Negative numbers remain unchanged in the workbook; only their display color changes. The following example replaces the default chart data with one series. Worksheet row 0 contains the series name, column 0 contains category names, and column 1 contains the values: ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using Aspose::Slides::Charts::ChartType; using Aspose::Slides::Export::SaveFormat; using Aspose::Slides::FillType; using Aspose::Slides::Presentation; using System::Drawing::Color; using System::ObjectExt; using System::String; const int firstSlideIndex = 0; const int worksheetIndex = 0; const int headerRowIndex = 0; const int categoryColumnIndex = 0; const int firstSeriesColumnIndex = 1; const int firstDataRowIndex = 1; const int categoryCount = 3; const String categoryNames[] = {u"Category 1", u"Category 2", u"Category 3"}; const int seriesValues[] = {-20, 50, -30}; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(firstSlideIndex); auto chart = slide->get_Shapes()->AddChart(ChartType::ClusteredColumn, 20.0f, 20.0f, 500.0f, 200.0f); auto chartData = chart->get_ChartData(); auto workbook = chartData->get_ChartDataWorkbook(); auto seriesCollection = chartData->get_Series(); seriesCollection->Clear(); chartData->get_Categories()->Clear(); auto seriesName = ObjectExt::Box(u"Series 1"); auto seriesNameCell = workbook->GetCell(worksheetIndex, headerRowIndex, firstSeriesColumnIndex, seriesName); auto chartType = chart->get_Type(); auto series = seriesCollection->Add(seriesNameCell, chartType); for (int categoryIndex = 0; categoryIndex < categoryCount; categoryIndex++) { const int dataRowIndex = firstDataRowIndex + categoryIndex; auto categoryName = categoryNames[categoryIndex]; const int seriesValue = seriesValues[categoryIndex]; auto boxedCategoryName = ObjectExt::Box(categoryName); auto categoryCell = workbook->GetCell(worksheetIndex, dataRowIndex, categoryColumnIndex, boxedCategoryName); chartData->get_Categories()->Add(categoryCell); auto boxedSeriesValue = ObjectExt::Box(seriesValue); auto valueCell = workbook->GetCell(worksheetIndex, dataRowIndex, firstSeriesColumnIndex, boxedSeriesValue); series->get_DataPoints()->AddDataPointForBarSeries(valueCell); } auto automaticSeriesColor = series->GetAutomaticSeriesColor(); auto invertedSeriesColor = Color::get_Red(); series->get_Format()->get_Fill()->set_FillType(FillType::Solid); series->get_Format()->get_Fill()->get_SolidFillColor()->set_Color(automaticSeriesColor); series->set_InvertIfNegative(true); series->get_InvertedSolidFillColor()->set_Color(invertedSeriesColor); presentation->Save(u"inverted_solid_fill_color.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` The result: ![The inverted solid fill color](https://docs.aspose.com/slides/cpp/chart-series/inverted_solid_fill_color.png) You can enable inversion for one point through [IChartDataPoint::set_InvertIfNegative](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdatapoint/set_invertifnegative/). In the following example, inversion is disabled for the series and enabled only for the selected point. The point is also assigned a negative value so that the effect is visible: ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using Aspose::Slides::Charts::ChartType; using Aspose::Slides::Export::SaveFormat; using Aspose::Slides::FillType; using Aspose::Slides::Presentation; using System::Drawing::Color; using System::ObjectExt; const int firstSlideIndex = 0; const int firstSeriesIndex = 0; const int targetDataPointIndex = 2; const int negativeValue = -30; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(firstSlideIndex); auto chart = slide->get_Shapes()->AddChart(ChartType::ClusteredColumn, 20.0f, 20.0f, 500.0f, 200.0f); auto seriesCollection = chart->get_ChartData()->get_Series(); auto series = seriesCollection->idx_get(firstSeriesIndex); auto automaticSeriesColor = series->GetAutomaticSeriesColor(); auto invertedSeriesColor = Color::get_Red(); series->get_Format()->get_Fill()->set_FillType(FillType::Solid); series->get_Format()->get_Fill()->get_SolidFillColor()->set_Color(automaticSeriesColor); series->get_InvertedSolidFillColor()->set_Color(invertedSeriesColor); series->set_InvertIfNegative(false); auto dataPoint = series->get_DataPoint(targetDataPointIndex); auto boxedNegativeValue = ObjectExt::Box(negativeValue); dataPoint->get_YValue()->get_AsCell()->set_Value(boxedNegativeValue); dataPoint->set_InvertIfNegative(true); presentation->Save(u"data_point_invert_color_if_negative.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ## **Clear a Specific Data Point Value** To make one point empty without removing the other points, set its backing workbook cell to `nullptr`. For a column chart, the plotted value is available through [IChartDataPoint::get_YValue](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdatapoint/get_yvalue/). The data point stays at the same category position, but the chart treats its value as blank according to the chart's blank-value settings. The following example clears only the second point in the first series: ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include using Aspose::Slides::Charts::ChartType; using Aspose::Slides::Export::SaveFormat; using Aspose::Slides::Presentation; const int firstSlideIndex = 0; const int firstSeriesIndex = 0; const int targetDataPointIndex = 1; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(firstSlideIndex); auto chart = slide->get_Shapes()->AddChart(ChartType::ClusteredColumn, 20.0f, 20.0f, 500.0f, 200.0f); auto seriesCollection = chart->get_ChartData()->get_Series(); auto series = seriesCollection->idx_get(firstSeriesIndex); auto dataPoint = series->get_DataPoint(targetDataPointIndex); dataPoint->get_YValue()->get_AsCell()->set_Value(nullptr); presentation->Save(u"clear_data_point_value.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` Scatter charts use separate X and Y cells, and bubble charts also use a size cell. Clear only the cell that represents the value you intend to remove. Do not call [IChartDataPointCollection::Clear](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdatapointcollection/clear/) when you want to keep the other points, because that method removes every data point from the collection. ## **Control the Display of Empty Cells** Hidden cells that contain values are a separate case from empty cells. To include or exclude data from hidden worksheet rows and columns, see [Include Data from Hidden Rows and Columns](https://docs.aspose.com/slides/cpp/chart-workbook/#include-data-from-hidden-rows-and-columns). An empty workbook cell represents missing data; a cell containing `0` represents a known numeric value. Call [IChartDataCell::set_Value](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdatacell/set_value/) with `nullptr` to make a cell empty. A numeric zero remains a zero regardless of the blank-cell setting. Use [IChart::set_DisplayBlanksAs](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichart/set_displayblanksas/) to choose how the chart displays empty cells. This setting applies to the whole chart. It changes how blanks are plotted, without filling the empty workbook cell with zero or an interpolated value. The following self-contained example creates a line chart with one series, clears the value for Day 3, and saves the same chart with each mode. No input file is required. The [IChartDataWorkbook](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdataworkbook/) uses worksheet 0, column 0 for category labels, and column 1 for values; row 0 holds the series name. The final data is `10, 20, empty, 30, 40`. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; using System::ObjectExt; using System::String; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::LineWithMarkers, 40.0f, 40.0f, 640.0f, 400.0f); auto chartData = chart->get_ChartData(); auto workbook = chartData->get_ChartDataWorkbook(); chartData->get_Series()->Clear(); chartData->get_Categories()->Clear(); auto seriesName = ObjectExt::Box(u"Measurements"); auto seriesNameCell = workbook->GetCell(0, 0, 1, seriesName); auto series = chartData->get_Series()->Add(seriesNameCell, chart->get_Type()); auto values = std::array{10, 20, 25, 30, 40}; for (auto i = 0; i < values.size(); i++) { auto categoryName = String::Format(u"Day {0}", i + 1); auto boxedCategoryName = ObjectExt::Box(categoryName); auto categoryCell = workbook->GetCell(0, i + 1, 0, boxedCategoryName); chartData->get_Categories()->Add(categoryCell); auto boxedValue = ObjectExt::Box(values[i]); auto valueCell = workbook->GetCell(0, i + 1, 1, boxedValue); series->get_DataPoints()->AddDataPointForLineSeries(valueCell); } // Leave Day 3 genuinely empty, while retaining its category and data point. workbook->GetCell(0, 3, 1)->set_Value(nullptr); auto modes = std::array{DisplayBlanksAsType::Gap, DisplayBlanksAsType::Zero, DisplayBlanksAsType::Span}; for (auto mode : modes) { chart->set_DisplayBlanksAs(mode); auto outputPath = String::Format(u"empty_cells_{0}.pptx", mode); presentation->Save(outputPath, SaveFormat::Pptx); } presentation->Dispose(); ``` Each output file stores the mode assigned before saving: `empty_cells_Gap.pptx`, `empty_cells_Zero.pptx`, and `empty_cells_Span.pptx`. To save only one version, assign the desired mode and save the presentation once instead of iterating over the modes. The comparison below shows the same data in all three files. Day 3 is empty in the workbook in every case: ![Line charts with identical data: Gap breaks the line at Day 3, Zero drops the line to zero, and Span connects Day 2 to Day 4.](https://docs.aspose.com/slides/cpp/chart-series/display_blanks_as.png) The visible effect depends on the chart type. A line chart makes all three modes easy to compare. Bar and column charts have no line to connect across a missing category, so `Span` cannot produce the connecting segment shown above; a missing column and a zero-height column can also look alike. Similarly, a scatter chart with markers only has no connecting line. Do not expect three distinct results for every chart type; check the output for the type you use. ## **Set the Series Gap Width** Gap width is the space between adjacent bar or column clusters, expressed as a percentage of the bar or column width. Like overlap, it belongs to the parent series group rather than to one series. Call [IChartSeriesGroup::set_GapWidth](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartseriesgroup/set_gapwidth/) once for the group. A larger value creates more space between clusters; a smaller value makes them denser. The following example changes the gap width and saves only the final presentation: ```cpp #include #include #include #include #include #include #include #include #include #include #include #include using Aspose::Slides::Charts::ChartType; using Aspose::Slides::Export::SaveFormat; using Aspose::Slides::Presentation; const int firstSlideIndex = 0; const int firstSeriesIndex = 0; const uint16_t gapWidthPercent = 30; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(firstSlideIndex); auto chart = slide->get_Shapes()->AddChart(ChartType::StackedColumn, 20.0f, 20.0f, 500.0f, 200.0f); auto seriesCollection = chart->get_ChartData()->get_Series(); auto series = seriesCollection->idx_get(firstSeriesIndex); series->get_ParentSeriesGroup()->set_GapWidth(gapWidthPercent); presentation->Save(u"gap_width_30.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` The result: ![The gap width](https://docs.aspose.com/slides/cpp/chart-series/gap_width.png) ## **Show or Hide Series Lines** Series lines visually connect related parts of a chart. Use [IChartSeriesGroup::set_HasSeriesLines](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartseriesgroup/set_hasserieslines/) to show or hide them in supported stacked bar and OfPie charts. In two-dimensional stacked bar and column charts, they connect corresponding stack boundaries across categories. In Pie of Pie and Bar of Pie charts, they connect the main plot to the secondary plot. This setting is not a general-purpose connector for other chart types. Access the group through [IChartSeries::get_ParentSeriesGroup](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartseries/get_parentseriesgroup/). The setting applies to every series in that group. [IChartSeries::get_HasSeriesLines](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartseries/get_hasserieslines/) only reads the value and reflects the parent group's setting; call the group setter to update it. The following example creates one [ChartType::PieOfPie](https://reference.aspose.com/slides/cpp/aspose.slides.charts/charttype/) chart with default data. It saves the same chart with series lines enabled and then disabled, producing two presentations for comparison. ```cpp #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::PieOfPie, 50, 50, 600, 400); auto series = chart->get_ChartData()->get_Series()->idx_get(0); auto seriesGroup = series->get_ParentSeriesGroup(); seriesGroup->set_HasSeriesLines(true); presentation->Save(u"series_lines_enabled.pptx", SaveFormat::Pptx); seriesGroup->set_HasSeriesLines(false); presentation->Save(u"series_lines_disabled.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` | Series lines enabled | Series lines disabled | | --- | --- | | ![Pie of Pie chart with series lines enabled](https://docs.aspose.com/slides/cpp/chart-series/series_lines_enabled.png) | ![Pie of Pie chart with series lines disabled](https://docs.aspose.com/slides/cpp/chart-series/series_lines_disabled.png) | | The two lines connect the main pie to the secondary pie. | Both pies remain visible, but the connecting lines are hidden. | Series lines differ from data label leader lines, which connect labels to their data points; gridlines, which mark intervals along chart axes; and the lines in a line chart, which represent data values. This setting does not control those elements. ## **FAQ** **Which chart types support data series?** All chart types represented by the [ChartType](https://reference.aspose.com/slides/cpp/aspose.slides.charts/charttype/) enumeration use chart data, but their series do not all have the same value structure or settings. For example, category charts use categories and values, scatter charts use X and Y values, and bubble charts add bubble sizes. Use the data-point creation method that matches the series type. Options such as overlap and gap width apply only to compatible bar or column groups. **What is a chart series group?** An [IChartSeriesGroup](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartseriesgroup/) contains compatible series that share group-level plotting settings. A combination chart can contain more than one group, so changing the group reached through one series does not necessarily change every series in the chart. **Does a newly created chart contain default data?** Yes. By default, [IShapeCollection::AddChart](https://reference.aspose.com/slides/cpp/aspose.slides/ishapecollection/addchart/) creates sample series, categories, and values. You can edit those cells or clear both the series and category collections before adding a completely custom data set. An overload can also create a chart without default data. **How are chart objects connected to workbook cells?** Series names, category labels, and data-point values reference cells in an [IChartDataWorkbook](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdataworkbook/). Changing a referenced cell updates the corresponding chart element. When you build custom data, keep category rows and series-value rows aligned so that each point is plotted under the intended category. **How do I clear one point instead of the whole series?** Set the relevant value cell to `nullptr` to retain the point's category position as an empty point. Call [IChartDataPointCollection::Clear](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdatapointcollection/clear/) only when you intend to remove all points from that series. If you also remove categories, update every series so their values remain aligned with the category collection. **How are empty points displayed?** The result depends on the chart type and [IChart::get_DisplayBlanksAs](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichart/get_displayblanksas/). Supported charts can display blanks as gaps, as zero values, or by connecting neighboring points. Choose the setting that matches the meaning of missing data in your presentation. See [Control the Display of Empty Cells](https://docs.aspose.com/slides/cpp/chart-series/#control-the-display-of-empty-cells) for a complete example and visual comparison. **How are negative values formatted?** For supported bar, column, and bubble series, call [IChartSeries::set_InvertIfNegative](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartseries/set_invertifnegative/) and set the color through [IChartSeries::get_InvertedSolidFillColor](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartseries/get_invertedsolidfillcolor/). You can override the behavior for an individual point with [IChartDataPoint::set_InvertIfNegative](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdatapoint/set_invertifnegative/). These methods affect formatting, not the stored numeric values. **Which formatting wins when both a series and a point are formatted?** Explicit data-point formatting takes precedence for that point. Other points continue to use the explicit series format or, when the series format is not defined, the automatic chart style and theme. Group settings such as overlap and gap width control layout and are not point-level formatting overrides. **Is there a limit to how many series a chart can contain?** Aspose.Slides does not impose a separate fixed series-count limit. In practice, presentation file constraints, available memory, rendering time, and chart readability determine a useful limit. **What should I change when columns are too close together or too far apart?** Call [IChartSeriesGroup::set_GapWidth](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartseriesgroup/set_gapwidth/) on the appropriate parent series group. Increase the value to widen the space between clusters, or decrease it to bring the clusters closer together. # Customize Presentation Charts in C++ > Explore every chart type you can create or edit with Aspose.Slides for C++ – fast, code-first guides for PowerPoint presentations. Source: https://docs.aspose.com/slides/cpp/chart-types/ Updated: 2026-07-31 --- lastmod: 2026-07-31T17:58:11+04:00 title: Customize Presentation Charts in C++ linktitle: Chart Types type: docs weight: 20 url: /cpp/chart-types/ keywords: - customize chart - manage chart - chart type - PowerPoint chart - presentation chart - PPT chart - PPTX chart - PowerPoint - presentation - C++ - Aspose.Slides description: "Explore every chart type you can create or edit with Aspose.Slides for C++ – fast, code-first guides for PowerPoint presentations." --- ## Related articles - [Create and Customize PowerPoint Charts in C++](https://docs.aspose.com/slides/cpp/powerpoint-charts/) - [Manage Media Files in C++](https://docs.aspose.com/slides/cpp/manage-media-files/) # Manage Chart Workbooks in Presentations Using C++ > Discover Aspose.Slides for C++: effortlessly manage chart workbooks in PowerPoint and OpenDocument formats to streamline your presentation data. Source: https://docs.aspose.com/slides/cpp/chart-workbook/ Updated: 2026-10-22 ## **Overview** This article explains how to work with chart workbooks in Aspose.Slides. It shows how to read and write chart data through workbook streams, use workbook cells as chart data labels, access worksheet collections, and specify the data source type for chart values. It also covers working with external workbooks as chart data sources. The examples demonstrate how to create and assign an external workbook, retrieve the path of an external workbook linked to a chart, and edit chart data when the workbook is available. For workbook cells that represent missing data, see [Control the Display of Empty Cells](https://docs.aspose.com/slides/cpp/chart-series/) for the difference between an empty cell and zero, and a line-chart comparison of the available display modes. ## **Include Data from Hidden Rows and Columns** Use [IChart::set_PlotVisibleCellsOnly](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichart/set_plotvisiblecellsonly/) to control whether a chart plots data from hidden worksheet rows and columns. Set it to `true` to plot only visible cells, or `false` to include both visible and hidden cells. This setting controls chart plotting; it does not hide or unhide worksheet rows or columns. The [sample presentation](https://docs.aspose.com/slides/cpp/chart-workbook/hidden-source-data.pptx) contains a column chart as the first shape on its first slide. The embedded worksheet, `Sheet1`, contains the following source range, `A1:C4`. Row 3 and column C are hidden, but their cells still contain values. | Worksheet row | A: Month | B: Retail | C: Wholesale (hidden column) | | --- | --- | --- | --- | | 2 | January | 10 | 30 | | 3 (hidden row) | February | 40 | 60 | | 4 | March | 20 | 50 | Access source cells through [IChartData::get_ChartDataWorkbook](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdata/get_chartdataworkbook/) and read [IChartDataCell::get_IsHidden](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdatacell/get_ishidden/) to inspect their hidden status. This property is read-only. In this file, B2 is visible, B3 belongs to the hidden row, and C2 belongs to the hidden column; the example prints `False`, `True`, and `True`, respectively. For this example, refresh the chart data after changing the plotting setting: retain the embedded workbook with [ReadWorkbookStream](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdata/readworkbookstream/) and reload it with [WriteWorkbookStream](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdata/writeworkbookstream/). When including all cells, also use [SetRange](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdata/setrange/) to restore the complete range, including the hidden February category. Simply changing the flag is insufficient to refresh this sample's cached chart data and category labels. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace System; auto presentation = MakeObject(u"hidden-source-data.pptx"); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->get_Count() > 0 ? AsCast(slide->get_Shape(0)) : nullptr; if (chart != nullptr) { auto workbook = chart->get_ChartData()->get_ChartDataWorkbook(); Console::WriteLine(u"B2 hidden: {0}", workbook->GetCell(0, u"B2")->get_IsHidden()); Console::WriteLine(u"B3 hidden: {0}", workbook->GetCell(0, u"B3")->get_IsHidden()); Console::WriteLine(u"C2 hidden: {0}", workbook->GetCell(0, u"C2")->get_IsHidden()); auto workbookStream = chart->get_ChartData()->ReadWorkbookStream(); for (auto visibleOnly : {true, false}) { chart->set_PlotVisibleCellsOnly(visibleOnly); // Refresh the chart data from the embedded workbook. workbookStream->set_Position(0); chart->get_ChartData()->WriteWorkbookStream(workbookStream); if (!visibleOnly) { // Restore the complete source range, including hidden categories. chart->get_ChartData()->SetRange(u"Sheet1!$A$1:$C$4"); } auto outputPath = visibleOnly ? u"hidden_cells_True.pptx" : u"hidden_cells_False.pptx"; presentation->Save(outputPath, Export::SaveFormat::Pptx); } } else { Console::WriteLine(u"The first shape is not a chart."); } ``` The example saves two versions of the presentation: one with only the visible Retail values (10 and 20), and another with all six values. The images below illustrate the two plotting modes. Row 3 and column C remain hidden in both embedded workbooks. | Only visible cells (`true`) | All cells (`false`) | | --- | --- | | ![Only visible cells: Retail values 10 and 20 for January and March.](https://docs.aspose.com/slides/cpp/chart-workbook/hidden_cells_True.png) | ![All cells: Retail and Wholesale values for January, February, and March.](https://docs.aspose.com/slides/cpp/chart-workbook/hidden_cells_False.png) | A hidden cell containing a value is different from an empty cell. [IChart::get_DisplayBlanksAs](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichart/get_displayblanksas/) controls how missing values are displayed; it does not include or exclude hidden source data. See [Control the Display of Empty Cells](https://docs.aspose.com/slides/cpp/chart-series/#control-the-display-of-empty-cells) for an example. ## **Retrieve a Chart's Data Range** Before updating workbook data in an existing presentation, inspect the source ranges to identify which worksheet cells each chart uses. The [IChartData::GetRange](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdata/getrange/) method returns the current data range as a worksheet-qualified formula, such as `Sheet1!$A$1:$D$5`. Here, `Sheet1` is the worksheet name, `!` separates it from the cell range, and `$A$1:$D$5` identifies cells A1 through D5, inclusive. The dollar signs indicate absolute row and column references. The method reads the current range without changing the chart or its workbook. If the chart does not use a workbook as its data source, it throws [System::InvalidOperationException](https://reference.aspose.com/slides/cpp/system/details_invalidoperationexception/). For more information, see the [ChartData API Reference](https://reference.aspose.com/slides/cpp/aspose.slides.charts/chartdata/). This example opens a presentation and checks the shapes directly on each slide for charts. It prints each chart's name and source range. If a chart does not use a workbook, it prints a message and continues to the next chart. ```cpp #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace System; auto presentation = MakeObject(u"presentation.pptx"); for (auto slide : IterateOver(presentation->get_Slides())) { for (auto shape : IterateOver(slide->get_Shapes())) { auto chart = AsCast(shape); if (chart != nullptr) { try { auto range = chart->get_ChartData()->GetRange(); Console::WriteLine(u"{0}: {1}", chart->get_Name(), range); } catch (const InvalidOperationException&) { Console::WriteLine(u"{0}: The chart does not use a workbook as its data source.", chart->get_Name()); } } } } ``` ## **Read and Write Chart Data from a Workbook** Aspose.Slides for C++ provides the [ReadWorkbookStream](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdata/readworkbookstream/) and [WriteWorkbookStream](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdata/writeworkbookstream/) methods that allow you to read and write chart data workbooks (containing chart data edited with Aspose.Cells). **Note** that the chart data has to be organized in the same manner or must have a structure similar to the source. This example uses a presentation with a chart as the first shape on its first slide. It reads the embedded workbook into a stream, clears the existing series and categories, and writes the same workbook back. The changes remain in memory; the example does not save the presentation. ```cpp #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace System; auto presentation = MakeObject(u"chart.pptx"); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->get_Count() > 0 ? AsCast(slide->get_Shape(0)) : nullptr; if (chart != nullptr) { auto chartData = chart->get_ChartData(); auto workbookStream = chartData->ReadWorkbookStream(); chartData->get_Series()->Clear(); chartData->get_Categories()->Clear(); workbookStream->set_Position(0); chartData->WriteWorkbookStream(workbookStream); } else { Console::WriteLine(u"The first shape is not a chart."); } ``` ### **Validate Chart Layout After Workbook Modification** When you replace an embedded workbook with a modified one, the chart retains its original series and category collections. This mismatch can cause [IChart::ValidateChartLayout](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichart/validatechartlayout/) to fail with an index-out-of-range error. Clear the existing series and categories before writing the updated workbook back to the chart. This example uses a chart that is the first shape on the first slide. The comment marks where workbook editing would occur; the runnable example writes the original workbook back and validates the layout in memory. ```cpp #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace System; auto presentation = MakeObject(u"chart.pptx"); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->get_Count() > 0 ? AsCast(slide->get_Shape(0)) : nullptr; if (chart != nullptr) { auto chartData = chart->get_ChartData(); auto workbookStream = chartData->ReadWorkbookStream(); // Modify the workbook stream here, for example, using Aspose.Cells. chartData->get_Series()->Clear(); chartData->get_Categories()->Clear(); workbookStream->set_Position(0); chartData->WriteWorkbookStream(workbookStream); chart->ValidateChartLayout(); } else { Console::WriteLine(u"The first shape is not a chart."); } ``` Clearing the collections removes stale data references before the workbook is written back. Rebuild any required series and category mappings for the updated workbook before using the chart. ## **Set Custom Number Formats for Workbook Cells** Use [IChartDataCell::set_CustomNumberFormat](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdatacell/set_customnumberformat/) to control how numeric values appear in a chart's embedded workbook. For example, a report may need a conversion rate displayed as a percentage with four decimal places and a coefficient displayed with five decimal places. Keep both values numeric so they remain available for calculations and chart plotting. A number format changes the display, not the stored value. The format `0.0000%` displays `0.125` as `12.5000%`; it does not replace the stored number with `12.5`. Similarly, `0.00000` displays `0.1234567` as `0.12346` without rounding the stored value. If the custom format is an empty string (`""`), the format assigned through [set_PresetNumberFormat](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdatacell/set_presetnumberformat/) is used instead. The following example creates a column chart and accesses its cells through [IChartData::get_ChartDataWorkbook](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdata/get_chartdataworkbook/). On worksheet 0, B2 contains the conversion rate and C2 contains the coefficient. Both cells supply chart values. The example also enables value labels linked to the source formats. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace System; auto presentation = MakeObject(); presentation->get_SlideSize()->SetSize(720, 270, SlideSizeScaleType::DoNotScale); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::ClusteredColumn, 50, 20, 620, 210); chart->set_HasTitle(false); chart->get_Axes()->get_VerticalAxis()->set_IsNumberFormatLinkedToSource(false); chart->get_Axes()->get_VerticalAxis()->set_NumberFormat(u"0.00"); chart->get_Axes()->get_VerticalAxis()->set_IsAutomaticMinValue(false); chart->get_Axes()->get_VerticalAxis()->set_MinValue(0); chart->get_ChartData()->get_Series()->Clear(); chart->get_ChartData()->get_Categories()->Clear(); auto workbook = chart->get_ChartData()->get_ChartDataWorkbook(); workbook->Clear(0); auto categoryCell = workbook->GetCell(0, u"A2", ObjectExt::Box(u"Sample")); chart->get_ChartData()->get_Categories()->Add(categoryCell); auto percentageCell = workbook->GetCell(0, u"B2", ObjectExt::Box(0.125)); percentageCell->set_CustomNumberFormat(u"0.0000%"); auto percentageName = workbook->GetCell(0, u"B1", ObjectExt::Box(u"Conversion rate")); auto percentageSeries = chart->get_ChartData()->get_Series()->Add(percentageName, chart->get_Type()); percentageSeries->get_DataPoints()->AddDataPointForBarSeries(percentageCell); auto precisionCell = workbook->GetCell(0, u"C2", ObjectExt::Box(0.1234567)); precisionCell->set_CustomNumberFormat(u"0.00000"); auto precisionName = workbook->GetCell(0, u"C1", ObjectExt::Box(u"Coefficient")); auto precisionSeries = chart->get_ChartData()->get_Series()->Add(precisionName, chart->get_Type()); precisionSeries->get_DataPoints()->AddDataPointForBarSeries(precisionCell); for (auto series : IterateOver(chart->get_ChartData()->get_Series())) { auto labelFormat = series->get_DataPoint(0)->get_Label()->get_DataLabelFormat(); labelFormat->set_ShowValue(true); labelFormat->set_IsNumberFormatLinkedToSource(true); } presentation->Save(u"CustomCellFormats.pptx", Export::SaveFormat::Pptx); ``` Workbook cell formats are separate from formats set directly on chart axes or data labels. In this example, each label displays its source cell's value because [set_ShowValue](https://reference.aspose.com/slides/cpp/aspose.slides.charts/idatalabelformat/set_showvalue/) is called with `true`, and follows the source number format because [set_IsNumberFormatLinkedToSource](https://reference.aspose.com/slides/cpp/aspose.slides.charts/idatalabelformat/set_isnumberformatlinkedtosource/) is called with `true`. After saving and reopening the presentation, the labels display `12.5000%` and `0.12346`, as shown below. The vertical axis uses its own format of `0.00`, assigned through [set_NumberFormat](https://reference.aspose.com/slides/cpp/aspose.slides.charts/iaxis/set_numberformat/), with [set_IsNumberFormatLinkedToSource](https://reference.aspose.com/slides/cpp/aspose.slides.charts/iaxis/set_isnumberformatlinkedtosource/) called with `false`. To format a data label independently, set its source-link flag to `false` and assign its format through [set_NumberFormat](https://reference.aspose.com/slides/cpp/aspose.slides.charts/idatalabelformat/set_numberformat/). This does not change the workbook cell's format. For example, an independent label format of `0.00` displays the first value as `0.13`, while B2 still displays `12.5000%`. See [Chart Data Labels](https://docs.aspose.com/slides/cpp/chart-data-label/#set-percentage-sign-with-chart-data-labels) for direct label formatting. The image below was rendered from the saved presentation after reopening it: ![Column chart with source-linked labels showing 12.5000% and 0.12346 and an independently formatted numeric axis.](https://docs.aspose.com/slides/cpp/chart-workbook/custom-cell-formats.png) ## **Set a Workbook Cell as a Chart Data Label** You can use text from workbook cells as chart data labels. This example adds a bubble chart with default data to the first slide of an existing presentation. It uses cells A10:A12 on worksheet 0 for the first three labels in the first series, enables labels from cells, and saves the updated presentation. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace System; auto presentation = MakeObject(u"chart2.pptx"); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::Bubble, 50, 50, 600, 400, true); auto series = chart->get_ChartData()->get_Series()->idx_get(0); auto workbook = chart->get_ChartData()->get_ChartDataWorkbook(); series->get_Labels()->get_DefaultDataLabelFormat()->set_ShowLabelValueFromCell(true); auto firstLabelCell = workbook->GetCell(0, u"A10", ObjectExt::Box(u"Label 0 cell value")); auto secondLabelCell = workbook->GetCell(0, u"A11", ObjectExt::Box(u"Label 1 cell value")); auto thirdLabelCell = workbook->GetCell(0, u"A12", ObjectExt::Box(u"Label 2 cell value")); series->get_Labels()->idx_get(0)->set_ValueFromCell(firstLabelCell); series->get_Labels()->idx_get(1)->set_ValueFromCell(secondLabelCell); series->get_Labels()->idx_get(2)->set_ValueFromCell(thirdLabelCell); presentation->Save(u"resultchart.pptx", Export::SaveFormat::Pptx); ``` ## **Manage Worksheets** The [IChartDataWorkbook::get_Worksheets](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdataworkbook/get_worksheets/) method provides access to the worksheets in a chart workbook. This example creates a pie chart with default data and prints each worksheet name to the console. ```cpp #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::Pie, 50, 50, 400, 500); auto workbook = chart->get_ChartData()->get_ChartDataWorkbook(); for (auto i = 0; i < workbook->get_Worksheets()->get_Count(); i++) { Console::WriteLine(workbook->get_Worksheets()->idx_get(i)->get_Name()); } ``` ## **Specify the Data Source Type** Series point values can also be stored directly as numeric literals. See [Set Series Values Using Numeric Literals](https://docs.aspose.com/slides/cpp/chart-series/#set-series-values-using-numeric-literals) for a complete example that saves and reads them. The source type of point values is separate from the chart's internal or external workbook configuration; using numeric literals does not, by itself, remove the embedded workbook. This example creates a 3D column chart with default data and sets two series names using different data sources. The first name uses a string literal; the second uses cell C1 on worksheet 0. The [DataSourceType](https://reference.aspose.com/slides/cpp/aspose.slides.charts/datasourcetype/) enumeration selects the source for each name. The example saves the presentation with the updated series names. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::Column3D, 50, 50, 600, 400, true); auto literalName = chart->get_ChartData()->get_Series()->idx_get(0)->get_Name(); literalName->set_DataSourceType(DataSourceType::StringLiterals); literalName->set_Data(ObjectExt::Box(u"LiteralString")); auto cellName = chart->get_ChartData()->get_Series()->idx_get(1)->get_Name(); auto nameCell = chart->get_ChartData()->get_ChartDataWorkbook()->GetCell(0, u"C1", ObjectExt::Box(u"NewCell")); cellName->set_DataSourceType(DataSourceType::Worksheet); cellName->set_Data(nameCell); presentation->Save(u"pres.pptx", Export::SaveFormat::Pptx); ``` ## **Detect Unsupported Embedded Workbook Formats** Aspose.Slides does not support the Excel binary workbook (.xlsb) format that can be embedded in some charts. You can use the [get_EmbeddedWorkbookType](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdata/get_embeddedworkbooktype/) method on [IChartData](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdata/) together with the [WorkbookType](https://reference.aspose.com/slides/cpp/aspose.slides.charts/workbooktype/) enumeration to detect unsupported formats and skip those charts. This example inspects the shapes on the first slide of an existing presentation, skips non-chart shapes, and prints a diagnostic message for each chart with an embedded .xlsb workbook. ```cpp #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace System; auto presentation = MakeObject(u"sample.pptx"); auto slide = presentation->get_Slide(0); for (auto shape : IterateOver(slide->get_Shapes())) { auto chart = AsCast(shape); if (chart == nullptr) { continue; } auto chartData = chart->get_ChartData(); auto isInternalWorkbook = chartData->get_DataSourceType() == ChartDataSourceType::InternalWorkbook; auto isBinaryMacro = chartData->get_EmbeddedWorkbookType() == WorkbookType::WorkbookBinaryMacro; if (isInternalWorkbook && isBinaryMacro) { Console::WriteLine(u"Skipping a chart with an unsupported .xlsb workbook."); continue; } // Read or modify supported chart workbook data here. } ``` ## **External Workbook** Aspose.Slides supports using external workbooks as a data source for charts. ### **Create an External Workbook** Use [ReadWorkbookStream](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdata/readworkbookstream/) and [SetExternalWorkbook](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdata/setexternalworkbook/) to export an embedded chart workbook to a file and link the chart to that external workbook. This example creates a pie chart with default data and exports its workbook. It closes the output stream before assigning the external workbook as the chart data source, then saves the linked presentation. ```cpp #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::Pie, 50, 50, 400, 600); auto workbookPath = IO::Path::GetFullPath(u"externalWorkbook1.xlsx"); auto workbookStream = chart->get_ChartData()->ReadWorkbookStream(); auto fileStream = IO::File::Create(workbookPath); workbookStream->CopyTo(fileStream); fileStream->Close(); chart->get_ChartData()->SetExternalWorkbook(workbookPath); presentation->Save(u"externalWorkbook.pptx", Export::SaveFormat::Pptx); ``` ### **Set an External Workbook** Using the [SetExternalWorkbook](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdata/setexternalworkbook/) method, you can assign an external workbook to a chart as its data source. This method can also be used to update a path to the external workbook (if the latter has been moved). While you cannot edit the data in workbooks stored in remote locations or resources, you can still use such workbooks as an external data source. If the relative path for an external workbook is provided, it gets converted to a full path automatically. This example uses an external workbook whose worksheet named `Sheet1` contains a series name in B1, category names in A2:A4, and numeric values in B2:B4. The example creates a pie chart, links the workbook, and uses [SetRange](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdata/setrange/) to map A1:B4 to one series and three categories. It saves the presentation with the linked chart. ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::Pie, 50, 50, 400, 600, true); auto chartData = chart->get_ChartData(); auto workbookPath = IO::Path::GetFullPath(u"externalWorkbook.xlsx"); chartData->SetExternalWorkbook(workbookPath); chartData->SetRange(u"Sheet1!$A$1:$B$4"); presentation->Save(u"Presentation_with_externalWorkbook.pptx", Export::SaveFormat::Pptx); ``` The `updateChartData` parameter of [SetExternalWorkbook](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdata/setexternalworkbook/) controls whether the workbook is loaded. * When `updateChartData` is `false`, only the workbook path is updated. The chart data is not loaded or updated from the target workbook, so the workbook can be unavailable. * When `updateChartData` is `true`, the chart data is updated from the target workbook. The following example assigns a placeholder URL with `updateChartData` set to `false`. It retains the pie chart's default data and saves the presentation without loading the unavailable workbook. ```cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::Pie, 50, 50, 400, 600, true); chart->get_ChartData()->SetExternalWorkbook(u"https://example.com/unavailable-workbook.xlsx", false); presentation->Save(u"SetExternalWorkbookWithUpdateChartData.pptx", Export::SaveFormat::Pptx); ``` ### **Get the External Data Source Workbook Path of a Chart** To identify the workbook linked to a chart, check whether the chart uses an external data source and retrieve its workbook path. This example inspects the first shape on the first slide of a presentation with a linked external workbook. If it is a chart linked to an external workbook, the example prints [get_ExternalWorkbookPath](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdata/get_externalworkbookpath/) to the console. It then saves a copy of the presentation. ```cpp #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace System; auto presentation = MakeObject(u"externalWorkbook.pptx"); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->get_Count() > 0 ? AsCast(slide->get_Shape(0)) : nullptr; if (chart != nullptr) { auto chartData = chart->get_ChartData(); if (chartData->get_DataSourceType() == ChartDataSourceType::ExternalWorkbook) { Console::WriteLine(chartData->get_ExternalWorkbookPath()); } else { Console::WriteLine(u"The chart does not use an external workbook."); } } else { Console::WriteLine(u"The first shape is not a chart."); } presentation->Save(u"Result.pptx", Export::SaveFormat::Pptx); ``` ### **Edit Chart Data** You can edit the data in external workbooks the same way you make changes to the contents of internal workbooks. When an external workbook cannot be loaded, an exception is thrown. This example uses a chart that is the first shape on the first slide and is linked to an accessible external workbook. It sets the cell-backed value of the first data point in the first series to 100 and saves the updated presentation. Editing cell values can update the linked external XLSX file, so use a copy if you need to preserve the original workbook. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace System; auto presentation = MakeObject(u"presentation.pptx"); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->get_Count() > 0 ? AsCast(slide->get_Shape(0)) : nullptr; if (chart != nullptr) { auto series = chart->get_ChartData()->get_Series(); if (series->get_Count() > 0 && series->idx_get(0)->get_DataPoints()->get_Count() > 0) { auto valueCell = series->idx_get(0)->get_DataPoints()->idx_get(0)->get_Value()->get_AsCell(); if (valueCell != nullptr) { valueCell->set_Value(ObjectExt::Box(100)); presentation->Save(u"presentation_out.pptx", Export::SaveFormat::Pptx); } else { Console::WriteLine(u"The first data point is not linked to a workbook cell."); } } else { Console::WriteLine(u"The chart has no data points to edit."); } } else { Console::WriteLine(u"The first shape is not a chart."); } ``` ### **Recover a Workbook from the Chart Cache** If a chart uses an external workbook that is missing or unavailable, Aspose.Slides can reconstruct the chart workbook from the data cached in the presentation. Create [LoadOptions](https://reference.aspose.com/slides/cpp/aspose.slides/loadoptions/), configure it with [set_SpreadsheetOptions](https://reference.aspose.com/slides/cpp/aspose.slides/loadoptions/set_spreadsheetoptions/), and call [ISpreadsheetOptions::set_RecoverWorkbookFromChartCache](https://reference.aspose.com/slides/cpp/aspose.slides/ispreadsheetoptions/set_recoverworkbookfromchartcache/) with `true` before opening the presentation. The following C++ example recovers workbook data for a chart that is the first shape on the first slide and references an unavailable external workbook. It accesses the recovered data through [IChart::get_ChartData](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichart/get_chartdata/) and [IChartData::get_ChartDataWorkbook](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdata/get_chartdataworkbook/): ```cpp #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace System; auto spreadsheetOptions = MakeObject(); spreadsheetOptions->set_RecoverWorkbookFromChartCache(true); auto loadOptions = MakeObject(); loadOptions->set_SpreadsheetOptions(spreadsheetOptions); auto presentation = MakeObject(u"presentation.pptx", loadOptions); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->get_Count() > 0 ? AsCast(slide->get_Shape(0)) : nullptr; if (chart != nullptr) { auto recoveredWorkbook = chart->get_ChartData()->get_ChartDataWorkbook(); // Read or modify the recovered workbook data here. } else { Console::WriteLine(u"The first shape is not a chart."); } ``` If the external workbook is unavailable and recovery is disabled, Aspose.Slides throws a [System::InvalidOperationException](https://reference.aspose.com/slides/cpp/system/details_invalidoperationexception/). Enable recovery only when using the cached chart data is an acceptable fallback, because the cache may not contain changes made to the external workbook after the presentation was last updated. ## **FAQ** **Can I determine whether a specific chart is linked to an external or an embedded workbook?** Yes. A chart has a [data source type](https://reference.aspose.com/slides/cpp/aspose.slides.charts/chartdata/get_datasourcetype/) and a [path to an external workbook](https://reference.aspose.com/slides/cpp/aspose.slides.charts/chartdata/get_externalworkbookpath/); if the source is an external workbook, you can read the full path to make sure an external file is being used. **Are relative paths to external workbooks supported, and how are they stored?** Yes. If you specify a relative path, it is automatically converted to an absolute path. The presentation stores the absolute path in the PPTX file, so moving the workbook may require updating the link. **Can I use workbooks located on network resources/shares?** Yes, such workbooks can be used as an external data source. However, editing remote workbooks directly from Aspose.Slides is not supported—they can only be used as a source. **Does Aspose.Slides overwrite the external XLSX when saving the presentation?** The presentation stores a [link to the external file](https://reference.aspose.com/slides/cpp/aspose.slides.charts/chartdata/get_externalworkbookpath/). Editing cell-backed chart data can also update the linked local XLSX file. Use a copy of the workbook if the original must remain unchanged. **What should I do if the external file is password-protected?** Aspose.Slides does not accept a password when linking. A common approach is to remove protection in advance or prepare a decrypted copy (for example, using [Aspose.Cells](https://reference.aspose.com/cells/cpp/)) and link to that copy. **Can multiple charts reference the same external workbook?** Yes. Each chart stores its own link. If they all point to the same file, updating that file will be reflected in each chart the next time the data is loaded. # Apply Chart Worksheet Formulas in Presentations Using C++ > Apply Excel-style formulas in Aspose.Slides for C++ chart worksheets, recalculate values, and use the results in PowerPoint charts. Source: https://docs.aspose.com/slides/cpp/chart-worksheet-formulas/ Updated: 2026-08-21 ## **Overview** PowerPoint charts usually store their source data in an embedded worksheet. In Aspose.Slides for C++, you can access that worksheet through the chart data workbook, write input values, assign formulas to cells, calculate supported formulas, and use the calculated cells as chart data. This article explains the complete formula workflow: create a chart, populate its worksheet, assign A1-style or R1C1-style formulas, recalculate them, read the calculated values, connect those cells to a chart series, and save the presentation. It also describes the supported formula syntax, the built-in function subset, cached values, unsupported formulas, and spreadsheet-specific errors. ## **Chart Worksheets and Formulas** A chart worksheet contains the categories, series names, and values used by a chart. In PowerPoint, you can inspect the worksheet by opening the chart data editor: ![PowerPoint chart with its embedded worksheet open, showing category and series data](https://docs.aspose.com/slides/cpp/chart-worksheet-formulas/chart-worksheet-formulas_1.png) In Aspose.Slides, the worksheet is exposed through the [IChartDataWorkbook](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdataworkbook/) interface. Use [IChartDataCell::set_Formula](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdatacell/set_formula/) for A1-style formulas and [IChartDataCell::set_R1C1Formula](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdatacell/set_r1c1formula/) for R1C1-style formulas. After changing input cells or formulas, call [IChartDataWorkbook::CalculateFormulas](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdataworkbook/calculateformulas/) to recalculate supported formulas and update the corresponding cell values. A calculated cell still exposes its result through [IChartDataCell::get_Value](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdatacell/get_value/). This is important when you need to inspect a formula result in code or use the cell as a chart data point. ## **Create a Chart and Calculate Worksheet Formulas** The following example demonstrates an end-to-end workflow. It creates a clustered column chart, clears the sample data, writes quarterly revenue and expense values, calculates profit with formulas, reads the results, uses the calculated cells as chart values, and saves the presentation. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::ClusteredColumn, 50.0f, 50.0f, 600.0f, 350.0f); auto chartData = chart->get_ChartData(); auto workbook = chartData->get_ChartDataWorkbook(); const int32_t worksheetIndex = 0; chartData->get_Series()->Clear(); chartData->get_Categories()->Clear(); workbook->Clear(worksheetIndex); auto category1 = workbook->GetCell(worksheetIndex, u"A2", ObjectExt::Box(u"Q1")); auto category2 = workbook->GetCell(worksheetIndex, u"A3", ObjectExt::Box(u"Q2")); auto category3 = workbook->GetCell(worksheetIndex, u"A4", ObjectExt::Box(u"Q3")); workbook->GetCell(worksheetIndex, u"B1", ObjectExt::Box(u"Revenue")); workbook->GetCell(worksheetIndex, u"C1", ObjectExt::Box(u"Expenses")); workbook->GetCell(worksheetIndex, u"D1", ObjectExt::Box(u"Profit")); workbook->GetCell(worksheetIndex, u"B2")->set_Value(ObjectExt::Box(120.0)); workbook->GetCell(worksheetIndex, u"C2")->set_Value(ObjectExt::Box(80.0)); workbook->GetCell(worksheetIndex, u"B3")->set_Value(ObjectExt::Box(150.0)); workbook->GetCell(worksheetIndex, u"C3")->set_Value(ObjectExt::Box(95.0)); workbook->GetCell(worksheetIndex, u"B4")->set_Value(ObjectExt::Box(135.0)); workbook->GetCell(worksheetIndex, u"C4")->set_Value(ObjectExt::Box(110.0)); auto profit1 = workbook->GetCell(worksheetIndex, u"D2"); auto profit2 = workbook->GetCell(worksheetIndex, u"D3"); auto profit3 = workbook->GetCell(worksheetIndex, u"D4"); profit1->set_Formula(u"B2-C2"); profit2->set_Formula(u"B3-C3"); profit3->set_Formula(u"B4-C4"); workbook->CalculateFormulas(); auto q1Profit = profit1->get_Value(); // 40 auto q2Profit = profit2->get_Value(); // 55 auto q3Profit = profit3->get_Value(); // 25 chartData->get_Categories()->Add(category1); chartData->get_Categories()->Add(category2); chartData->get_Categories()->Add(category3); auto profitSeries = chartData->get_Series()->Add(workbook->GetCell(worksheetIndex, u"D1"), chart->get_Type()); profitSeries->get_DataPoints()->AddDataPointForBarSeries(profit1); profitSeries->get_DataPoints()->AddDataPointForBarSeries(profit2); profitSeries->get_DataPoints()->AddDataPointForBarSeries(profit3); profitSeries->get_Labels()->get_DefaultDataLabelFormat()->set_ShowValue(true); presentation->Save(u"chart-formulas.pptx", SaveFormat::Pptx); ``` The chart data points reference `D2:D4`, so the chart uses the calculated profit values. There is no separate chart-refresh call in this workflow: recalculate the workbook first, then use or save the chart data that points to the calculated cells. ## **Use A1-Style Formulas** A1 notation identifies columns with letters and rows with numbers. Assign A1-style expressions through [IChartDataCell::set_Formula](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdatacell/set_formula/). ```cpp #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::ClusteredColumn, 50.0f, 50.0f, 500.0f, 300.0f); auto workbook = chart->get_ChartData()->get_ChartDataWorkbook(); workbook->GetCell(0, u"C3")->set_Value(ObjectExt::Box(10)); workbook->GetCell(0, u"F2")->set_Value(ObjectExt::Box(2)); workbook->GetCell(0, u"G2")->set_Value(ObjectExt::Box(3)); workbook->GetCell(0, u"H2")->set_Value(ObjectExt::Box(4)); auto cell = workbook->GetCell(0, u"A2"); cell->set_Formula(u"C3+SUM(F2:H2)"); workbook->CalculateFormulas(); auto value = cell->get_Value(); // 19 ``` Common A1 reference forms are: | Reference | Relative | Absolute | Mixed | |---|---|---|---| | Cell | `A2` | `$A$2` | `A$2`, `$A2` | | Row | `2:2` | `$2:$2` | — | | Column | `A:A` | `$A:$A` | — | | Range | `A2:C4` | `$A$2:$C$4` | `A$2:$C4`, `$A2:C$4` | Relative references can change when a formula is moved or copied by a spreadsheet application. Absolute references keep both coordinates fixed, while mixed references fix only a row or a column. ## **Use R1C1-Style Formulas** R1C1 notation identifies both rows and columns numerically. Relative references use offsets in square brackets. Assign this syntax through [IChartDataCell::set_R1C1Formula](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdatacell/set_r1c1formula/). ```cpp #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::ClusteredColumn, 50.0f, 50.0f, 500.0f, 300.0f); auto workbook = chart->get_ChartData()->get_ChartDataWorkbook(); workbook->GetCell(0, u"B2")->set_Value(ObjectExt::Box(12)); workbook->GetCell(0, u"C2")->set_Value(ObjectExt::Box(5)); auto cell = workbook->GetCell(0, u"D2"); cell->set_R1C1Formula(u"RC[-2]-RC[-1]"); workbook->CalculateFormulas(); auto value = cell->get_Value(); // 7 ``` Common R1C1 reference forms are: | Reference | Relative | Absolute | Mixed | |---|---|---|---| | Cell | `R[2]C[3]` | `R2C3` | `R2C[3]`, `R[2]C3` | | Row | `R[2]` | `R2` | — | | Column | `C[3]` | `C3` | — | | Range | `R[2]C[3]:R[5]C[7]` | `R2C3:R5C7` | `R2C3:R[5]C[7]`, `R[2]C3:R5C[7]` | For example, in cell `D2`, `RC[-2]` means the cell in the same row two columns to the left (`B2`). ## **Formula Constants and Operators** The built-in formula evaluator supports logical values, numeric literals, strings, spreadsheet error values, arithmetic operators, and comparison operators. ### **Constants and Literals** | Type | Examples | Notes | |---|---|---| | Logical | `TRUE`, `FALSE` | Can be used directly in logical expressions such as `A2=TRUE`. | | Numeric | `1`, `0.5`, `.3`, `1E-2` | Common and scientific notation are supported. | | String | `"abc"`, `"2/3/2020 12:00"` | Text literals are enclosed in double quotation marks inside the formula. | | Error result | `#DIV/0!`, `#N/A`, `#REF!` | A valid formula can evaluate to a spreadsheet error value instead of a normal result. | This example uses several constant types: ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::ClusteredColumn, 50.0f, 50.0f, 500.0f, 300.0f); auto workbook = chart->get_ChartData()->get_ChartDataWorkbook(); workbook->GetCell(0, u"A2")->set_Value(ObjectExt::Box(false)); workbook->GetCell(0, u"B2")->set_Formula(u"A2=TRUE"); workbook->GetCell(0, u"C2")->set_Formula(u"1+0.5"); workbook->GetCell(0, u"D2")->set_Formula(u".3*1E-2"); workbook->GetCell(0, u"E2")->set_Formula(u"\"abc\""); workbook->GetCell(0, u"F2")->set_Formula(u"2/0"); workbook->CalculateFormulas(); auto logicalValue = workbook->GetCell(0, u"B2")->get_Value(); // False auto numericValue = workbook->GetCell(0, u"C2")->get_Value(); // 1.5 auto scientificValue = workbook->GetCell(0, u"D2")->get_Value(); // 0.003 auto stringValue = workbook->GetCell(0, u"E2")->get_Value(); // abc auto errorValue = workbook->GetCell(0, u"F2")->get_Value(); // #DIV/0! ``` ### **Arithmetic Operators** | Operator | Meaning | Example | |---|---|---| | `+` | Addition or unary plus | `2+3` | | `-` | Subtraction or negation | `2-3`, `-3` | | `*` | Multiplication | `2*3` | | `/` | Division | `2/3` | | `%` | Percent | `30%` | | `^` | Exponentiation | `2^3` | Use parentheses to make evaluation order explicit, for example `(A2+B2)*C2`. ### **Comparison Operators** Comparison expressions return logical values. | Operator | Meaning | Example | |---|---|---| | `=` | Equal to | `A2=3` | | `<>` | Not equal to | `A2<>3` | | `>` | Greater than | `A2>3` | | `>=` | Greater than or equal to | `A2>=3` | | `<` | Less than | `A2<3` | | `<=` | Less than or equal to | `A2<=3` | ## **Supported Predefined Functions** Aspose.Slides includes a built-in formula evaluator for chart worksheets, but it is not a complete Excel calculation engine. The documented function set is limited to the functions below. Do not assume that an arbitrary Excel function can be recalculated by [IChartDataWorkbook::CalculateFormulas](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdataworkbook/calculateformulas/). | Function | Purpose or supported form | Example | |---|---|---| | `ABS` | Absolute value | `ABS(A2)` | | `AVERAGE` | Arithmetic mean | `AVERAGE(B2:B5)` | | `CEILING` | Round a number upward to a multiple | `CEILING(A2,5)` | | `CHOOSE` | Select a value by index | `CHOOSE(A2,"Low","High")` | | `CONCAT` | Join text values | `CONCAT(A2,B2)` | | `CONCATENATE` | Join text values | `CONCATENATE(A2," ",B2)` | | `DATE` | Create a date value using the 1900 date system | `DATE(2026,8,19)` | | `DAYS` | Return the number of days between dates | `DAYS(B2,A2)` | | `FIND` | Find one text value inside another | `FIND("-",A2)` | | `FINDB` | Byte-oriented text search | `FINDB("a",A2)` | | `IF` | Conditional result | `IF(A2>0,A2,0)` | | `INDEX` | Reference form | `INDEX(A2:C4,2,3)` | | `LOOKUP` | Vector form | `LOOKUP(A2,B2:B5,C2:C5)` | | `MATCH` | Vector form | `MATCH(A2,B2:B5,0)` | | `MAX` | Maximum value | `MAX(B2:B5)` | | `SUM` | Sum values | `SUM(B2:B5)` | | `VLOOKUP` | Vertical lookup | `VLOOKUP(A2,B2:D10,3,FALSE)` | The restrictions shown in the table are significant: `INDEX` is documented in reference form, while `LOOKUP` and `MATCH` are documented in their vector forms. `DATE` uses the 1900 date system. Features and functions not listed here should be treated as unsupported by the Aspose.Slides formula evaluator unless they are documented separately. ## **Calculate Formulas with a Preferred Culture** Some chart workbook functions interpret text according to culture-specific rules. This is especially important for functions intended for languages that use double-byte character sets (DBCS). To calculate such formulas correctly, create [LoadOptions](https://reference.aspose.com/slides/cpp/aspose.slides/loadoptions/), configure [ISpreadsheetOptions::set_PreferredCulture](https://reference.aspose.com/slides/cpp/aspose.slides/ispreadsheetoptions/set_preferredculture/) through [LoadOptions::set_SpreadsheetOptions](https://reference.aspose.com/slides/cpp/aspose.slides/loadoptions/set_spreadsheetoptions/), and then load the presentation. The following example selects the Japanese culture, opens a presentation with the configured load options, and calls [IChartDataWorkbook::CalculateFormulas](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdataworkbook/calculateformulas/) for every chart workbook: ```cpp #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace System; using namespace System::Globalization; auto japaneseCulture = CultureInfo::GetCultureInfo(u"ja-JP"); auto spreadsheetOptions = MakeObject(); spreadsheetOptions->set_PreferredCulture(japaneseCulture); auto loadOptions = MakeObject(); loadOptions->set_SpreadsheetOptions(spreadsheetOptions); auto presentation = MakeObject(u"presentation.pptx", loadOptions); for (int32_t slideIndex = 0; slideIndex < presentation->get_Slides()->get_Count(); slideIndex++) { auto slide = presentation->get_Slide(slideIndex); for (int32_t shapeIndex = 0; shapeIndex < slide->get_Shapes()->get_Count(); shapeIndex++) { auto shape = slide->get_Shape(shapeIndex); if (ObjectExt::Is(shape)) { auto chart = ExplicitCast(shape); chart->get_ChartData()->get_ChartDataWorkbook()->CalculateFormulas(); } } } ``` The preferred culture is part of the presentation loading configuration, so specify it before creating the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) instance. Use the culture expected by the workbook formulas; for example, use `ja-JP` for formulas that should follow Japanese DBCS calculation rules. ## **Recalculation and Cached Values** Spreadsheet files commonly store both a formula and its last calculated value. Aspose.Slides can therefore read a cached value from [IChartDataCell::get_Value](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdatacell/get_value/) when a presentation is loaded and the relevant chart data has not been changed. After changing input cells or formulas, do not rely on an old cached result. Call [IChartDataWorkbook::CalculateFormulas](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdataworkbook/calculateformulas/) before reading calculated values or saving chart data that depends on them. For formulas outside the supported subset, Aspose.Slides may be unable to parse the formula or establish its dependencies. If the workbook has been modified, the previous cached value can no longer be considered reliable. In that situation, reading the value of a cell with unsupported data can raise [CellUnsupportedDataException](https://reference.aspose.com/slides/cpp/aspose.slides.spreadsheet/cellunsupporteddataexception/). If your chart depends on Excel functions that Aspose.Slides does not evaluate, calculate those formulas with a spreadsheet engine that supports them and write the resulting values back to the chart workbook. Do not replace unsupported formulas with guessed values. ## **Handle Formula Errors** There are two different kinds of problems to distinguish. A formula can be valid but produce a spreadsheet error result such as `#DIV/0!`, `#N/A`, `#NAME?`, `#NULL!`, `#NUM!`, `#REF!`, or `#VALUE!`. In this case, the error token is a cell result and can be returned through [IChartDataCell::get_Value](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdatacell/get_value/). A formula can also fail at the parsing, reference, dependency, or supported-data level. Aspose.Slides provides spreadsheet-specific exceptions for these cases: [CellInvalidFormulaException](https://reference.aspose.com/slides/cpp/aspose.slides.spreadsheet/cellinvalidformulaexception/), [CellInvalidReferenceException](https://reference.aspose.com/slides/cpp/aspose.slides.spreadsheet/cellinvalidreferenceexception/), [CellCircularReferenceException](https://reference.aspose.com/slides/cpp/aspose.slides.spreadsheet/cellcircularreferenceexception/), and [CellUnsupportedDataException](https://reference.aspose.com/slides/cpp/aspose.slides.spreadsheet/cellunsupporteddataexception/). When formulas come from templates or user input, handle these exceptions around recalculation and value access: ```cpp #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Spreadsheet; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::ClusteredColumn, 50.0f, 50.0f, 500.0f, 300.0f); auto workbook = chart->get_ChartData()->get_ChartDataWorkbook(); auto cell = workbook->GetCell(0, u"A2"); cell->set_Formula(u"SUM(B2:B5)"); try { workbook->CalculateFormulas(); auto value = cell->get_Value(); } catch (CellInvalidFormulaException&) { // Handle an invalid formula. } catch (CellInvalidReferenceException&) { // Handle an invalid cell reference. } catch (CellCircularReferenceException&) { // Handle a circular reference. } catch (CellUnsupportedDataException&) { // Handle unsupported spreadsheet data. } ``` ## **Practical Limitations** The formula support in chart worksheets is intended for a defined subset of spreadsheet calculations, not for full Excel compatibility. Keep these constraints in mind when designing a reporting workflow: - Use only the documented constants, operators, references, and functions when you need Aspose.Slides to recalculate formulas. - Recalculate after changing cells that formula results depend on. - Treat cached values from loaded presentations as snapshots, not as a replacement for recalculation after edits. - Test formulas from existing templates before relying on their calculated values, especially when they use functions outside the documented list. - For formulas that require a full spreadsheet calculation engine, calculate them externally and then update the chart workbook with the resulting values. ## **FAQ** **What is the difference between `set_Formula` and `set_R1C1Formula`?** [IChartDataCell::set_Formula](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdatacell/set_formula/) stores an A1-style expression such as `B2-C2`. [IChartDataCell::set_R1C1Formula](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdatacell/set_r1c1formula/) stores an R1C1-style expression such as `RC[-2]-RC[-1]`. Use the notation that best matches how you generate or copy formulas. **Do I need to read the cell itself or its value after calculation?** [IChartDataWorkbook::GetCell](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdataworkbook/getcell/) returns an `IChartDataCell`. To obtain the calculated result, read that cell's [IChartDataCell::get_Value](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdatacell/get_value/) value after recalculation. **When should I call `CalculateFormulas`?** Call [IChartDataWorkbook::CalculateFormulas](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdataworkbook/calculateformulas/) after changing input values or formulas and before you depend on the calculated results. This updates the values of formulas that the built-in evaluator supports. **Does Aspose.Slides support every Excel function?** No. The built-in evaluator supports a documented subset of functions. Functions outside that subset should not be assumed to recalculate correctly. If full Excel formula compatibility is required, perform the calculation with an appropriate spreadsheet engine and write the final values to the chart workbook. **What happens if a loaded presentation contains an unsupported formula?** If the chart data has not changed, the workbook may still contain a previously calculated cached value. After related data is modified, that cached value may no longer be valid. Accessing a cell whose formula cannot be handled can raise [CellUnsupportedDataException](https://reference.aspose.com/slides/cpp/aspose.slides.spreadsheet/cellunsupporteddataexception/). **Are formula error values the same as C++ exceptions?** No. A result such as `#DIV/0!` is a spreadsheet value produced by a valid calculation. Exceptions such as [CellInvalidFormulaException](https://reference.aspose.com/slides/cpp/aspose.slides.spreadsheet/cellinvalidformulaexception/) or [CellCircularReferenceException](https://reference.aspose.com/slides/cpp/aspose.slides.spreadsheet/cellcircularreferenceexception/) indicate that the formula cannot be processed normally. **Does a chart update automatically when a formula cell changes?** A chart series can reference workbook cells. Recalculate the workbook first, then save or render the presentation. If the chart data points reference the calculated cells, the chart uses those updated cell values; no separate chart-refresh method is required for this workflow. **Can charts use an external Excel workbook?** Yes, chart data can be configured to use an external workbook through the chart data API. However, the formula calculation workflow described in this article concerns the chart data workbook and the formula subset evaluated by Aspose.Slides. Do not assume that [IChartDataWorkbook::CalculateFormulas](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdataworkbook/calculateformulas/) provides full recalculation of arbitrary formulas in an external XLSX file. **Can I use formulas that reference another worksheet or workbook?** Excel-style references may exist in chart workbooks, but formula evaluation is limited by the supported parser and function set. If a cross-sheet or external reference is essential, validate that exact formula with your target Aspose.Slides version. For workflows that require broad Excel reference compatibility, calculate the workbook externally and write the resolved values back to the chart data. **Should formula strings start with `=`?** The Aspose.Slides API examples assign expressions such as `B2-C2` or `SUM(B2:B5)` without a leading `=`. Using that form keeps generated formulas consistent with the documented API examples. # Clone Presentation Slides in C++ > Quickly duplicate PowerPoint slides with Aspose.Slides for C++. Follow our clear code examples to automate PPT creation in seconds and eliminate manual work. Source: https://docs.aspose.com/slides/cpp/clone-slides/ Updated: 2026-10-26 ## **Introduction** Cloning is the process of making an exact copy or replica of something. Aspose.Slides for C++ also makes it possible to make a copy or clone of any slide and then insert that cloned slide to the current or any other opened presentation. The process of slide cloning creates a new slide that can be modified by developers without changing the original slide. There are several possible ways to clone a slide: - Clone at End within a Presentation. - Clone at Another Position with in Presentation. - Clone at End in another Presentation. - Clone at Another Position in another Presentation. - Clone at specific position in another Presentation. In Aspose.Slides for C++, (a collection of [ISlide](https://reference.aspose.com/slides/cpp/aspose.slides/islide/) objects) exposed by the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) object provides the [AddClone](https://reference.aspose.com/slides/cpp/aspose.slides/islidecollection/addclone/) and [InsertClone](https://reference.aspose.com/slides/cpp/aspose.slides/islidecollection/insertclone/) methods to perform the above types of slide cloning ## **Clone a Slide at the End of a Presentation** If you want to clone a slide and then use it within the same presentation file at the end of the existing slides, use the [AddClone](https://reference.aspose.com/slides/cpp/aspose.slides/islidecollection/addclone/) method according to the steps listed below: 1. Create an instance of the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) class. 1. Instantiate the [ISlideCollection](https://reference.aspose.com/slides/cpp/aspose.slides/islidecollection/) class by referencing the Slides collection exposed by the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) object. 1. Call the [AddClone](https://reference.aspose.com/slides/cpp/aspose.slides/islidecollection/addclone/) method exposed by the [ISlideCollection](https://reference.aspose.com/slides/cpp/aspose.slides/islidecollection/) object and pass the slide to be cloned as a parameter to the [AddClone](https://reference.aspose.com/slides/cpp/aspose.slides/islidecollection/addclone/) method. 1. Write the modified presentation file. In the example given below, we have cloned a slide (lying at the first position – zero index – of the presentation) to the end of the presentation. ```cpp For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C // The path to the documents directory. const String templatePath = u"../templates/AddSlides.pptx"; const String outPath = u"../out/CloneWithinSamePresentationToEnd.pptx"; // Instantiate Presentation class SharedPtr pres = MakeObject(templatePath); // Accessing Slide by ID from collection SharedPtr slides = pres->get_Slides(); // Clone the desired slide at end of same presentation slides->AddClone(pres->get_Slides()->idx_get(0)); // Writing the presentation file pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx); ``` [Source: Examples-SlidesCPP-CloneWithinSamePresentationToEnd-CloneWithinSamePresentationToEnd.cpp](https://gist.githubusercontent.com/aspose-slides/a690df625dc0b1fff869ab198affe7a4/raw/bbd2df92211f444202171cb215d4bda28ed9678f/Examples-SlidesCPP-CloneWithinSamePresentationToEnd-CloneWithinSamePresentationToEnd.cpp) ## **Clone a Slide to Another Position within a Presentation** in Presentation** If you want to clone a slide and then use it within the same presentation file but at a different position, use the [InsertClone](https://reference.aspose.com/slides/cpp/aspose.slides/islidecollection/insertclone/) method: 1. Create an instance of the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) class. 1. Instantiate the class by referencing the **Slides** collection exposed by the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) object. 1. Call the [InsertClone](https://reference.aspose.com/slides/cpp/aspose.slides/islidecollection/insertclone/) method exposed by the [ISlideCollection](https://reference.aspose.com/slides/cpp/aspose.slides/islidecollection/) object and pass the slide to be cloned along with the index for the new position as a parameter to the [InsertClone](https://reference.aspose.com/slides/cpp/aspose.slides/islidecollection/insertclone/) method. 1. Write the modified presentation as a PPTX file. In the example given below, we have cloned a slide (lying at the zero index – position 1 – of the presentation) to index 1 – Position 2 – of the presentation. ```cpp For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C // The path to the documents directory. const String templatePath = u"../templates/AddSlides.pptx"; const String outPath = u"../out/CloneWithInSamePresentation.pptx"; // Instantiate Presentation class SharedPtr pres = MakeObject(templatePath); // Accessing Slide by ID from collection SharedPtr slides = pres->get_Slides(); // Clone the desired slide to the specified index in the same presentation slides->InsertClone(2, pres->get_Slides()->idx_get(0)); // Writing the presentation file pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx); ``` [Source: Examples-SlidesCPP-CloneWithInSamePresentation-CloneWithInSamePresentation.cpp](https://gist.githubusercontent.com/aspose-slides/a690df625dc0b1fff869ab198affe7a4/raw/8934ab57a79a93788f696785014462ab06ec7ccd/Examples-SlidesCPP-CloneWithInSamePresentation-CloneWithInSamePresentation.cpp) ## **Clone a Slide at the End of Another Presentation** If you need to clone a slide from one presentation and use it in another presentation file, at the end of the existing slides: 1. Create an instance of the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) class containing the presentation the slide will be cloned from. 1. Create an instance of the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) class containing the destination presentation that the slide will be added to. 1. Instantiate the [ISlideCollection](https://reference.aspose.com/slides/cpp/aspose.slides/islidecollection/) class by referencing the **Slides** collection exposed by the Presentation object of the destination presentation. 1. Call the [AddClone](https://reference.aspose.com/slides/cpp/aspose.slides/islidecollection/addclone/) method exposed by the [ISlideCollection](https://reference.aspose.com/slides/cpp/aspose.slides/islidecollection/) object and pass the slide from the source presentation as a parameter to the [AddClone](https://reference.aspose.com/slides/cpp/aspose.slides/islidecollection/addclone/) method. 1. Write the modified destination presentation file. In the example given below, we have cloned a slide (from the first index of the source presentation) to the end of the destination presentation. ```cpp For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C // The path to the documents directory. const String templatePath = u"../templates/AddSlides.pptx"; const String outPath = u"../out/CloneAtEndOfAnotherPresentation.pptx"; // Instantiate Presentation class SharedPtr pres = MakeObject(templatePath); //Instantiate target presentation object SharedPtr destPres = MakeObject(); // Accessing Slide by ID from collection SharedPtr slideCollection = destPres->get_Slides(); // Clone the desired slide at end of other presentation slideCollection->AddClone(pres->get_Slides()->idx_get(0)); // Writing the presentation file destPres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx); ``` [Source: Examples-SlidesCPP-CloneAtEndOfAnotherPresentation-CloneAtEndOfAnotherPresentation.cpp](https://gist.githubusercontent.com/aspose-slides/a690df625dc0b1fff869ab198affe7a4/raw/b77ef80e8599b65d7539f7babc24bce4ec4a1ccc/Examples-SlidesCPP-CloneAtEndOfAnotherPresentation-CloneAtEndOfAnotherPresentation.cpp) ## **Clone a Slide to Another Position in Another Presentation** If you need to clone a slide from one presentation and use it in another presentation file, at a specific position: 1. Create an instance of the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) class containing the source presentation the slide will be cloned from. 1. Create an instance of the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) class containing the presentation the slide will be added to. 1. Instantiate the [ISlideCollection](https://reference.aspose.com/slides/cpp/aspose.slides/islidecollection/) class by referencing the Slides collection exposed by the Presentation object of the destination presentation. 1. Call the [InsertClone](https://reference.aspose.com/slides/cpp/aspose.slides/islidecollection/insertclone/) method exposed by the [ISlideCollection](https://reference.aspose.com/slides/cpp/aspose.slides/islidecollection/) object and pass the slide from the source presentation along with the desired position as parameter to the [InsertClone](https://reference.aspose.com/slides/cpp/aspose.slides/islidecollection/insertclone/) method. 1. Write the modified destination presentation file. In the example given below, we have cloned a slide (from the zero index of the source presentation) to index 1 (position 2) of the destination presentation. ```cpp For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C // The path to the documents directory. const String templatePath = u"../templates/AddSlides.pptx"; const String outPath = u"../out/CloneAtEndOfAnotherPresentation.pptx"; // Instantiate Presentation class SharedPtr pres = MakeObject(templatePath); //Instantiate target presentation object SharedPtr destPres = MakeObject(); // Accessing Slide by ID from collection SharedPtr slideCollection = destPres->get_Slides(); // Clone the desired slide at end of other presentation slideCollection->AddClone(pres->get_Slides()->idx_get(0)); // Writing the presentation file destPres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx); ``` [Source: Examples-SlidesCPP-CloneAtEndOfAnotherPresentation-CloneAtEndOfAnotherPresentation.cpp](https://gist.githubusercontent.com/aspose-slides/a690df625dc0b1fff869ab198affe7a4/raw/b77ef80e8599b65d7539f7babc24bce4ec4a1ccc/Examples-SlidesCPP-CloneAtEndOfAnotherPresentation-CloneAtEndOfAnotherPresentation.cpp) ## **Clone a Slide at a Specific Position in Another Presentation** If you need to clone a slide with master slide from one presentation from and use it in another presentation , you need to clone the desired master slide from source presentation to destination presentation first. Then you need to use that master slide for cloning slide with master slide. The **AddClone(ISlide, IMasterSlide)** expects master slide from destination presentation rather than from source presentation. In order to clone the slide with master, please follow the steps below: 1. Create an instance of the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) class containing the source presentation the slide will be cloned from. 1. Create an instance of the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) class containing the destination presentation the slide will be cloned to. 1. Access the slide to be cloned along with the master slide. 1. Instantiate the [IMasterSlideCollection](https://reference.aspose.com/slides/cpp/aspose.slides/imasterslidecollection/) class by referencing the Masters collection exposed by the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) object of the destination presentation. 1. Call the [AddClone](https://reference.aspose.com/slides/cpp/aspose.slides/islidecollection/addclone/) method exposed by the [IMasterSlideCollection](https://reference.aspose.com/slides/cpp/aspose.slides/imasterslidecollection/) object and pass the master from the source PPTX to be cloned as parameter to the [AddClone](https://reference.aspose.com/slides/cpp/aspose.slides/islidecollection/addclone/) method. 1. Instantiate the [ISlideCollection](https://reference.aspose.com/slides/cpp/aspose.slides/islidecollection/) class by setting the reference to the Slides collection exposed by the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) object of the destination presentation. 1. Call the [AddClone](https://reference.aspose.com/slides/cpp/aspose.slides/islidecollection/addclone/) method exposed by the [ISlideCollection](https://reference.aspose.com/slides/cpp/aspose.slides/islidecollection/) object and pass the slide from the source presentation to be cloned and master slide as parameter to the [AddClone](https://reference.aspose.com/slides/cpp/aspose.slides/islidecollection/addclone/) method. 1. Write the modified destination presentation file. In the example given below, we have cloned a slide with master (lying at the zero index of the source presentation) to the end of the destination presentation using master from source slide. ```cpp For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C // The path to the documents directory. const String templatePath = u"../templates/AddSlides.pptx"; const String outPath = u"../out/CloneToAnotherPresentationWithMaster.pptx"; // Instantiate Presentation class SharedPtr pres = MakeObject(templatePath); //Instantiate target presentation object SharedPtr destPres = MakeObject(); // Accessing Slide by ID from collection SharedPtr slideCollection = destPres->get_Slides(); // Instantiate ISlide from the collection of slides in source presentation along with // Master slide SharedPtr SourceSlide = pres->get_Slides()->idx_get(0); SharedPtr SourceMaster = SourceSlide->get_LayoutSlide()->get_MasterSlide(); // Clone the desired master slide from the source presentation to the collection of masters in the // Destination presentation SharedPtr masters = destPres->get_Masters(); SharedPtr DestMaster = SourceSlide->get_LayoutSlide()->get_MasterSlide(); // Clone the desired master slide from the source presentation to the collection of masters in the // Destination presentation SharedPtr iSlide = masters->AddClone(SourceMaster); // Clone the desired slide from the source presentation with the desired master to the end of the // Collection of slides in the destination presentation slideCollection->AddClone(SourceSlide, iSlide, true); // Clone the desired slide at end of other presentation slideCollection->InsertClone(1, pres->get_Slides()->idx_get(0)); // Writing the presentation file destPres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx); ``` [Source: Examples-SlidesCPP-CloneToAnotherPresentationWithMaster-CloneToAnotherPresentationWithMaster.cpp](https://gist.githubusercontent.com/aspose-slides/a690df625dc0b1fff869ab198affe7a4/raw/821bafe68070eb23422778df60ca2333e59bb848/Examples-SlidesCPP-CloneToAnotherPresentationWithMaster-CloneToAnotherPresentationWithMaster.cpp) ## **Clone a Slide at the End of a Specified Section** If you want to clone a slide and then use it within the same presentation file but at a different section, then use the [**AddClone()**](https://reference.aspose.com/slides/cpp/aspose.slides/islidecollection/addclone/) method exposed by the [**ISlideCollection** ](https://reference.aspose.com/slides/cpp/aspose.slides/islidecollection/)interface. Aspose.Slides for C++ makes it possible to clone a slide from the first section and then insert that cloned slide to the second section of the same presentation. The following code snippet shows you how to clone a slide and insert the cloned slide into a specified section. ```cpp const String outPath = u"../out/CloneSlideIntoSpecifiedSection.pptx"; auto presentation = MakeObject(); presentation->get_Slides()->idx_get(0)->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 200.0f, 50.0f, 300.0f, 100.0f); presentation->get_Sections()->AddSection(u"Section 1", presentation->get_Slides()->idx_get(0)); auto section2 = presentation->get_Sections()->AppendEmptySection(u"Section 2"); presentation->get_Slides()->AddClone(presentation->get_Slides()->idx_get(0), section2); presentation->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx); ``` [Source: Examples-SlidesCPP-CloneSlideIntoSpecifiedSection-CloneSlideIntoSpecifiedSection.cpp](https://gist.githubusercontent.com/aspose-com-gists/81aeb05e6d3a070aa76fdea22ed53bc7/raw/22444f4dbd696bba25a83a45c81742f6b28135c2/Examples-SlidesCPP-CloneSlideIntoSpecifiedSection-CloneSlideIntoSpecifiedSection.cpp) ## **Ensure Matching Slide Size** When cloning slides into another presentation, make sure the destination presentation has the same slide size as the source. If the slide sizes differ, Aspose.Slides does not automatically rescale the cloned shapes—their original coordinates and dimensions are preserved, which may cause the content to appear misaligned or extend beyond the slide boundaries. You can set the destination presentation's slide size to match the source before cloning the master and slide: ```cpp auto sourceSize = sourcePresentation->get_SlideSize()->get_Size(); targetPresentation->get_SlideSize()->SetSize( sourceSize.get_Width(), sourceSize.get_Height(), SlideSizeScaleType::DoNotScale); ``` Do this before cloning the master and the slide. ## **FAQ** **Do speaker notes and reviewer comments get cloned?** Yes. The notes page and review comments are included in the clone. If you don’t want them, [remove them](https://docs.aspose.com/slides/cpp/presentation-notes/) after insertion. **How are charts and their data sources handled?** The chart object, formatting, and embedded data are copied. If the chart was linked to an external source (e.g., an OLE-embedded workbook), that linkage is preserved as an [OLE object](https://docs.aspose.com/slides/cpp/manage-ole/). After moving between files, verify data availability and refresh behavior. **Can I control the insertion position and sections for the clone?** Yes. You can insert the clone at a specific slide index and place it into a chosen [section](https://docs.aspose.com/slides/cpp/slide-section/). If the target section doesn’t exist, create it first and then move the slide into it. Related feature: [Clone slides between presentations](https://docs.aspose.com/slides/features/clone-slides/). # Compare Presentation Slides in C++ > Compare PowerPoint and OpenDocument presentations programmatically with Aspose.Slides for C++. Identify slide differences in code quickly. Source: https://docs.aspose.com/slides/cpp/compare-slides/ Updated: 2026-08-02 ## **Overview** Aspose.Slides allows you to compare slides, layout slides, and master slides using the `Equals` method provided by the `IBaseSlide` interface and the `BaseSlide` class. This method returns `true` when the compared slides are identical in their structure and static content. ## **Compare Two Slides** Equals method has been added to IBaseSlide interface and BaseSlide class. It returns true for the slides / layout slides / master slides which identical by its structure and static content. Two slides are equal if all shapes, styles, texts, animation and other settings. etc. The comparison doesn't take into account unique identifier values, e.g. SlideId and dynamic content, e.g. current date value in Date Placeholder. ```cpp For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C // The path to the documents directory. const String templatePath1 = u"../templates/AccessSlides.pptx"; const String templatePath2 = u"../templates/HelloWorld.pptx"; // Instantiate Presentation class SharedPtr presentation1 = MakeObject(templatePath1); SharedPtr presentation2 = MakeObject(templatePath2); for (int i = 0; i < presentation1->get_Masters()->get_Count(); i++) { for (int j = 0; j get_Masters()->get_Count(); j++) { if (presentation1->get_Masters()->idx_get(i)->Equals(presentation2->get_Masters()->idx_get(j))) printf("SomePresentation1 MasterSlide# %d is equal to SomePresentation2 MasterSlide #%d : %d\n",i,j); } } ``` [Source: Examples-SlidesCPP-CheckSlidesComparison-CheckSlidesComparison.cpp](https://gist.githubusercontent.com/aspose-slides/a690df625dc0b1fff869ab198affe7a4/raw/2d525acf5241d014e9b49d7eb28960511d198c4b/Examples-SlidesCPP-CheckSlidesComparison-CheckSlidesComparison.cpp) ## **FAQ** ### Does the fact that a slide is hidden affect the comparison of the slides themselves? [Hidden status](https://reference.aspose.com/slides/cpp/aspose.slides/slide/get_hidden/) is a presentation/playback-level property, not visual content. The equality of two specific slides is determined by their structure and static content; the mere fact that a slide is hidden does not make the slides different. ### Are hyperlinks and their parameters taken into account? Yes. Links are part of a slide’s static content. If the URL or the hyperlink action differs, this is usually treated as a difference in static content. ### If a chart refers to an external Excel file, will the contents of that file be taken into account? No. The comparison is performed based on the slides themselves. External data sources are generally not read at comparison time; only what is present in the slide’s structure and static state is considered. # Manage Connectors in Presentations Using C++ > Learn how to add, attach, reroute, adjust, and inspect straight, bent, and curved PowerPoint connectors with Aspose.Slides for C++. Source: https://docs.aspose.com/slides/cpp/connector/ Updated: 2026-08-27 ## **Overview** A connector is a line that can remain attached to two shapes when either shape moves. Its ends attach to connection sites, represented by green dots in PowerPoint. Some bent and curved connectors also expose adjustment points, represented by orange dots, that control the position of individual connector segments. Aspose.Slides represents connectors through the [IConnector](https://reference.aspose.com/slides/cpp/aspose.slides/iconnector/) interface. You can create them, attach their ends to shapes, choose connection sites, reroute them, and modify the geometry of connectors that have adjustment points. ## **Connector Types** The [ShapeType](https://reference.aspose.com/slides/cpp/aspose.slides/shapetype/) enumeration includes straight, bent, and curved connector presets. The following table shows the available connector geometries and the number of adjustment points defined by each preset. | Connector | Image | Number of adjustment points | |---|---|---| | `ShapeType::Line` | ![shapetype-lineconnector](https://docs.aspose.com/slides/cpp/connector/shapetype-lineconnector.png) | 0 | | `ShapeType::StraightConnector1` | ![shapetype-straightconnector1](https://docs.aspose.com/slides/cpp/connector/shapetype-straightconnector1.png) | 0 | | `ShapeType::BentConnector2` | ![shapetype-bent-connector2](https://docs.aspose.com/slides/cpp/connector/shapetype-bent-connector2.png) | 0 | | `ShapeType::BentConnector3` | ![shapetype-bentconnector3](https://docs.aspose.com/slides/cpp/connector/shapetype-bentconnector3.png) | 1 | | `ShapeType::BentConnector4` | ![shapetype-bentconnector4](https://docs.aspose.com/slides/cpp/connector/shapetype-bentconnector4.png) | 2 | | `ShapeType::BentConnector5` | ![shapetype-bentconnector5](https://docs.aspose.com/slides/cpp/connector/shapetype-bentconnector5.png) | 3 | | `ShapeType::CurvedConnector2` | ![shapetype-curvedconnector2](https://docs.aspose.com/slides/cpp/connector/shapetype-curvedconnector2.png) | 0 | | `ShapeType::CurvedConnector3` | ![shapetype-curvedconnector3](https://docs.aspose.com/slides/cpp/connector/shapetype-curvedconnector3.png) | 1 | | `ShapeType::CurvedConnector4` | ![shapetype-curvedconnector4](https://docs.aspose.com/slides/cpp/connector/shapetype-curvedconnector4.png) | 2 | | `ShapeType::CurvedConnector5` | ![shapetype.curvedconnector5](https://docs.aspose.com/slides/cpp/connector/shapetype.curvedconnector5.png) | 3 | The number and meaning of adjustment points are part of the selected connector preset. Do not assume that two different connector types expose the same collection layout. ## **Connect Two Shapes** Use [IShapeCollection::AddConnector](https://reference.aspose.com/slides/cpp/aspose.slides/ishapecollection/addconnector/) to add a connector, and call [IConnector::set_StartShapeConnectedTo](https://reference.aspose.com/slides/cpp/aspose.slides/iconnector/set_startshapeconnectedto/) and [IConnector::set_EndShapeConnectedTo](https://reference.aspose.com/slides/cpp/aspose.slides/iconnector/set_endshapeconnectedto/) to attach its ends. After both ends are attached, [IConnector::Reroute](https://reference.aspose.com/slides/cpp/aspose.slides/iconnector/reroute/) selects a short route between the shapes. The following example connects an ellipse and a rectangle with a bent connector: ```cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; System::SharedPtr presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto shapes = slide->get_Shapes(); auto ellipse = shapes->AddAutoShape(ShapeType::Ellipse, 40, 80, 120, 80); auto rectangle = shapes->AddAutoShape(ShapeType::Rectangle, 320, 240, 140, 80); auto connector = shapes->AddConnector(ShapeType::BentConnector2, 0, 0, 10, 10); connector->set_StartShapeConnectedTo(ellipse); connector->set_EndShapeConnectedTo(rectangle); connector->Reroute(); presentation->Save(u"connected-shapes.pptx", SaveFormat::Pptx); ``` Calling `IConnector::Reroute` can change the [IConnector::set_StartShapeConnectionSiteIndex](https://reference.aspose.com/slides/cpp/aspose.slides/iconnector/set_startshapeconnectionsiteindex/) and [IConnector::set_EndShapeConnectionSiteIndex](https://reference.aspose.com/slides/cpp/aspose.slides/iconnector/set_endshapeconnectionsiteindex/) values. Assign specific connection sites after rerouting if those sites must remain fixed. ## **Choose a Connection Site** Each connectable shape reports its number of sites through [IShape::get_ConnectionSiteCount](https://reference.aspose.com/slides/cpp/aspose.slides/ishape/get_connectionsitecount/). Validate a preferred zero-based site index before assigning it to a connector end; site counts vary by shape geometry. This example attaches the connector to a particular site on the ellipse when that site exists: ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto shapes = slide->get_Shapes(); auto ellipse = shapes->AddAutoShape(ShapeType::Ellipse, 40, 80, 120, 80); auto rectangle = shapes->AddAutoShape(ShapeType::Rectangle, 320, 240, 140, 80); auto connector = shapes->AddConnector(ShapeType::BentConnector3, 0, 0, 10, 10); connector->set_StartShapeConnectedTo(ellipse); connector->set_EndShapeConnectedTo(rectangle); int32_t preferredSiteIndex = 2; if (preferredSiteIndex < ellipse->get_ConnectionSiteCount()) { connector->set_StartShapeConnectionSiteIndex(preferredSiteIndex); } else { Console::WriteLine(u"The ellipse has only {0} connection sites.", ellipse->get_ConnectionSiteCount()); } presentation->Save(u"specific-connection-site.pptx", SaveFormat::Pptx); ``` ## **Adjust a Connector Point** Connectors with adjustment points expose them through [IGeometryShape::get_Adjustments](https://reference.aspose.com/slides/cpp/aspose.slides/igeometryshape/get_adjustments/). Inspect every [IAdjustValue](https://reference.aspose.com/slides/cpp/aspose.slides/iadjustvalue/) and check its [IAdjustValue::get_Type](https://reference.aspose.com/slides/cpp/aspose.slides/iadjustvalue/get_type/) before changing its [IAdjustValue::set_RawValue](https://reference.aspose.com/slides/cpp/aspose.slides/iadjustvalue/set_rawvalue/). The general rules for identifying preset shape adjustments are described in [Shape Manipulation](https://docs.aspose.com/slides/cpp/shape-manipulations/). The number, order, meaning, and valid value range of connector adjustments depend on the connector preset. The type returned by `IAdjustValue::get_Type` is read-only, while the raw adjustment value is writable. The read-only [IAdjustValue::get_Name](https://reference.aspose.com/slides/cpp/aspose.slides/iadjustvalue/get_name/) method provides additional identification when a connector contains more than one adjustment of the same semantic type. ### **Route Around an Obstacle** In the following layout, a `ShapeType::BentConnector5` connector between two shapes passes through a third shape: ![connector-obstruction](https://docs.aspose.com/slides/cpp/connector/connector-obstruction.png) This code creates the obstructed connector: ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System::Drawing; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto shapes = slide->get_Shapes(); shapes->AddAutoShape(ShapeType::Rectangle, 300, 150, 150, 75); auto sourceShape = shapes->AddAutoShape(ShapeType::Rectangle, 500, 400, 100, 50); auto targetShape = shapes->AddAutoShape(ShapeType::Rectangle, 100, 100, 70, 30); auto connector = shapes->AddConnector(ShapeType::BentConnector5, 20, 20, 400, 300); auto lineFormat = connector->get_LineFormat(); lineFormat->set_EndArrowheadStyle(LineArrowheadStyle::Triangle); auto lineFillFormat = lineFormat->get_FillFormat(); lineFillFormat->set_FillType(FillType::Solid); lineFillFormat->get_SolidFillColor()->set_Color(Color::get_Black()); connector->set_StartShapeConnectedTo(sourceShape); connector->set_EndShapeConnectedTo(targetShape); connector->set_StartShapeConnectionSiteIndex(2); presentation->Save(u"connector-obstruction.pptx", SaveFormat::Pptx); ``` Moving the vertical bend changes the route so that the connector bypasses the obstacle: ![connector-obstruction-fixed](https://docs.aspose.com/slides/cpp/connector/connector-obstruction-fixed.png) Instead of assuming that collection index `1` always represents the vertical bend, this example searches for `ShapeAdjustmentType::ConnectorBendPositionY` and changes it only when the expected semantic type is present: ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::Drawing; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto shapes = slide->get_Shapes(); shapes->AddAutoShape(ShapeType::Rectangle, 300, 150, 150, 75); auto sourceShape = shapes->AddAutoShape(ShapeType::Rectangle, 500, 400, 100, 50); auto targetShape = shapes->AddAutoShape(ShapeType::Rectangle, 100, 100, 70, 30); auto connector = shapes->AddConnector(ShapeType::BentConnector5, 20, 20, 400, 300); auto lineFormat = connector->get_LineFormat(); lineFormat->set_EndArrowheadStyle(LineArrowheadStyle::Triangle); auto lineFillFormat = lineFormat->get_FillFormat(); lineFillFormat->set_FillType(FillType::Solid); lineFillFormat->get_SolidFillColor()->set_Color(Color::get_Black()); connector->set_StartShapeConnectedTo(sourceShape); connector->set_EndShapeConnectedTo(targetShape); connector->set_StartShapeConnectionSiteIndex(2); SharedPtr verticalBend; auto adjustments = connector->get_Adjustments(); for (int32_t adjustmentIndex = 0; adjustmentIndex < adjustments->get_Count(); ++adjustmentIndex) { auto adjustment = adjustments->idx_get(adjustmentIndex); Console::WriteLine(u"{0}: type = {1}, raw value = {2}", adjustment->get_Name(), static_cast(adjustment->get_Type()), adjustment->get_RawValue()); if (adjustment->get_Type() == ShapeAdjustmentType::ConnectorBendPositionY) { verticalBend = adjustment; break; } } if (verticalBend == nullptr) { Console::WriteLine(u"The connector does not expose a vertical bend adjustment."); } else { verticalBend->set_RawValue(60000); presentation->Save(u"connector-obstruction-fixed.pptx", SaveFormat::Pptx); } ``` A `ShapeType::BentConnector5` has two `ShapeAdjustmentType::ConnectorBendPositionX` adjustments and one `ShapeAdjustmentType::ConnectorBendPositionY` adjustment. If the type you need occurs more than once, inspect `IAdjustValue::get_Name` and the known geometry of that preset before selecting one. If an adjustment reports `ShapeAdjustmentType::Custom`, treat its meaning and range as preset-specific and do not change it until that contract is known. ## **Relate Adjustment Values to Connector Geometry** For bent connectors, adjustment values can be used to estimate the positions of individual segments. These calculations are specific to the connector preset: - `ShapeType::BentConnector4` normally exposes one `ShapeAdjustmentType::ConnectorBendPositionX` and one `ShapeAdjustmentType::ConnectorBendPositionY` adjustment. - For these bend positions, `RawValue / 100000.0f` produces the fraction of the connector frame width or height used by the examples below. - A connector frame can be rotated or flipped, so frame coordinates must be transformed before they are compared with slide coordinates. The following examples use `IAdjustValue::get_Type` to identify the adjustments first. They do not treat collection indexes as portable identifiers. ### **Unrotated Connector** The initial layout contains two text shapes connected by a `ShapeType::BentConnector4`: ![connector-shape-complex](https://docs.aspose.com/slides/cpp/connector/connector-shape-complex.png) This example inspects the connector and obtains its horizontal and vertical bend adjustments: ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; using namespace System::Drawing; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto shapes = slide->get_Shapes(); auto sourceShape = shapes->AddAutoShape(ShapeType::Rectangle, 100, 100, 60, 25); sourceShape->get_TextFrame()->set_Text(u"From"); auto targetShape = shapes->AddAutoShape(ShapeType::Rectangle, 500, 100, 60, 25); targetShape->get_TextFrame()->set_Text(u"To"); auto connector = shapes->AddConnector(ShapeType::BentConnector4, 20, 20, 400, 300); auto lineFormat = connector->get_LineFormat(); lineFormat->set_EndArrowheadStyle(LineArrowheadStyle::Triangle); auto lineFillFormat = lineFormat->get_FillFormat(); lineFillFormat->set_FillType(FillType::Solid); lineFillFormat->get_SolidFillColor()->set_Color(Color::get_Crimson()); lineFormat->set_Width(3); connector->set_StartShapeConnectedTo(sourceShape); connector->set_StartShapeConnectionSiteIndex(3); connector->set_EndShapeConnectedTo(targetShape); connector->set_EndShapeConnectionSiteIndex(2); auto adjustments = connector->get_Adjustments(); for (int32_t adjustmentIndex = 0; adjustmentIndex < adjustments->get_Count(); ++adjustmentIndex) { auto adjustment = adjustments->idx_get(adjustmentIndex); Console::WriteLine(u"{0}: type = {1}, raw value = {2}", adjustment->get_Name(), static_cast(adjustment->get_Type()), adjustment->get_RawValue()); } ``` To change both bends, locate each expected type and modify the values only after both have been found: ```cpp #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto shapes = slide->get_Shapes(); auto sourceShape = shapes->AddAutoShape(ShapeType::Rectangle, 100, 100, 60, 25); auto targetShape = shapes->AddAutoShape(ShapeType::Rectangle, 500, 100, 60, 25); auto connector = shapes->AddConnector(ShapeType::BentConnector4, 20, 20, 400, 300); connector->set_StartShapeConnectedTo(sourceShape); connector->set_StartShapeConnectionSiteIndex(3); connector->set_EndShapeConnectedTo(targetShape); connector->set_EndShapeConnectionSiteIndex(2); SharedPtr horizontalBend; SharedPtr verticalBend; auto adjustments = connector->get_Adjustments(); for (int32_t adjustmentIndex = 0; adjustmentIndex < adjustments->get_Count(); ++adjustmentIndex) { auto adjustment = adjustments->idx_get(adjustmentIndex); if (adjustment->get_Type() == ShapeAdjustmentType::ConnectorBendPositionX) { horizontalBend = adjustment; } else if (adjustment->get_Type() == ShapeAdjustmentType::ConnectorBendPositionY) { verticalBend = adjustment; } } if (horizontalBend == nullptr || verticalBend == nullptr) { Console::WriteLine(u"The connector does not expose the expected bend adjustments."); } else { horizontalBend->set_RawValue(horizontalBend->get_RawValue() + 20000); verticalBend->set_RawValue(verticalBend->get_RawValue() + 200000); presentation->Save(u"connector-adjusted.pptx", SaveFormat::Pptx); } ``` The result is a connector whose horizontal and vertical segments have moved: ![connector-adjusted-1](https://docs.aspose.com/slides/cpp/connector/connector-adjusted-1.png) Once the semantic types are known, their values can be converted into connector-frame coordinates. This example draws a thin rectangle over the vertical segment controlled by the two bend adjustments: ```cpp #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto shapes = slide->get_Shapes(); auto sourceShape = shapes->AddAutoShape(ShapeType::Rectangle, 100, 100, 60, 25); auto targetShape = shapes->AddAutoShape(ShapeType::Rectangle, 500, 100, 60, 25); auto connector = shapes->AddConnector(ShapeType::BentConnector4, 20, 20, 400, 300); connector->set_StartShapeConnectedTo(sourceShape); connector->set_StartShapeConnectionSiteIndex(3); connector->set_EndShapeConnectedTo(targetShape); connector->set_EndShapeConnectionSiteIndex(2); SharedPtr horizontalBend; SharedPtr verticalBend; auto adjustments = connector->get_Adjustments(); for (int32_t adjustmentIndex = 0; adjustmentIndex < adjustments->get_Count(); ++adjustmentIndex) { auto adjustment = adjustments->idx_get(adjustmentIndex); if (adjustment->get_Type() == ShapeAdjustmentType::ConnectorBendPositionX) { horizontalBend = adjustment; } else if (adjustment->get_Type() == ShapeAdjustmentType::ConnectorBendPositionY) { verticalBend = adjustment; } } if (horizontalBend == nullptr || verticalBend == nullptr) { Console::WriteLine(u"The connector does not expose the expected bend adjustments."); } else { float x = connector->get_X() + connector->get_Width() * horizontalBend->get_RawValue() / 100000.0f; float y = connector->get_Y(); float height = connector->get_Height() * verticalBend->get_RawValue() / 100000.0f; shapes->AddAutoShape(ShapeType::Rectangle, x, y, 1, height); presentation->Save(u"connector-segment-guide.pptx", SaveFormat::Pptx); } ``` The guide shape marks the calculated segment: ![connector-adjusted-2](https://docs.aspose.com/slides/cpp/connector/connector-adjusted-2.png) ### **Rotated or Flipped Connector** When the same connector geometry is oriented vertically, its [IShape::get_Frame](https://reference.aspose.com/slides/cpp/aspose.slides/ishape/get_frame/), [IShapeFrame::get_FlipH](https://reference.aspose.com/slides/cpp/aspose.slides/ishapeframe/get_fliph/), and [IShapeFrame::get_FlipV](https://reference.aspose.com/slides/cpp/aspose.slides/ishapeframe/get_flipv/) values affect the conversion from connector-frame coordinates to slide coordinates. This example creates and adjusts the vertically oriented connector: ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System::Drawing; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto shapes = slide->get_Shapes(); auto sourceShape = shapes->AddAutoShape(ShapeType::Rectangle, 100, 100, 60, 25); sourceShape->get_TextFrame()->set_Text(u"From"); auto targetShape = shapes->AddAutoShape(ShapeType::Rectangle, 100, 400, 60, 25); targetShape->get_TextFrame()->set_Text(u"To 1"); auto connector = shapes->AddConnector(ShapeType::BentConnector4, 20, 20, 400, 300); auto lineFormat = connector->get_LineFormat(); lineFormat->set_EndArrowheadStyle(LineArrowheadStyle::Triangle); auto lineFillFormat = lineFormat->get_FillFormat(); lineFillFormat->set_FillType(FillType::Solid); lineFillFormat->get_SolidFillColor()->set_Color(Color::get_MediumAquamarine()); lineFormat->set_Width(3); connector->set_StartShapeConnectedTo(sourceShape); connector->set_StartShapeConnectionSiteIndex(2); connector->set_EndShapeConnectedTo(targetShape); connector->set_EndShapeConnectionSiteIndex(3); auto adjustments = connector->get_Adjustments(); for (int32_t adjustmentIndex = 0; adjustmentIndex < adjustments->get_Count(); ++adjustmentIndex) { auto adjustment = adjustments->idx_get(adjustmentIndex); if (adjustment->get_Type() == ShapeAdjustmentType::ConnectorBendPositionX) { adjustment->set_RawValue(adjustment->get_RawValue() + 20000); } else if (adjustment->get_Type() == ShapeAdjustmentType::ConnectorBendPositionY) { adjustment->set_RawValue(adjustment->get_RawValue() + 200000); } } presentation->Save(u"vertical-connector-adjusted.pptx", SaveFormat::Pptx); ``` The adjusted connector appears vertically between the shapes: ![connector-adjusted-3](https://docs.aspose.com/slides/cpp/connector/connector-adjusted-3.png) For an arbitrary rotation angle `alpha`, rotate a connector-frame point `(x, y)` around the frame center `(x0, y0)`: `X = (x - x0) * cos(alpha) - (y - y0) * sin(alpha) + x0` `Y = (x - x0) * sin(alpha) + (y - y0) * cos(alpha) + y0` The following code handles the 90-degree orientation used in this example and draws a red guide over the corresponding connector segment: ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::Drawing; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto shapes = slide->get_Shapes(); auto sourceShape = shapes->AddAutoShape(ShapeType::Rectangle, 100, 100, 60, 25); auto targetShape = shapes->AddAutoShape(ShapeType::Rectangle, 100, 400, 60, 25); auto connector = shapes->AddConnector(ShapeType::BentConnector4, 20, 20, 400, 300); connector->set_StartShapeConnectedTo(sourceShape); connector->set_StartShapeConnectionSiteIndex(2); connector->set_EndShapeConnectedTo(targetShape); connector->set_EndShapeConnectionSiteIndex(3); SharedPtr horizontalBend; SharedPtr verticalBend; auto adjustments = connector->get_Adjustments(); for (int32_t adjustmentIndex = 0; adjustmentIndex < adjustments->get_Count(); ++adjustmentIndex) { auto adjustment = adjustments->idx_get(adjustmentIndex); if (adjustment->get_Type() == ShapeAdjustmentType::ConnectorBendPositionX) { horizontalBend = adjustment; } else if (adjustment->get_Type() == ShapeAdjustmentType::ConnectorBendPositionY) { verticalBend = adjustment; } } if (horizontalBend == nullptr || verticalBend == nullptr) { Console::WriteLine(u"The connector does not expose the expected bend adjustments."); } else { horizontalBend->set_RawValue(horizontalBend->get_RawValue() + 20000); verticalBend->set_RawValue(verticalBend->get_RawValue() + 200000); float x = connector->get_X(); float y = connector->get_Y(); auto frame = connector->get_Frame(); if (frame->get_FlipH() == NullableBool::True) { x += connector->get_Width(); } if (frame->get_FlipV() == NullableBool::True) { y += connector->get_Height(); } x += connector->get_Width() * horizontalBend->get_RawValue() / 100000.0f; float rotatedX = frame->get_CenterX() - y + frame->get_CenterY(); float rotatedY = x - frame->get_CenterX() + frame->get_CenterY(); float segmentWidth = connector->get_Height() * verticalBend->get_RawValue() / 100000.0f; auto guide = shapes->AddAutoShape(ShapeType::Rectangle, rotatedX, rotatedY, segmentWidth, 1); auto guideLineFillFormat = guide->get_LineFormat()->get_FillFormat(); guideLineFillFormat->set_FillType(FillType::Solid); guideLineFillFormat->get_SolidFillColor()->set_Color(Color::get_Red()); presentation->Save(u"rotated-connector-segment-guide.pptx", SaveFormat::Pptx); } ``` The red guide marks the calculated segment after the coordinate transformation: ![connector-adjusted-4](https://docs.aspose.com/slides/cpp/connector/connector-adjusted-4.png) These formulas describe the presets used in the examples, not a universal connector model. Validate the adjustment types, frame orientation, and value ranges before applying the same calculation to a different preset. ## **Find a Connector Direction Angle** The direction of a straight connector can be calculated from its width and height, with horizontal and vertical flips applied. The following example reports the clockwise angle from the positive horizontal axis in slide coordinates: ```cpp #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto connector = slide->get_Shapes()->AddConnector(ShapeType::StraightConnector1, 100, 100, 200, 100); auto frame = connector->get_Frame(); bool flipH = frame->get_FlipH() == NullableBool::True; bool flipV = frame->get_FlipV() == NullableBool::True; float deltaX = connector->get_Width() * (flipH ? -1 : 1); float deltaY = connector->get_Height() * (flipV ? -1 : 1); double angle = Math::Atan2(deltaY, deltaX) * 180.0 / Math::PI; if (angle < 0) { angle += 360; } Console::WriteLine(u"Connector direction: {0:F2} degrees", angle); ``` ## **FAQ** **How can I tell whether a connector can attach to a shape?** Check the shape's `IShape::get_ConnectionSiteCount` value. A positive count means the shape exposes connection sites. Validate the selected site index before assigning it to either connector end. **Can I identify a connector adjustment by its collection index?** An index is meaningful only for a known connector preset and collection layout. Check `IAdjustValue::get_Type` before modifying a value, and use `IAdjustValue::get_Name` as additional information when the same semantic type occurs more than once. **What happens when a connected shape is deleted?** The corresponding connector end becomes detached. The connector remains on the slide and can be deleted, positioned as a free line, or attached to another shape. **Are connector bindings preserved when a slide is copied?** Bindings are generally preserved when the connected shapes are copied with the slide. If a connector is copied without one of its target shapes, the affected end must be attached again. ## Related articles - [Connector](https://docs.aspose.com/slides/cpp/examples/elements/connector/) # Convert ODP to PPTX in C++ > Convert ODP to PPTX with Aspose.Slides for C++. Clean code examples, batch tips, and high-quality results—no PowerPoint needed. Source: https://docs.aspose.com/slides/cpp/convert-odp-to-pptx/ Updated: 2026-08-05 ## **Overview** This article explains how to convert an ODP presentation to PPTX format using Aspose.Slides. ## **ODP to PPTX Conversion** Aspose.Slides for .NET offers Presentation class that represents a presentation file. [**Presentation**](https://reference.aspose.com/slides/cpp/class/aspose.slides.presentation) class can now also access ODP through Presentation constructor when the object is instantiated. The following example shows how to convert a ODP Presentation into PPTX Presentation. ``` cpp #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; // The path to the documents directory. String dataDir = u"../documents/"; // Open the ODP file auto pres = System::MakeObject(dataDir + u"AccessOpenDoc.odp"); // Saving the ODP presentation to PPTX format pres->Save(dataDir + u"AccessOpenDoc_out.pptx", SaveFormat::Pptx); ``` ## **Live Example** You can visit [**Aspose.Slides Conversion**](https://products.aspose.app/slides/conversion/) web app, which is built with **Aspose.Slides API.** The app demonstrates how ODP to PPTX conversion can be implemented with Aspose.Slides API. ## **FAQ** ### Do I need to install Microsoft PowerPoint or LibreOffice to convert ODP to PPTX? No. Aspose.Slides works standalone and does not require third-party applications to read or write ODP/PPTX. ### Are master slides, layouts, and themes preserved during conversion? Yes. The library uses a full presentation object model and retains structure, including master slides and layouts, so the design remains correct after conversion. ### Can I convert password-protected ODP files? Yes. Aspose.Slides supports detecting protection, opening and working with [protected presentations](https://docs.aspose.com/slides/cpp/password-protected-presentation/) (including ODP) when you provide the password, as well as configuring encryption and access to document properties. ### Is Aspose.Slides suitable for cloud or REST-based conversion services? Yes. You can use the local library in your own backend or [Aspose.Slides Cloud](https://products.aspose.cloud/slides/family/) (REST API); both options support ODP → PPTX conversion. # Convert OpenDocument Presentations in C++ > Aspose.Slides for C++ lets you convert ODP to PDF, HTML, and image formats with ease. Boost your C++ apps with fast and accurate presentation conversion. Source: https://docs.aspose.com/slides/cpp/convert-openoffice-odp/ Updated: 2026-08-05 [**Aspose.Slides API**](https://products.aspose.com/slides/cpp/) allows you to convert OpenDocument (ODP) presentations to many formats (HTML, PDF, TIFF, SWF, XPS, etc.). The API used to convert ODP files to other document formats is the same as the one used for PowerPoint (PPT and PPTX) conversion operations. For example, if you need to convert an ODP presentation to PDF, you can do it as follows: ```cpp #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto pres = MakeObject(u"pres.odp"); pres->Save(u"pres.pdf", SaveFormat::Pdf); pres->Dispose(); ``` ## Related articles - [Convert PowerPoint Presentations in C++ | HTML, PNG, PDF, Word, TIFF](https://docs.aspose.com/slides/cpp/convert-powerpoint/) - [Convert Presentations to Multiple Formats in C++](https://docs.aspose.com/slides/cpp/convert-presentation/) - [API Reference](https://docs.aspose.com/slides/cpp/api-reference/) # Convert PowerPoint Presentations in Handout Mode Using C++ > Convert presentations to handouts in C++. Set slides per page, keep notes, export to PDF or images with Aspose.Slides, with sample code. Try it free. Source: https://docs.aspose.com/slides/cpp/convert-powerpoint-in-handout-mode/ Updated: 2026-11-08 ## **Introduction** Aspose.Slides provides the ability to convert presentations into various formats, including creating handouts for printing in Handout mode. This mode allows you to configure how multiple slides appear on a single page, making it useful for conferences, seminars, and other events. You can enable this mode by calling the `set_SlidesLayoutOptions` method in the [IPdfOptions](https://reference.aspose.com/slides/cpp/aspose.slides.export/ipdfoptions/), [IRenderingOptions](https://reference.aspose.com/slides/cpp/aspose.slides.export/irenderingoptions/), [IHtmlOptions](https://reference.aspose.com/slides/cpp/aspose.slides.export/ihtmloptions/), and [ITiffOptions](https://reference.aspose.com/slides/cpp/aspose.slides.export/itiffoptions/) interfaces. To set the handout page dimensions and orientation before export, see [Notes Page Size](https://docs.aspose.com/slides/cpp/notes-size/). ## **Handout Mode Export** To configure Handout mode, use the [HandoutLayoutingOptions](https://reference.aspose.com/slides/cpp/aspose.slides.export/handoutlayoutingoptions/) object, which determines how many slides are placed on a single page and other display parameters. Below is a code example showing how to convert a presentation to PDF in Handout mode. ```cpp #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; // Load a presentation. auto presentation = MakeObject(u"sample.pptx"); // Set the export options. auto slidesLayoutOptions = MakeObject(); slidesLayoutOptions->set_Handout(HandoutType::Handouts4Horizontal); // 4 slides on one page horizontally slidesLayoutOptions->set_PrintSlideNumbers(true); // print slide numbers slidesLayoutOptions->set_PrintFrameSlide(true); // print a frame around slides slidesLayoutOptions->set_PrintComments(false); // no comments auto pdfOptions = MakeObject(); pdfOptions->set_SlidesLayoutOptions(slidesLayoutOptions); // Export the presentation to PDF with the chosen layout. presentation->Save(u"output.pdf", SaveFormat::Pdf, pdfOptions); presentation->Dispose(); ``` Keep in mind that the `set_SlidesLayoutOptions` method is available only for certain output formats, such as PDF, HTML, TIFF, and when rendering as images. [![Four separately exported PDF pages are followed by one four-thumbnail handout. Slide 1 and Slide 2 are across the top, and Slide 3 and Slide 4 are across the bottom.](https://docs.aspose.com/slides/cpp/convert-powerpoint-in-handout-mode/visual-convert-powerpoint-in-handout-mode-2d311e39d758.svg)](https://docs.aspose.com/slides/cpp/convert-powerpoint-in-handout-mode/visual-convert-powerpoint-in-handout-mode-2d311e39d758.svg) *The same four numbered slides exported as one slide per PDF page and as a horizontal handout. The handout includes printed slide numbers and frames.* ## **FAQ** ### What is the maximum number of slide thumbnails per page in Handout mode? Aspose.Slides supports [presets](https://reference.aspose.com/slides/cpp/aspose.slides.export/handouttype/) up to 9 thumbnails per page with horizontal or vertical ordering: 1, 2, 3, 4 (horizontal/vertical), 6 (horizontal/vertical), and 9 (horizontal/vertical). ### Can I define a custom grid, such as 5 or 8 slides per page? No. The number and ordering of thumbnails are controlled strictly by the [HandoutType](https://reference.aspose.com/slides/cpp/aspose.slides.export/handouttype/) enumeration; arbitrary layouts are not supported. ### Can I include hidden slides in the Handout output? Yes. Use the `set_ShowHiddenSlides` method in the export settings for the target format, such as [PdfOptions](https://reference.aspose.com/slides/cpp/aspose.slides.export/pdfoptions/), [HtmlOptions](https://reference.aspose.com/slides/cpp/aspose.slides.export/htmloptions/), or [TiffOptions](https://reference.aspose.com/slides/cpp/aspose.slides.export/tiffoptions/). # Convert PowerPoint Presentations to Animated GIFs in C++ > Easily convert PowerPoint presentations (PPT, PPTX) to animated GIFs with Aspose.Slides for C++. Fast, high-quality results. Source: https://docs.aspose.com/slides/cpp/convert-powerpoint-to-animated-gif/ Updated: 2026-08-13 ## **Overview** Aspose.Slides allows you to convert PowerPoint presentations to animated GIF files with just a few lines of code. This is useful when you need to share slide content in a lightweight, widely supported animated format that can be embedded in web pages, messengers, or documentation. This article explains how to export a presentation to GIF using default settings and how to customize the output by configuring options such as frame size, slide delay, and transition frame rate through [GifOptions](https://reference.aspose.com/slides/cpp/aspose.slides.export/gifoptions/). ## **Convert Presentations to Animated GIF Using Default Settings** This sample code in C++ shows you how to convert a presentation to animated GIF using standard settings: ``` cpp #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto pres = System::MakeObject(u"pres.pptx"); pres->Save(u"pres.gif", SaveFormat::Gif); ``` The animated GIF will be created with default parameters. If you prefer to customize the parameters for the GIF, you can use the [GifOptions](https://reference.aspose.com/slides/cpp/class/aspose.slides.export.gif_options) class. See the sample code below. ## **Convert Presentations to Animated GIF Using Custom Settings** This sample code shows you how to convert a presentation to animated GIF using custom settings in C++: ``` cpp #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto gifOptions = System::MakeObject(); // the size of the resulted GIF gifOptions->set_FrameSize(System::Drawing::Size(960, 720)); // how long each slide will be showed until it will be changed to the next one gifOptions->set_DefaultDelay(2000); // increase FPS to better transition animation quality gifOptions->set_TransitionFps(35); auto pres = System::MakeObject(u"pres.pptx"); pres->Save(u"pres.gif", SaveFormat::Gif, gifOptions); ``` You may want to check out a FREE [Text to GIF](https://products.aspose.app/slides/text-to-gif) converter developed by Aspose. ## **FAQ** ### What if the fonts used in the presentation aren’t installed on the system? Install the missing fonts or [configure fallback fonts](https://docs.aspose.com/slides/cpp/powerpoint-fonts/). Aspose.Slides will substitute, but the appearance may differ. For branding, always ensure the required typefaces are explicitly available. ### Can I overlay a watermark on the GIF frames? Yes. [Add a semi-transparent object/logo](https://docs.aspose.com/slides/cpp/watermark/) to the master slide or to individual slides before export — the watermark will appear on every frame. # Convert PowerPoint Presentations to HTML in C++ > Convert PowerPoint presentations to HTML in C++. Use Aspose.Slides to export PPT and PPTX files, selected slides, notes, fonts, images, SVG, and media. Source: https://docs.aspose.com/slides/cpp/convert-powerpoint-to-html/ Updated: 2026-08-05 ## **Overview** Aspose.Slides for C++ can save PowerPoint presentations as HTML without Microsoft PowerPoint. The basic conversion is a single [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) load and a `Save` call with [SaveFormat](https://reference.aspose.com/slides/cpp/aspose.slides.export/saveformat/). Use [HtmlOptions](https://reference.aspose.com/slides/cpp/aspose.slides.export/htmloptions/) when you need to control the exported layout, fonts, images, notes, comments, SVG output, or linked resources. This guide focuses on practical HTML export scenarios: - Export a whole presentation or selected slides. - Generate fixed-layout, responsive, or SVG-based HTML. - Include speaker notes and comments. - Control image quality and cropped image data. - Embed fonts or save font files separately. - Choose how external resources and media files are written and referenced. By default, HTML export produces a self-contained HTML document where most resources are embedded. This is convenient for sharing one file, but it can increase output size. For web publishing, consider external resources, lower image DPI, and only embedding fonts that are not reliably available in the target environment. ## **Convert a Presentation to HTML** To export a presentation to HTML, load it with [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) and save it with `SaveFormat::Html`. ```cpp #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(u"presentation.pptx"); presentation->Save(u"presentation.html", SaveFormat::Html); presentation->Dispose(); ``` This example writes one HTML file. The call to `Dispose` releases file handles and rendering resources after export. ## **Use HtmlOptions** [HtmlOptions](https://reference.aspose.com/slides/cpp/aspose.slides.export/htmloptions/) is the main configuration class for HTML export. Common settings include: - `SlidesLayoutOptions`: adds notes, comments, handouts, or other layout information. - `HtmlFormatter`: changes the HTML document structure or delegates formatting to a controller. - `SlideImageFormat`: changes how slides are represented, for example as SVG. - `PicturesCompression`: controls image DPI and output size. - `DeletePicturesCroppedAreas`: keeps or removes cropped image data. - `SvgResponsiveLayout`: makes exported SVG content adapt to its container. - `ShowHiddenSlides`: includes hidden slides when required. The following sections show the most common options separately so you can combine only the ones your workflow needs. ## **Convert Selected Slides to HTML** The `Presentation::Save` overload that accepts slide numbers uses 1-based slide positions. The loop below saves every slide to a separate HTML file. ```cpp #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(u"presentation.pptx"); auto slideCount = presentation->get_Slides()->get_Count(); for (int slideIndex = 0; slideIndex < slideCount; slideIndex++) { auto slideNumber = slideIndex + 1; auto slideNumbers = System::MakeArray({ slideNumber }); auto htmlFileName = System::String::Format(u"slide-{0}.html", slideNumber); presentation->Save(htmlFileName, slideNumbers, SaveFormat::Html); } presentation->Dispose(); ``` Use this pattern when a website or application needs one HTML page per slide. If each slide should have the same layout, create one [HtmlOptions](https://reference.aspose.com/slides/cpp/aspose.slides.export/htmloptions/) instance and pass it to each `Save` call. ## **Create Responsive HTML** [ResponsiveHtmlController](https://reference.aspose.com/slides/cpp/aspose.slides.export/responsivehtmlcontroller/) provides responsive HTML output through [HtmlFormatter](https://reference.aspose.com/slides/cpp/aspose.slides.export/htmlformatter/). Use it when the exported page should adapt better to browser width. ```cpp #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(u"presentation.pptx"); auto controller = System::MakeObject(); auto formatter = HtmlFormatter::CreateCustomFormatter(controller); auto htmlOptions = System::MakeObject(); htmlOptions->set_HtmlFormatter(formatter); presentation->Save(u"presentation-responsive.html", SaveFormat::Html, htmlOptions); presentation->Dispose(); ``` For SVG-based responsive layout, set `SvgResponsiveLayout` on [HtmlOptions](https://reference.aspose.com/slides/cpp/aspose.slides.export/htmloptions/). This is useful when the slide content is exported as scalable SVG markup. ```cpp #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(u"presentation.pptx"); auto htmlOptions = System::MakeObject(); htmlOptions->set_SvgResponsiveLayout(true); presentation->Save(u"presentation-svg-responsive.html", SaveFormat::Html, htmlOptions); presentation->Dispose(); ``` ## **Include Speaker Notes and Comments** Use [NotesCommentsLayoutingOptions](https://reference.aspose.com/slides/cpp/aspose.slides.export/notescommentslayoutingoptions/) through `HtmlOptions.SlidesLayoutOptions` to include speaker notes or comments. Notes and comments are hidden by default unless you choose their positions. Suppose the source presentation contains speaker notes: ![Slide with speaker notes in PowerPoint](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-html/slide_with_notes.png) The following code exports the slide content with speaker notes below the slide. ```cpp #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(u"presentation.pptx"); auto layoutOptions = System::MakeObject(); layoutOptions->set_NotesPosition(NotesPositions::BottomFull); auto htmlOptions = System::MakeObject(); htmlOptions->set_SlidesLayoutOptions(layoutOptions); presentation->Save(u"presentation-with-notes.html", SaveFormat::Html, htmlOptions); presentation->Dispose(); ``` The exported HTML includes the notes area: ![HTML output with the slide and speaker notes](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-html/HTML_with_notes.png) To export comments, set `CommentsPosition`, for example to `CommentsPositions::Right` or `CommentsPositions::Bottom`. If you need only comments, omit `NotesPosition`. If you need both notes and comments, set both properties. ## **Control Image Quality and Cropped Areas** HTML export can compress slide images to reduce output size. Set `PicturesCompression` to a value from [PicturesCompression](https://reference.aspose.com/slides/cpp/aspose.slides.export/picturescompression/) when you need higher image quality. ```cpp #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(u"presentation.pptx"); auto htmlOptions = System::MakeObject(); htmlOptions->set_PicturesCompression(PicturesCompression::Dpi150); presentation->Save(u"presentation-dpi-150.html", SaveFormat::Html, htmlOptions); presentation->Dispose(); ``` By default, cropped areas of images may be removed from the exported output. Keep cropped data only when users must be able to recover or inspect those hidden image parts. Keeping it can increase the HTML size. ```cpp #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(u"presentation.pptx"); auto htmlOptions = System::MakeObject(); htmlOptions->set_DeletePicturesCroppedAreas(false); presentation->Save(u"presentation-with-cropped-areas.html", SaveFormat::Html, htmlOptions); presentation->Dispose(); ``` ## **Add CSS** For simple styling, pass a CSS string to `HtmlFormatter::CreateDocumentFormatter`. This changes the surrounding HTML document while Aspose.Slides continues to render the slide content. ```cpp #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(u"presentation.pptx"); auto cssRules = u"body { margin: 0; background: #f7f7f7; } .slide { margin: 24px auto; }"; auto formatter = HtmlFormatter::CreateDocumentFormatter(cssRules, true); auto htmlOptions = System::MakeObject(); htmlOptions->set_HtmlFormatter(formatter); presentation->Save(u"presentation-styled.html", SaveFormat::Html, htmlOptions); presentation->Dispose(); ``` For a custom document header, a linked CSS file, or custom markup around slides and shapes, implement [IHtmlFormattingController](https://reference.aspose.com/slides/cpp/aspose.slides.export/ihtmlformattingcontroller/) and pass it to [HtmlFormatter](https://reference.aspose.com/slides/cpp/aspose.slides.export/htmlformatter/) with `CreateCustomFormatter`. ## **Embed Fonts** If the target environment may not have the presentation fonts installed, embed fonts in the HTML with [EmbedAllFontsHtmlController](https://reference.aspose.com/slides/cpp/aspose.slides.export/embedallfontshtmlcontroller/). Embedding improves visual fidelity but increases output size. ```cpp #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(u"presentation.pptx"); auto fontNamesToExclude = System::MakeArray({ u"Arial" }); auto fontController = System::MakeObject(fontNamesToExclude); auto formatter = HtmlFormatter::CreateCustomFormatter(fontController); auto htmlOptions = System::MakeObject(); htmlOptions->set_HtmlFormatter(formatter); presentation->Save(u"presentation-embedded-fonts.html", SaveFormat::Html, htmlOptions); presentation->Dispose(); ``` Exclude fonts only when you are confident that the target browsers or systems already provide them. For brand fonts or less common fonts, embedding is usually safer. ## **Link Font Files Instead of Embedding Them** To reduce the HTML file size, you can write font data to separate WOFF files and add `@font-face` rules to the HTML. The helper below extends [EmbedAllFontsHtmlController](https://reference.aspose.com/slides/cpp/aspose.slides.export/embedallfontshtmlcontroller/) and overrides `WriteFont`. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::IO; class LinkedFontsHtmlController : public EmbedAllFontsHtmlController { public: LinkedFontsHtmlController( System::String fontOutputDirectory, System::String fontUrlPrefix) : EmbedAllFontsHtmlController(System::MakeArray(0)), m_fontOutputDirectory(fontOutputDirectory), m_fontUrlPrefix(fontUrlPrefix.TrimEnd(u'/') + u"/") { System::IO::Directory::CreateDirectory_(m_fontOutputDirectory); } void WriteFont( System::SharedPtr generator, System::SharedPtr originalFont, System::SharedPtr substitutedFont, System::String fontStyle, System::String fontWeight, System::ArrayPtr fontData) override { auto font = substitutedFont == nullptr ? originalFont : substitutedFont; auto safeFontName = MakeSafeFileName(font->get_FontName()); auto safeFontStyle = System::String::IsNullOrWhiteSpace(fontStyle) ? u"normal" : fontStyle; auto safeFontWeight = System::String::IsNullOrWhiteSpace(fontWeight) ? u"normal" : fontWeight; auto fontFileName = System::String::Format(u"{0}-{1}-{2}.woff", safeFontName, safeFontStyle, safeFontWeight); auto fontFilePath = System::IO::Path::Combine(m_fontOutputDirectory, fontFileName); System::IO::File::WriteAllBytes(fontFilePath, fontData); auto fontUrl = m_fontUrlPrefix + System::Uri::EscapeDataString(fontFileName); auto fontFamily = font->get_FontName().Replace(u"\\", u"\\\\").Replace(u"'", u"\\'"); generator->AddHtml(u""); } private: System::String m_fontOutputDirectory; System::String m_fontUrlPrefix; System::String MakeSafeFileName(System::String fileName) { auto invalidCharacters = System::IO::Path::GetInvalidFileNameChars(); auto safeCharacters = fileName.ToCharArray(); for (int characterIndex = 0; characterIndex < safeCharacters->get_Length(); characterIndex++) { if (System::Array::IndexOf(invalidCharacters, safeCharacters[characterIndex]) >= 0) { safeCharacters[characterIndex] = u'_'; } } return System::String(safeCharacters); } }; auto outputDirectory = System::IO::Path::Combine(System::Environment::get_CurrentDirectory(), u"html-output"); auto fontsDirectory = System::IO::Path::Combine(outputDirectory, u"fonts"); System::IO::Directory::CreateDirectory_(outputDirectory); auto presentation = System::MakeObject(u"presentation.pptx"); auto fontController = System::MakeObject(fontsDirectory, u"fonts"); auto formatter = HtmlFormatter::CreateCustomFormatter(fontController); auto htmlOptions = System::MakeObject(); htmlOptions->set_HtmlFormatter(formatter); auto htmlFilePath = System::IO::Path::Combine(outputDirectory, u"presentation.html"); presentation->Save(htmlFilePath, SaveFormat::Html, htmlOptions); presentation->Dispose(); ``` In this example, font files are saved to `html-output/fonts`, and the HTML references them with URLs such as `fonts/BrandFont-normal-400.woff`. If the HTML file and fonts are deployed to another location, choose `fontUrlPrefix` so that it matches the deployed URL path. ## **Save Resources Externally** Self-contained HTML is easy to move around, but embedded Base64 resources can make the file large. If your application needs external image files, implement [ILinkEmbedController](https://reference.aspose.com/slides/cpp/aspose.slides.export/ilinkembedcontroller/) and pass it to the [HtmlOptions](https://reference.aspose.com/slides/cpp/aspose.slides.export/htmloptions/) constructor. When you externalize resources, choose two paths deliberately: - The file system output path, where your application writes generated images, fonts, audio, or video. - The URL path, which is what the browser uses from the HTML document to load those files. ## **Export Media Files** [VideoPlayerHtmlController](https://reference.aspose.com/slides/cpp/aspose.slides.export/videoplayerhtmlcontroller/) exports video and audio files and writes HTML that can play them in a browser. Its constructor takes: - `path`: the directory where generated media files will be written. - `fileName`: the HTML file name being generated. - `baseUri`: the absolute URI prefix used in the HTML links to media files. If the HTML file is `html-output/presentation.html` and media files are saved in `html-output/media`, `path` should point to the media directory on disk, while `baseUri` should point to the same directory from the browser's point of view. For local preview, you can build a `file:///` URI from the media directory. For a deployed application, use the absolute URL of the published media directory. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::IO; auto outputDirectory = System::IO::Path::Combine(System::Environment::get_CurrentDirectory(), u"html-output"); auto mediaDirectory = System::IO::Path::Combine(outputDirectory, u"media"); System::IO::Directory::CreateDirectory_(outputDirectory); System::IO::Directory::CreateDirectory_(mediaDirectory); auto htmlFileName = u"presentation.html"; auto mediaBaseUri = System::MakeObject(mediaDirectory + System::IO::Path::DirectorySeparatorChar)->get_AbsoluteUri(); auto presentation = System::MakeObject(); auto videoStream = System::MakeObject(u"intro.mp4", System::IO::FileMode::Open, System::IO::FileAccess::Read); auto video = presentation->get_Videos()->AddVideo(videoStream, LoadingStreamBehavior::ReadStreamAndRelease); auto slide = presentation->get_Slide(0); slide->get_Shapes()->AddVideoFrame(20.0f, 20.0f, 480.0f, 270.0f, video); auto controller = System::MakeObject(mediaDirectory, htmlFileName, mediaBaseUri); auto formatter = HtmlFormatter::CreateCustomFormatter(controller); auto svgOptions = System::MakeObject(controller); auto slideImageFormat = SlideImageFormat::Svg(svgOptions); auto htmlOptions = System::MakeObject(controller); htmlOptions->set_HtmlFormatter(formatter); htmlOptions->set_SlideImageFormat(slideImageFormat); auto htmlFilePath = System::IO::Path::Combine(outputDirectory, htmlFileName); presentation->Save(htmlFilePath, SaveFormat::Html, htmlOptions); videoStream->Dispose(); presentation->Dispose(); ``` Use output directories that are unique per export job, especially in server applications. Shared output paths can cause files from different conversions to overwrite each other. ## **Performance and Resource Management** HTML conversion is a rendering operation, so processing time and memory use depend on slide count, image resolution, fonts, effects, charts, and embedded media. Higher `PicturesCompression` DPI values, embedded fonts, SVG output, and retained cropped image areas can improve fidelity but usually increase output size. For batch conversion: - Dispose every [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) instance promptly. - Use separate output directories for separate jobs. - Avoid embedding common fonts unless fidelity requires it. - Lower image DPI when the HTML is for preview or thumbnails. - Keep the source presentation, generated HTML, and external resources together until deployment paths are final. ## **FAQ** ### Are hyperlinks preserved in HTML output? Yes. Presentation hyperlinks are exported to HTML and remain clickable when the target URL is valid. ### Can I convert presentations to HTML in parallel? Yes, but do not share one [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) instance across threads. Process different files with separate presentation instances, separate streams, and separate output directories. See the [multithreading guidance](https://docs.aspose.com/slides/cpp/multithreading/) for details. ### Is a Presentation object thread-safe? No. A single [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) instance should be loaded, modified, saved, and disposed on one thread. For parallel work, create an independent instance per thread or process. ### Why is the generated HTML file large? The default export can embed resources directly in the HTML. Embedded fonts, high-DPI images, media, SVG content, and retained cropped image areas also increase size. Use external resources, exclude common fonts from embedding, and lower `PicturesCompression` when smaller output is more important than maximum fidelity. ### Why does a PowerPoint font size such as 24 pt appear as 17.999819 pt in HTML? This can happen because PowerPoint and HTML use different DPI models. PowerPoint stores text sizes in typographic points based on 72 DPI, while HTML layout is based on CSS pixels in a 96 DPI model. When Aspose.Slides exports a presentation to HTML, the font size is translated between these systems, and the conversion may introduce small rounding differences. These values do not indicate a real visual font-size change. They are only a mathematical side effect of converting text metrics between PowerPoint and HTML. ### How should I choose baseUri for media export? Choose `baseUri` from the browser's point of view and pass it as an absolute URI. For local preview, you can derive it from the output directory with `System::MakeObject(mediaDirectory + System::IO::Path::DirectorySeparatorChar)->get_AbsoluteUri()`. For deployment, use the absolute URL of the published media directory. The file system `path` and browser `baseUri` do not have to be the same string, but they must describe the same resource location. ### Can I include hidden slides? Yes. Set `ShowHiddenSlides` to `true` on [HtmlOptions](https://reference.aspose.com/slides/cpp/aspose.slides.export/htmloptions/) when hidden slides must be exported. ## Related articles - [Export Presentations to HTML with Externally Linked Images](https://docs.aspose.com/slides/cpp/exporting-presentations-to-html-with-externally-linked-images/) # Convert PPT and PPTX to JPG in C++ > Convert PowerPoint (PPT, PPTX) slides to high-quality JPG images in C++ with Aspose.Slides using fast, reliable code examples. Source: https://docs.aspose.com/slides/cpp/convert-powerpoint-to-jpg/ Updated: 2026-08-13 ## **Introduction** Converting PowerPoint and OpenDocument presentations to JPG images helps with sharing slides, optimizing performance, and embedding content into websites or applications. Aspose.Slides for C++ allows you to transform PPTX, PPT, and ODP files into high-quality JPEG images. This guide explains different methods for conversion. With these features, it's easy to implement your own presentation viewer and create a thumbnail for every slide. This may be useful if you want to protect presentation slides from copying or demonstrate the presentation in read-only mode. Aspose.Slides allows you to convert the whole presentation or a specific slide into image formats. ## **Convert Presentation Slides to JPG Images** Here are the steps to convert a PPT, PPTX, or ODP file to JPG: 1. Create an instance of the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) class. 1. Get the slide object of the [ISlide](https://reference.aspose.com/slides/cpp/aspose.slides/islide/) type from the presentation's slide collection. 1. Create an image of the slide using the [ISlide.GetImage](https://reference.aspose.com/slides/cpp/aspose.slides/islide/getimage/) method. 1. Call the [IImage.Save](https://reference.aspose.com/slides/cpp/aspose.slides/iimage/save/) method on the image object. Pass the output file name and image format as arguments. **Note:** PPT, PPTX, or ODP to JPG conversion differs from conversion to other formats in the Aspose.Slides for C++ API. For other formats, you typically use the [IPresentation.Save](https://reference.aspose.com/slides/cpp/aspose.slides/ipresentation/save/) method. However, for JPG conversion, you need to use the [IImage.Save](https://reference.aspose.com/slides/cpp/aspose.slides/iimage/save/) method. ```cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; float scaleX = 1.0f; float scaleY = scaleX; auto presentation = MakeObject(u"PowerPoint-Presentation.ppt"); for (auto&& slide : presentation->get_Slides()) { // Create a slide image of the specified scale. auto image = slide->GetImage(scaleX, scaleY); // Save the image to disk in JPEG format. auto fileName = String::Format(u"Slide_{0}.jpg", slide->get_SlideNumber()); image->Save(fileName, ImageFormat::Jpeg); image->Dispose(); } presentation->Dispose(); ``` ## **Convert Slides to JPG with Customized Dimensions** To change the dimensions of the resulting JPG images, you can set the image size by passing it into the [ISlide.GetImage(Size)](https://reference.aspose.com/slides/cpp/aspose.slides/islide/getimage/#islidegetimagesystemdrawingsize-method) method. This allows you to generate images with specific width and height values, ensuring that the output meets your requirements for resolution and aspect ratio. This flexibility is particularly useful when generating images for web applications, reports, or documentation, where precise image dimensions are required. ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; System::Drawing::Size imageSize(1200, 800); auto presentation = MakeObject(u"PowerPoint-Presentation.pptx"); for (auto&& slide : presentation->get_Slides()) { // Create a slide image of the specified size. auto image = slide->GetImage(imageSize); // Save the image to disk in JPEG format. auto fileName = System::String::Format(u"Slide_{0}.jpg", slide->get_SlideNumber()); image->Save(fileName, ImageFormat::Jpeg); image->Dispose(); } presentation->Dispose(); ``` ## **Render Comments When Saving Slides as Images** Aspose.Slides for C++ provides a feature that allows you to render comments on a presentation's slides when converting them into JPG images. This functionality is particularly useful for preserving annotations, feedback, or discussions added by collaborators in PowerPoint presentations. By enabling this option, you ensure that comments are visible in the generated images, making it easier to review and share feedback without needing to open the original presentation file. Let's say we have a presentation file, "sample.pptx," with a slide that contains comments: ![The slide with comments](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-jpg/slide_with_comments.png) The following C++ code converts the slide to a JPG image while preserving the comments: ```cpp #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::Drawing; float scaleX = 2.0f; float scaleY = scaleX; auto presentation = MakeObject(u"sample.pptx"); { auto commentOptions = MakeObject(); commentOptions->set_CommentsPosition(CommentsPositions::Right); commentOptions->set_CommentsAreaWidth(200); commentOptions->set_CommentsAreaColor(Color::get_DarkOrange()); // Set options for the slide comments. auto options = MakeObject(); options->set_SlidesLayoutOptions(commentOptions); // Convert the first slide to an image. auto image = presentation->get_Slide(0)->GetImage(options, scaleX, scaleY); image->Save(u"Slide_1.jpg", ImageFormat::Jpeg); image->Dispose(); } presentation->Dispose(); ``` The result: ![The JPG image with comments](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-jpg/image_with_comments.png) ## **See Also** See other options for converting PPT, PPTX, or ODP to images, such as: - [Convert PowerPoint to GIF](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-animated-gif/) - [Convert PowerPoint to PNG](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-png/) - [Convert PowerPoint to TIFF](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-tiff/) - [Convert PowerPoint to SVG](https://docs.aspose.com/slides/cpp/render-a-slide-as-an-svg-image/) To see how Aspose.Slides converts PowerPoint to JPG images, try these free online converters: PowerPoint [PPTX to JPG](https://products.aspose.app/slides/conversion/pptx-to-jpg) and [PPT to JPG](https://products.aspose.app/slides/conversion/ppt-to-jpg). ![Free Online PPTX to JPG Converter](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-jpg/ppt-to-jpg.png) Aspose provides a [FREE Collage web app](https://products.aspose.app/slides/collage). Using this online service, you can merge [JPG to JPG](https://products.aspose.app/slides/collage/jpg) or PNG to PNG images, create [photo grids](https://products.aspose.app/slides/collage/photo-grid), and so on. Using the same principles described in this article, you can convert images from one format to another. For more information, see these pages: convert [image to JPG](https://products.aspose.com/slides/cpp/conversion/image-to-jpg/); convert [JPG to image](https://products.aspose.com/slides/cpp/conversion/jpg-to-image/); convert [JPG to PNG](https://products.aspose.com/slides/cpp/conversion/jpg-to-png/), convert [PNG to JPG](https://products.aspose.com/slides/cpp/conversion/png-to-jpg/); convert [PNG to SVG](https://products.aspose.com/slides/cpp/conversion/png-to-svg/), convert [SVG to PNG](https://products.aspose.com/slides/cpp/conversion/svg-to-png/). ## **FAQ** ### Does this method support batch conversion? Yes, Aspose.Slides allows batch conversion of multiple slides to JPG in a single operation. ### Does the conversion support SmartArt, charts, and other complex objects? Yes, Aspose.Slides renders all content, including SmartArt, charts, tables, shapes, and more. However, the rendering accuracy may vary slightly compared to PowerPoint, especially when using custom or missing fonts. ### Are there any limitations on the number of slides that can be processed? Aspose.Slides itself does not impose any strict limits on the number of slides you can process. However, you may encounter out-of-memory error when working with large presentations or high-resolution images. ## Related articles - [Convert Presentation Slides to Images in C++](https://docs.aspose.com/slides/cpp/convert-slide/) # Convert PowerPoint Presentations to Markdown in C++ > Convert PPT and PPTX presentations to Markdown in C++ and control where exported bitmap, metafile, and SVG images are saved and referenced. Source: https://docs.aspose.com/slides/cpp/convert-powerpoint-to-markdown/ Updated: 2026-10-01 ## **Overview** Aspose.Slides for C++ can convert PPT and PPTX presentations to Markdown for documentation, static-site, content-migration, and version-control workflows. You can choose a Markdown flavor, control how slide content is rendered, and decide where exported images are stored and how the generated Markdown references them. By default, Markdown export uses text-only output. To export visual content, set the [MarkdownSaveOptions::set_ExportType](https://reference.aspose.com/slides/cpp/aspose.slides.export/markdownsaveoptions/set_exporttype/) method to the `Sequential` or `Visual` value from the [MarkdownExportType](https://reference.aspose.com/slides/cpp/aspose.slides.export/markdownexporttype/) enumeration. `Sequential` renders slide items separately and in order, whereas `Visual` keeps grouped items together to preserve their visual relationship. The `TextOnly` value does not emit image resources, so the image-saving events are not invoked in that mode. ## **Convert a Presentation to Markdown** Load the source file with the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) class, and then call the [Presentation::Save](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/save/) method with the `Md` value from the [SaveFormat](https://reference.aspose.com/slides/cpp/aspose.slides.export/saveformat/) enumeration. ```cpp #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(u"presentation.pptx"); presentation->Save(u"presentation.md", SaveFormat::Md); ``` ## **Select a Markdown Flavor** The [MarkdownSaveOptions::set_Flavor](https://reference.aspose.com/slides/cpp/aspose.slides.export/markdownsaveoptions/set_flavor/) method controls the Markdown specification used for the output. The [Flavor](https://reference.aspose.com/slides/cpp/aspose.slides.export/flavor/) enumeration includes CommonMark, GitHub Flavored Markdown, and other supported variants. The following example exports a presentation as CommonMark: ```cpp #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(u"presentation.pptx"); auto options = System::MakeObject(); options->set_Flavor(Flavor::CommonMark); presentation->Save(u"presentation.md", SaveFormat::Md, options); ``` ## **Control Repeated Spaces** When preparing slide text for documentation, text processing, or publication, use [MarkdownSaveOptions::set_HandleRepeatedSpaces](https://reference.aspose.com/slides/cpp/aspose.slides.export/markdownsaveoptions/set_handlerepeatedspaces/) to control consecutive regular spaces. Single spaces remain regular spaces in all three modes. The following self-contained example creates text with one, two, and three consecutive spaces and exports the same slide using each mode. ```cpp #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 20, 20, 600, 100); shape->get_TextFrame()->set_Text(u"One space; two spaces; three spaces."); const HandleRepeatedSpaces modes[] = { HandleRepeatedSpaces::None, HandleRepeatedSpaces::AlternateSpacesToNbsp, HandleRepeatedSpaces::MultipleSpacesToNbsp }; const System::String outputPaths[] = { u"spaces-None.md", u"spaces-AlternateSpacesToNbsp.md", u"spaces-MultipleSpacesToNbsp.md" }; for (auto i = 0; i < 3; ++i) { auto options = System::MakeObject(); options->set_Flavor(Flavor::CommonMark); options->set_HandleRepeatedSpaces(modes[i]); presentation->Save(outputPaths[i], SaveFormat::Md, options); } ``` The exported text lines are shown below. These excerpts omit the slide separator and the two trailing spaces added by the exporter. `None`: ```markdown One space; two spaces; three spaces. ``` `AlternateSpacesToNbsp`: ```markdown One space; two  spaces; three   spaces. ``` `MultipleSpacesToNbsp`: ```markdown One space; two  spaces; three   spaces. ``` In a typical HTML-based Markdown viewer, consecutive regular spaces collapse visually even though they remain in the source. Both replacement modes preserve the visible spacing in this example; their source differs for the three-space sequence. Choose `None` when downstream tools need ordinary space characters without HTML entities. Choose a replacement mode when visible spacing matters more. A text-processing pipeline consuming that output may need to decode ` ` and normalize the resulting nonbreaking spaces. Nonbreaking spaces also affect where a viewer can wrap text. ## **Remove Empty Lines** The [MarkdownSaveOptions::set_RemoveEmptyLines](https://reference.aspose.com/slides/cpp/aspose.slides.export/markdownsaveoptions/set_removeemptylines/) method controls whether empty or whitespace-only lines are removed during export. The default value is `false`. This controls vertical separation, independently of how repeated spaces within text are represented. The following example creates two text paragraphs separated by an empty paragraph and a paragraph containing three regular spaces. It exports both settings. The `\r` characters create paragraph boundaries in the text frame; `HandleRepeatedSpaces::None` makes the treatment of ordinary spaces easier to inspect. ```cpp #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 20, 20, 600, 300); // Include an empty paragraph and a paragraph containing three regular spaces. shape->get_TextFrame()->set_Text(u"First paragraph.\r\r \rSecond paragraph."); auto options = System::MakeObject(); options->set_Flavor(Flavor::CommonMark); options->set_HandleRepeatedSpaces(HandleRepeatedSpaces::None); options->set_RemoveEmptyLines(false); presentation->Save(u"empty-lines-kept.md", SaveFormat::Md, options); options->set_RemoveEmptyLines(true); presentation->Save(u"empty-lines-removed.md", SaveFormat::Md, options); ``` With `false`, the generated Markdown is: ```markdown --- First paragraph.   Second paragraph. ``` With `true`, it becomes: ```markdown --- First paragraph. Second paragraph. ``` With `RemoveEmptyLines = false`, the exported Markdown preserves the empty and whitespace-only paragraphs. The ` ` line represents an empty paragraph. With `RemoveEmptyLines = true`, these blank paragraphs are removed. The two text paragraphs become a single Markdown paragraph with a line break between them. This line break is preserved by two trailing spaces after `First paragraph.`—Markdown syntax for a hard line break. The slide separator (`---`) remains in both outputs. Keep `RemoveEmptyLines = false` when you need to preserve paragraph separation. If your presentation contains lists or code blocks, check the exported result in your target Markdown viewer, since blank lines can affect how that content is interpreted. ## **Export Images Using the Default Local-Saving Behavior** The [MarkdownSaveOptions](https://reference.aspose.com/slides/cpp/aspose.slides.export/markdownsaveoptions/) class provides two methods for configuring locally saved images: - [set_BasePath](https://reference.aspose.com/slides/cpp/aspose.slides.export/markdownsaveoptions/set_basepath/) specifies the base directory for the Markdown document and its resources. - [set_ImagesSaveFolderName](https://reference.aspose.com/slides/cpp/aspose.slides.export/markdownsaveoptions/set_imagessavefoldername/) specifies the image subdirectory. Its default value is `Images`. The following example renders visual content, writes images to `output/assets`, and creates relative image references in the Markdown document: ```cpp #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System::IO; const System::String outputDirectory = u"output"; Directory::CreateDirectory_(outputDirectory); auto presentation = System::MakeObject(u"presentation.pptx"); auto options = System::MakeObject(); options->set_ExportType(MarkdownExportType::Visual); options->set_BasePath(outputDirectory); options->set_ImagesSaveFolderName(u"assets"); auto markdownPath = Path::Combine(outputDirectory, u"presentation.md"); presentation->Save(markdownPath, SaveFormat::Md, options); ``` This behavior also serves as the fallback when a custom image-saving handler returns `false`. ## **Customize Image Saving and Markdown Links** Use the `MarkdownSaveOptions::ImageSaving` event for non-SVG bitmap and metafile resources emitted during Markdown export. Its [MarkdownImageSavingHandler](https://reference.aspose.com/slides/cpp/aspose.slides.export/markdownsaveoptions/markdownimagesavinghandler/) delegate receives the [IImage](https://reference.aspose.com/slides/cpp/aspose.slides/iimage/) object, its [ImageFormat](https://reference.aspose.com/slides/cpp/aspose.slides/imageformat/), and the generated Markdown link as a `System::String&` parameter. Save or upload the image with the supplied format, and replace `link` with the reference that must appear in the Markdown output. Resources emitted in SVG format are handled separately. Subscribe to the `MarkdownSaveOptions::SvgImageSaving` event, whose [MarkdownSvgImageSavingHandler](https://reference.aspose.com/slides/cpp/aspose.slides.export/markdownsaveoptions/markdownsvgimagesavinghandler/) delegate receives an [ISvgImage](https://reference.aspose.com/slides/cpp/aspose.slides/isvgimage/) object and the `System::String& link` parameter. An SVG has no `ImageFormat` argument; write or upload its XML data from the [ISvgImage::get_SvgData](https://reference.aspose.com/slides/cpp/aspose.slides/isvgimage/get_svgdata/) method instead. Depending on the export mode and visual grouping, an SVG in the source presentation can be rasterized or combined with other content; the resulting non-SVG resource is then passed to `ImageSaving`. Subscribe to both events when every exported visual resource requires custom processing. The handler return value determines who processes the image: - Return `true` after the handler has saved, uploaded, transformed, or otherwise processed the image and assigned a valid value to `link`. Aspose.Slides writes that value to the Markdown document and does not perform its default local save. - Return `false` to let Aspose.Slides save the image locally and generate its link according to [MarkdownSaveOptions::set_BasePath](https://reference.aspose.com/slides/cpp/aspose.slides.export/markdownsaveoptions/set_basepath/) and [MarkdownSaveOptions::set_ImagesSaveFolderName](https://reference.aspose.com/slides/cpp/aspose.slides.export/markdownsaveoptions/set_imagessavefoldername/). A handler that returns `true` takes responsibility for the image. If it returns `true` without assigning a valid, nonempty link, the export fails with an `InvalidOperationException`. ### **Save Images to a CDN Origin Directory and Use External URLs** The following example treats `cdn-origin/presentations/quarterly-report` as a mounted or synchronized CDN origin directory. Each handler extracts the generated file name, saves the image to that custom directory, and replaces the generated local reference with a public CDN URL. The sample itself performs no network upload: the URL becomes valid only after the directory is mounted as the CDN origin or its files are published to the CDN. For object storage, replace the file-system write with the storage SDK's upload operation and assign `link` only after the upload succeeds. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System::IO; const System::String outputDirectory = u"output"; const System::String publicBaseUrl = u"https://cdn.example.com/presentations/quarterly-report"; const System::String storageDirectory = Path::Combine(u"cdn-origin", u"presentations", u"quarterly-report"); Directory::CreateDirectory_(outputDirectory); Directory::CreateDirectory_(storageDirectory); auto presentation = System::MakeObject(u"presentation.pptx"); auto options = System::MakeObject(); options->set_ExportType(MarkdownExportType::Visual); options->set_BasePath(outputDirectory); options->set_ImagesSaveFolderName(u"fallback-images"); options->ImageSaving.connect(std::function, ImageFormat, System::String&)>([storageDirectory, publicBaseUrl](System::SharedPtr image, ImageFormat format, System::String& link) -> bool { if (image->get_Width() < 128 || image->get_Height() < 128) { return false; } auto urlCompatibleLink = link.Replace(u"\\", u"/"); auto fileName = urlCompatibleLink.Substring(urlCompatibleLink.LastIndexOf(u'/') + 1); auto storagePath = Path::Combine(storageDirectory, fileName); image->Save(storagePath, format); link = publicBaseUrl + u"/" + System::Uri::EscapeDataString(fileName); return true; })); options->SvgImageSaving.connect(std::function, System::String&)>([storageDirectory, publicBaseUrl](System::SharedPtr svgImage, System::String& link) -> bool { auto urlCompatibleLink = link.Replace(u"\\", u"/"); auto fileName = urlCompatibleLink.Substring(urlCompatibleLink.LastIndexOf(u'/') + 1); auto storagePath = Path::Combine(storageDirectory, fileName); File::WriteAllBytes(storagePath, svgImage->get_SvgData()); link = publicBaseUrl + u"/" + System::Uri::EscapeDataString(fileName); return true; })); auto markdownPath = Path::Combine(outputDirectory, u"presentation.md"); presentation->Save(markdownPath, SaveFormat::Md, options); ``` The bitmap handler deliberately returns `false` for images smaller than 128 × 128 pixels, so Aspose.Slides saves those images to `output/fallback-images` using the default behavior. Larger bitmap and metafile resources, as well as SVG resources, are handled by the custom code. For example, a generated local reference such as `fallback-images/image1.png` becomes `https://cdn.example.com/presentations/quarterly-report/image1.png`. The handlers use operating-system paths only when writing files; links written to Markdown use forward slashes and URL-escaped file names. Apply the same rule when building relative links: use `/`, not the platform-specific directory separator. ## **FAQ** **Can one handler process both raster images and SVG images?** No. Use `MarkdownSaveOptions::ImageSaving` for emitted bitmap and metafile resources and `MarkdownSaveOptions::SvgImageSaving` for resources emitted as SVG. The former provides an [IImage](https://reference.aspose.com/slides/cpp/aspose.slides/iimage/) object and an [ImageFormat](https://reference.aspose.com/slides/cpp/aspose.slides/imageformat/); the latter provides an [ISvgImage](https://reference.aspose.com/slides/cpp/aspose.slides/isvgimage/) object whose SVG data can be read with [ISvgImage::get_SvgData](https://reference.aspose.com/slides/cpp/aspose.slides/isvgimage/get_svgdata/). A source SVG that is rasterized during export is processed by `ImageSaving` instead. **What happens when an image-saving handler returns `false`?** Aspose.Slides uses its default local-saving behavior. The image location and generated reference are controlled by [MarkdownSaveOptions::set_BasePath](https://reference.aspose.com/slides/cpp/aspose.slides.export/markdownsaveoptions/set_basepath/) and [MarkdownSaveOptions::set_ImagesSaveFolderName](https://reference.aspose.com/slides/cpp/aspose.slides.export/markdownsaveoptions/set_imagessavefoldername/). **Can a handler provide a URL without saving the image locally?** Yes. The handler can upload the image to object storage or pass it to another service, assign the resulting URL to `link`, and return `true`. The handler must complete the processing itself; returning `true` prevents the default local save. **Why does Markdown export throw an `InvalidOperationException` from a handler?** This exception occurs when the handler returns `true` but does not provide a valid link. Assign the relative path or external URL that should be written to Markdown before returning `true`. **Which path separator should image links use?** Use forward slashes in Markdown links and URLs. Use `Path::Combine` only for file-system paths, then construct or normalize the Markdown reference separately. **Are hyperlinks preserved during Markdown export?** Yes. Text [hyperlinks](https://docs.aspose.com/slides/cpp/manage-hyperlinks/) are preserved as standard Markdown links. Slide [transitions](https://docs.aspose.com/slides/cpp/slide-transition/) and [animations](https://docs.aspose.com/slides/cpp/powerpoint-animation/) are not converted. **Can presentations be converted to Markdown in parallel?** You can process different presentation files in parallel, but do not share the same [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) instance between threads. Follow the [multithreading guidelines](https://docs.aspose.com/slides/cpp/multithreading/) and use a separate instance for each file. # Convert PowerPoint Presentations to PDF with Notes in C++ > Convert formats PPT and PPTX to PDF with notes using Aspose.Slides for C++. Preserve layouts and speaker notes for professional presentations. Source: https://docs.aspose.com/slides/cpp/convert-powerpoint-to-pdf-with-notes/ Updated: 2026-11-08 ## **Overview** In this article, you will learn how to convert PowerPoint presentations to PDF format with speaker notes using Aspose.Slides. This guide will cover the necessary steps and provide code examples to help you achieve this task efficiently. By the end of this article, you will be able to: - Implement the conversion process to transform PowerPoint slides into PDF documents while preserving the speaker notes. - Customize the output PDF to ensure that the speaker notes are included and formatted according to your requirements. To set the notes page dimensions and orientation before export, see [Notes Page Size](https://docs.aspose.com/slides/cpp/notes-size/). ## **Convert PowerPoint to PDF with Notes** The `Save` method in the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) class can be used to convert a PPT or PPTX presentation to a PDF with speaker notes. With Aspose.Slides, you simply load the presentation, configure the layout options using the [NotesCommentsLayoutingOptions](https://reference.aspose.com/slides/cpp/aspose.slides.export/notescommentslayoutingoptions/) class to include speaker notes, and then save the file as a PDF. The following code snippet demonstrates how to convert a sample presentation to a PDF in Notes Slide view. ```cpp #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(u"sample.pptx"); // Configure PDF options for rendering speaker notes. auto notesOptions = MakeObject(); notesOptions->set_NotesPosition(NotesPositions::BottomFull); // Render speaker notes below the slide. auto pdfOptions = MakeObject(); pdfOptions->set_SlidesLayoutOptions(notesOptions); // Save the presentation to PDF with speaker notes. presentation->Save(u"output.pdf", SaveFormat::Pdf, pdfOptions); ``` You may want to check out the Aspose [Online PowerPoint to PDF Converter](https://products.aspose.app/slides/conversion). [![Actual BottomFull PDF page with the slide above a line reading Speaker note marker, shown again in an enlargement.](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-pdf-with-notes/visual-notes-export-f0ed0501bd93.svg)](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-pdf-with-notes/visual-notes-export-f0ed0501bd93.svg) *This BottomFull PDF places the speaker note below the slide.* ## Related articles - [Note](https://docs.aspose.com/slides/cpp/examples/elements/note/) - [Convert PowerPoint Presentations to TIFF with Notes in C++](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-tiff-with-notes/) - [Convert PowerPoint Presentations in C++ | HTML, PNG, PDF, Word, TIFF](https://docs.aspose.com/slides/cpp/convert-powerpoint/) # Convert PPT and PPTX to PDF in C++ [Advanced Features Included] > Convert PowerPoint PPT/PPTX to high-quality, searchable PDFs in C++ using Aspose.Slides, with fast code examples and advanced conversion options. Source: https://docs.aspose.com/slides/cpp/convert-powerpoint-to-pdf/ Updated: 2026-10-26 ## **Overview** Converting PowerPoint presentations (PPT, PPTX, ODP, etc.) into PDF format in C++ offers several advantages, including compatibility across different devices and preserving the layout and formatting of your presentation. This guide demonstrates how to convert presentations to PDF documents, use various options to control image quality, include hidden slides, password-protect PDF files, detect font substitutions, select specific slides for conversion, and apply compliance standards to output documents. ## **PowerPoint to PDF Conversions** Using Aspose.Slides, you can convert presentations in the following formats to PDF: * **PPT** * **PPTX** * **ODP** To convert a presentation to PDF, pass the file name as an argument to the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) class and then save the presentation as a PDF using a [Save](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/save/) method. The [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) class exposes the [Save](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/save/) method that is typically used to convert a presentation to PDF. Aspose.Slides for C++ inserts its API information and version number into output documents. For example, when converting a presentation to PDF, Aspose.Slides populates the Application field with "*Aspose.Slides*" and the PDF Producer field with a value in "*Aspose.Slides v XX.XX*" form. **Note** that you cannot instruct Aspose.Slides to change or remove this information from output documents. Aspose.Slides allows you to convert: * Entire presentations to PDF * Specific slides from a presentation to PDF Aspose.Slides exports presentations to PDF, ensuring the resulting PDFs closely match the original presentations. Elements and attributes are rendered accurately in the conversion, including: * Images * Text boxes and shapes * Text formatting * Paragraph formatting * Hyperlinks * Headers and footers * Bullets * Tables ## **Convert PowerPoint to PDF** The standard PowerPoint-to-PDF conversion process uses default options. In this case, Aspose.Slides tries to convert the provided presentation to PDF using optimal settings at the maximum quality levels. The following example loads a presentation and saves all visible slides to PDF using the default export settings. ```cpp #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(u"PowerPoint.ppt"); presentation->Save(u"PPT-to-PDF.pdf", SaveFormat::Pdf); presentation->Dispose(); ``` Aspose offers a free online [**PowerPoint to PDF converter**](https://products.aspose.app/slides/conversion/ppt-to-pdf) that demonstrates the presentation-to-PDF conversion process. You can run a test with this converter for a live implementation of the procedure described here. ## **Convert PowerPoint to PDF with Options** Aspose.Slides provides custom options—properties under the [PdfOptions](https://reference.aspose.com/slides/cpp/aspose.slides.export/pdfoptions/) class—that allow you to customize the resulting PDF, lock the PDF with a password, or specify how the conversion process should proceed. ### **Convert PowerPoint to PDF with Custom Options** Using custom conversion options, you can define your preferred quality setting for raster images, specify how metafiles should be handled, set a compression level for text, configure DPI for images, and more. The following example exports a presentation to PDF 1.5 with JPEG quality set to 90, image resolution set to 300 DPI, metafiles saved as PNG, and Flate text compression. ```cpp #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto pdfOptions = MakeObject(); pdfOptions->set_JpegQuality(90); pdfOptions->set_SufficientResolution(300); pdfOptions->set_SaveMetafilesAsPng(true); pdfOptions->set_TextCompression(PdfTextCompression::Flate); pdfOptions->set_Compliance(PdfCompliance::Pdf15); auto presentation = MakeObject(u"PowerPoint.pptx"); presentation->Save(u"PowerPoint-to-PDF.pdf", SaveFormat::Pdf, pdfOptions); presentation->Dispose(); ``` ### **Automatically Select Image Compression** When a presentation contains many photographs or screenshots, reducing the size of the exported PDF can make it easier to email or download. Call [PdfOptions::set_BestImagesCompressionRatio](https://reference.aspose.com/slides/cpp/aspose.slides.export/pdfoptions/set_bestimagescompressionratio/) with `true` to automatically select the most appropriate compression algorithm for each image during PDF export. The following example loads an existing presentation, enables automatic image compression selection, and saves it as a PDF document. All other PDF export settings retain their default values. ```cpp #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto pdfOptions = MakeObject(); pdfOptions->set_BestImagesCompressionRatio(true); auto presentation = MakeObject(u"image-heavy.pptx"); presentation->Save(u"image-heavy.pdf", SaveFormat::Pdf, pdfOptions); presentation->Dispose(); ``` This option selects a compression algorithm for each image. Lowering JPEG quality with [set_JpegQuality](https://reference.aspose.com/slides/cpp/aspose.slides.export/pdfoptions/set_jpegquality/) instead reduces JPEG image quality, while lowering the resolution with [set_SufficientResolution](https://reference.aspose.com/slides/cpp/aspose.slides.export/pdfoptions/set_sufficientresolution/) allows images to be downsampled to a lower resolution, which can reduce detail. Enabling automatic compression selection does not itself lower either of these settings. Selecting image compression algorithms requires additional processing time and memory. The size reduction depends on the presentation's images and export settings; a fixed reduction is not guaranteed for every presentation. ### **Preserve Embedded OLE Files as PDF Attachments** If a presentation contains an embedded Excel workbook, you may want PDF recipients to access the workbook's data as well as view the slides. Call [PdfOptions::set_IncludeOleData](https://reference.aspose.com/slides/cpp/aspose.slides.export/pdfoptions/set_includeoledata/) with `true` to preserve embedded OLE files as attachments in the resulting PDF. The default value is `false`: the OLE object's preview image or icon is rendered on the PDF page, but its embedded file is not included as an attachment. Setting the option to `true` additionally includes the file data. The preview remains a visual representation; the attachment lets recipients open or save the embedded file separately. The OLE object does not become an interactive Excel worksheet on the PDF page. The following example loads a presentation that already contains an embedded Excel workbook and exports it to PDF with the workbook attached. ```cpp #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto pdfOptions = MakeObject(); pdfOptions->set_IncludeOleData(true); auto presentation = MakeObject(u"presentation.pptx"); presentation->Save(u"presentation.pdf", SaveFormat::Pdf, pdfOptions); presentation->Dispose(); ``` To check the result: 1. Open the exported PDF in a viewer that supports file attachments, such as Adobe Acrobat Reader. 2. Open the viewer's **Attachments** panel and locate the embedded workbook. 3. Save the attachment and open it in Excel to inspect its data, or open it directly if the viewer permits it. The preview on the PDF page is separate from the attachment. The PDF/A standards impose restrictions on attachments: PDF/A-1 prohibits embedded files, PDF/A-2 permits only PDF/A attachments, and PDF/A-3 permits other file types, including Excel workbooks. These are requirements of the standards, not restrictions specific to Aspose.Slides. This example uses the default PDF compliance setting and does not demonstrate PDF/A export. ### **Convert PowerPoint to PDF with Hidden Slides** If a presentation contains hidden slides, you can use the [set_ShowHiddenSlides](https://reference.aspose.com/slides/cpp/aspose.slides.export/pdfoptions/set_showhiddenslides/) method from the [PdfOptions](https://reference.aspose.com/slides/cpp/aspose.slides.export/pdfoptions/) class to include the hidden slides as pages in the resulting PDF. The following example exports a presentation to PDF, including any hidden slides. ```cpp #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto pdfOptions = MakeObject(); pdfOptions->set_ShowHiddenSlides(true); auto presentation = MakeObject(u"PowerPoint.pptx"); presentation->Save(u"PowerPoint-to-PDF.pdf", SaveFormat::Pdf, pdfOptions); presentation->Dispose(); ``` ### **Convert PowerPoint to a Password-Protected PDF** The following example exports a presentation to a PDF that requires the password `password` to open. The access permissions allow printing, including high-quality printing. ```cpp #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto pdfOptions = MakeObject(); pdfOptions->set_Password(u"password"); pdfOptions->set_AccessPermissions(PdfAccessPermissions::PrintDocument | PdfAccessPermissions::HighQualityPrint); auto presentation = MakeObject(u"PowerPoint.pptx"); presentation->Save(u"PPTX-to-PDF.pdf", SaveFormat::Pdf, pdfOptions); presentation->Dispose(); ``` ### **Detect Font Substitutions** Aspose.Slides provides the [set_WarningCallback](https://reference.aspose.com/slides/cpp/aspose.slides.export/saveoptions/set_warningcallback/) method under the [PdfOptions](https://reference.aspose.com/slides/cpp/aspose.slides.export/pdfoptions/) class, enabling you to detect font substitutions during the presentation-to-PDF conversion process. The following example exports a presentation to PDF and prints font substitution warnings to the console. A warning is printed only when an unavailable font is substituted during export. ```cpp #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace Aspose::Slides::Warnings; using namespace System; class FontSubstitutionHandler : public IWarningCallback { public: ReturnAction Warning(SharedPtr warning) override { if (warning->get_WarningType() == WarningType::DataLoss && warning->get_Description().StartsWith(u"Font will be substituted")) { Console::WriteLine(u"Font substitution warning: {0}", warning->get_Description()); } return ReturnAction::Continue; } }; auto pdfOptions = MakeObject(); auto warningHandler = MakeObject(); pdfOptions->set_WarningCallback(warningHandler); auto presentation = MakeObject(u"sample.pptx"); presentation->Save(u"output.pdf", SaveFormat::Pdf, pdfOptions); presentation->Dispose(); ``` For more information on font substitution, see the [Font Substitution](https://docs.aspose.com/slides/cpp/font-substitution/) article. ### **Handle Fonts Without a Dedicated Bold Typeface** A presentation can apply bold formatting to text even when its font has no dedicated bold typeface. The text can still appear bold through synthetic bolding, which artificially thickens the regular glyphs. When that text looks too heavy or otherwise differs from the intended appearance in PDF, try calling [PdfOptions::set_RasterizeUnsupportedFontStyles](https://reference.aspose.com/slides/cpp/aspose.slides.export/pdfoptions/set_rasterizeunsupportedfontstyles/) with `true`. This option renders the affected text as a bitmap during PDF export and can improve its appearance for certain fonts. Its default value is `false`. The sample presentation contains two text boxes: one with regular text and one with bold formatting applied to the same font, which has no dedicated bold typeface. The following example loads the presentation, enables rasterization of unsupported font styles, and exports it to PDF: ```cpp #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto pdfOptions = MakeObject(); pdfOptions->set_RasterizeUnsupportedFontStyles(true); auto presentation = MakeObject(u"unsupported-bold.pptx"); presentation->Save(u"rasterized.pdf", SaveFormat::Pdf, pdfOptions); presentation->Dispose(); ``` The following previews show the disabled output and the enabled output. In this example, the bold text has heavier strokes with the option disabled. With the option enabled, its strokes are lighter; the regular text is unchanged. Compare the results before choosing the setting for your presentation. | Option disabled (`false`, the default) | Option enabled (`true`) | |---|---| | ![PDF with unsupported font style rasterization disabled](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-pdf/unsupported-bold-disabled.png) | ![PDF with unsupported font style rasterization enabled](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-pdf/unsupported-bold-enabled.png) | In this example, enabling the option turns only the bold text into a bitmap: it cannot be selected, copied, or searched as text without OCR, and its edges appear softer at 800% zoom. The regular text remains searchable. With the option disabled, both strings remain text. This option rasterizes text formatted as bold when its font has no dedicated bold typeface. [Font substitution](https://docs.aspose.com/slides/cpp/font-substitution/) instead selects another font when the original is unavailable. ## **Convert Selected Slides from PowerPoint to PDF** The following example exports slides 1 and 3 from a presentation to PDF. Slide numbers in this array are one-based, and the input presentation must contain at least three slides. ```cpp #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(u"PowerPoint.pptx"); auto slides = MakeArray({ 1, 3 }); presentation->Save(u"PPTX-to-PDF.pdf", slides, SaveFormat::Pdf); presentation->Dispose(); ``` ## **Convert PowerPoint to PDF with Custom Slide Size** The following example copies the first slide from a presentation into a new presentation with a slide size of 612 × 792 points (8.5 × 11 inches). It scales the slide content to fit and exports the single slide to PDF. ```cpp #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto slideWidth = 612; auto slideHeight = 792; auto presentation = MakeObject(u"SelectedSlides.pptx"); auto resizedPresentation = MakeObject(); resizedPresentation->get_SlideSize()->SetSize(slideWidth, slideHeight, SlideSizeScaleType::EnsureFit); auto slide = presentation->get_Slide(0); resizedPresentation->get_Slides()->InsertClone(0, slide); // Remove the blank slide that the new presentation was created with. resizedPresentation->get_Slides()->RemoveAt(1); resizedPresentation->Save(u"PDF_with_custom_slide_size.pdf", SaveFormat::Pdf); resizedPresentation->Dispose(); presentation->Dispose(); ``` ## **Convert PowerPoint to PDF in Notes Slide View** The following example exports a presentation to PDF, placing each slide's speaker notes below the slide. Use a presentation containing speaker notes to see the result. ```cpp #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto notesOptions = MakeObject(); notesOptions->set_NotesPosition(NotesPositions::BottomFull); auto pdfOptions = MakeObject(); pdfOptions->set_SlidesLayoutOptions(notesOptions); auto presentation = MakeObject(u"NotesFile.pptx"); presentation->Save(u"PDF_with_notes.pdf", SaveFormat::Pdf, pdfOptions); presentation->Dispose(); ``` ## **Accessibility and Compliance Standards for PDF** Aspose.Slides allows you to use a conversion procedure that complies with [Web Content Accessibility Guidelines (**WCAG**)](https://www.w3.org/TR/WCAG-TECHS/pdf.html). You can export a PowerPoint document to PDF using any of these compliance standards: **PDF/A1a**, **PDF/A1b**, and **PDF/UA**. This C++ code demonstrates a PowerPoint-to-PDF conversion process that produces multiple PDFs based on different compliance standards: ```cpp #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(u"pres.pptx"); auto pdfOptionsA1a = MakeObject(); pdfOptionsA1a->set_Compliance(PdfCompliance::PdfA1a); presentation->Save(u"pres-a1a-compliance.pdf", SaveFormat::Pdf, pdfOptionsA1a); auto pdfOptionsA1b = MakeObject(); pdfOptionsA1b->set_Compliance(PdfCompliance::PdfA1b); presentation->Save(u"pres-a1b-compliance.pdf", SaveFormat::Pdf, pdfOptionsA1b); auto pdfOptionsUa = MakeObject(); pdfOptionsUa->set_Compliance(PdfCompliance::PdfUa); presentation->Save(u"pres-ua-compliance.pdf", SaveFormat::Pdf, pdfOptionsUa); presentation->Dispose(); ``` Aspose.Slides supports PDF conversion operations, allowing you to convert PDF files to popular file formats. You can perform [PDF to HTML](https://products.aspose.com/slides/cpp/conversion/pdf-to-html/), [PDF to image](https://products.aspose.com/slides/cpp/conversion/pdf-to-image/), [PDF to JPG](https://products.aspose.com/slides/cpp/conversion/pdf-to-jpg/), and [PDF to PNG](https://products.aspose.com/slides/cpp/conversion/pdf-to-png/) conversions. Other PDF conversion operations to specialized formats—[PDF to SVG](https://products.aspose.com/slides/cpp/conversion/pdf-to-svg/), [PDF to TIFF](https://products.aspose.com/slides/cpp/conversion/pdf-to-tiff/), and [PDF to XML](https://products.aspose.com/slides/cpp/conversion/pdf-to-xml/)—are also supported. > **Note:** When exporting to PDF/UA, Aspose.Slides treats complex graphics such as SmartArt, charts, and formulas as a single figure. Individual path elements are not preserved as separate content and may be marked as artifacts; alternative text is provided only for the whole figure. ## **FAQ** **Can I convert multiple PowerPoint files to PDF in bulk?** Yes, Aspose.Slides supports batch conversion of multiple PPT or PPTX files to PDF. You can iterate through your files and apply the conversion process programmatically. **Is it possible to password-protect the converted PDF?** Yes. Use the [PdfOptions](https://reference.aspose.com/slides/cpp/aspose.slides.export/pdfoptions/) class to set a password and define access permissions during the conversion process. **How do I include hidden slides in the PDF?** Use the [set_ShowHiddenSlides](https://reference.aspose.com/slides/cpp/aspose.slides.export/pdfoptions/set_showhiddenslides/) method in the [PdfOptions](https://reference.aspose.com/slides/cpp/aspose.slides.export/pdfoptions/) class to include hidden slides in the resulting PDF. **Can Aspose.Slides maintain high image quality in the PDF?** Yes, you can control image quality by using methods such as [set_JpegQuality](https://reference.aspose.com/slides/cpp/aspose.slides.export/pdfoptions/set_jpegquality/) and [set_SufficientResolution](https://reference.aspose.com/slides/cpp/aspose.slides.export/pdfoptions/set_sufficientresolution/) in the [PdfOptions](https://reference.aspose.com/slides/cpp/aspose.slides.export/pdfoptions/) class to ensure high-quality images in your PDF. **Does Aspose.Slides support PDF/A compliance standards?** Yes, Aspose.Slides allows you to export PDFs that comply with various standards, including PDF/A1a, PDF/A1b, and PDF/UA, ensuring your documents meet accessibility and archival requirements. ## **Additional Resources** - [Aspose.Slides for C++ Documentation](https://docs.aspose.com/slides/cpp/) - [Aspose.Slides for C++ API Reference](https://reference.aspose.com/slides/cpp/) - [Aspose Free Online Converters](https://products.aspose.app/slides/conversion) Related feature: [Export presentations to PDF](https://docs.aspose.com/slides/features/pdf-export/). # Convert PowerPoint Slides to PNG in C++ > Convert PowerPoint presentations to high-quality PNG images quickly with Aspose.Slides for C++, ensuring precise, automated results. Source: https://docs.aspose.com/slides/cpp/convert-powerpoint-to-png/ Updated: 2026-10-14 ## **Overview** This article explains how to convert presentation slides to PNG images using Aspose.Slides for C++. You can load presentations in formats such as PPT, PPTX, and ODP, render each slide, and save it as a separate PNG image. The examples below demonstrate rendering at the default scale, increasing the scale, specifying the output dimensions in pixels, and choosing a gradient rendering style. ## **Convert PowerPoint to PNG** Load a presentation with the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) class and access its slides through the [Presentation::get_Slide](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/get_slide/) accessor. The example renders every slide with [ISlide::GetImage](https://reference.aspose.com/slides/cpp/aspose.slides/islide/getimage/) without parameters to create a thumbnail. It then calls [IImage::Save](https://reference.aspose.com/slides/cpp/aspose.slides/iimage/save/) with [ImageFormat::Png](https://reference.aspose.com/slides/cpp/aspose.slides/imageformat/) to save each rendered slide as a PNG image. ```cpp #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto presentation = MakeObject(u"presentation.pptx"); auto slideCount = presentation->get_Slides()->get_Count(); for (auto index = 0; index < slideCount; index++) { auto slide = presentation->get_Slide(index); auto image = slide->GetImage(); image->Save(String::Format(u"slide_{0}.png", index), ImageFormat::Png); image->Dispose(); } presentation->Dispose(); ``` The parameterless [ISlide::GetImage](https://reference.aspose.com/slides/cpp/aspose.slides/islide/getimage/) overload renders at a scale of 0.2. For example, a slide measuring 720 × 540 points produces a 144 × 108 pixel thumbnail. To control the output dimensions, use the overloads with scale factors or an explicit image size shown below. ## **Convert PowerPoint to PNG With Custom Dimensions** Pass horizontal and vertical scale factors to [ISlide::GetImage](https://reference.aspose.com/slides/cpp/aspose.slides/islide/getimage/) to control the rendered dimensions. In this example, both factors are 2, so a slide measuring 720 × 540 points produces a 1440 × 1080 pixel image. Equal scale factors preserve the slide's aspect ratio. Each image is saved in PNG format with [IImage::Save](https://reference.aspose.com/slides/cpp/aspose.slides/iimage/save/). ```cpp #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto presentation = MakeObject(u"presentation.pptx"); auto scaleX = 2.f; auto scaleY = scaleX; auto slideCount = presentation->get_Slides()->get_Count(); for (auto index = 0; index < slideCount; index++) { auto slide = presentation->get_Slide(index); auto image = slide->GetImage(scaleX, scaleY); image->Save(String::Format(u"slide_{0}.png", index), ImageFormat::Png); image->Dispose(); } presentation->Dispose(); ``` ## **Convert PowerPoint to PNG With Custom Size** To specify output dimensions in pixels, pass a size to [ISlide::GetImage](https://reference.aspose.com/slides/cpp/aspose.slides/islide/getimage/) instead of scale factors. This example renders every slide at 960 × 720 pixels and saves the result with [IImage::Save](https://reference.aspose.com/slides/cpp/aspose.slides/iimage/save/). Choose dimensions that match the slide's aspect ratio to avoid stretching the image. ```cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto presentation = MakeObject(u"presentation.pptx"); auto imageSize = System::Drawing::Size(960, 720); auto slideCount = presentation->get_Slides()->get_Count(); for (auto index = 0; index < slideCount; index++) { auto slide = presentation->get_Slide(index); auto image = slide->GetImage(imageSize); image->Save(String::Format(u"slide_{0}.png", index), ImageFormat::Png); image->Dispose(); } presentation->Dispose(); ``` ## **Choose a Gradient Rendering Style** Suppose a slide contains gradient fills, but the transitions in the exported PNG look lighter or otherwise different from what you see in PowerPoint. You can use the [SaveOptions::set_GradientStyle](https://reference.aspose.com/slides/cpp/aspose.slides.export/saveoptions/set_gradientstyle/) method of [RenderingOptions](https://reference.aspose.com/slides/cpp/aspose.slides.export/renderingoptions/) to choose how the gradients are rendered. Download [gradient-styles.pptx](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-png/gradient-styles.pptx) and place it in the application's working directory. Its first slide contains two linear gradients: cyan to orange at the top and blue to yellow at the bottom. Each gradient has two stops, at 0% and 100%. The following example loads this presentation and renders the same first slide in both modes with [ISlide::GetImage](https://reference.aspose.com/slides/cpp/aspose.slides/islide/getimage/). ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(u"gradient-styles.pptx"); auto slide = presentation->get_Slide(0); auto gradientStyles = { GradientStyle::Default, GradientStyle::PowerPointUI }; for (auto style : gradientStyles) { auto options = MakeObject(); options->set_GradientStyle(style); auto image = slide->GetImage(options, 1.f, 1.f); auto styleName = style == GradientStyle::Default ? u"Default" : u"PowerPointUI"; image->Save(String::Format(u"gradient-{0}.png", styleName), ImageFormat::Png); image->Dispose(); } presentation->Dispose(); ``` The images below show the output from the same slide, with both gradients in each image: | Default | PowerPointUI | | --- | --- | | ![Cyan-to-orange and blue-to-yellow gradients rendered with Default](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-png/gradient-Default.png) | ![The same gradients rendered with PowerPointUI](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-png/gradient-PowerPointUI.png) | In this example, `Default` produces lighter intermediate colors, while `PowerPointUI` produces darker intermediate colors. The difference depends on the colors and stops in the gradient. Choose `Default` when the standard Aspose.Slides output suits your needs. Try `PowerPointUI` when your priority is matching the appearance in PowerPoint. Compare both outputs with your intended result; neither mode is universally preferable. ## **FAQ** **How can I export a specific shape, such as a chart or picture, instead of the entire slide?** Aspose.Slides supports [generating thumbnails for individual shapes](https://docs.aspose.com/slides/cpp/shape-thumbnails/), allowing you to render a shape as a PNG image. **Is parallel conversion supported on a server?** Yes. Use a separate presentation instance for each thread or process; [do not share a single instance across threads](https://docs.aspose.com/slides/cpp/multithreading/). **What are the evaluation limitations when exporting to PNG?** Evaluation mode adds a watermark to output images and applies [other restrictions](https://docs.aspose.com/slides/cpp/licensing/) until a license is applied. # Convert PowerPoint Presentations to SWF Flash in C++ > Convert PowerPoint (PPT/PPTX) to SWF Flash in C++ with Aspose.Slides. Step‑by‑step code samples, fast quality output, no PowerPoint automation. Source: https://docs.aspose.com/slides/cpp/convert-powerpoint-to-swf-flash/ Updated: 2026-08-05 ## **Overview** This article explains how to convert PowerPoint presentations to SWF by using Aspose.Slides. It shows how to save a presentation as an SWF file with the [Presentation::Save](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/save/) method and how to configure the export with [SwfOptions](https://reference.aspose.com/slides/cpp/aspose.slides.export/swfoptions/), including viewer settings and notes or comments layout. ## **Convert Presentations to Flash** The [Save](https://reference.aspose.com/slides/cpp/class/aspose.slides.presentation#afcd59ec697bf05c10f78c3869de2ec9e) method exposed by [Presentation](https://reference.aspose.com/slides/cpp/class/aspose.slides.presentation) class can be used to convert the whole presentation into SWF document.  You can also include comments in generated SWF by using [SWFOptions](https://reference.aspose.com/slides/cpp/class/aspose.slides.export.swf_options) class and [NotesCommentsLayoutingOptions](https://reference.aspose.com/slides/cpp/aspose.slides.export/notescommentslayoutingoptions/) class. The following example shows how to convert a presentation into SWF document by using options provided by SWFOptions class. ``` cpp #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; // Instantiate a Presentation object that represents a presentation file auto presentation = System::MakeObject(u"HelloWorld.pptx"); auto swfOptions = System::MakeObject(); swfOptions->set_ViewerIncluded(false); auto notesOptions = System::MakeObject(); notesOptions->set_NotesPosition(NotesPositions::BottomFull); swfOptions->set_SlidesLayoutOptions(notesOptions); // Saving presentation and notes pages presentation->Save(u"SaveAsSwf_out.swf", SaveFormat::Swf, swfOptions); swfOptions->set_ViewerIncluded(true); presentation->Save(u"SaveNotes_out.swf", SaveFormat::Swf, swfOptions); ``` ## **FAQ** ### Can I include hidden slides in the SWF? Yes. Use the [set_ShowHiddenSlides](https://reference.aspose.com/slides/cpp/aspose.slides.export/swfoptions/set_showhiddenslides/) method in [SwfOptions](https://reference.aspose.com/slides/cpp/aspose.slides.export/swfoptions/). By default, hidden slides are not exported. ### How can I control compression and the final SWF size? Use the [set_Compressed](https://reference.aspose.com/slides/cpp/aspose.slides.export/swfoptions/set_compressed/) method and adjust [JPEG quality](https://reference.aspose.com/slides/cpp/aspose.slides.export/swfoptions/set_jpegquality/) to balance file size and image fidelity. ### What is 'set_ViewerIncluded' for, and when should I use it? [set_ViewerIncluded](https://reference.aspose.com/slides/cpp/aspose.slides.export/swfoptions/set_viewerincluded/) adds an embedded player UI (navigation controls, panels, search). Disable it if you plan to use your own player or need a bare SWF frame without UI. ### What happens if a source font is missing on the export machine? Aspose.Slides will substitute the font you specify via [set_DefaultRegularFont](https://reference.aspose.com/slides/cpp/aspose.slides.export/saveoptions/set_defaultregularfont/) in [SwfOptions](https://reference.aspose.com/slides/cpp/aspose.slides.export/swfoptions/) to avoid an unintended fallback. ## Related articles - [Extract Flash Objects from Presentations in C++](https://docs.aspose.com/slides/cpp/flash/) # Convert PowerPoint Presentations to TIFF with Notes in C++ > Convert PowerPoint presentations to TIFF with notes using Aspose.Slides for C++. Learn how to export slides with speaker notes efficiently. Source: https://docs.aspose.com/slides/cpp/convert-powerpoint-to-tiff-with-notes/ Updated: 2026-08-13 ## **Introduction** Aspose.Slides for C++ provides a simple solution for converting PowerPoint and OpenDocument presentations (PPT, PPTX, and ODP) with notes to the TIFF format. This format is widely used for high-quality image storage, printing, and document archiving. With Aspose.Slides, you can not only export entire presentations with speaker notes but also generate slide thumbnails in the Notes Slide view. The conversion process is simple and efficient, utilizing the `Save` method of the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) class to transform the entire presentation into a series of TIFF images while preserving the notes and layout. ## **Convert a Presentation to TIFF with Notes** Saving a PowerPoint or OpenDocument presentation to TIFF with notes using Aspose.Slides for C++ involves the following steps: 1. Instantiate the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) class: Load a PowerPoint or OpenDocument file. 1. Configure the output layout options: Use the [NotesCommentsLayoutingOptions](https://reference.aspose.com/slides/cpp/aspose.slides.export/notescommentslayoutingoptions/) class to specify how notes and comments should be displayed. 1. Save the presentation to TIFF: Pass the configured options to the [Save](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/save/) method. Let's say we have a "speaker_notes.pptx" file with the following slide: ![The presentation slide with speaker notes](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-tiff-with-notes/slide_with_notes.png) The code snippet below demonstrates how to convert the presentation to a TIFF image in Notes Slide view using the [set_SlidesLayoutOptions](https://reference.aspose.com/slides/cpp/aspose.slides.export/tiffoptions/set_slideslayoutoptions/) method. ```cpp #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; // Instantiate the Presentation class that represents a presentation file. auto presentation = MakeObject(u"speaker_notes.pptx"); auto notesOptions = MakeObject(); notesOptions->set_NotesPosition(NotesPositions::BottomFull); // Display the notes below the slide. // Configure the TIFF options with Notes layouting. auto tiffOptions = MakeObject(); tiffOptions->set_DpiX(300); tiffOptions->set_DpiY(300); tiffOptions->set_SlidesLayoutOptions(notesOptions); // Save the presentation to TIFF with the speaker notes. presentation->Save(u"TIFF_with_notes.tiff", SaveFormat::Tiff, tiffOptions); presentation->Dispose(); ``` The result: ![The TIFF image with speaker notes](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-tiff-with-notes/TIFF_with_notes.png) Check out Aspose [Free PowerPoint to Poster Converter](https://products.aspose.app/slides/conversion/convert-ppt-to-poster-online). ## **FAQ** ### Can I control the position of the notes area in the resulting TIFF? Yes. Use the [notes layout settings](https://reference.aspose.com/slides/cpp/aspose.slides.export/tiffoptions/set_slideslayoutoptions/) to choose among options like `None`, `BottomTruncated`, or `BottomFull`, which respectively hide notes, fit them into a single page, or allow them to flow onto additional pages. ### How can I reduce the size of a TIFF file with notes without visible loss of quality? Pick an [efficient compression](https://reference.aspose.com/slides/cpp/aspose.slides.export/tiffoptions/set_compressiontype/) (e.g., `LZW` or `RLE`), set a reasonable DPI, and, if acceptable, use a lower [pixel format](https://reference.aspose.com/slides/cpp/aspose.slides.export/tiffoptions/set_pixelformat/) (such as 8 bpp or 1 bpp for monochrome). Slightly reducing the [image dimensions](https://reference.aspose.com/slides/cpp/aspose.slides.export/tiffoptions/set_imagesize/) can also help without noticeably hurting readability. ### Does the font in the notes affect the result if the original fonts are missing from the system? Yes. Missing fonts trigger [substitution](https://docs.aspose.com/slides/cpp/font-selection-sequence/), which can change text metrics and appearance. To avoid this, [supply the required fonts](https://docs.aspose.com/slides/cpp/custom-font/) or set a default [fallback font](https://docs.aspose.com/slides/cpp/fallback-font/) so the intended typefaces are used. ## Related articles - [Convert PowerPoint Presentations to PDF with Notes in C++](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-pdf-with-notes/) - [Convert Presentation Slides to Images in C++](https://docs.aspose.com/slides/cpp/convert-slide/) - [Convert PowerPoint Presentations to TIFF in C++](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-tiff/) # Convert PowerPoint Presentations to TIFF in C++ > Learn how to easily convert PowerPoint (PPT, PPTX) presentations to high-quality TIFF images using Aspose.Slides for C++, with code examples. Source: https://docs.aspose.com/slides/cpp/convert-powerpoint-to-tiff/ Updated: 2026-08-25 ## **Introduction** TIFF (**Tagged Image File Format**) is a widely-used, lossless raster image format known for its exceptional quality and detailed preservation of graphics. Designers, photographers, and desktop publishers often choose TIFF to maintain layers, color accuracy, and original settings in their images. Using Aspose.Slides, you can effortlessly convert your PowerPoint slides (PPT, PPTX) and OpenDocument slides (ODP) directly into high-quality TIFF images, ensuring your presentations retain maximum visual fidelity. ## **Convert a Presentation to TIFF** Using the [Save](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/save/) method provided by the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) class, you can quickly convert an entire PowerPoint presentation to TIFF. The resulting TIFF images correspond to the default slide size. This C++ code demonstrates how to convert a PowerPoint presentation to TIFF: ```cpp #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; // Instantiate the Presentation class that represents a presentation file (PPT, PPTX, ODP, etc.). auto presentation = MakeObject(u"Demo_File.pptx"); // Save the presentation as TIFF. presentation->Save(u"Output.tiff", SaveFormat::Tiff); presentation->Dispose(); ``` ## **Convert a Presentation to Black-and-White TIFF** The method [set_BwConversionMode](https://reference.aspose.com/slides/cpp/aspose.slides.export/tiffoptions/set_bwconversionmode/) in the [TiffOptions](https://reference.aspose.com/slides/cpp/aspose.slides.export/tiffoptions/) class allows you to specify the algorithm used when converting a colored slide or image to a black-and-white TIFF. Note that this setting applies only when the [set_CompressionType](https://reference.aspose.com/slides/cpp/aspose.slides.export/tiffoptions/set_compressiontype/) method is set to `CCITT4` or `CCITT3`. [TiffOptions::set_BwConversionMode](https://reference.aspose.com/slides/cpp/aspose.slides.export/tiffoptions/set_bwconversionmode/) is an export-level setting that selects a pixel-conversion algorithm for the complete TIFF image. To define how an individual shape should appear when black-and-white display mode is active, use [IShape::set_BlackWhiteMode](https://reference.aspose.com/slides/cpp/aspose.slides/ishape/set_blackwhitemode/). See [Control Black-and-White Rendering for Shapes](https://docs.aspose.com/slides/cpp/shape-formatting/#control-black-and-white-rendering-for-shapes) for examples. Let's say we have a "sample.pptx" file with the following slide: ![A presentation slide](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-tiff/slide_black_and_white.png) This C++ code demonstrates how to convert the colored slide to a black-and-white TIFF: ```cpp #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto tiffOptions = MakeObject(); tiffOptions->set_CompressionType(TiffCompressionTypes::CCITT4); tiffOptions->set_BwConversionMode(BlackWhiteConversionMode::Dithering); auto presentation = MakeObject(u"sample.pptx"); presentation->Save(u"output.tiff", SaveFormat::Tiff, tiffOptions); presentation->Dispose(); ``` The result: ![Black-and-White TIFF](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-tiff/TIFF_black_and_white.png) ## **Convert a Presentation to TIFF with Custom Size** If you require a TIFF image with specific dimensions, you can set your desired values using methods available in [TiffOptions](https://reference.aspose.com/slides/cpp/aspose.slides.export/tiffoptions/). For instance, the [set_ImageSize](https://reference.aspose.com/slides/cpp/aspose.slides.export/tiffoptions/set_imagesize/) method allows you to define the size of the resulting image. This C++ code demonstrates how to convert a PowerPoint presentation to TIFF images with a custom size: ```cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; // Instantiate the Presentation class that represents a presentation file (PPT, PPTX, ODP, etc.). auto presentation = MakeObject(u"sample.pptx"); auto tiffOptions = MakeObject(); // Set the compression type. tiffOptions->set_CompressionType(TiffCompressionTypes::Default); /* Compression types: Default - Specifies the default compression scheme (LZW). None - Specifies no compression. CCITT3 CCITT4 LZW RLE */ // The depth depends on the compression type and cannot be set manually. // Set the image DPI. tiffOptions->set_DpiX(200); tiffOptions->set_DpiY(200); // Set the image size. tiffOptions->set_ImageSize(System::Drawing::Size(1728, 1078)); auto notesOptions = MakeObject(); notesOptions->set_NotesPosition(NotesPositions::BottomFull); tiffOptions->set_SlidesLayoutOptions(notesOptions); // Save the presentation as TIFF with the specified size. presentation->Save(u"custom_size.tiff", SaveFormat::Tiff, tiffOptions); presentation->Dispose(); ``` ## **Convert a Presentation to TIFF with Custom Image Pixel Format** Using the [set_PixelFormat](https://reference.aspose.com/slides/cpp/aspose.slides.export/tiffoptions/set_pixelformat/) method from the [TiffOptions](https://reference.aspose.com/slides/cpp/aspose.slides.export/tiffoptions/) class, you can specify your preferred pixel format for the resulting TIFF image. This C++ code demonstrates how to convert a PowerPoint presentation to a TIFF image with a custom pixel format: ```cpp #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; // Instantiate the Presentation class that represents a presentation file (PPT, PPTX, ODP, etc.). auto presentation = MakeObject(u"Demo_File.pptx"); auto tiffOptions = MakeObject(); tiffOptions->set_PixelFormat(ImagePixelFormat::Format8bppIndexed); /* ImagePixelFormat contains the following values (as stated in the documentation): Format1bppIndexed - 1 bit per pixel, indexed. Format4bppIndexed - 4 bits per pixel, indexed. Format8bppIndexed - 8 bits per pixel, indexed. Format24bppRgb - 24 bits per pixel, RGB. Format32bppArgb - 32 bits per pixel, ARGB. */ // Save the presentation as TIFF with the specified image size. presentation->Save(u"Custom_Image_Pixel_Format.tiff", SaveFormat::Tiff, tiffOptions); presentation->Dispose(); ``` Check out Aspose's [FREE PowerPoint to Poster converter](https://products.aspose.app/slides/conversion/convert-ppt-to-poster-online). ## **FAQ** **Can I convert an individual slide instead of entire PowerPoint presentation to TIFF?** Yes. Aspose.Slides allows you to convert individual slides from PowerPoint and OpenDocument presentations into TIFF images separately. **Is there any limit to the number of slides when converting a presentation to TIFF?** No, Aspose.Slides does not impose any restrictions on the number of slides. You can convert presentations of any size into TIFF format. **Are PowerPoint animations and transition effects preserved when converting slides to TIFF?** No, TIFF is a static image format. Therefore, animations and transition effects are not preserved; only static snapshots of slides are exported. ## Related articles - [Convert Presentation Slides to Images in C++](https://docs.aspose.com/slides/cpp/convert-slide/) - [Convert PowerPoint Presentations to TIFF with Notes in C++](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-tiff-with-notes/) # Convert PowerPoint Presentations to Video in C++ > Learn how to convert PowerPoint presentations to video in C++. Discover sample code and automation techniques to streamline your workflow. Source: https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/ Updated: 2026-11-08 ## **Introduction** By converting your PowerPoint presentation to video, you get * **Increase in accessibility:** All devices (regardless of platform) are equipped with video players by default compared to presentation-opening applications, so users find it easier to open or play videos. * **More reach:** Through videos, you can reach a large audience and target them with information that might otherwise seem tedious in a presentation. Most surveys and statistics suggest that people watch and consume videos more than other forms of content, and they generally prefer such content. In [Aspose.Slides 22.11](https://docs.aspose.com/slides/cpp/aspose-slides-for-cpp-22-11-release-notes/), we implemented support for presentation to video conversion. * Use Aspose.Slides to generate a set of frames (from the presentation slides) that correspond to a certain FPS (frames per second) * Use a third-party utility like `ffmpeg` to create a video based on the frames. ## **Convert a PowerPoint Presentation to Video** 1. Download ffmpeg [here](https://ffmpeg.org/download.html). 2. Add path to `ffmpeg.exe` to environment variable `PATH`. 3. Run the PowerPoint to video code. This C++ code shows you how to convert a presentation (containing a figure and two animation effects) to a video: ```c++ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Animation; using namespace Aspose::Slides::Export; void OnFrameTick(System::SharedPtr sender, System::SharedPtr args) { System::String fileName = System::String::Format(u"frame_{0}.png", sender->get_FrameIndex()); args->GetFrame()->Save(fileName); } void Run() { auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); // Adds a smile shape and then animates it System::SharedPtr smile = slide->get_Shapes()->AddAutoShape(ShapeType::SmileyFace, 110.0f, 20.0f, 500.0f, 500.0f); auto sequence = slide->get_Timeline()->get_MainSequence(); System::SharedPtr effectIn = sequence->AddEffect(smile, EffectType::Fly, EffectSubtype::TopLeft, EffectTriggerType::AfterPrevious); System::SharedPtr effectOut = sequence->AddEffect(smile, EffectType::Fly, EffectSubtype::BottomRight, EffectTriggerType::AfterPrevious); effectIn->get_Timing()->set_Duration(2.0f); effectOut->set_PresetClassType(EffectPresetClassType::Exit); const int32_t fps = 33; auto animationsGenerator = System::MakeObject(presentation); auto player = System::MakeObject(animationsGenerator, fps); player->FrameTick += OnFrameTick; animationsGenerator->Run(presentation->get_Slides()); const System::String ffmpegParameters = System::String::Format( u"-loglevel {0} -framerate {1} -i {2} -y -c:v {3} -pix_fmt {4} {5}", u"warning", fps, u"frame_%d.png", u"libx264", u"yuv420p", u"video.mp4"); auto ffmpegProcess = System::Diagnostics::Process::Start(u"ffmpeg", ffmpegParameters); ffmpegProcess->WaitForExit(); } ``` [![Presentation animation data is rendered to numbered PNGs, then a separate encoder writes the selected video format with coordinated frame rates.](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/visual-convert-powerpoint-to-video-f34cee01f867.svg)](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/visual-convert-powerpoint-to-video-f34cee01f867.svg) *The animation workflow produces frames; a separate encoder writes the video file. Coordinate its image-sequence input and output rates with rendering to preserve intended pacing. Frame APIs and output formats vary by platform.* ## **Video Effects** You can apply animations to objects on slides and use transitions between slides. You may want to see these articles: [PowerPoint Animation](https://docs.aspose.com/slides/cpp/powerpoint-animation/), [Shape Animation](https://docs.aspose.com/slides/cpp/shape-animation/), and [Shape Effect](https://docs.aspose.com/slides/cpp/shape-effect/). Animations and transitions make slideshows more engaging and interesting—and they do the same thing for videos. Let's add another slide and transition to the code for the previous presentation: ```c++ #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::SlideShow; // Adds a smile shape and animates it as shown above auto presentation = System::MakeObject(); // Adds a new slide and animated transition System::SharedPtr newSlide = presentation->get_Slides()->AddEmptySlide(presentation->get_Slide(0)->get_LayoutSlide()); System::SharedPtr slideBackground = newSlide->get_Background(); slideBackground->set_Type(BackgroundType::OwnBackground); auto fillFormat = slideBackground->get_FillFormat(); fillFormat->set_FillType(FillType::Solid); fillFormat->get_SolidFillColor()->set_Color(System::Drawing::Color::get_Indigo()); newSlide->get_SlideShowTransition()->set_Type(TransitionType::Push); ``` Aspose.Slides also supports animation for texts. So we animate paragraphs on objects, which will appear one after the other (with the delay set to a second): ```c++ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Animation; using namespace Aspose::Slides::Export; void OnFrameTick(System::SharedPtr sender, System::SharedPtr args) { System::String fileName = System::String::Format(u"frame_{0}.png", sender->get_FrameIndex()); args->GetFrame()->Save(fileName); } void Run() { auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); // Adds text and animations System::SharedPtr autoShape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 210.0f, 120.0f, 300.0f, 300.0f); System::SharedPtr para1 = System::MakeObject(); para1->get_Portions()->Add(System::MakeObject(u"Aspose Slides for C++")); System::SharedPtr para2 = System::MakeObject(); para2->get_Portions()->Add(System::MakeObject(u"convert PowerPoint Presentation with text to video")); System::SharedPtr para3 = System::MakeObject(); para3->get_Portions()->Add(System::MakeObject(u"paragraph by paragraph")); auto paragraphs = autoShape->get_TextFrame()->get_Paragraphs(); paragraphs->Add(para1); paragraphs->Add(para2); paragraphs->Add(para3); paragraphs->Add(System::MakeObject()); auto sequence = slide->get_Timeline()->get_MainSequence(); System::SharedPtr effect = sequence->AddEffect(para1, EffectType::Appear, EffectSubtype::None, EffectTriggerType::AfterPrevious); System::SharedPtr effect2 = sequence->AddEffect(para2, EffectType::Appear, EffectSubtype::None, EffectTriggerType::AfterPrevious); System::SharedPtr effect3 = sequence->AddEffect(para3, EffectType::Appear, EffectSubtype::None, EffectTriggerType::AfterPrevious); System::SharedPtr effect4 = sequence->AddEffect(para3, EffectType::Appear, EffectSubtype::None, EffectTriggerType::AfterPrevious); effect->get_Timing()->set_TriggerDelayTime(1.0f); effect2->get_Timing()->set_TriggerDelayTime(1.0f); effect3->get_Timing()->set_TriggerDelayTime(1.0f); effect4->get_Timing()->set_TriggerDelayTime(1.0f); // Converts frames to video const int32_t fps = 33; auto animationsGenerator = System::MakeObject(presentation); auto player = System::MakeObject(animationsGenerator, fps); player->FrameTick += OnFrameTick; animationsGenerator->Run(presentation->get_Slides()); const System::String ffmpegParameters = System::String::Format( u"-loglevel {0} -framerate {1} -i {2} -y -c:v {3} -pix_fmt {4} {5}", u"warning", fps, u"frame_%d.png", u"libx264", u"yuv420p", u"video.mp4"); auto ffmpegProcess = System::Diagnostics::Process::Start(u"ffmpeg", ffmpegParameters); ffmpegProcess->WaitForExit(); } ``` ## **Video Conversion Classes** To allow you to perform PowerPoint to video conversion tasks, Aspose.Slides provides the [PresentationAnimationsGenerator](https://reference.aspose.com/slides/cpp/class/aspose.slides.export.presentation_animations_generator/) and [PresentationPlayer](https://reference.aspose.com/slides/cpp/class/aspose.slides.export.presentation_player/) classes. PresentationAnimationsGenerator allows you to set the frame size for the video (that will be created later) through its constructor. If you pass an instance of the presentation, `Presentation.SlideSize` will be used and it generates animations that [PresentationPlayer](https://reference.aspose.com/slides/cpp/class/aspose.slides.export.presentation_player/) uses. When animations are generated, a `NewAnimation` event is generated for each subsequent animation, which has the [IPresentationAnimationPlayer](https://reference.aspose.com/slides/cpp/class/aspose.slides.export.i_presentation_animation_player/) parameter. The latter is a class that represents a player for a separate animation. To work with [IPresentationAnimationPlayer](https://reference.aspose.com/slides/cpp/class/aspose.slides.export.i_presentation_animation_player/), the [get_Duration](https://reference.aspose.com/slides/cpp/class/aspose.slides.export.i_presentation_animation_player#a29881d28eb42f345ab130d52f05a2d91) (the full duration of the animation) property and [SetTimePosition](https://reference.aspose.com/slides/cpp/class/aspose.slides.export.i_presentation_animation_player#a29cb11a73e3ad5f645626fcee3bc4ea0) method are used. Each animation position is set within the *0 to duration* range, and then the `GetFrame` method will return a Bitmap that corresponds to the animation state at that moment. ```c++ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Animation; using namespace Aspose::Slides::Export; void OnNewAnimation(System::SharedPtr animationPlayer) { System::Console::WriteLine(u"Total animation duration: {0}", animationPlayer->get_Duration()); animationPlayer->SetTimePosition(0); // initial animation state System::SharedPtr image = animationPlayer->GetFrame(); // initial animation state bitmap animationPlayer->SetTimePosition(animationPlayer->get_Duration()); // final state of the animation System::SharedPtr lastImage = animationPlayer->GetFrame(); // last frame of the animation lastImage->Save(u"last.png"); } void Run() { auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); // Adds a smile shape and animates it System::SharedPtr smile = slide->get_Shapes()->AddAutoShape(ShapeType::SmileyFace, 110.0f, 20.0f, 500.0f, 500.0f); auto sequence = slide->get_Timeline()->get_MainSequence(); System::SharedPtr effectIn = sequence->AddEffect(smile, EffectType::Fly, EffectSubtype::TopLeft, EffectTriggerType::AfterPrevious); System::SharedPtr effectOut = sequence->AddEffect(smile, EffectType::Fly, EffectSubtype::BottomRight, EffectTriggerType::AfterPrevious); effectIn->get_Timing()->set_Duration(2.0f); effectOut->set_PresetClassType(EffectPresetClassType::Exit); auto animationsGenerator = System::MakeObject(presentation); animationsGenerator->NewAnimation += OnNewAnimation; } ``` To make all animations in a presentation play at once, the [PresentationPlayer](https://reference.aspose.com/slides/cpp/class/aspose.slides.export.presentation_player/) class is used. This class takes a [PresentationAnimationsGenerator](https://reference.aspose.com/slides/cpp/class/aspose.slides.export.presentation_animations_generator/) instance and FPS for effects in its constructor and then calls the `FrameTick` event for all the animations to get them played: ```c++ #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; void OnFrameTick(System::SharedPtr sender, System::SharedPtr args) { System::String fileName = System::String::Format(u"frame_{0}.png", sender->get_FrameIndex()); args->GetFrame()->Save(fileName); } void Run() { auto presentation = System::MakeObject(u"animated.pptx"); auto animationsGenerator = System::MakeObject(presentation); auto player = System::MakeObject(animationsGenerator, 33); player->FrameTick += OnFrameTick; animationsGenerator->Run(presentation->get_Slides()); } ``` Then the generated frames can be compiled to produce a video. See the [Convert PowerPoint to Video](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/#convert-powerpoint-to-video) section. ## **Supported Animations and Effects** **Entrance**: | Animation Type | Aspose.Slides | PowerPoint | |---|---|---| | **Appear** | ![not supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/x.png) | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | | **Fade** | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | | **Fly In** | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | | **Float In** | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | | **Split** | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | | **Wipe** | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | | **Shape** | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | | **Wheel** | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | | **Random Bars** | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | | **Grow & Turn** | ![not supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/x.png) | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | | **Zoom** | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | | **Swivel** | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | | **Bounce** | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | **Emphasis**: | Animation Type | Aspose.Slides | PowerPoint | |---|---|---| | **Pulse** | ![not supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/x.png) | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | | **Color Pulse** | ![not supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/x.png) | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | | **Teeter** | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | | **Spin** | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | | **Grow/Shrink** | ![not supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/x.png) | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | | **Desaturate** | ![not supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/x.png) | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | | **Darken** | ![not supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/x.png) | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | | **Lighten** | ![not supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/x.png) | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | | **Transparency** | ![not supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/x.png) | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | | **Object Color** | ![not supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/x.png) | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | | **Complementary Color** | ![not supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/x.png) | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | | **Line Color** | ![not supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/x.png) | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | | **Fill Color** | ![not supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/x.png) | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | **Exit**: | Animation Type | Aspose.Slides | PowerPoint | |---|---|---| | **Disappear** | ![not supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/x.png) | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | | **Fade** | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | | **Fly Out** | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | | **Float Out** | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | | **Split** | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | | **Wipe** | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | | **Shape** | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | | **Random Bars** | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | | **Shrink & Turn** | ![not supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/x.png) | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | | **Zoom** | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | | **Swivel** | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | | **Bounce** | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | **Motion Paths:** | Animation Type | Aspose.Slides | PowerPoint | |---|---|---| | **Lines** | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | | **Arcs** | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | | **Turns** | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | | **Shapes** | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | | **Loops** | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | | **Custom Path** | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | ![supported](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/v.png) | ## **FAQ** ### Is it possible to convert presentations that are password protected? Yes, Aspose.Slides allows working with [password-protected presentations](https://docs.aspose.com/slides/cpp/password-protected-presentation/). When processing such files, you need to provide the correct password so that the library can access the content of the presentation. ### Does Aspose.Slides support usage in cloud solutions? Yes, Aspose.Slides can be integrated into cloud applications and services. The library is designed to work in server environments, ensuring high performance and scalability for batch processing of files. ### Are there any size limitations for presentations during conversion? Aspose.Slides is capable of handling presentations of virtually any size. However, when working with very large files, additional system resources may be required, and it is sometimes recommended to optimize the presentation to improve performance. # Convert PowerPoint Presentations to Word Documents in C++ > Convert PowerPoint PPT and PPTX slides to editable Word documents in C++ using Aspose.Slides with precise layout, images and formatting preserved. Source: https://docs.aspose.com/slides/cpp/convert-powerpoint-to-word/ Updated: 2026-08-13 ## **Introduction** If you plan to use textual content or information from a presentation (PPT or PPTX) in new ways, you may benefit from converting the presentation to Word (DOC or DOCX). * When compared to Microsoft PowerPoint, the Microsoft Word app is more equipped with tools or functionalities for content. * Besides the editing functions in Word, you may also benefit from enhanced collaboration, printing, and sharing features. You may want to try out our [**Presentation to Word Online Converter**](https://products.aspose.app/slides/conversion/ppt-to-word) to see what you could gain from working with textual content from slides. ## **Aspose.Slides and Aspose.Words** To convert a PowerPoint file (PPTX or PPT) to Word (DOCX or DOCX), you need both [Aspose.Slides for C++](https://products.aspose.com/slides/cpp/) and [Aspose.Words for C++](https://products.aspose.com/words/cpp/). As a standalone API, [Aspose.Slides](https://products.aspose.app/slides) for C++ provides functions that allow you to extract texts from presentations. [Aspose.Words](https://docs.aspose.com/words/cpp/) is an advanced document processing API that allows applications to generate, modify, convert, render, print files, and perform other tasks with documents without utilizing Microsoft Word. ## **Convert a PowerPoint Presentation to a Word Document** Use this code snippet to convert the PowerPoint to Word: ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto presentation = MakeObject(u"sample.pptx"); auto doc = MakeObject(); auto builder = MakeObject(doc); for (const auto& slide : presentation->get_Slides()) { // generates a slide image as a byte array stream auto image = slide->GetImage(1.0f, 1.0f); auto imageStream = MakeObject(); image->Save(imageStream, Aspose::Slides::ImageFormat::Png); image->Dispose(); builder->InsertImage(imageStream->ToArray()); // inserts slide's texts for (const auto& shape : slide->get_Shapes()) { if (ObjectExt::Is(shape)) { auto autoShape = System::AsCast(shape); builder->Writeln(autoShape->get_TextFrame()->get_Text()); } } builder->InsertBreak(Aspose::Words::BreakType::PageBreak); } doc->Save(u"output.docx"); presentation->Dispose(); ``` ## **FAQ** ### What components need to be installed to convert PowerPoint and OpenDocument presentations to Word documents? You only need to add the respective packages for [Aspose.Slides for C++](https://releases.aspose.com/slides/cpp/) and [Aspose.Words for C++](https://releases.aspose.com/words/cpp/) to your project. Both libraries operate as standalone APIs, and there is no requirement for Microsoft Office to be installed. ### Are all PowerPoint and OpenDocument presentation formats supported? Aspose.Slides [supports all presentation formats](https://docs.aspose.com/slides/cpp/supported-file-formats/), including PPT, PPTX, ODP, and other common file types. This ensures that you can work with presentations created in various versions of Microsoft PowerPoint. # Convert PowerPoint Presentations to XML in C++ > Convert PowerPoint and OpenDocument presentations to PowerPoint XML files or streams in C++ with Aspose.Slides for C++. Source: https://docs.aspose.com/slides/cpp/convert-powerpoint-to-xml/ Updated: 2026-09-01 ## **Overview** Aspose.Slides for C++ can convert PowerPoint presentations to the PowerPoint XML Presentation format. XML output is useful when you need a text-based representation for inspecting presentation structure, troubleshooting generated documents, comparing output in automated tests, or integrating with a workflow that consumes XML instead of a presentation package. Use the [Presentation::Save](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/save/) method with the `Xml` value from the [SaveFormat](https://reference.aspose.com/slides/cpp/aspose.slides.export/saveformat/) enumeration. You can write the result directly to a file or to a stream. `SaveFormat::Xml` creates a PowerPoint XML Presentation. It does not extract the individual Office Open XML parts stored inside a PPTX package. If you need the exact PPTX package parts, such as `ppt/presentation.xml` or individual slide XML files, inspect the PPTX package itself. ## **Convert a Presentation to an XML File** Load a source presentation with the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) class, and then pass the output path and `SaveFormat::Xml` to [Presentation::Save](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/save/). The source can be any presentation format supported for loading, such as PPT, PPTX, or ODP. The following example converts a PPTX presentation to an XML file: ```cpp #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(u"presentation.pptx"); presentation->Save(u"presentation.xml", SaveFormat::Xml); presentation->Dispose(); ``` ## **Write the XML Output to a Stream** Use the stream overload of [Presentation::Save](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/save/) when the XML must remain in memory or be passed to another component, such as a web service, storage provider, or XML processing pipeline. The following example writes the result to a [MemoryStream](https://reference.aspose.com/slides/cpp/system.io/memorystream/) and rewinds it for subsequent reading: ```cpp #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System::IO; auto presentation = System::MakeObject(u"presentation.pptx"); auto xmlStream = System::MakeObject(); presentation->Save(xmlStream, SaveFormat::Xml); xmlStream->set_Position(0); presentation->Dispose(); // Pass xmlStream to the next component in the workflow. ``` ## **Compare XML with Presentation and Export Formats** Choose the output format according to how the result will be used: | Format | Output | Typical use | | --- | --- | --- | | PowerPoint XML (`.xml`) | A PowerPoint XML Presentation | Inspecting structure, troubleshooting, comparing generated output, and XML-based integration | | PPT (`.ppt`) | A legacy binary presentation file | Compatibility with older PowerPoint workflows | | PPTX (`.pptx`) | An Office Open XML package containing multiple parts | Regular PowerPoint editing and presentation exchange | | PDF or TIFF | Fixed-layout pages or a multi-page image | Viewing, printing, and archiving | | PNG, JPEG, or SVG | A rendered representation of an individual slide | Thumbnails, previews, and image assets | | HTML or HTML5 | Web-oriented presentation output | Browser viewing and web publishing | Unlike PPT and PPTX, XML output is primarily intended for inspection and data-oriented workflows. Unlike PDF, TIFF, HTML, and slide image formats, it represents presentation data rather than rendering slides as pages or visual assets. The [supported file formats](https://docs.aspose.com/slides/cpp/supported-file-formats/) table lists PowerPoint XML Presentation as a save-only format, so do not use it when a workflow must load the exported file back into Aspose.Slides for continued editing. ## **FAQ** **Is `SaveFormat::Xml` the same as saving a PPTX file?** No. PPTX is a package containing multiple Office Open XML parts, whereas `SaveFormat::Xml` creates a PowerPoint XML Presentation file. **Can I save the XML output without creating a file on disk?** Yes. Pass a writable stream to [Presentation::Save](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/save/). For example, use a [MemoryStream](https://reference.aspose.com/slides/cpp/system.io/memorystream/) for in-memory processing. **Can Aspose.Slides load the exported XML file again?** No. PowerPoint XML Presentation is currently supported for saving but not for loading. Use PPTX or another supported presentation format when round-trip editing is required. **Does XML conversion render each slide as a page or image?** No. XML conversion writes structured presentation data. Use PDF or TIFF for page-oriented output, or PNG, JPEG, and SVG for individual slide images. # Convert PowerPoint Presentations to XPS in C++ > Convert PowerPoint PPT/PPTX to high-quality, platform-independent XPS in C++ using Aspose.Slides. Get step-by-step guide and sample code. Source: https://docs.aspose.com/slides/cpp/convert-powerpoint-to-xps/ Updated: 2026-08-13 ## **Overview** Aspose.Slides allows you to convert PowerPoint presentations to XPS by saving a PPT or PPTX file in the XPS format. This article explains when the XPS format may be useful and shows how to perform the conversion with Aspose.Slides using either default settings or custom [XpsOptions](https://reference.aspose.com/slides/cpp/aspose.slides.export/xpsoptions/) settings. ## **About XPS** Microsoft developed [XPS](https://docs.fileformat.com/page-description-language/xps/) as an alternative to [PDF](https://docs.fileformat.com/pdf/). It allows you to print content by outputting a file very similar to a PDF. The XPS format is based on XML. The layout or structure of an XPS file remains the same on all operating systems and printers. ## **When to Use Microsoft XPS Format** To see how Aspose.Slides converts PPT or PPTX presentation to the XPS format, you can check out [this free online converter app](https://products.aspose.app/slides/conversion). If you want to cut down on storage costs, you can convert your Microsoft PowerPoint presentation to the XPS format. This way, you will find it easier to save, share, and print your documents. Microsoft continues to implement strong support for XPS in Windows (even in Windows 10), so you may want to consider saving files to this format. If you are dealing with Windows 8.1, Windows 8, Windows 7, and Windows Vista, then XPS might actually be your best option for certain operations. - **Windows 8** uses the OXPS (Open XPS) format for XPS files. OXPS is a standardized version of the original XPS format. Windows 8 provides better support for XPS files than it does for PDF files. - **XPS:** Built-in XPS viewer/reader and printing to XPS feature available. - **PDF**: PDF reader available but no printing to PDF feature. - **Windows 7 and Windows Vista** use the original XPS format. These operating systems also provide better support for XPS files than they do for PDFs. - **XPS**: Built-in XPS viewer and printing to XPS feature available. - **PDF**: No PDF reader. No printing to PDF feature. |

**Input PPT(X):

**![todo:image_alt_text](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-xps/convert-powerpoint-ppt-and-pptx-to-microsoft-xps-document_1.png)**

|

**Output XPS:

**![todo:image_alt_text](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-xps/convert-powerpoint-ppt-and-pptx-to-microsoft-xps-document_2.png)**

| | :- | :- | Microsoft eventually implemented support for printing operations in PDF through the Print to PDF feature in Windows 10. Previously, users were expected to print documents through the XPS format. ## **XPS Conversion with Aspose.Slides** In [**Aspose.Slides**](https://products.aspose.com/slides/cpp/) for C++, you can use the [**Save**](https://reference.aspose.com/slides/cpp/class/aspose.slides.presentation#afcd59ec697bf05c10f78c3869de2ec9e) method exposed by the [Presentation](https://reference.aspose.com/slides/cpp/class/aspose.slides.presentation) class to convert the entire presentation into an XPS document. When converting a presentation to XPS, you have to save the presentation using either of these settings: - Default settings (without [**XPSOptions**](https://reference.aspose.com/slides/cpp/class/aspose.slides.export.xps_options)) - Custom settings (with [**XPSOptions**](https://reference.aspose.com/slides/cpp/class/aspose.slides.export.xps_options)) ### **Convert Presentations to XPS Using Default Settings** This sample code in C++ shows you how to convert a presentation to an XPS document using standard settings: ``` cpp #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; // Instantiate a Presentation object that represents a presentation file auto pres = System::MakeObject(u"Convert_XPS.pptx"); // Saving the presentation to XPS document pres->Save(u"XPS_Output_Without_XPSOption_out.xps", SaveFormat::Xps); ``` ### **Convert Presentations to XPS Using Custom Settings** This sample code shows you how to convert a presentation to an XPS document using custom settings in C++: ``` cpp #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; // Instantiate a Presentation object that represents a presentation file auto pres = System::MakeObject(u"Convert_XPS_Options.pptx"); // Instantiate the TiffOptions class auto options = System::MakeObject(); // Save MetaFiles as PNG options->set_SaveMetafilesAsPng(true); // Save the presentation to XPS document pres->Save(u"XPS_With_Options_out.xps", SaveFormat::Xps, options); ``` ## **FAQ** ### Can I save to XPS into a stream instead of a file? Yes—Aspose.Slides lets you export directly to a stream, which is ideal for web APIs, server-side pipelines, or any scenario where you want to send the XPS without touching the file system. ### Are hidden slides carried over to XPS, and can I exclude them? By default, only regular (visible) slides are rendered. You can [include or exclude hidden slides](https://reference.aspose.com/slides/cpp/aspose.slides.export/xpsoptions/set_showhiddenslides/) through [export settings](https://reference.aspose.com/slides/cpp/aspose.slides.export/xpsoptions/) before saving to XPS, ensuring the output contains exactly the pages you intend. # Convert PowerPoint Presentations in C++ | HTML, PNG, PDF, Word, TIFF > Convert PowerPoint presentations to other formats using Aspose.Slides for C++. Fast, accurate, and seamless PPT and PPTX conversion. Source: https://docs.aspose.com/slides/cpp/convert-powerpoint/ Updated: 2025-11-19 --- lastmod: 2025-11-19T22:55:59+04:00 title: Convert PowerPoint Presentations in C++ | HTML, PNG, PDF, Word, TIFF linktitle: Convert PowerPoint type: docs weight: 20 url: /cpp/convert-powerpoint/ keywords: - convert PowerPoint - convert presentation - convert slide - convert PPT - convert PPTX - export PowerPoint - export presentation - export slide - export PPT - export PPTX - C++ - Aspose.Slides description: "Convert PowerPoint presentations to other formats using Aspose.Slides for C++. Fast, accurate, and seamless PPT and PPTX conversion." --- ## Related articles - [Convert OpenDocument Presentations in C++](https://docs.aspose.com/slides/cpp/convert-openoffice-odp/) - [Convert PPTX to PPT in C++](https://docs.aspose.com/slides/cpp/convert-pptx-to-ppt/) - [Import Presentations from PDF or HTML in C++](https://docs.aspose.com/slides/cpp/import-presentation/) # Convert PPT to PPTX in C++ > Convert legacy PPT files to PPTX in C++ with Aspose.Slides. Includes C++ examples for single-file and batch conversion, error handling, and fidelity notes. Source: https://docs.aspose.com/slides/cpp/convert-ppt-to-pptx/ Updated: 2026-08-25 ## **Overview** PPT is the legacy binary PowerPoint format, while PPTX is the newer Open XML format. Aspose.Slides for C++ can load a PPT file and save it as PPTX without Microsoft PowerPoint. This article shows how to convert one file or a directory of files and explains what to verify after conversion. ## **Convert a PPT File to PPTX** Load the source file with the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) class, then call [Presentation::Save](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/save/) with [SaveFormat::Pptx](https://reference.aspose.com/slides/cpp/aspose.slides.export/saveformat/). Dispose of the presentation when it is no longer needed to release its resources. ```cpp #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; // Load the legacy PPT presentation. auto presentation = System::MakeObject(u"presentation.ppt"); // Save the presentation in PPTX format. presentation->Save(u"presentation.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` The file extension does not select the output format by itself; the [SaveFormat::Pptx](https://reference.aspose.com/slides/cpp/aspose.slides.export/saveformat/) argument does. Keep the input and output paths different if you need to retain the original PPT file. ## **Convert Multiple PPT Files** The following example converts every `.ppt` file in one directory. Each file is processed independently, so one failed conversion does not stop the rest of the batch. ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::IO; String inputDirectory = u"input"; String outputDirectory = u"output"; Directory::CreateDirectory_(outputDirectory); auto inputPaths = Directory::GetFiles(inputDirectory, u"*.ppt", SearchOption::TopDirectoryOnly); for (const auto& inputPath : inputPaths) { auto outputFileName = Path::GetFileNameWithoutExtension(inputPath) + u".pptx"; auto outputPath = Path::Combine(outputDirectory, outputFileName); try { auto presentation = MakeObject(inputPath); presentation->Save(outputPath, SaveFormat::Pptx); presentation->Dispose(); Console::WriteLine(String::Format(u"Converted: {0}", inputPath)); } catch (Exception& exception) { Console::get_Error()->WriteLine(String::Format(u"Failed: {0} ({1})", inputPath, exception->get_Message())); } } ``` For production workloads, log the complete exception, decide whether an existing output file may be overwritten, and write failed file names to a retry or review queue. Corrupt files, password-protected files opened without the required password, inaccessible paths, and unsupported content can all cause a conversion to fail. See [Password-Protected Presentations](https://docs.aspose.com/slides/cpp/password-protected-presentation/) for loading encrypted files. ## **Fidelity and Legacy Features** Conversion normally preserves slides, masters, layouts, text, shapes, images, tables, and charts. However, PPT and PPTX do not represent every feature in exactly the same way. A legacy feature that has no PPTX equivalent, or is not supported by the library, may be normalized, omitted, or displayed differently. Check the converted file when it contains animations, transitions, embedded or linked OLE objects, ActiveX controls, embedded media, uncommon fonts, or VBA macros. A plain PPTX file is not a macro-enabled format, so use an appropriate macro-enabled workflow when VBA must remain available. Also verify that required fonts and external resources are present in the environment where the converted presentation will be opened or rendered. For important documents, reopen the generated PPTX programmatically and inspect key slide counts and content, then compare its appearance and slide-show behavior in the intended viewer. Do not treat a successful [Presentation::Save](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/save/) call as proof that every legacy feature has an exact PPTX representation. ## **When to Use PPTX** Use PPTX when the presentation will be edited in current PowerPoint versions, exchanged with systems that work with Open XML packages, or stored in a format that is easier to inspect and recover than legacy binary PPT. Keep the original PPT as an archival or rollback copy until the converted presentation has passed your fidelity checks. If you need PDF, HTML, images, XPS, or another output type instead, use the format-specific guidance in [Convert Presentations to Multiple Formats](https://docs.aspose.com/slides/cpp/convert-presentation/) rather than assuming that all targets preserve editable PowerPoint features. ## **Online Converter** For an occasional file or a quick comparison, you can use the [online PPT to PPTX converter](https://products.aspose.app/slides/conversion/ppt-to-pptx). For repeatable conversions, batch processing, or application-level error handling, use the C++ API. ## **Related Articles** - [Save Presentations in C++](https://docs.aspose.com/slides/cpp/save-presentation/) - [Supported File Formats](https://docs.aspose.com/slides/cpp/supported-file-formats/) - [Open Presentations in C++](https://docs.aspose.com/slides/cpp/open-presentation/) ## **FAQ** **Can I convert PPT to PPTX without Microsoft PowerPoint installed?** Yes. Aspose.Slides for C++ loads and saves presentation files without requiring Microsoft PowerPoint. **Will PPT-to-PPTX conversion preserve all content exactly?** It preserves common presentation content, but exact fidelity is not guaranteed for every legacy or unsupported feature. Review the generated file when it contains macros, OLE or ActiveX objects, media, specialized animations, or uncommon fonts. **Can I convert a password-protected PPT file?** Yes, if you supply the correct password when loading the file. A missing or incorrect password causes the load operation to fail. **Should I delete the PPT file after conversion?** Keep the original until you have verified the PPTX in the viewers and workflows that matter to you. This provides a rollback copy if a legacy feature converts differently. ## Related articles - [Convert PPTX to PPT in C++](https://docs.aspose.com/slides/cpp/convert-pptx-to-ppt/) - [Convert PowerPoint Presentations in C++ | HTML, PNG, PDF, Word, TIFF](https://docs.aspose.com/slides/cpp/convert-powerpoint/) - [Convert Presentations to Multiple Formats in C++](https://docs.aspose.com/slides/cpp/convert-presentation/) # Convert PPTX to PPT in C++ > Easily convert PPTX to PPT with Aspose.Slides for C++—ensure seamless compatibility with PowerPoint formats while preserving your presentation’s layout and quality. Source: https://docs.aspose.com/slides/cpp/convert-pptx-to-ppt/ Updated: 2026-08-05 ## **Overview** This article explains how to convert PowerPoint Presentation in PPTX format into PPT format using C++. The following topic is covered. - Convert PPTX to PPT in C++ ## **Convert PPTX to PPT in C++** For C++ sample code to convert PPTX to PPT, please see the section below i.e. [Convert PPTX to PPT](https://docs.aspose.com/slides/cpp/convert-pptx-to-ppt/#convert-pptx-to-ppt). It just loads the PPTX file and saves in PPT format. By specifiying different save formats, you can also save PPTX file into many other formats like PDF, XPS, ODP, HTML etc. as disscussed in these articles. - [Convert PPTX to PDF in C++](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-pdf/) - [Convert PPTX to XPS in C++](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-xps/) - [Convert PPTX to HTML in C++](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-html/) - [Convert PPTX to ODP in C++](https://docs.aspose.com/slides/cpp/save-presentation/) - [Convert PPTX to PNG in C++](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-png/) ## **Convert PPTX to PPT** To convert a PPTX to PPT simply pass the file name and save format to the **Save** method of [**Presentation**](https://reference.aspose.com/slides/cpp/class/aspose.slides.presentation/) class. The C++ code sample below converts a Presentation from PPTX to PPT using default options. ```cpp #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; // Load the PPTX. SharedPtr prs = MakeObject(u"sourceFile.pptx"); // Save in PPT format. prs->Save(u"convertedFile.ppt", Aspose::Slides::Export::SaveFormat::Ppt); ``` ## **FAQ** ### Do all PPTX effects and features survive when saving to the legacy PPT (97–2003) format? Not always. The PPT format lacks some newer capabilities (e.g., certain effects, objects, and behaviors), so features may be simplified or rasterized during conversion. ### Can I convert only selected slides to PPT instead of the entire presentation? Direct saving targets the whole presentation. To convert specific slides, create a new presentation with just those slides and save it as PPT; alternatively, use a service/API that supports per-slide conversion parameters. ### Are password-protected presentations supported? Yes. You can detect whether a file is protected, open it with a password, and also [configure protection/encryption settings](https://docs.aspose.com/slides/cpp/password-protected-presentation/) for the saved PPT. ## Related articles - [Convert PPT to PPTX in C++](https://docs.aspose.com/slides/cpp/convert-ppt-to-pptx/) - [Convert PowerPoint Presentations in C++ | HTML, PNG, PDF, Word, TIFF](https://docs.aspose.com/slides/cpp/convert-powerpoint/) # Convert Presentations to Multiple Formats in C++ > Convert PowerPoint and OpenDocument presentations to PPTX, PDF, HTML, images, XPS, TIFF, and more with Aspose.Slides for C++. Source: https://docs.aspose.com/slides/cpp/convert-presentation/ Updated: 2026-09-01 ## **Overview** Aspose.Slides for C++ can load PowerPoint and OpenDocument presentations and save or render them to many other formats without Microsoft PowerPoint, OpenOffice, or LibreOffice. You can convert legacy PPT files to modern PPTX, export presentations to fixed-layout documents such as PDF and XPS, publish slides as HTML, or render slides as image files for previews, thumbnails, and archives. Most document conversions use the same general workflow: load the source file, choose the required output format, and apply format-specific options when needed. For image formats, each slide is rendered separately and then saved as a raster or vector image. The dedicated articles linked below provide the implementation details for each case. ## **Choose a Conversion Scenario** Use the articles below for complete C++ examples and format-specific options. | Scenario | Use it when you need to | Article | | --- | --- | --- | | PPT/PPTX/ODP to PPTX | Modernize legacy PPT files, normalize existing PPTX files, or convert OpenDocument presentations to PowerPoint PPTX. | [Convert PPT to PPTX](https://docs.aspose.com/slides/cpp/convert-ppt-to-pptx/), [Convert ODP to PPTX](https://docs.aspose.com/slides/cpp/convert-odp-to-pptx/), [Save Presentations](https://docs.aspose.com/slides/cpp/save-presentation/) | | PPTX to PPT | Save a modern PowerPoint presentation to the older binary PPT format for compatibility with older workflows. | [Convert PPTX to PPT](https://docs.aspose.com/slides/cpp/convert-pptx-to-ppt/) | | PPT/PPTX/ODP to PDF | Create portable, searchable, fixed-layout documents for sharing, printing, or archiving. | [Convert PowerPoint to PDF](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-pdf/) | | PPT/PPTX/ODP to PDF with notes | Export speaker notes together with slide content. | [Convert PowerPoint to PDF with Notes](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-pdf-with-notes/) | | PPT/PPTX/ODP to HTML | Publish presentations as HTML pages and control images, fonts, notes, and responsive layout options. | [Convert PowerPoint to HTML](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-html/) | | PPT/PPTX/ODP to HTML5 | Export slides to HTML5 for browser-based viewing with preserved formatting and interactivity. | [Convert Presentations to HTML5](https://docs.aspose.com/slides/cpp/export-to-html5/) | | PPT/PPTX/ODP to PNG | Render each slide to a PNG image for previews, thumbnails, or web output. | [Convert PowerPoint to PNG](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-png/) | | PPT/PPTX/ODP to JPG | Render slides to JPG images and control image dimensions and quality. | [Convert PowerPoint to JPG](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-jpg/) | | Slide to SVG | Export individual slides as scalable vector graphics. | [Render Slide as SVG](https://docs.aspose.com/slides/cpp/render-a-slide-as-an-svg-image/) | | PPT/PPTX/ODP to XPS | Generate fixed-layout XPS documents. | [Convert PowerPoint to XPS](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-xps/) | | PPT/PPTX/ODP to TIFF | Save a presentation as a multi-page TIFF file for printing, scanning, fax, or archival workflows. | [Convert PowerPoint to TIFF](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-tiff/) | | PPT/PPTX/ODP to TIFF with notes | Save slides with speaker notes to TIFF. | [Convert PowerPoint to TIFF with Notes](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-tiff-with-notes/) | | PPT/PPTX to Word | Convert slides to a Word document when you need document-style output. | [Convert PowerPoint to Word](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-word/) | | PPT/PPTX to Markdown | Extract presentation content into Markdown for documentation and text-based workflows. | [Convert PowerPoint to Markdown](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-markdown/) | | PPT/PPTX/ODP to XML | Create a text-based PowerPoint XML Presentation for inspection, comparison, troubleshooting, or XML-based workflows. | [Convert PowerPoint to XML](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-xml/) | | PPT/PPTX to animated GIF | Create an animated GIF from slides. | [Convert PowerPoint to Animated GIF](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-animated-gif/) | | PPT/PPTX to video | Build a video export workflow from presentation slides. | [Convert PowerPoint to Video](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/) | | Presentation to XAML | Export slides to XAML for C++ UI scenarios. | [Export Presentations to XAML](https://docs.aspose.com/slides/cpp/export-to-xaml/) | For a broader list of input and output formats, see [Supported File Formats](https://docs.aspose.com/slides/cpp/supported-file-formats/). ## **PowerPoint and OpenDocument Conversion** Aspose.Slides for C++ supports conversion from commonly used presentation formats such as PPT, PPTX, PPS, PPSX, POT, POTX, and ODP. The same conversion API is used for PowerPoint and OpenDocument files, so a workflow that saves a PPTX file to PDF can usually be applied to an ODP file by changing only the input file. When converting ODP files, remember that PowerPoint and OpenDocument applications do not support every layout and formatting feature in exactly the same way. If an ODP file was created in LibreOffice or OpenOffice Impress, review the output and use the options described in [Convert OpenDocument Presentations](https://docs.aspose.com/slides/cpp/convert-openoffice-odp/) when you need format-specific guidance. ## **PPT to PPTX Conversion** PPT is the older binary PowerPoint format, while PPTX is the modern Office Open XML format. Aspose.Slides for C++ supports high-fidelity PPT to PPTX conversion while preserving complex presentation structures such as masters, layouts, slides, charts, grouped shapes, placeholders, text frames, textures, and picture fills. For details, see [Convert PPT to PPTX](https://docs.aspose.com/slides/cpp/convert-ppt-to-pptx/). ## **Fixed-Layout Export** PDF, XPS, and TIFF are useful when the output should look the same across devices and should not be edited as a presentation. The dedicated PDF, XPS, and TIFF articles explain how to control compliance, hidden slides, notes, image quality, compression, pixel format, and output size. ## **HTML and Image Export** HTML and HTML5 export are useful for browser viewing, web publishing, and lightweight sharing. Image export is useful when each slide must become a separate preview, thumbnail, or raster asset. Use the PNG, JPG, and SVG articles for format-specific rendering guidance. ## **FAQ** **Do I need Microsoft PowerPoint to convert presentations?** No. Aspose.Slides for C++ is a standalone library and does not require Microsoft PowerPoint or Office automation. **Can I batch convert many presentations?** Yes. Load each presentation, save it to the required format, and dispose of the presentation object after processing. For parallel processing, use separate presentation instances and follow the [multithreading](https://docs.aspose.com/slides/cpp/multithreading/) guidance. **Can I export only selected slides?** Yes. Several export methods allow you to pass slide indexes or render individual slides, depending on the output format. See the dedicated article for the target format. **Can I include hidden slides when exporting to PDF or XPS?** Yes. Use the hidden-slide export settings described in the [PDF](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-pdf/) and [XPS](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-xps/) conversion articles. **Can I create PDF/A output?** Yes. PDF compliance settings are available for PDF export. See [Convert PowerPoint to PDF](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-pdf/) for details. **How are fonts handled during conversion?** Aspose.Slides can use embedded fonts, font fallback, and font substitution settings. See [Embedded Font](https://docs.aspose.com/slides/cpp/embedded-font/), [Fallback Font](https://docs.aspose.com/slides/cpp/fallback-font/), and [Font Substitution](https://docs.aspose.com/slides/cpp/font-substitution/). ## Related articles - [Convert OpenDocument Presentations in C++](https://docs.aspose.com/slides/cpp/convert-openoffice-odp/) - [Supported File Formats](https://docs.aspose.com/slides/cpp/supported-file-formats/) - [Convert PPT to PPTX in C++](https://docs.aspose.com/slides/cpp/convert-ppt-to-pptx/) # Convert Presentation Slides to Images in C++ > Convert slides from PPT, PPTX, and ODP presentations to PNG, JPEG, GIF, TIFF, EMF, and other image formats in C++ with Aspose.Slides for C++. Source: https://docs.aspose.com/slides/cpp/convert-slide/ Updated: 2026-10-26 ## **Introduction** Aspose.Slides for C++ can render individual slides from PowerPoint and OpenDocument presentations as PNG, JPEG, GIF, TIFF, and other image formats. To convert a slide into an image, follow these steps: 1. Load the presentation with the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) class. 2. Select the slide that you want to render. 3. If necessary, configure rendering with the [RenderingOptions](https://reference.aspose.com/slides/cpp/aspose.slides.export/renderingoptions/) or [TiffOptions](https://reference.aspose.com/slides/cpp/aspose.slides.export/tiffoptions/) class. 4. Call the [ISlide::GetImage](https://reference.aspose.com/slides/cpp/aspose.slides/islide/getimage/) method. It returns an [IImage](https://reference.aspose.com/slides/cpp/aspose.slides/iimage/) object. 5. Call the [IImage::Save](https://reference.aspose.com/slides/cpp/aspose.slides/iimage/save/) method and specify the output format with an [ImageFormat](https://reference.aspose.com/slides/cpp/aspose.slides/imageformat/) value. ## **Convert a Slide to a PNG Image** The simplest conversion uses the default rendering settings. The resulting [IImage](https://reference.aspose.com/slides/cpp/aspose.slides/iimage/) object can be processed in memory or saved to a file. The following C++ example renders the first slide and saves it as a PNG image: ```cpp #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto presentation = MakeObject(u"Presentation.pptx"); auto slide = presentation->get_Slide(0); auto image = slide->GetImage(); image->Save(u"Slide_0.png", ImageFormat::Png); image->Dispose(); presentation->Dispose(); ``` ## **Convert Slides to Images with Custom Sizes** Use the [ISlide::GetImage](https://reference.aspose.com/slides/cpp/aspose.slides/islide/getimage/) overload that accepts a [Size](https://reference.aspose.com/slides/cpp/system.drawing/size/) value to render a slide with exact pixel dimensions. The following example creates a 1820 × 1040 JPEG image: ```cpp #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; using namespace System::Drawing; Size imageSize(1820, 1040); auto presentation = MakeObject(u"Presentation.pptx"); auto slide = presentation->get_Slide(0); auto image = slide->GetImage(imageSize); image->Save(u"Slide_0.jpg", ImageFormat::Jpeg); image->Dispose(); presentation->Dispose(); ``` ## **Convert Slides with Notes and Comments to Images** By default, slide images do not include notes or comments. Assign a [NotesCommentsLayoutingOptions](https://reference.aspose.com/slides/cpp/aspose.slides.export/notescommentslayoutingoptions/) object to the [RenderingOptions::set_SlidesLayoutOptions](https://reference.aspose.com/slides/cpp/aspose.slides.export/renderingoptions/set_slideslayoutoptions/) method to control where notes and comments appear. The following example places truncated notes below the slide and comments to its right: ```cpp #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::Drawing; float scaleX = 2.0f; float scaleY = scaleX; auto layoutOptions = MakeObject(); layoutOptions->set_NotesPosition(NotesPositions::BottomTruncated); layoutOptions->set_CommentsPosition(CommentsPositions::Right); layoutOptions->set_CommentsAreaWidth(500); layoutOptions->set_CommentsAreaColor(Color::get_AntiqueWhite()); auto renderingOptions = MakeObject(); renderingOptions->set_SlidesLayoutOptions(layoutOptions); auto presentation = MakeObject(u"Presentation_with_notes_and_comments.pptx"); auto slide = presentation->get_Slide(0); auto image = slide->GetImage(renderingOptions, scaleX, scaleY); image->Save(u"Image_with_notes_and_comments_0.gif", ImageFormat::Gif); image->Dispose(); presentation->Dispose(); ``` For slide-to-image conversion, do not set the [NotesCommentsLayoutingOptions::set_NotesPosition](https://reference.aspose.com/slides/cpp/aspose.slides.export/notescommentslayoutingoptions/set_notesposition/) method to [BottomFull](https://reference.aspose.com/slides/cpp/aspose.slides.export/notespositions/). Notes can contain more text than the fixed image size can accommodate. Use [BottomTruncated](https://reference.aspose.com/slides/cpp/aspose.slides.export/notespositions/) instead. ## **Convert Slides to Images Using TIFF Options** The [TiffOptions](https://reference.aspose.com/slides/cpp/aspose.slides.export/tiffoptions/) class lets you control the size, resolution, and other properties of the rendered TIFF image. The following example renders the first slide as a 2160 × 2880 TIFF image at 300 DPI: ```cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::Drawing; auto tiffOptions = MakeObject(); tiffOptions->set_ImageSize(Size(2160, 2880)); tiffOptions->set_DpiX(300); tiffOptions->set_DpiY(300); auto presentation = MakeObject(u"sample.pptx"); auto slide = presentation->get_Slide(0); auto image = slide->GetImage(tiffOptions); image->Save(u"output.tiff", ImageFormat::Tiff); image->Dispose(); presentation->Dispose(); ``` ## **Convert All Slides to Images** Iterate through the slide collection to convert the entire presentation into a series of images. Hidden slides are included unless you explicitly skip them. The following example renders every slide as a JPEG image with horizontal and vertical scale factors of 2: ```cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; float scaleX = 2.0f; float scaleY = scaleX; auto presentation = MakeObject(u"Presentation.pptx"); int32_t slideCount = presentation->get_Slides()->get_Count(); for (int32_t index = 0; index < slideCount; index++) { auto slide = presentation->get_Slide(index); auto image = slide->GetImage(scaleX, scaleY); image->Save(String::Format(u"Slide_{0}.jpg", index), ImageFormat::Jpeg); image->Dispose(); } presentation->Dispose(); ``` ## **Create Enhanced Metafile Output** Enhanced Metafile (EMF) is useful when vector-based graphics must be exchanged with Microsoft Office or other Windows applications that support Windows metafiles. Unlike a pixel-based image, an EMF can retain vector drawing operations that scale without the same loss of sharpness. However, EMF is primarily a compatibility format for applications with Windows metafile support, not a universal interchange format. In addition, complex slide content, such as bitmap images and some effects, may be stored as rasterized elements inside the vector metafile container. ### **Export a Slide to EMF** The [ISlide::WriteAsEmf](https://reference.aspose.com/slides/cpp/aspose.slides/islide/writeasemf/) method writes an [ISlide](https://reference.aspose.com/slides/cpp/aspose.slides/islide/) to a target stream in EMF format. The following example loads a presentation, selects the first slide, and writes it to an EMF file stream: ```cpp #include #include #include #include using namespace Aspose::Slides; using namespace System; using namespace System::IO; auto presentation = MakeObject(u"Presentation.pptx"); auto slide = presentation->get_Slide(0); auto emfStream = File::Create(u"Slide_0.emf"); slide->WriteAsEmf(emfStream); emfStream->Close(); presentation->Dispose(); ``` The caller owns the stream passed to [ISlide::WriteAsEmf](https://reference.aspose.com/slides/cpp/aspose.slides/islide/writeasemf/) and must close or dispose it. Aspose.Slides writes at the stream's current position and leaves the stream open. ### **Convert an SVG Image to EMF and Add It to a Presentation** Use [ISvgImage::WriteAsEmf](https://reference.aspose.com/slides/cpp/aspose.slides/isvgimage/writeasemf/) to convert SVG content to EMF. The resulting bytes can be added to the presentation through [IImageCollection::AddImage](https://reference.aspose.com/slides/cpp/aspose.slides/iimagecollection/addimage/) and placed on a slide with [IShapeCollection::AddPictureFrame](https://reference.aspose.com/slides/cpp/aspose.slides/ishapecollection/addpictureframe/). The following example creates an [SvgImage](https://reference.aspose.com/slides/cpp/aspose.slides/svgimage/) from SVG markup, converts it to an in-memory EMF, inserts the metafile on the first slide, and saves the presentation: ```cpp #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::IO; String svgContent = u""; auto svgImage = MakeObject(svgContent); auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto emfStream = MakeObject(); svgImage->WriteAsEmf(emfStream); auto emfData = emfStream->ToArray(); auto image = presentation->get_Images()->AddImage(emfData); slide->get_Shapes()->AddPictureFrame(ShapeType::Rectangle, 20, 20, 200, 100, image); presentation->Save(u"Presentation_with_emf.pptx", SaveFormat::Pptx); emfStream->Close(); presentation->Dispose(); ``` [ISvgImage::WriteAsEmf](https://reference.aspose.com/slides/cpp/aspose.slides/isvgimage/writeasemf/) does not take ownership of the destination stream. After writing, the stream position is at the end of the generated data. The example calls [MemoryStream::ToArray](https://reference.aspose.com/slides/cpp/system.io/memorystream/toarray/) to obtain the complete buffer regardless of the current stream position, then passes that byte array to [IImageCollection::AddImage](https://reference.aspose.com/slides/cpp/aspose.slides/iimagecollection/addimage/). Keep the stream open until the consumer has finished reading it, and close it afterward. EMF generation is available on the operating systems supported by Aspose.Slides for C++, but rendering can differ across platforms when fonts or native graphics dependencies are unavailable. Install the fonts used by the source content or configure suitable substitutions, follow the [platform requirements](https://docs.aspose.com/slides/cpp/system-requirements/) for Aspose.Slides for C++, and validate the result in the target EMF-consuming application. Linux and macOS applications often have limited or inconsistent support for displaying and editing Windows metafiles. ## **Color Emoji Rendering** To render color emojis correctly when converting presentation slides to images, the emoji fonts used in the presentation must be installed and available on the system performing the conversion. For example, if the presentation uses **Segoe UI Emoji** and this font is missing, emojis may appear in monochrome in the output images. ## **FAQ** **Does Aspose.Slides support rendering slides with animations?** No. The [ISlide::GetImage](https://reference.aspose.com/slides/cpp/aspose.slides/islide/getimage/) method renders a static image of the slide and does not export animations. **Can hidden slides be exported as images?** Yes. Hidden slides can be rendered like regular slides. Include them in the processing loop, as shown in the example above. **Are shadows and other effects preserved in slide images?** Yes. Aspose.Slides renders shadows, transparency, and other supported graphical effects in slide images. Related feature: [Render slides as images](https://docs.aspose.com/slides/features/slide-images/). ## Related articles - [Convert PowerPoint Presentations to TIFF in C++](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-tiff/) - [Convert PPT and PPTX to JPG in C++](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-jpg/) - [Convert PowerPoint Presentations to TIFF with Notes in C++](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-tiff-with-notes/) # Create or Update PowerPoint Presentation Charts in C++ > Create and customize charts in PowerPoint presentations using Aspose.Slides for C++. Add, format, and edit charts with practical code examples in C++. Source: https://docs.aspose.com/slides/cpp/create-chart/ Updated: 2026-11-18 ## **Overview** This article provides a comprehensive guide on how to create and customize charts using Aspose.Slides for C++. You will learn how to programmatically add a chart to a slide, populate it with data, and apply various formatting options to match your specific design requirements. Throughout the article, detailed code examples illustrate each step, from initializing the presentation and chart object to configuring series, axes, and legends. By following this guide, you'll gain a solid understanding of how to integrate dynamic chart generation into your C++ applications, streamlining the process of creating data-driven presentations. ## **Create a Chart** Charts help people quickly visualize data and gain insights that may not be immediately obvious from a table or spreadsheet. **Why Create Charts?** Using charts, you can: * aggregate, condense, or summarize large amounts of data on a single slide in a presentation; * expose patterns and trends in data; * deduce the direction and momentum of data over time or with respect to a specific unit of measurement; * spot outliers, aberrations, deviations, errors, and nonsensical data; * communicate or present complex data. In PowerPoint, you can create charts through the *Insert* function, which provides templates for designing many types of charts. Using Aspose.Slides, you can create both regular charts (based on popular chart types) and custom charts. Use the [ChartType](https://reference.aspose.com/slides/cpp/aspose.slides.charts/charttype/) enumeration under the [Aspose::Slides::Charts](https://reference.aspose.com/slides/cpp/aspose.slides.charts/) namespace. The values in this enumeration correspond to different chart types. ### **Create Clustered Column Charts** This example uses [AddChart](https://reference.aspose.com/slides/cpp/aspose.slides/ishapecollection/addchart/) to create a clustered column chart that compares two series across three categories. The series use red and green fills, and individual labels demonstrate category names, series names, and values. Worksheet index 0 refers to the first sheet in the embedded chart workbook. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace System; using namespace System::Drawing; using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::ClusteredColumn, 20, 20, 500, 300); chart->get_ChartTitle()->AddTextFrameForOverriding(u"Sample Title"); chart->get_ChartTitle()->get_TextFrameForOverriding()->get_TextFrameFormat()->set_CenterText(NullableBool::True); chart->get_ChartTitle()->set_Height(20); chart->set_HasTitle(true); auto workbook = chart->get_ChartData()->get_ChartDataWorkbook(); auto worksheetIndex = 0; chart->get_ChartData()->get_Series()->Clear(); chart->get_ChartData()->get_Categories()->Clear(); auto seriesNameCell = workbook->GetCell(worksheetIndex, 0, 1, ObjectExt::Box(String(u"Series 1"))); chart->get_ChartData()->get_Series()->Add(seriesNameCell, chart->get_Type()); seriesNameCell = workbook->GetCell(worksheetIndex, 0, 2, ObjectExt::Box(String(u"Series 2"))); chart->get_ChartData()->get_Series()->Add(seriesNameCell, chart->get_Type()); auto categoryCell = workbook->GetCell(worksheetIndex, 1, 0, ObjectExt::Box(String(u"Category 1"))); chart->get_ChartData()->get_Categories()->Add(categoryCell); categoryCell = workbook->GetCell(worksheetIndex, 2, 0, ObjectExt::Box(String(u"Category 2"))); chart->get_ChartData()->get_Categories()->Add(categoryCell); categoryCell = workbook->GetCell(worksheetIndex, 3, 0, ObjectExt::Box(String(u"Category 3"))); chart->get_ChartData()->get_Categories()->Add(categoryCell); auto series = chart->get_ChartData()->get_Series()->idx_get(0); auto valueCell = workbook->GetCell(worksheetIndex, 1, 1, ObjectExt::Box(20)); series->get_DataPoints()->AddDataPointForBarSeries(valueCell); valueCell = workbook->GetCell(worksheetIndex, 2, 1, ObjectExt::Box(50)); series->get_DataPoints()->AddDataPointForBarSeries(valueCell); valueCell = workbook->GetCell(worksheetIndex, 3, 1, ObjectExt::Box(30)); series->get_DataPoints()->AddDataPointForBarSeries(valueCell); series->get_Format()->get_Fill()->set_FillType(FillType::Solid); series->get_Format()->get_Fill()->get_SolidFillColor()->set_Color(Color::get_Red()); series = chart->get_ChartData()->get_Series()->idx_get(1); valueCell = workbook->GetCell(worksheetIndex, 1, 2, ObjectExt::Box(30)); series->get_DataPoints()->AddDataPointForBarSeries(valueCell); valueCell = workbook->GetCell(worksheetIndex, 2, 2, ObjectExt::Box(10)); series->get_DataPoints()->AddDataPointForBarSeries(valueCell); valueCell = workbook->GetCell(worksheetIndex, 3, 2, ObjectExt::Box(60)); series->get_DataPoints()->AddDataPointForBarSeries(valueCell); series->get_Format()->get_Fill()->set_FillType(FillType::Solid); series->get_Format()->get_Fill()->get_SolidFillColor()->set_Color(Color::get_Green()); auto label = series->get_DataPoints()->idx_get(0)->get_Label(); label->get_DataLabelFormat()->set_ShowCategoryName(true); label = series->get_DataPoints()->idx_get(1)->get_Label(); label->get_DataLabelFormat()->set_ShowSeriesName(true); label = series->get_DataPoints()->idx_get(2)->get_Label(); label->get_DataLabelFormat()->set_ShowValue(true); label->get_DataLabelFormat()->set_ShowSeriesName(true); label->get_DataLabelFormat()->set_Separator(u"/"); presentation->Save(u"AsposeChart.pptx", SaveFormat::Pptx); ``` The result: ![The Clustered Column chart](https://docs.aspose.com/slides/cpp/create-chart/clustered_column_chart.png) ### **Create Scatter Charts** Scatter charts (also known as scatter plots or x-y graphs) are often used to check for patterns or demonstrate correlations between two variables. Use a scatter chart when: * You have paired numerical data. * You have two variables that pair well together. * You want to determine whether the two variables are related. * You have an independent variable that has multiple values for a dependent variable. This example plots two sets of x-y values. The first series uses straight lines with star markers, while the second uses smooth lines with circle markers; both use a marker size of 10, set with [set_Size](https://reference.aspose.com/slides/cpp/aspose.slides.charts/imarker/set_size/). The [set_Symbol](https://reference.aspose.com/slides/cpp/aspose.slides.charts/imarker/set_symbol/) method controls the marker shape. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace System; using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::ScatterWithSmoothLines, 20, 20, 500, 300); auto workbook = chart->get_ChartData()->get_ChartDataWorkbook(); auto worksheetIndex = 0; chart->get_ChartData()->get_Series()->Clear(); auto seriesNameCell = workbook->GetCell(worksheetIndex, 1, 1, ObjectExt::Box(String(u"Series 1"))); chart->get_ChartData()->get_Series()->Add(seriesNameCell, chart->get_Type()); seriesNameCell = workbook->GetCell(worksheetIndex, 1, 3, ObjectExt::Box(String(u"Series 2"))); chart->get_ChartData()->get_Series()->Add(seriesNameCell, chart->get_Type()); auto series = chart->get_ChartData()->get_Series()->idx_get(0); auto xValueCell = workbook->GetCell(worksheetIndex, 2, 1, ObjectExt::Box(1)); auto yValueCell = workbook->GetCell(worksheetIndex, 2, 2, ObjectExt::Box(3)); series->get_DataPoints()->AddDataPointForScatterSeries(xValueCell, yValueCell); xValueCell = workbook->GetCell(worksheetIndex, 3, 1, ObjectExt::Box(2)); yValueCell = workbook->GetCell(worksheetIndex, 3, 2, ObjectExt::Box(10)); series->get_DataPoints()->AddDataPointForScatterSeries(xValueCell, yValueCell); series->set_Type(ChartType::ScatterWithStraightLinesAndMarkers); series->get_Marker()->set_Size(10); series->get_Marker()->set_Symbol(MarkerStyleType::Star); series = chart->get_ChartData()->get_Series()->idx_get(1); xValueCell = workbook->GetCell(worksheetIndex, 2, 3, ObjectExt::Box(5)); yValueCell = workbook->GetCell(worksheetIndex, 2, 4, ObjectExt::Box(2)); series->get_DataPoints()->AddDataPointForScatterSeries(xValueCell, yValueCell); xValueCell = workbook->GetCell(worksheetIndex, 3, 3, ObjectExt::Box(3)); yValueCell = workbook->GetCell(worksheetIndex, 3, 4, ObjectExt::Box(1)); series->get_DataPoints()->AddDataPointForScatterSeries(xValueCell, yValueCell); xValueCell = workbook->GetCell(worksheetIndex, 4, 3, ObjectExt::Box(2)); yValueCell = workbook->GetCell(worksheetIndex, 4, 4, ObjectExt::Box(2)); series->get_DataPoints()->AddDataPointForScatterSeries(xValueCell, yValueCell); xValueCell = workbook->GetCell(worksheetIndex, 5, 3, ObjectExt::Box(5)); yValueCell = workbook->GetCell(worksheetIndex, 5, 4, ObjectExt::Box(1)); series->get_DataPoints()->AddDataPointForScatterSeries(xValueCell, yValueCell); series->get_Marker()->set_Size(10); series->get_Marker()->set_Symbol(MarkerStyleType::Circle); presentation->Save(u"AsposeChart.pptx", SaveFormat::Pptx); ``` The result: ![The Scatter chart](https://docs.aspose.com/slides/cpp/create-chart/scatter_chart.png) ### **Create Pie Charts** Pie charts are best used to show the part-to-whole relationship in data, especially when the data contains categorical labels with numeric values. However, if your data contains many parts or labels, you might want to consider using a bar chart instead. This example creates a pie chart with three quarterly values. Each slice has a custom fill and border, and the labels display different combinations of values, percentages, and series information. The [set_FirstSliceAngle](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartseriesgroup/set_firstsliceangle/) method sets the first slice to start at 180 degrees. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace System; using namespace System::Drawing; using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::Pie, 20, 20, 500, 300); chart->get_ChartTitle()->AddTextFrameForOverriding(u"Sample Title"); chart->get_ChartTitle()->get_TextFrameForOverriding()->get_TextFrameFormat()->set_CenterText(NullableBool::True); chart->get_ChartTitle()->set_Height(20); chart->set_HasTitle(true); chart->get_ChartData()->get_Series()->idx_get(0)->get_Labels()->get_DefaultDataLabelFormat()->set_ShowValue(true); auto workbook = chart->get_ChartData()->get_ChartDataWorkbook(); auto worksheetIndex = 0; chart->get_ChartData()->get_Series()->Clear(); chart->get_ChartData()->get_Categories()->Clear(); auto categoryCell = workbook->GetCell(0, 1, 0, ObjectExt::Box(String(u"1st Qtr"))); chart->get_ChartData()->get_Categories()->Add(categoryCell); categoryCell = workbook->GetCell(0, 2, 0, ObjectExt::Box(String(u"2nd Qtr"))); chart->get_ChartData()->get_Categories()->Add(categoryCell); categoryCell = workbook->GetCell(0, 3, 0, ObjectExt::Box(String(u"3rd Qtr"))); chart->get_ChartData()->get_Categories()->Add(categoryCell); auto seriesNameCell = workbook->GetCell(0, 0, 1, ObjectExt::Box(String(u"Series 1"))); auto series = chart->get_ChartData()->get_Series()->Add(seriesNameCell, chart->get_Type()); auto valueCell = workbook->GetCell(worksheetIndex, 1, 1, ObjectExt::Box(20)); series->get_DataPoints()->AddDataPointForPieSeries(valueCell); valueCell = workbook->GetCell(worksheetIndex, 2, 1, ObjectExt::Box(50)); series->get_DataPoints()->AddDataPointForPieSeries(valueCell); valueCell = workbook->GetCell(worksheetIndex, 3, 1, ObjectExt::Box(30)); series->get_DataPoints()->AddDataPointForPieSeries(valueCell); chart->get_ChartData()->get_SeriesGroups()->idx_get(0)->set_IsColorVaried(true); auto firstSlice = series->get_DataPoints()->idx_get(0); firstSlice->get_Format()->get_Fill()->set_FillType(FillType::Solid); firstSlice->get_Format()->get_Fill()->get_SolidFillColor()->set_Color(Color::get_Cyan()); firstSlice->get_Format()->get_Line()->get_FillFormat()->set_FillType(FillType::Solid); firstSlice->get_Format()->get_Line()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Gray()); firstSlice->get_Format()->get_Line()->set_Width(3.0); firstSlice->get_Format()->get_Line()->set_Style(LineStyle::ThinThick); firstSlice->get_Format()->get_Line()->set_DashStyle(LineDashStyle::LargeDash); auto secondSlice = series->get_DataPoints()->idx_get(1); secondSlice->get_Format()->get_Fill()->set_FillType(FillType::Solid); secondSlice->get_Format()->get_Fill()->get_SolidFillColor()->set_Color(Color::get_Brown()); secondSlice->get_Format()->get_Line()->get_FillFormat()->set_FillType(FillType::Solid); secondSlice->get_Format()->get_Line()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Blue()); secondSlice->get_Format()->get_Line()->set_Width(3.0); secondSlice->get_Format()->get_Line()->set_Style(LineStyle::Single); secondSlice->get_Format()->get_Line()->set_DashStyle(LineDashStyle::LargeDashDot); auto thirdSlice = series->get_DataPoints()->idx_get(2); thirdSlice->get_Format()->get_Fill()->set_FillType(FillType::Solid); thirdSlice->get_Format()->get_Fill()->get_SolidFillColor()->set_Color(Color::get_Coral()); thirdSlice->get_Format()->get_Line()->get_FillFormat()->set_FillType(FillType::Solid); thirdSlice->get_Format()->get_Line()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Red()); thirdSlice->get_Format()->get_Line()->set_Width(2.0); thirdSlice->get_Format()->get_Line()->set_Style(LineStyle::ThinThin); thirdSlice->get_Format()->get_Line()->set_DashStyle(LineDashStyle::LargeDashDotDot); auto firstLabel = series->get_DataPoints()->idx_get(0)->get_Label(); firstLabel->get_DataLabelFormat()->set_ShowValue(true); auto secondLabel = series->get_DataPoints()->idx_get(1)->get_Label(); secondLabel->get_DataLabelFormat()->set_ShowValue(true); secondLabel->get_DataLabelFormat()->set_ShowLegendKey(true); secondLabel->get_DataLabelFormat()->set_ShowPercentage(true); auto thirdLabel = series->get_DataPoints()->idx_get(2)->get_Label(); thirdLabel->get_DataLabelFormat()->set_ShowSeriesName(true); thirdLabel->get_DataLabelFormat()->set_ShowPercentage(true); series->get_Labels()->get_DefaultDataLabelFormat()->set_ShowLeaderLines(true); chart->get_ChartData()->get_SeriesGroups()->idx_get(0)->set_FirstSliceAngle(180); presentation->Save(u"PieChart.pptx", SaveFormat::Pptx); ``` The result: ![The Pie chart](https://docs.aspose.com/slides/cpp/create-chart/pie_chart.png) To improve the readability of labels outside the pie, see [Format Leader Lines](https://docs.aspose.com/slides/cpp/chart-data-label/#format-leader-lines) for an example that positions labels and customizes the lines' color, width, transparency, and dash style. ### **Create Line Charts** Line charts (also known as line graphs) are best used in situations where you want to demonstrate changes in value over time. Using a line chart, you can compare a large amount of data at once, track changes and trends over time, highlight anomalies in data series, and more. This example uses [AddChart](https://reference.aspose.com/slides/cpp/aspose.slides/ishapecollection/addchart/) to create a line chart with the default series and categories, then saves the presentation as PPTX. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace System; using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto lineChart = slide->get_Shapes()->AddChart(ChartType::Line, 20, 20, 500, 300); presentation->Save(u"lineChart.pptx", SaveFormat::Pptx); ``` By default, points on a line chart are joined by straight continuous lines. If you want the points to be joined by dashes instead, call [set_DashStyle](https://reference.aspose.com/slides/cpp/aspose.slides/ilineformat/set_dashstyle/) with a value from [LineDashStyle](https://reference.aspose.com/slides/cpp/aspose.slides/linedashstyle/): ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace System; using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto lineChart = slide->get_Shapes()->AddChart(ChartType::Line, 20, 20, 500, 300); for (auto series : lineChart->get_ChartData()->get_Series()) { series->get_Format()->get_Line()->set_DashStyle(LineDashStyle::Dash); } ``` The result: ![The Line chart](https://docs.aspose.com/slides/cpp/create-chart/line_chart.png) ### **Create Tree Map Charts** Tree map charts are best used for sales data when you want to show the relative size of data categories and quickly draw attention to items that are large contributors within each category. This example creates a tree map with eight leaves grouped into four stems and two branches. The [SetGroupingItem](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartcategorylevelsmanager/setgroupingitem/) method assigns stems at grouping level 1 and branches at level 2. Values determine the relative rectangle sizes, while category labels and overlapping parent labels identify the hierarchy. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace System; using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::Treemap, 20, 20, 500, 300); chart->get_ChartData()->get_Categories()->Clear(); chart->get_ChartData()->get_Series()->Clear(); auto workbook = chart->get_ChartData()->get_ChartDataWorkbook(); workbook->Clear(0); // Branch 1 auto categoryCell = workbook->GetCell(0, u"C1", ObjectExt::Box(String(u"Leaf1"))); auto leaf = chart->get_ChartData()->get_Categories()->Add(categoryCell); leaf->get_GroupingLevels()->SetGroupingItem(1, ObjectExt::Box(String(u"Stem1"))); leaf->get_GroupingLevels()->SetGroupingItem(2, ObjectExt::Box(String(u"Branch1"))); categoryCell = workbook->GetCell(0, u"C2", ObjectExt::Box(String(u"Leaf2"))); chart->get_ChartData()->get_Categories()->Add(categoryCell); categoryCell = workbook->GetCell(0, u"C3", ObjectExt::Box(String(u"Leaf3"))); leaf = chart->get_ChartData()->get_Categories()->Add(categoryCell); leaf->get_GroupingLevels()->SetGroupingItem(1, ObjectExt::Box(String(u"Stem2"))); categoryCell = workbook->GetCell(0, u"C4", ObjectExt::Box(String(u"Leaf4"))); chart->get_ChartData()->get_Categories()->Add(categoryCell); // Branch 2 categoryCell = workbook->GetCell(0, u"C5", ObjectExt::Box(String(u"Leaf5"))); leaf = chart->get_ChartData()->get_Categories()->Add(categoryCell); leaf->get_GroupingLevels()->SetGroupingItem(1, ObjectExt::Box(String(u"Stem3"))); leaf->get_GroupingLevels()->SetGroupingItem(2, ObjectExt::Box(String(u"Branch2"))); categoryCell = workbook->GetCell(0, u"C6", ObjectExt::Box(String(u"Leaf6"))); chart->get_ChartData()->get_Categories()->Add(categoryCell); categoryCell = workbook->GetCell(0, u"C7", ObjectExt::Box(String(u"Leaf7"))); leaf = chart->get_ChartData()->get_Categories()->Add(categoryCell); leaf->get_GroupingLevels()->SetGroupingItem(1, ObjectExt::Box(String(u"Stem4"))); categoryCell = workbook->GetCell(0, u"C8", ObjectExt::Box(String(u"Leaf8"))); chart->get_ChartData()->get_Categories()->Add(categoryCell); auto series = chart->get_ChartData()->get_Series()->Add(ChartType::Treemap); series->get_Labels()->get_DefaultDataLabelFormat()->set_ShowCategoryName(true); auto valueCell = workbook->GetCell(0, u"D1", ObjectExt::Box(4)); series->get_DataPoints()->AddDataPointForTreemapSeries(valueCell); valueCell = workbook->GetCell(0, u"D2", ObjectExt::Box(5)); series->get_DataPoints()->AddDataPointForTreemapSeries(valueCell); valueCell = workbook->GetCell(0, u"D3", ObjectExt::Box(3)); series->get_DataPoints()->AddDataPointForTreemapSeries(valueCell); valueCell = workbook->GetCell(0, u"D4", ObjectExt::Box(6)); series->get_DataPoints()->AddDataPointForTreemapSeries(valueCell); valueCell = workbook->GetCell(0, u"D5", ObjectExt::Box(9)); series->get_DataPoints()->AddDataPointForTreemapSeries(valueCell); valueCell = workbook->GetCell(0, u"D6", ObjectExt::Box(9)); series->get_DataPoints()->AddDataPointForTreemapSeries(valueCell); valueCell = workbook->GetCell(0, u"D7", ObjectExt::Box(4)); series->get_DataPoints()->AddDataPointForTreemapSeries(valueCell); valueCell = workbook->GetCell(0, u"D8", ObjectExt::Box(3)); series->get_DataPoints()->AddDataPointForTreemapSeries(valueCell); series->set_ParentLabelLayout(ParentLabelLayoutType::Overlapping); presentation->Save(u"Treemap.pptx", SaveFormat::Pptx); ``` The result: ![The Treemap chart](https://docs.aspose.com/slides/cpp/create-chart/treemap_chart.png) ### **Create Waterfall Charts** A waterfall chart shows how positive and negative changes contribute to a final value. For example, a profit breakdown can start with revenue, subtract costs, and add other income. Change columns float between the previous and new running values, while total columns extend from zero to the accumulated value. The following example uses amounts in thousands of US dollars: | Category | Workbook value | Column type | | --- | ---: | --- | | Revenue | 1000 | Increase | | Cost of sales | -400 | Decrease | | Gross profit | 600 | Intermediate total | | Operating expenses | -200 | Decrease | | Other income | 50 | Increase | | Net profit | 450 | Final total | To mark a point as an intermediate or final total, call its [set_SetAsTotal](https://reference.aspose.com/slides/cpp/aspose.slides.charts/chartdatapoint/set_setastotal/) method with `true`. Supply the actual accumulated amount in that point's workbook cell: `600` for gross profit (`1000 - 400`) and `450` for net profit (`600 - 200 + 50`). The method marks the column as a total; it does not calculate or populate the cell value. Do not use zero as a placeholder or supply another change for a total point. A total column displays the accumulated value without adding it again to the running value. This complete C++ example creates a chart using the `Waterfall` member of [ChartType](https://reference.aspose.com/slides/cpp/aspose.slides.charts/charttype/), clears the default data, and fills the embedded workbook. Worksheet index `0` selects the first worksheet; column A contains category names and column B contains values. Each value cell is added with [AddDataPointForWaterfallSeries](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdatapointcollection/adddatapointforwaterfallseries/). The zero-based point indices `2` and `5` identify the intermediate and final totals. Passing `true` to [set_ShowValue](https://reference.aspose.com/slides/cpp/aspose.slides.charts/idatalabelformat/set_showvalue/) displays the amounts on the columns. No input presentation or workbook is required. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace System; using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::Waterfall, 20, 20, 680, 200); chart->set_HasTitle(true); chart->get_ChartTitle()->AddTextFrameForOverriding(u"Profit breakdown (USD thousands)"); chart->get_ChartTitle()->set_Overlay(false); chart->set_HasLegend(false); chart->get_ChartData()->get_Series()->Clear(); chart->get_ChartData()->get_Categories()->Clear(); auto workbook = chart->get_ChartData()->get_ChartDataWorkbook(); auto worksheetIndex = 0; workbook->Clear(worksheetIndex); auto seriesNameCell = workbook->GetCell(worksheetIndex, 0, 1, ObjectExt::Box(String(u"Profit"))); auto series = chart->get_ChartData()->get_Series()->Add(seriesNameCell, ChartType::Waterfall); auto categories = MakeArray({ u"Revenue", u"Cost of sales", u"Gross profit", u"Operating expenses", u"Other income", u"Net profit" }); auto values = MakeArray({ 1000, -400, 600, -200, 50, 450 }); for (auto i = 0; i < categories->get_Length(); i++) { auto categoryCell = workbook->GetCell(worksheetIndex, i + 1, 0, ObjectExt::Box(categories->idx_get(i))); chart->get_ChartData()->get_Categories()->Add(categoryCell); auto valueCell = workbook->GetCell(worksheetIndex, i + 1, 1, ObjectExt::Box(values->idx_get(i))); series->get_DataPoints()->AddDataPointForWaterfallSeries(valueCell); } // The third and sixth points represent totals, not additional changes. series->get_DataPoints()->idx_get(2)->set_SetAsTotal(true); series->get_DataPoints()->idx_get(5)->set_SetAsTotal(true); series->set_ShowConnectorLines(true); series->get_Labels()->get_DefaultDataLabelFormat()->set_ShowValue(true); presentation->Save(u"WaterfallChart.pptx", SaveFormat::Pptx); ``` Call the series-level [set_ShowConnectorLines](https://reference.aspose.com/slides/cpp/aspose.slides.charts/chartseries/set_showconnectorlines/) method with `true` to show lines linking consecutive columns and make the running value easier to follow. To hide these lines, replace the assignment in the example with `series->set_ShowConnectorLines(false);` before saving. This changes only the line visibility, not the data or totals. The saved presentation shows gross profit of 600 and net profit of 450, with both totals drawn from zero: ![Waterfall chart showing revenue, costs, gross profit of 600, and net profit of 450, with value labels and connector lines](https://docs.aspose.com/slides/cpp/create-chart/waterfall_chart.png) ### **Create Stock Charts** Stock charts are used to display financial data such as open, high, low, and close prices, helping analyze market trends and volatility. They offer essential insights into stock performance, aiding investors and analysts in making informed decisions. This example creates an open-high-low-close chart with four series in that order and three categories. The [set_HasUpDownBars](https://reference.aspose.com/slides/cpp/aspose.slides.charts/iupdownbarsmanager/set_hasupdownbars/) method enables up/down bars, and [get_HiLowLinesFormat](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartseriesgroup/get_hilowlinesformat/) controls the high-low lines that show the price ranges, while the individual series lines and minor horizontal gridlines are hidden. The manager returned by [get_UpDownBars](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartseriesgroup/get_updownbars/) exposes separate formatting objects through [get_UpBarsFormat](https://reference.aspose.com/slides/cpp/aspose.slides.charts/iupdownbarsmanager/get_upbarsformat/) and [get_DownBarsFormat](https://reference.aspose.com/slides/cpp/aspose.slides.charts/iupdownbarsmanager/get_downbarsformat/). Use each object's [get_Fill](https://reference.aspose.com/slides/cpp/aspose.slides.charts/iformat/get_fill/) and [get_Line](https://reference.aspose.com/slides/cpp/aspose.slides.charts/iformat/get_line/) methods to access and configure its fill and outline independently. This example uses green bars with dark-green outlines for rising intervals and orange-red bars with dark-red outlines for falling intervals. Provide numeric values for all four series at each category, with High and Low enclosing Open and Close. The bars compare Close with Open **within the same category**, not with the previous category: A falls from 72 to 25, while B rises from 25 to 38 and C rises from 38 to 50. Equal Open and Close values produce no visible filled interval. Up/down bars span Open–Close; high-low lines span Low–High. These bars belong to the series group and are not ordinary bar-chart series. This formatting also works with [Line and LineWithMarkers](https://reference.aspose.com/slides/cpp/aspose.slides.charts/charttype/) charts containing at least two series in the same group and corresponding numeric values for each category. For these non-stacked line charts, up/down bars compare the first and last series: a higher last value produces an up bar, and a lower last value produces a down bar. Reversing those series reverses the classification. The example below uses [OpenHighLowClose](https://reference.aspose.com/slides/cpp/aspose.slides.charts/charttype/); do not assume that other stock, stacked-line, or 3D variants use the same data arrangement or interval interpretation. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace System; using namespace System::Drawing; using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::OpenHighLowClose, 20, 20, 500, 150, false); auto workbook = chart->get_ChartData()->get_ChartDataWorkbook(); auto categoryCell = workbook->GetCell(0, 1, 0, ObjectExt::Box(String(u"A"))); chart->get_ChartData()->get_Categories()->Add(categoryCell); categoryCell = workbook->GetCell(0, 2, 0, ObjectExt::Box(String(u"B"))); chart->get_ChartData()->get_Categories()->Add(categoryCell); categoryCell = workbook->GetCell(0, 3, 0, ObjectExt::Box(String(u"C"))); chart->get_ChartData()->get_Categories()->Add(categoryCell); auto seriesNameCell = workbook->GetCell(0, 0, 1, ObjectExt::Box(String(u"Open"))); chart->get_ChartData()->get_Series()->Add(seriesNameCell, ChartType::OpenHighLowClose); seriesNameCell = workbook->GetCell(0, 0, 2, ObjectExt::Box(String(u"High"))); chart->get_ChartData()->get_Series()->Add(seriesNameCell, ChartType::OpenHighLowClose); seriesNameCell = workbook->GetCell(0, 0, 3, ObjectExt::Box(String(u"Low"))); chart->get_ChartData()->get_Series()->Add(seriesNameCell, ChartType::OpenHighLowClose); seriesNameCell = workbook->GetCell(0, 0, 4, ObjectExt::Box(String(u"Close"))); chart->get_ChartData()->get_Series()->Add(seriesNameCell, ChartType::OpenHighLowClose); auto series = chart->get_ChartData()->get_Series()->idx_get(0); auto valueCell = workbook->GetCell(0, 1, 1, ObjectExt::Box(72)); series->get_DataPoints()->AddDataPointForStockSeries(valueCell); valueCell = workbook->GetCell(0, 2, 1, ObjectExt::Box(25)); series->get_DataPoints()->AddDataPointForStockSeries(valueCell); valueCell = workbook->GetCell(0, 3, 1, ObjectExt::Box(38)); series->get_DataPoints()->AddDataPointForStockSeries(valueCell); series = chart->get_ChartData()->get_Series()->idx_get(1); valueCell = workbook->GetCell(0, 1, 2, ObjectExt::Box(172)); series->get_DataPoints()->AddDataPointForStockSeries(valueCell); valueCell = workbook->GetCell(0, 2, 2, ObjectExt::Box(57)); series->get_DataPoints()->AddDataPointForStockSeries(valueCell); valueCell = workbook->GetCell(0, 3, 2, ObjectExt::Box(57)); series->get_DataPoints()->AddDataPointForStockSeries(valueCell); series = chart->get_ChartData()->get_Series()->idx_get(2); valueCell = workbook->GetCell(0, 1, 3, ObjectExt::Box(12)); series->get_DataPoints()->AddDataPointForStockSeries(valueCell); valueCell = workbook->GetCell(0, 2, 3, ObjectExt::Box(12)); series->get_DataPoints()->AddDataPointForStockSeries(valueCell); valueCell = workbook->GetCell(0, 3, 3, ObjectExt::Box(13)); series->get_DataPoints()->AddDataPointForStockSeries(valueCell); series = chart->get_ChartData()->get_Series()->idx_get(3); valueCell = workbook->GetCell(0, 1, 4, ObjectExt::Box(25)); series->get_DataPoints()->AddDataPointForStockSeries(valueCell); valueCell = workbook->GetCell(0, 2, 4, ObjectExt::Box(38)); series->get_DataPoints()->AddDataPointForStockSeries(valueCell); valueCell = workbook->GetCell(0, 3, 4, ObjectExt::Box(50)); series->get_DataPoints()->AddDataPointForStockSeries(valueCell); auto upDownBars = chart->get_ChartData()->get_SeriesGroups()->idx_get(0)->get_UpDownBars(); upDownBars->set_HasUpDownBars(true); upDownBars->get_UpBarsFormat()->get_Fill()->set_FillType(FillType::Solid); upDownBars->get_UpBarsFormat()->get_Fill()->get_SolidFillColor()->set_Color(Color::get_LimeGreen()); upDownBars->get_UpBarsFormat()->get_Line()->get_FillFormat()->set_FillType(FillType::Solid); upDownBars->get_UpBarsFormat()->get_Line()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_DarkGreen()); upDownBars->get_UpBarsFormat()->get_Line()->set_Width(2); upDownBars->get_DownBarsFormat()->get_Fill()->set_FillType(FillType::Solid); upDownBars->get_DownBarsFormat()->get_Fill()->get_SolidFillColor()->set_Color(Color::get_OrangeRed()); upDownBars->get_DownBarsFormat()->get_Line()->get_FillFormat()->set_FillType(FillType::Solid); upDownBars->get_DownBarsFormat()->get_Line()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_DarkRed()); upDownBars->get_DownBarsFormat()->get_Line()->set_Width(2); chart->get_ChartData()->get_SeriesGroups()->idx_get(0)->get_HiLowLinesFormat()->get_Line()->get_FillFormat()->set_FillType(FillType::Solid); for (auto stockSeries : chart->get_ChartData()->get_Series()) { stockSeries->get_Format()->get_Line()->get_FillFormat()->set_FillType(FillType::NoFill); } chart->get_Axes()->get_VerticalAxis()->get_MinorGridLinesFormat()->get_Line()->get_FillFormat()->set_FillType(FillType::NoFill); presentation->Save(u"Stock-chart.pptx", SaveFormat::Pptx); ``` The result, exported from PowerPoint: ![Stock chart with an orange-red falling interval for A and green rising intervals for B and C](https://docs.aspose.com/slides/cpp/create-chart/stock_chart.png) ### **Create Box and Whisker Charts** Box and whisker charts are used to display the distribution of data by summarizing key statistical measures, such as the median, quartiles, and potential outliers. They are particularly useful in exploratory data analysis and statistical studies to quickly understand data variability and identify any anomalies. This example creates a box and whisker chart from six values. The [set_QuartileMethod](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartseries/set_quartilemethod/) method selects the exclusive quartile calculation. The example also enables mean lines, mean markers, inner points, and outlier points. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace System; using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::BoxAndWhisker, 20, 20, 500, 300); chart->get_ChartData()->get_Categories()->Clear(); chart->get_ChartData()->get_Series()->Clear(); auto workbook = chart->get_ChartData()->get_ChartDataWorkbook(); workbook->Clear(0); auto categoryCell = workbook->GetCell(0, u"A1", ObjectExt::Box(String(u"Category 1"))); chart->get_ChartData()->get_Categories()->Add(categoryCell); categoryCell = workbook->GetCell(0, u"A2", ObjectExt::Box(String(u"Category 2"))); chart->get_ChartData()->get_Categories()->Add(categoryCell); categoryCell = workbook->GetCell(0, u"A3", ObjectExt::Box(String(u"Category 3"))); chart->get_ChartData()->get_Categories()->Add(categoryCell); categoryCell = workbook->GetCell(0, u"A4", ObjectExt::Box(String(u"Category 4"))); chart->get_ChartData()->get_Categories()->Add(categoryCell); categoryCell = workbook->GetCell(0, u"A5", ObjectExt::Box(String(u"Category 5"))); chart->get_ChartData()->get_Categories()->Add(categoryCell); categoryCell = workbook->GetCell(0, u"A6", ObjectExt::Box(String(u"Category 6"))); chart->get_ChartData()->get_Categories()->Add(categoryCell); auto series = chart->get_ChartData()->get_Series()->Add(ChartType::BoxAndWhisker); series->set_QuartileMethod(QuartileMethodType::Exclusive); series->set_ShowMeanLine(true); series->set_ShowMeanMarkers(true); series->set_ShowInnerPoints(true); series->set_ShowOutlierPoints(true); auto valueCell = workbook->GetCell(0, u"B1", ObjectExt::Box(15)); series->get_DataPoints()->AddDataPointForBoxAndWhiskerSeries(valueCell); valueCell = workbook->GetCell(0, u"B2", ObjectExt::Box(41)); series->get_DataPoints()->AddDataPointForBoxAndWhiskerSeries(valueCell); valueCell = workbook->GetCell(0, u"B3", ObjectExt::Box(16)); series->get_DataPoints()->AddDataPointForBoxAndWhiskerSeries(valueCell); valueCell = workbook->GetCell(0, u"B4", ObjectExt::Box(10)); series->get_DataPoints()->AddDataPointForBoxAndWhiskerSeries(valueCell); valueCell = workbook->GetCell(0, u"B5", ObjectExt::Box(23)); series->get_DataPoints()->AddDataPointForBoxAndWhiskerSeries(valueCell); valueCell = workbook->GetCell(0, u"B6", ObjectExt::Box(16)); series->get_DataPoints()->AddDataPointForBoxAndWhiskerSeries(valueCell); presentation->Save(u"BoxAndWhisker.pptx", SaveFormat::Pptx); ``` ### **Create Funnel Charts** Funnel charts are used to visualize processes that involve sequential stages, where the volume of data decreases as it progresses from one step to the next. They are especially helpful for analyzing conversion rates, identifying bottlenecks, and tracking the efficiency of sales or marketing processes. This example uses [AddChart](https://reference.aspose.com/slides/cpp/aspose.slides/ishapecollection/addchart/) to add a funnel chart to the first slide of an existing presentation. It replaces the default data with six categories and values ranging from 50 to 500, then saves the updated presentation. The input presentation must contain at least one slide. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace System; using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; auto presentation = MakeObject(u"test.pptx"); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::Funnel, 50, 50, 500, 400); chart->get_ChartData()->get_Categories()->Clear(); chart->get_ChartData()->get_Series()->Clear(); auto workbook = chart->get_ChartData()->get_ChartDataWorkbook(); workbook->Clear(0); auto categoryCell = workbook->GetCell(0, u"A1", ObjectExt::Box(String(u"Category 1"))); chart->get_ChartData()->get_Categories()->Add(categoryCell); categoryCell = workbook->GetCell(0, u"A2", ObjectExt::Box(String(u"Category 2"))); chart->get_ChartData()->get_Categories()->Add(categoryCell); categoryCell = workbook->GetCell(0, u"A3", ObjectExt::Box(String(u"Category 3"))); chart->get_ChartData()->get_Categories()->Add(categoryCell); categoryCell = workbook->GetCell(0, u"A4", ObjectExt::Box(String(u"Category 4"))); chart->get_ChartData()->get_Categories()->Add(categoryCell); categoryCell = workbook->GetCell(0, u"A5", ObjectExt::Box(String(u"Category 5"))); chart->get_ChartData()->get_Categories()->Add(categoryCell); categoryCell = workbook->GetCell(0, u"A6", ObjectExt::Box(String(u"Category 6"))); chart->get_ChartData()->get_Categories()->Add(categoryCell); auto series = chart->get_ChartData()->get_Series()->Add(ChartType::Funnel); auto valueCell = workbook->GetCell(0, u"B1", ObjectExt::Box(50)); series->get_DataPoints()->AddDataPointForFunnelSeries(valueCell); valueCell = workbook->GetCell(0, u"B2", ObjectExt::Box(100)); series->get_DataPoints()->AddDataPointForFunnelSeries(valueCell); valueCell = workbook->GetCell(0, u"B3", ObjectExt::Box(200)); series->get_DataPoints()->AddDataPointForFunnelSeries(valueCell); valueCell = workbook->GetCell(0, u"B4", ObjectExt::Box(300)); series->get_DataPoints()->AddDataPointForFunnelSeries(valueCell); valueCell = workbook->GetCell(0, u"B5", ObjectExt::Box(400)); series->get_DataPoints()->AddDataPointForFunnelSeries(valueCell); valueCell = workbook->GetCell(0, u"B6", ObjectExt::Box(500)); series->get_DataPoints()->AddDataPointForFunnelSeries(valueCell); presentation->Save(u"Funnel.pptx", SaveFormat::Pptx); ``` The result: ![The Funnel chart](https://docs.aspose.com/slides/cpp/create-chart/funnel_chart.png) ### **Create Sunburst Charts** Sunburst charts are used to visualize hierarchical data, displaying levels as concentric rings. They help illustrate part-to-whole relationships and are ideal for representing nested categories and subcategories in a clear, compact format. This example creates a sunburst chart with eight leaves grouped into four stems and two branches. The [SetGroupingItem](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartcategorylevelsmanager/setgroupingitem/) method assigns stems at grouping level 1 and branches at level 2. Category labels identify the segments, and the values determine their relative sizes. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace System; using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::Sunburst, 20, 20, 500, 300); chart->get_ChartData()->get_Categories()->Clear(); chart->get_ChartData()->get_Series()->Clear(); auto workbook = chart->get_ChartData()->get_ChartDataWorkbook(); workbook->Clear(0); // Branch 1 auto categoryCell = workbook->GetCell(0, u"C1", ObjectExt::Box(String(u"Leaf1"))); auto leaf = chart->get_ChartData()->get_Categories()->Add(categoryCell); leaf->get_GroupingLevels()->SetGroupingItem(1, ObjectExt::Box(String(u"Stem1"))); leaf->get_GroupingLevels()->SetGroupingItem(2, ObjectExt::Box(String(u"Branch1"))); categoryCell = workbook->GetCell(0, u"C2", ObjectExt::Box(String(u"Leaf2"))); chart->get_ChartData()->get_Categories()->Add(categoryCell); categoryCell = workbook->GetCell(0, u"C3", ObjectExt::Box(String(u"Leaf3"))); leaf = chart->get_ChartData()->get_Categories()->Add(categoryCell); leaf->get_GroupingLevels()->SetGroupingItem(1, ObjectExt::Box(String(u"Stem2"))); categoryCell = workbook->GetCell(0, u"C4", ObjectExt::Box(String(u"Leaf4"))); chart->get_ChartData()->get_Categories()->Add(categoryCell); // Branch 2 categoryCell = workbook->GetCell(0, u"C5", ObjectExt::Box(String(u"Leaf5"))); leaf = chart->get_ChartData()->get_Categories()->Add(categoryCell); leaf->get_GroupingLevels()->SetGroupingItem(1, ObjectExt::Box(String(u"Stem3"))); leaf->get_GroupingLevels()->SetGroupingItem(2, ObjectExt::Box(String(u"Branch2"))); categoryCell = workbook->GetCell(0, u"C6", ObjectExt::Box(String(u"Leaf6"))); chart->get_ChartData()->get_Categories()->Add(categoryCell); categoryCell = workbook->GetCell(0, u"C7", ObjectExt::Box(String(u"Leaf7"))); leaf = chart->get_ChartData()->get_Categories()->Add(categoryCell); leaf->get_GroupingLevels()->SetGroupingItem(1, ObjectExt::Box(String(u"Stem4"))); categoryCell = workbook->GetCell(0, u"C8", ObjectExt::Box(String(u"Leaf8"))); chart->get_ChartData()->get_Categories()->Add(categoryCell); auto series = chart->get_ChartData()->get_Series()->Add(ChartType::Sunburst); series->get_Labels()->get_DefaultDataLabelFormat()->set_ShowCategoryName(true); auto valueCell = workbook->GetCell(0, u"D1", ObjectExt::Box(4)); series->get_DataPoints()->AddDataPointForSunburstSeries(valueCell); valueCell = workbook->GetCell(0, u"D2", ObjectExt::Box(5)); series->get_DataPoints()->AddDataPointForSunburstSeries(valueCell); valueCell = workbook->GetCell(0, u"D3", ObjectExt::Box(3)); series->get_DataPoints()->AddDataPointForSunburstSeries(valueCell); valueCell = workbook->GetCell(0, u"D4", ObjectExt::Box(6)); series->get_DataPoints()->AddDataPointForSunburstSeries(valueCell); valueCell = workbook->GetCell(0, u"D5", ObjectExt::Box(9)); series->get_DataPoints()->AddDataPointForSunburstSeries(valueCell); valueCell = workbook->GetCell(0, u"D6", ObjectExt::Box(9)); series->get_DataPoints()->AddDataPointForSunburstSeries(valueCell); valueCell = workbook->GetCell(0, u"D7", ObjectExt::Box(4)); series->get_DataPoints()->AddDataPointForSunburstSeries(valueCell); valueCell = workbook->GetCell(0, u"D8", ObjectExt::Box(3)); series->get_DataPoints()->AddDataPointForSunburstSeries(valueCell); presentation->Save(u"Sunburst.pptx", SaveFormat::Pptx); ``` The result: ![The Sunburst chart](https://docs.aspose.com/slides/cpp/create-chart/sunburst_chart.png) ### **Create Histogram Charts** Histogram charts show how numerical values are distributed across intervals (bins). For monthly reports on order processing times, use the same bin width and thresholds to keep intervals consistent and make distributions easier to compare. Call the horizontal axis [set_AggregationType](https://reference.aspose.com/slides/cpp/aspose.slides.charts/iaxis/set_aggregationtype/) method with a mode from [AxisAggregationType](https://reference.aspose.com/slides/cpp/aspose.slides.charts/axisaggregationtype/). [set_BinWidth](https://reference.aspose.com/slides/cpp/aspose.slides.charts/iaxis/set_binwidth/) applies only to `ByBinWidth`; [set_NumberOfBins](https://reference.aspose.com/slides/cpp/aspose.slides.charts/iaxis/set_numberofbins/) applies only to `ByNumberOfBins`. Use `Automatic` to let the chart choose the bins. #### **Use a Fixed Bin Width** This example groups processing times into 10-minute intervals, with separate bins for times at or below 10 minutes and above 40 minutes. Enable these bins with [set_IsUnderflowBin](https://reference.aspose.com/slides/cpp/aspose.slides.charts/iaxis/set_isunderflowbin/) and [set_IsOverflowBin](https://reference.aspose.com/slides/cpp/aspose.slides.charts/iaxis/set_isoverflowbin/). When supplying explicit thresholds through [set_UnderflowBin](https://reference.aspose.com/slides/cpp/aspose.slides.charts/iaxis/set_underflowbin/) and [set_OverflowBin](https://reference.aspose.com/slides/cpp/aspose.slides.charts/iaxis/set_overflowbin/), call [set_IsAutomaticUnderflowBin](https://reference.aspose.com/slides/cpp/aspose.slides.charts/iaxis/set_isautomaticunderflowbin/) and [set_IsAutomaticOverflowBin](https://reference.aspose.com/slides/cpp/aspose.slides.charts/iaxis/set_isautomaticoverflowbin/) with `false`. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace System; using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::Histogram, 20, 20, 680, 200); chart->set_HasLegend(false); chart->set_HasTitle(false); chart->get_ChartData()->get_Categories()->Clear(); chart->get_ChartData()->get_Series()->Clear(); auto workbook = chart->get_ChartData()->get_ChartDataWorkbook(); workbook->Clear(0); auto series = chart->get_ChartData()->get_Series()->Add(ChartType::Histogram); auto values = MakeArray({ 5, 10, 10, 11, 15, 20, 20, 21, 25, 30, 30, 31, 35, 40, 40, 41, 50 }); for (auto i = 0; i < values->get_Length(); i++) { auto valueCell = workbook->GetCell(0, i, 0, ObjectExt::Box(values[i])); series->get_DataPoints()->AddDataPointForHistogramSeries(valueCell); } auto axis = chart->get_Axes()->get_HorizontalAxis(); axis->set_AggregationType(AxisAggregationType::ByBinWidth); axis->set_BinWidth(10); axis->set_IsUnderflowBin(true); axis->set_IsAutomaticUnderflowBin(false); axis->set_UnderflowBin(10); axis->set_IsOverflowBin(true); axis->set_IsAutomaticOverflowBin(false); axis->set_OverflowBin(40); presentation->Save(u"Histogram-bin-width.pptx", SaveFormat::Pptx); ``` The presentation displayed in PowerPoint shows bin counts of **3, 4, 4, 4, and 2**. The underflow bin includes `5, 10, 10`, so its threshold is inclusive. The overflow bin includes only `41, 50`, so its threshold is exclusive; both values equal to `40` remain in the preceding interval. The interior bins contain values greater than their lower boundary and less than or equal to their upper boundary. ![Histogram with 10-minute bins and explicit underflow and overflow thresholds](https://docs.aspose.com/slides/cpp/create-chart/histogram_bin_width.png) #### **Specify the Number of Bins** For a fixed level of detail instead of fixed intervals, request five bins for the same data. This example leaves underflow and overflow bins disabled. The chart determines the width from the data range, so boundaries can change between reports. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace System; using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::Histogram, 20, 20, 680, 200); chart->set_HasLegend(false); chart->set_HasTitle(false); chart->get_ChartData()->get_Categories()->Clear(); chart->get_ChartData()->get_Series()->Clear(); auto workbook = chart->get_ChartData()->get_ChartDataWorkbook(); workbook->Clear(0); auto series = chart->get_ChartData()->get_Series()->Add(ChartType::Histogram); auto values = MakeArray({ 5, 10, 10, 11, 15, 20, 20, 21, 25, 30, 30, 31, 35, 40, 40, 41, 50 }); for (auto i = 0; i < values->get_Length(); i++) { auto valueCell = workbook->GetCell(0, i, 0, ObjectExt::Box(values[i])); series->get_DataPoints()->AddDataPointForHistogramSeries(valueCell); } auto axis = chart->get_Axes()->get_HorizontalAxis(); axis->set_AggregationType(AxisAggregationType::ByNumberOfBins); axis->set_NumberOfBins(5); presentation->Save(u"Histogram-bin-count.pptx", SaveFormat::Pptx); ``` The five bins have counts of **4, 4, 4, 4, and 1**. Compare this distribution with the fixed-width result above: the input values are identical, but the boundaries differ. ![Histogram with five bins calculated from the same data](https://docs.aspose.com/slides/cpp/create-chart/histogram_bin_count.png) ### **Create Radar Charts** Radar charts are used to display multivariate data in a two-dimensional format, allowing for easy comparison of several variables simultaneously. They are particularly useful for identifying patterns, strengths, and weaknesses across multiple performance metrics or attributes. This example uses [AddChart](https://reference.aspose.com/slides/cpp/aspose.slides/ishapecollection/addchart/) to create a radar chart with the default series and categories, then saves the presentation as PPTX. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace System; using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); slide->get_Shapes()->AddChart(ChartType::Radar, 20, 20, 500, 300); presentation->Save(u"Radar-chart.pptx", SaveFormat::Pptx); ``` The result: ![The Radar chart](https://docs.aspose.com/slides/cpp/create-chart/radar_chart.png) ### **Create Multi-Category Charts** Multi-category charts are used to display data that involves more than one categorical grouping, allowing you to compare values across multiple dimensions simultaneously. They are particularly helpful when you need to analyze trends and relationships within complex, multi-layered datasets. This example creates a clustered column chart with eight categories arranged in four pairs. The [SetGroupingItem](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartcategorylevelsmanager/setgroupingitem/) method gives each pair a shared label at grouping level 1, producing a category axis with both individual and group labels. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace System; using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::ClusteredColumn, 20, 20, 500, 300); chart->get_ChartData()->get_Series()->Clear(); chart->get_ChartData()->get_Categories()->Clear(); auto workbook = chart->get_ChartData()->get_ChartDataWorkbook(); workbook->Clear(0); auto worksheetIndex = 0; auto categoryCell = workbook->GetCell(0, u"c2", ObjectExt::Box(String(u"A"))); auto category = chart->get_ChartData()->get_Categories()->Add(categoryCell); category->get_GroupingLevels()->SetGroupingItem(1, ObjectExt::Box(String(u"Group1"))); categoryCell = workbook->GetCell(0, u"c3", ObjectExt::Box(String(u"B"))); category = chart->get_ChartData()->get_Categories()->Add(categoryCell); categoryCell = workbook->GetCell(0, u"c4", ObjectExt::Box(String(u"C"))); category = chart->get_ChartData()->get_Categories()->Add(categoryCell); category->get_GroupingLevels()->SetGroupingItem(1, ObjectExt::Box(String(u"Group2"))); categoryCell = workbook->GetCell(0, u"c5", ObjectExt::Box(String(u"D"))); category = chart->get_ChartData()->get_Categories()->Add(categoryCell); categoryCell = workbook->GetCell(0, u"c6", ObjectExt::Box(String(u"E"))); category = chart->get_ChartData()->get_Categories()->Add(categoryCell); category->get_GroupingLevels()->SetGroupingItem(1, ObjectExt::Box(String(u"Group3"))); categoryCell = workbook->GetCell(0, u"c7", ObjectExt::Box(String(u"F"))); category = chart->get_ChartData()->get_Categories()->Add(categoryCell); categoryCell = workbook->GetCell(0, u"c8", ObjectExt::Box(String(u"G"))); category = chart->get_ChartData()->get_Categories()->Add(categoryCell); category->get_GroupingLevels()->SetGroupingItem(1, ObjectExt::Box(String(u"Group4"))); categoryCell = workbook->GetCell(0, u"c9", ObjectExt::Box(String(u"H"))); category = chart->get_ChartData()->get_Categories()->Add(categoryCell); auto seriesNameCell = workbook->GetCell(0, u"D1", ObjectExt::Box(String(u"Series 1"))); auto series = chart->get_ChartData()->get_Series()->Add(seriesNameCell, ChartType::ClusteredColumn); auto valueCell = workbook->GetCell(worksheetIndex, u"D2", ObjectExt::Box(10)); series->get_DataPoints()->AddDataPointForBarSeries(valueCell); valueCell = workbook->GetCell(worksheetIndex, u"D3", ObjectExt::Box(20)); series->get_DataPoints()->AddDataPointForBarSeries(valueCell); valueCell = workbook->GetCell(worksheetIndex, u"D4", ObjectExt::Box(30)); series->get_DataPoints()->AddDataPointForBarSeries(valueCell); valueCell = workbook->GetCell(worksheetIndex, u"D5", ObjectExt::Box(40)); series->get_DataPoints()->AddDataPointForBarSeries(valueCell); valueCell = workbook->GetCell(worksheetIndex, u"D6", ObjectExt::Box(50)); series->get_DataPoints()->AddDataPointForBarSeries(valueCell); valueCell = workbook->GetCell(worksheetIndex, u"D7", ObjectExt::Box(60)); series->get_DataPoints()->AddDataPointForBarSeries(valueCell); valueCell = workbook->GetCell(worksheetIndex, u"D8", ObjectExt::Box(70)); series->get_DataPoints()->AddDataPointForBarSeries(valueCell); valueCell = workbook->GetCell(worksheetIndex, u"D9", ObjectExt::Box(80)); series->get_DataPoints()->AddDataPointForBarSeries(valueCell); presentation->Save(u"AsposeChart.pptx", SaveFormat::Pptx); ``` The result: ![The multi category chart](https://docs.aspose.com/slides/cpp/create-chart/multi_category_chart.png) #### **Remove a Quarter Label** Download [quarters.pptx](https://docs.aspose.com/slides/cpp/create-chart/quarters.pptx) and place it in the working directory. Its chart shows nine months and a single sales series with values from 10 through 18. The category axis has three quarter labels: Q1 spans Jan–Mar, Q2 spans Apr–Jun, and Q3 spans Jul–Sep. April is the fourth category and the one on which Q2 was explicitly set. Call [DeleteGroupingItem](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartcategorylevelsmanager/deletegroupingitem/) on April's [get_GroupingLevels](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartcategory/get_groupinglevels/) collection. The level is relative to April: level 1 is its quarter, and level 0 is the month itself. The method cannot remove the leaf category at level 0. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace System; using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; auto presentation = MakeObject(u"quarters.pptx"); auto chart = ExplicitCast(presentation->get_Slide(0)->get_Shape(0)); auto april = chart->get_ChartData()->get_Categories()->idx_get(3); april->get_GroupingLevels()->DeleteGroupingItem(1); presentation->Save(u"quarters-updated.pptx", SaveFormat::Pptx); auto reopened = MakeObject(u"quarters-updated.pptx"); auto updatedChart = ExplicitCast(reopened->get_Slide(0)->get_Shape(0)); auto data = updatedChart->get_ChartData(); auto categories = data->get_Categories(); for (auto i = 0; i < categories->get_Count(); ++i) { if (i > 0) Console::Write(u", "); Console::Write(categories->idx_get(i)->get_AsCell()->get_Value()->ToString()); } Console::WriteLine(); auto points = data->get_Series()->idx_get(0)->get_DataPoints(); for (auto i = 0; i < points->get_Count(); ++i) { if (i > 0) Console::Write(u", "); Console::Write(points->idx_get(i)->get_Value()->get_Data()->ToString()); } Console::WriteLine(); ``` The reopened chart prints the original months (`Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep`) and sales values (`10, 11, 12, 13, 14, 15, 16, 17, 18`) in the same order. Open `quarters-updated.pptx` in PowerPoint to compare the axis labels. The Q2 label and the group boundary before April disappear, so Q1 spans January through June. Q3 still begins in July. ![Quarter labels before and after removal. On the left, Q2 spans April through June. On the right, Q1 spans January through June.](https://docs.aspose.com/slides/cpp/create-chart/quarter-label-comparison.png) ### **Create Map Charts** Map charts are used to visualize geographical data by mapping information to specific locations such as countries, states, or cities. They are particularly useful for analyzing regional trends, demographic data, and spatial distributions in a clear, visually engaging manner. This example uses [AddChart](https://reference.aspose.com/slides/cpp/aspose.slides/ishapecollection/addchart/) to create a map chart with the default geographical data and saves it for viewing in PowerPoint. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace System; using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::Map, 20, 20, 500, 300); presentation->Save(u"mapChart.pptx", SaveFormat::Pptx); ``` The result: ![The Map chart](https://docs.aspose.com/slides/cpp/create-chart/map_chart.png) The picture above shows the saved presentation opened in PowerPoint. Aspose.Slides writes the map chart and its data correctly, but it does not draw map charts itself: when a slide holding one is rendered to an image or converted to PDF or SVG, the chart area comes out blank. Other shapes on the same slide are unaffected. ### **Create Combination Charts** A combination chart (or combo chart) combines two or more chart types in a single graph. This chart lets you highlight, compare, or examine differences between two or more data sets, helping you identify relationships between them. ![The combination chart](https://docs.aspose.com/slides/cpp/create-chart/combination_chart.png) This example combines two clustered column series with a line series across four categories. The columns use the primary vertical axis, while [set_PlotOnSecondAxis](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartseries/set_plotonsecondaxis/) places the line on a secondary vertical axis on the right. The helper functions configure the title, legend, axis labels, and gridlines. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace System; using namespace System::Drawing; using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; struct ComboChartExample { static void CreateComboChart() { auto presentation = MakeObject(); auto chart = CreateChartWithFirstSeries(presentation->get_Slide(0)); AddSecondSeriesToChart(chart); AddThirdSeriesToChart(chart); SetPrimaryAxesFormat(chart); SetSecondaryAxesFormat(chart); presentation->Save(u"combo-chart.pptx", SaveFormat::Pptx); } static SharedPtr CreateChartWithFirstSeries(SharedPtr slide) { auto chart = slide->get_Shapes()->AddChart(ChartType::ClusteredColumn, 50, 50, 600, 400); chart->set_HasTitle(true); chart->get_ChartTitle()->AddTextFrameForOverriding(u"Chart Title"); chart->get_ChartTitle()->set_Overlay(false); auto portionFormat = chart->get_ChartTitle()->get_TextFrameForOverriding()->get_Paragraphs()->idx_get(0)->get_ParagraphFormat()->get_DefaultPortionFormat(); portionFormat->set_FontBold(NullableBool::False); portionFormat->set_FontHeight(18.0f); chart->get_Legend()->set_Position(LegendPositionType::Bottom); chart->get_Legend()->get_TextFormat()->get_PortionFormat()->set_FontHeight(12.0f); chart->get_ChartData()->get_Series()->Clear(); chart->get_ChartData()->get_Categories()->Clear(); auto workbook = chart->get_ChartData()->get_ChartDataWorkbook(); auto worksheetIndex = 0; auto categoryCell = workbook->GetCell(worksheetIndex, 1, 0, ObjectExt::Box(String(u"Category 1"))); chart->get_ChartData()->get_Categories()->Add(categoryCell); categoryCell = workbook->GetCell(worksheetIndex, 2, 0, ObjectExt::Box(String(u"Category 2"))); chart->get_ChartData()->get_Categories()->Add(categoryCell); categoryCell = workbook->GetCell(worksheetIndex, 3, 0, ObjectExt::Box(String(u"Category 3"))); chart->get_ChartData()->get_Categories()->Add(categoryCell); categoryCell = workbook->GetCell(worksheetIndex, 4, 0, ObjectExt::Box(String(u"Category 4"))); chart->get_ChartData()->get_Categories()->Add(categoryCell); auto seriesNameCell = workbook->GetCell(worksheetIndex, 0, 1, ObjectExt::Box(String(u"Series 1"))); auto series = chart->get_ChartData()->get_Series()->Add(seriesNameCell, chart->get_Type()); series->get_ParentSeriesGroup()->set_Overlap(-25); series->get_ParentSeriesGroup()->set_GapWidth(220); auto valueCell = workbook->GetCell(worksheetIndex, 1, 1, ObjectExt::Box(4.3)); series->get_DataPoints()->AddDataPointForBarSeries(valueCell); valueCell = workbook->GetCell(worksheetIndex, 2, 1, ObjectExt::Box(2.5)); series->get_DataPoints()->AddDataPointForBarSeries(valueCell); valueCell = workbook->GetCell(worksheetIndex, 3, 1, ObjectExt::Box(3.5)); series->get_DataPoints()->AddDataPointForBarSeries(valueCell); valueCell = workbook->GetCell(worksheetIndex, 4, 1, ObjectExt::Box(4.5)); series->get_DataPoints()->AddDataPointForBarSeries(valueCell); return chart; } static void AddSecondSeriesToChart(SharedPtr chart) { auto workbook = chart->get_ChartData()->get_ChartDataWorkbook(); const int worksheetIndex = 0; auto seriesNameCell = workbook->GetCell(worksheetIndex, 0, 2, ObjectExt::Box(String(u"Series 2"))); auto series = chart->get_ChartData()->get_Series()->Add(seriesNameCell, ChartType::ClusteredColumn); series->get_ParentSeriesGroup()->set_Overlap(-25); series->get_ParentSeriesGroup()->set_GapWidth(220); auto valueCell = workbook->GetCell(worksheetIndex, 1, 2, ObjectExt::Box(2.4)); series->get_DataPoints()->AddDataPointForBarSeries(valueCell); valueCell = workbook->GetCell(worksheetIndex, 2, 2, ObjectExt::Box(4.4)); series->get_DataPoints()->AddDataPointForBarSeries(valueCell); valueCell = workbook->GetCell(worksheetIndex, 3, 2, ObjectExt::Box(1.8)); series->get_DataPoints()->AddDataPointForBarSeries(valueCell); valueCell = workbook->GetCell(worksheetIndex, 4, 2, ObjectExt::Box(2.8)); series->get_DataPoints()->AddDataPointForBarSeries(valueCell); } static void AddThirdSeriesToChart(SharedPtr chart) { auto workbook = chart->get_ChartData()->get_ChartDataWorkbook(); const int worksheetIndex = 0; auto seriesNameCell = workbook->GetCell(worksheetIndex, 0, 3, ObjectExt::Box(String(u"Series 3"))); auto series = chart->get_ChartData()->get_Series()->Add(seriesNameCell, ChartType::Line); auto valueCell = workbook->GetCell(worksheetIndex, 1, 3, ObjectExt::Box(2.0)); series->get_DataPoints()->AddDataPointForLineSeries(valueCell); valueCell = workbook->GetCell(worksheetIndex, 2, 3, ObjectExt::Box(2.0)); series->get_DataPoints()->AddDataPointForLineSeries(valueCell); valueCell = workbook->GetCell(worksheetIndex, 3, 3, ObjectExt::Box(3.0)); series->get_DataPoints()->AddDataPointForLineSeries(valueCell); valueCell = workbook->GetCell(worksheetIndex, 4, 3, ObjectExt::Box(5.0)); series->get_DataPoints()->AddDataPointForLineSeries(valueCell); series->set_PlotOnSecondAxis(true); } static void SetPrimaryAxesFormat(SharedPtr chart) { auto horizontalAxis = chart->get_Axes()->get_HorizontalAxis(); horizontalAxis->get_TextFormat()->get_PortionFormat()->set_FontHeight(12.0f); horizontalAxis->get_Format()->get_Line()->get_FillFormat()->set_FillType(FillType::NoFill); SetAxisTitle(horizontalAxis, u"X Axis"); auto verticalAxis = chart->get_Axes()->get_VerticalAxis(); verticalAxis->get_TextFormat()->get_PortionFormat()->set_FontHeight(12.0f); verticalAxis->get_Format()->get_Line()->get_FillFormat()->set_FillType(FillType::NoFill); SetAxisTitle(verticalAxis, u"Y Axis 1"); auto majorGridLinesFormat = verticalAxis->get_MajorGridLinesFormat()->get_Line()->get_FillFormat(); majorGridLinesFormat->set_FillType(FillType::Solid); majorGridLinesFormat->get_SolidFillColor()->set_Color(Color::FromArgb(217, 217, 217)); } static void SetSecondaryAxesFormat(SharedPtr chart) { auto secondaryHorizontalAxis = chart->get_Axes()->get_SecondaryHorizontalAxis(); secondaryHorizontalAxis->set_Position(AxisPositionType::Bottom); secondaryHorizontalAxis->set_CrossType(CrossesType::Maximum); secondaryHorizontalAxis->set_IsVisible(false); secondaryHorizontalAxis->get_MajorGridLinesFormat()->get_Line()->get_FillFormat()->set_FillType(FillType::NoFill); secondaryHorizontalAxis->get_MinorGridLinesFormat()->get_Line()->get_FillFormat()->set_FillType(FillType::NoFill); auto secondaryVerticalAxis = chart->get_Axes()->get_SecondaryVerticalAxis(); secondaryVerticalAxis->set_Position(AxisPositionType::Right); secondaryVerticalAxis->get_TextFormat()->get_PortionFormat()->set_FontHeight(12.0f); secondaryVerticalAxis->get_Format()->get_Line()->get_FillFormat()->set_FillType(FillType::NoFill); secondaryVerticalAxis->get_MajorGridLinesFormat()->get_Line()->get_FillFormat()->set_FillType(FillType::NoFill); secondaryVerticalAxis->get_MinorGridLinesFormat()->get_Line()->get_FillFormat()->set_FillType(FillType::NoFill); SetAxisTitle(secondaryVerticalAxis, u"Y Axis 2"); } static void SetAxisTitle(SharedPtr axis, String axisTitle) { axis->set_HasTitle(true); axis->get_Title()->set_Overlay(false); auto titlePortionFormat = axis->get_Title()->AddTextFrameForOverriding(axisTitle)->get_Paragraphs()->idx_get(0)->get_ParagraphFormat()->get_DefaultPortionFormat(); titlePortionFormat->set_FontBold(NullableBool::False); titlePortionFormat->set_FontHeight(12.0f); } }; ComboChartExample::CreateComboChart(); ``` ## **Update Charts** Aspose.Slides for C++ enables you to update PowerPoint charts by modifying chart data, formatting, and styling. This functionality simplifies the process of keeping presentations up-to-date with dynamic content and ensures that charts accurately reflect current data and visual standards. This example updates the chart named "My chart" on the first slide of an existing presentation. It requires two column series with three data points each, with category labels in column A and series names in the first row of the first worksheet. The example uses [GetCell](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdataworkbook/getcell/) to change workbook cells, updates series values, adds a third series, and changes the chart to clustered cylinders through [set_Type](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichart/set_type/). ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace System; using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; const String chartName = u"My chart"; auto presentation = MakeObject(u"ExistingChart.pptx"); auto slide = presentation->get_Slide(0); for (auto shape : slide->get_Shapes()) { auto chart = System::DynamicCast(shape); if (chart != nullptr && chart->get_Name() == chartName) { auto worksheetIndex = 0; auto workbook = chart->get_ChartData()->get_ChartDataWorkbook(); workbook->GetCell(worksheetIndex, 1, 0, ObjectExt::Box(String(u"Modified Category 1"))); workbook->GetCell(worksheetIndex, 2, 0, ObjectExt::Box(String(u"Modified Category 2"))); auto series = chart->get_ChartData()->get_Series()->idx_get(0); workbook->GetCell(worksheetIndex, 0, 1, ObjectExt::Box(String(u"New_Series 1"))); series->get_DataPoints()->idx_get(0)->get_Value()->set_Data(ObjectExt::Box(90)); series->get_DataPoints()->idx_get(1)->get_Value()->set_Data(ObjectExt::Box(123)); series->get_DataPoints()->idx_get(2)->get_Value()->set_Data(ObjectExt::Box(44)); series = chart->get_ChartData()->get_Series()->idx_get(1); workbook->GetCell(worksheetIndex, 0, 2, ObjectExt::Box(String(u"New_Series 2"))); series->get_DataPoints()->idx_get(0)->get_Value()->set_Data(ObjectExt::Box(23)); series->get_DataPoints()->idx_get(1)->get_Value()->set_Data(ObjectExt::Box(67)); series->get_DataPoints()->idx_get(2)->get_Value()->set_Data(ObjectExt::Box(99)); auto seriesNameCell = workbook->GetCell(worksheetIndex, 0, 3, ObjectExt::Box(String(u"Series 3"))); series = chart->get_ChartData()->get_Series()->Add(seriesNameCell, chart->get_Type()); auto valueCell = workbook->GetCell(worksheetIndex, 1, 3, ObjectExt::Box(20)); series->get_DataPoints()->AddDataPointForBarSeries(valueCell); valueCell = workbook->GetCell(worksheetIndex, 2, 3, ObjectExt::Box(50)); series->get_DataPoints()->AddDataPointForBarSeries(valueCell); valueCell = workbook->GetCell(worksheetIndex, 3, 3, ObjectExt::Box(30)); series->get_DataPoints()->AddDataPointForBarSeries(valueCell); chart->set_Type(ChartType::ClusteredCylinder); } } presentation->Save(u"AsposeChartModified.pptx", SaveFormat::Pptx); ``` ## **Set Data Range for a Chart** To inspect the range already used by an existing chart, see [Retrieve a Chart's Data Range](https://docs.aspose.com/slides/cpp/chart-workbook/#retrieve-a-charts-data-range). Aspose.Slides for C++ provides the flexibility to define a specific data range from a worksheet as the source for your chart's data. This means you can directly map a portion of your worksheet to the chart, allowing you to control which cells contribute to the chart's series and categories. As a result, you can easily update and synchronize your charts with the latest data changes in your worksheet, ensuring that your PowerPoint presentations reflect current and accurate information. This example uses [SetRange](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdata/setrange/) to set the data source of the chart named "My chart" on the first slide of an existing presentation to `Sheet1!A1:B4`. The chart workbook must contain that worksheet and a populated range with a series heading in the first row, category labels in column A, and three values in column B. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace System; using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; const String chartName = u"My chart"; auto presentation = MakeObject(u"ExistingChart.pptx"); auto slide = presentation->get_Slide(0); for (auto shape : slide->get_Shapes()) { auto chart = System::DynamicCast(shape); if (chart != nullptr && chart->get_Name() == chartName) { chart->get_ChartData()->SetRange(u"Sheet1!A1:B4"); } } presentation->Save(u"SetDataRange.pptx", SaveFormat::Pptx); ``` ## **Use Default Markers in Charts** When you use default markers in charts, each chart series gets a different default marker symbol automatically. This example uses [AddChart](https://reference.aspose.com/slides/cpp/aspose.slides/ishapecollection/addchart/) to create a chart with two line series and a legend. The [get_Marker](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartseries/get_marker/) settings retain the automatically assigned marker symbols. The first series includes a negative value and a missing value, represented by `nullptr`, while the second has a value for every category. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace System; using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::LineWithMarkers, 10, 10, 400, 400); chart->get_ChartData()->get_Series()->Clear(); chart->get_ChartData()->get_Categories()->Clear(); auto workbook = chart->get_ChartData()->get_ChartDataWorkbook(); auto seriesNameCell = workbook->GetCell(0, 0, 1, ObjectExt::Box(String(u"Series 1"))); auto series = chart->get_ChartData()->get_Series()->Add(seriesNameCell, chart->get_Type()); auto categoryCell = workbook->GetCell(0, 1, 0, ObjectExt::Box(String(u"C1"))); chart->get_ChartData()->get_Categories()->Add(categoryCell); auto valueCell = workbook->GetCell(0, 1, 1, ObjectExt::Box(24)); series->get_DataPoints()->AddDataPointForLineSeries(valueCell); categoryCell = workbook->GetCell(0, 2, 0, ObjectExt::Box(String(u"C2"))); chart->get_ChartData()->get_Categories()->Add(categoryCell); valueCell = workbook->GetCell(0, 2, 1, ObjectExt::Box(23)); series->get_DataPoints()->AddDataPointForLineSeries(valueCell); categoryCell = workbook->GetCell(0, 3, 0, ObjectExt::Box(String(u"C3"))); chart->get_ChartData()->get_Categories()->Add(categoryCell); valueCell = workbook->GetCell(0, 3, 1, ObjectExt::Box(-10)); series->get_DataPoints()->AddDataPointForLineSeries(valueCell); categoryCell = workbook->GetCell(0, 4, 0, ObjectExt::Box(String(u"C4"))); chart->get_ChartData()->get_Categories()->Add(categoryCell); valueCell = workbook->GetCell(0, 4, 1, nullptr); series->get_DataPoints()->AddDataPointForLineSeries(valueCell); seriesNameCell = workbook->GetCell(0, 0, 2, ObjectExt::Box(String(u"Series 2"))); auto secondSeries = chart->get_ChartData()->get_Series()->Add(seriesNameCell, chart->get_Type()); valueCell = workbook->GetCell(0, 1, 2, ObjectExt::Box(30)); secondSeries->get_DataPoints()->AddDataPointForLineSeries(valueCell); valueCell = workbook->GetCell(0, 2, 2, ObjectExt::Box(10)); secondSeries->get_DataPoints()->AddDataPointForLineSeries(valueCell); valueCell = workbook->GetCell(0, 3, 2, ObjectExt::Box(60)); secondSeries->get_DataPoints()->AddDataPointForLineSeries(valueCell); valueCell = workbook->GetCell(0, 4, 2, ObjectExt::Box(40)); secondSeries->get_DataPoints()->AddDataPointForLineSeries(valueCell); chart->set_HasLegend(true); chart->get_Legend()->set_Overlay(false); presentation->Save(u"DefaultMarkersInChart.pptx", SaveFormat::Pptx); ``` ## **FAQ** **What chart types are supported by Aspose.Slides for C++?** Aspose.Slides for C++ supports a wide range of chart types, including bar, line, pie, area, scatter, histogram, radar, and many more. This flexibility allows you to choose the most appropriate chart type for your data visualization needs. **How do I add a new chart to a slide?** To add a chart, you first create an instance of the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation) class, retrieve the desired slide using its index, and then call the method to add a chart, specifying the chart type and initial data. This process integrates the chart directly into your presentation. **How can I update the data displayed in a chart?** You can update a chart's data by accessing its data workbook ([IChartDataWorkbook](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdataworkbook/)), clearing any default series and categories, and then adding your custom data. This allows you to programmatically refresh the chart to reflect the latest data. **Is it possible to customize the appearance of the chart?** Yes, Aspose.Slides for C++ provides extensive customization options. You can modify colors, fonts, labels, legends, and other formatting elements to tailor the chart's appearance to your specific design requirements. Related feature: [Create editable charts](https://docs.aspose.com/slides/features/create-charts/). # Specify Fallback Fonts for Presentations in C++ > Master Aspose.Slides for C++ to set fallback fonts in PPT, PPTX and ODP files, safeguarding consistent text display on any device or OS. Source: https://docs.aspose.com/slides/cpp/create-fallback-font/ Updated: 2026-08-13 ## **Overview** Aspose.Slides allows you to specify fallback fonts for presentation rendering and export operations. Fallback fonts are used when the primary font does not contain glyphs for particular characters. Fallback behavior is configured through fallback rules. Each rule associates a Unicode range with one or more fonts that may contain the required glyphs. You can define rules for different character ranges, add or remove fallback fonts from existing rules, and organize multiple rules in a fallback font rules collection. Fallback rules are runtime rendering settings. They do not modify the presentation file itself and are not stored inside the PPTX file. ## **Fallback Rules** Aspose.Slides supports [IFontFallBackRule](https://reference.aspose.com/slides/cpp/aspose.slides/ifontfallbackrule/) interface and [FontFallBackRule](https://reference.aspose.com/slides/cpp/aspose.slides/fontfallbackrule/) class to specify the rules to apply a fallback font. [FontFallBackRule](https://reference.aspose.com/slides/cpp/aspose.slides/fontfallbackrule/) class represents an association between the specified Unicode range, used for searching missed glyphs, and a list of fonts that may contain proper glyphs: ``` cpp #include #include using namespace Aspose::Slides; using namespace System; uint32_t startUnicodeIndex = 0x0B80; uint32_t endUnicodeIndex = 0x0BFF; auto firstRule = MakeObject(startUnicodeIndex, endUnicodeIndex, u"Vijaya"); auto secondRule = MakeObject(static_cast(0x3040), static_cast(0x309F), u"MS Mincho, MS Gothic"); // Using multiple ways you can add fonts list: auto fontNames = MakeArray({ u"Segoe UI Emoji, Segoe UI Symbol", u"Arial" }); auto thirdRule = MakeObject(static_cast(0x1F300), static_cast(0x1F64F), fontNames); ``` It is also possible to [Remove()](https://reference.aspose.com/slides/cpp/aspose.slides/ifontfallbackrule/remove/) fallback font or [AddFallBackFonts()](https://reference.aspose.com/slides/cpp/aspose.slides/ifontfallbackrule/addfallbackfonts/) into existing [FontFallBackRule](https://reference.aspose.com/slides/cpp/aspose.slides/fontfallbackrule/) object. [FontFallBackRulesCollection](https://reference.aspose.com/slides/cpp/aspose.slides/fontfallbackrulescollection/) can be used to organize a list of [FontFallBackRule](https://reference.aspose.com/slides/cpp/aspose.slides/fontfallbackrule/) objects, when there is a need to specify fallback font replacement rules for multiple Unicode ranges. - [Create Fallback Fonts Collection](https://docs.aspose.com/slides/cpp/create-fallback-fonts-collection/) ## **FAQ** ### What is the difference between a fallback font, font substitution, and font embedding? A fallback font is used only for characters missing in the primary font. [Font substitution](https://docs.aspose.com/slides/cpp/font-substitution/) replaces the entire specified font with another font. [Font embedding](https://docs.aspose.com/slides/cpp/embedded-font/) packages the fonts inside the output file so recipients can view the text as intended. ### Are fallback fonts applied during exports like PDF, PNG, or SVG, or only on-screen rendering? Yes. Fallback affects all [rendering and export operations](https://docs.aspose.com/slides/cpp/convert-presentation/) where characters must be drawn but are absent in the source font. ### Does configuring fallback change the presentation file itself, and will the setting persist for future openings? No. Fallback rules are runtime rendering settings in your code; they are not stored inside the .pptx and won’t appear in PowerPoint. ### Does the operating system (Windows/Linux/macOS) and the set of font directories affect fallback selection? Yes. The engine resolves fonts from available system folders and any [additional paths](https://docs.aspose.com/slides/cpp/custom-font/) you provide. If a font isn’t physically available, a rule referencing it cannot take effect. ### Does fallback work for WordArt, SmartArt, and charts? Yes. When these objects contain text, the same glyph-substitution mechanism applies to render missing characters. ## Related articles - [Manage Fallback Fonts for Presentations in C++](https://docs.aspose.com/slides/cpp/fallback-font/) - [Configure Fallback Font Collections in C++](https://docs.aspose.com/slides/cpp/create-fallback-fonts-collection/) - [Render Presentations with Fallback Fonts in C++](https://docs.aspose.com/slides/cpp/render-presentation-with-fallback-font/) # Configure Fallback Font Collections in C++ > Set up a fallback fonts collection in Aspose.Slides for C++ to keep text consistent and crisp in PowerPoint and OpenDocument presentations. Source: https://docs.aspose.com/slides/cpp/create-fallback-fonts-collection/ Updated: 2026-08-13 ## **Overview** Aspose.Slides allows you to configure a collection of fallback font rules for a presentation. Each fallback rule is represented by the `FontFallBackRule` class and can be added to a `FontFallBackRulesCollection`, which implements the `IFontFallBackRulesCollection` interface. After creating the collection, you can assign it using the `set_FontFallBackRulesCollection` method of the presentation’s `FontsManager`. The `FontsManager` controls fonts across the presentation, and each `Presentation` instance has its own `FontsManager`. Once the `FontsManager` is initialized with the fallback font collection, the specified fallback fonts are applied during presentation rendering. ## **Apply Fallback Rules** Instances of [FontFallBackRule](https://reference.aspose.com/slides/cpp/aspose.slides/fontfallbackrule/) class can be organized into [FontFallBackRulesCollection](https://reference.aspose.com/slides/cpp/aspose.slides/fontfallbackrulescollection/), that implements [IFontFallBackRulesCollection](https://reference.aspose.com/slides/cpp/aspose.slides/ifontfallbackrulescollection/) interface. It is possible to add or remove rules from the collection. Then this collection may be passed to [set_FontFallBackRulesCollection()](https://reference.aspose.com/slides/cpp/aspose.slides/fontsmanager/set_fontfallbackrulescollection/) method of the [FontsManager](https://reference.aspose.com/slides/cpp/aspose.slides/fontsmanager/) class. FontsManager controls fonts across the presentation. Each [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) has a [get_FontsManager()](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/get_fontsmanager/) method with its own instance of the FontsManager class. Here is an examples how to create fallback fonts rules collection and assign in into the FontsManager of a certain presentation:   ``` cpp #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto presentation = MakeObject(); auto userRulesList = MakeObject(); userRulesList->Add(MakeObject(static_cast(0x0B80), static_cast(0x0BFF), u"Vijaya")); userRulesList->Add(MakeObject(static_cast(0x3040), static_cast(0x309F), u"MS Mincho, MS Gothic")); presentation->get_FontsManager()->set_FontFallBackRulesCollection(userRulesList); ``` After FontsManager is initialised with fallback fonts collection, the fallback fonts are applied during presentation rendering. Read more how to [Render Presentation with Fallback Font](https://docs.aspose.com/slides/cpp/render-presentation-with-fallback-font/). ## **FAQ** ### Will my fallback rules be embedded into the PPTX file and visible in PowerPoint after saving? No. Fallback rules are runtime rendering settings; they are not serialized into PPTX and will not appear in PowerPoint's UI. ### Does fallback apply to text inside SmartArt, WordArt, charts, and tables? Yes. The same glyph-substitution mechanism is used for any text in these objects. ### Does Aspose distribute any fonts with the library? No. You add and use fonts on your side and under your own responsibility. ### Can replacement/substitution for missing fonts and fallback for missing glyphs be used together? Yes. They are independent stages of the same font-resolution pipeline: first the engine resolves font availability ([replacement](https://docs.aspose.com/slides/cpp/font-replacement/)/[substitution](https://docs.aspose.com/slides/cpp/font-substitution/)), then fallback fills gaps for missing glyphs in available fonts. ## Related articles - [Render Presentations with Fallback Fonts in C++](https://docs.aspose.com/slides/cpp/render-presentation-with-fallback-font/) - [Manage Fallback Fonts for Presentations in C++](https://docs.aspose.com/slides/cpp/fallback-font/) - [Specify Fallback Fonts for Presentations in C++](https://docs.aspose.com/slides/cpp/create-fallback-font/) # Create Presentations in C++ > Create presentations in C++ with Aspose.Slides—produce PPT, PPTX, and ODP files, benefit from OpenDocument support, and save them programmatically for reliable results. Source: https://docs.aspose.com/slides/cpp/create-presentation/ Updated: 2026-09-27 ## **Overview** This article shows how to create a presentation in Aspose.Slides, add a text box to its first slide, and save the result as a file. A short FAQ at the end covers common questions about formats, templates, slide sizing, units, memory usage, threading, licensing, digital signatures, and VBA support. Before you begin, add Aspose.Slides to your project: from NuGet in a Visual Studio project on Windows, or from the ZIP package with CMake on Linux. See [Installation](https://docs.aspose.com/slides/cpp/installation/). ## **Create a PowerPoint Presentation** To create a presentation and put a text box on its first slide, follow these steps: 1. Create an instance of the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) class. A new presentation already contains one empty slide. 1. Get that slide with the [Presentation::get_Slide](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/get_slide/) method and its index, 0. 1. Add a rectangle with the [IShapeCollection::AddAutoShape](https://reference.aspose.com/slides/cpp/aspose.slides/ishapecollection/addautoshape/) method, and set its text with the [ITextFrame::set_Text](https://reference.aspose.com/slides/cpp/aspose.slides/itextframe/set_text/) method. 1. Save the presentation as a PPTX file with the [Presentation::Save](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/save/) method. ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; int main() { auto presentation = MakeObject(); 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; } ``` The rectangle's top-left corner is 50 points from the left edge and 50 points from the top edge of the slide, and the rectangle is 400 points wide and 100 points high. The program saves *hello.pptx* in its working directory, with one slide that holds the rectangle and its text. Without a license, Aspose.Slides also adds an evaluation watermark to every slide it saves; see [Licensing](https://docs.aspose.com/slides/cpp/licensing/). ## **FAQ** ### What formats can I save a new presentation to? You can save to [PPTX, PPT, and ODP](https://docs.aspose.com/slides/cpp/save-presentation/), and export to [PDF](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-pdf/), [XPS](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-xps/), [HTML](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-html/), [SVG](https://docs.aspose.com/slides/cpp/render-a-slide-as-an-svg-image/), and [images](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-png/), among others. ### Can I start from a template (POTX/POTM) and save as a regular PPTX? Yes. Load the template and save to the desired format; POTX/POTM/PPTM and similar formats [are supported](https://docs.aspose.com/slides/cpp/supported-file-formats/). ### How do I control slide size/aspect ratio when creating a presentation? Set the [slide size](https://docs.aspose.com/slides/cpp/slide-size/) (including presets like 4:3 and 16:9 or custom dimensions) and choose how content should scale. ### In what units are sizes and coordinates measured? In points: 1 inch equals 72 units. ### How do I handle very large presentations (with many media files) to reduce memory usage? Use [BLOB management strategies](https://docs.aspose.com/slides/cpp/manage-blob/), limit in-memory storage by leveraging temporary files, and prefer file-based workflows over purely in-memory streams. ### Can I create/save presentations in parallel? You cannot operate on the same [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) instance from [multiple threads](https://docs.aspose.com/slides/cpp/multithreading/). Run separate, isolated instances per thread or process. ### How do I remove the trial watermark and limitations? [Apply a license](https://docs.aspose.com/slides/cpp/licensing/) once per process. The license XML must remain unmodified, and the license setup should be synchronized if multiple threads are involved. ### Can I digitally sign the PPTX I create? Yes. [Digital signatures](https://docs.aspose.com/slides/cpp/digital-signature-in-powerpoint/) (adding and verifying) are supported for presentations. ### Are macros (VBA) supported in created presentations? Yes. You can [create/edit VBA projects](https://docs.aspose.com/slides/cpp/presentation-via-vba/) and save macro-enabled files such as PPTM/PPSM. # Create Excel Charts and Embed Them in Presentations as OLE Objects > Create an Excel chart with Aspose.Cells for C++ and embed the workbook in a PowerPoint presentation with Aspose.Slides, including a chart preview. Source: https://docs.aspose.com/slides/cpp/creating-excel-chart-and-embedding-it-in-presentation-as-ole-object/ Updated: 2026-10-20 ## **Overview** This article shows how to create an Excel column chart with Aspose.Cells for C++ and embed its workbook in a PowerPoint presentation with Aspose.Slides for C++. The embedded workbook contains both the source data and the chart. A separate PNG preview displays the chart on the slide before the OLE object is activated. The result is an embedded Excel object, not a native PowerPoint chart. Editing the workbook through OLE requires a desktop application that supports OLE activation and a compatible Excel installation. ## **Prerequisites** Configure your C++ project with the headers and libraries for Aspose.Cells for C++ and Aspose.Slides for C++. Place the example code in your application entry point, with the include declarations at file scope. Microsoft Office is not required to generate the presentation with these libraries. No input files are required: the example creates the data and chart in memory, then writes `OutputChart.pptx` to the current working directory. Apply licenses for both products when running outside evaluation mode. ## **How the Embedding Works** 1. Create a workbook with a data worksheet and a chart sheet. 1. Make the chart sheet active so that the workbook opens on the chart. 1. Set the workbook's OLE display range and render the chart to PNG. 1. Save the workbook as XLSX in memory and embed those bytes in a slide. 1. Assign the PNG as the OLE object's preview and save the presentation as PPTX. The workbook display range and the frame on the slide have different roles. [WorksheetCollection::SetOleSize](https://reference.aspose.com/cells/cpp/aspose.cells/worksheetcollection/setolesize/) takes zero-based start/end row and column indices. [ChartCollection::Add](https://reference.aspose.com/cells/cpp/aspose.cells.charts/chartcollection/add/) instead takes the top row, left column, bottom row, and right column. The example uses row index 55 and column index 25 as the lower-right boundaries; these values are layout choices, not the number of data rows or columns. The slide frame uses points. The example fits it within the slide and centers it while preserving the PNG's aspect ratio, rather than stretching the preview to fill the slide. ## **Create and Embed the Chart** The following complete example populates `DataSheet` with four rows and five columns of values. Each row becomes a chart series. `ChartSheet` is selected as the active sheet before the workbook is saved. The workbook is explicitly saved as XLSX, matching the `xlsx` extension passed to [OleEmbeddedDataInfo](https://reference.aspose.com/slides/cpp/aspose.slides.dom.ole/oleembeddeddatainfo/). The PNG is loaded from an in-memory stream without an intermediate bitmap conversion. Aspose.Cells returns byte vectors, which the example copies into the array type accepted by Aspose.Slides. Initialize Aspose.Cells before using its objects, and release its resources after those objects have been destroyed. Assigning it through [IOleObjectFrame::get_SubstitutePictureFormat](https://reference.aspose.com/slides/cpp/aspose.slides/ioleobjectframe/get_substitutepictureformat/) replaces the default OLE placeholder. ```cpp #include "Aspose.Cells/Cell.h" #include "Aspose.Cells/Cells.h" #include "Aspose.Cells/Chart.h" #include "Aspose.Cells/ChartCollection.h" #include "Aspose.Cells/ChartType.h" #include "Aspose.Cells/ImageType.h" #include "Aspose.Cells/Initializer.h" #include "Aspose.Cells/SaveFormat.h" #include "Aspose.Cells/SeriesCollection.h" #include "Aspose.Cells/SheetType.h" #include "Aspose.Cells/U16String.h" #include "Aspose.Cells/Vector.h" #include "Aspose.Cells/Workbook.h" #include "Aspose.Cells/Worksheet.h" #include "Aspose.Cells/WorksheetCollection.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::DOM::Ole; // Initialize Cells before creating any of its objects. Aspose::Cells::Startup(); { Aspose::Cells::Workbook workbook; auto dataSheet = workbook.GetWorksheets().Get(0); dataSheet.SetName(u"DataSheet"); int32_t values[4][5] = { { 67, 44, 46, 43, 24 }, { 86, 64, 97, 29, 40 }, { 68, 89, 78, 69, 38 }, { 91, 48, 60, 26, 25 } }; for (auto row = 0; row < 4; row++) { for (auto column = 0; column < 5; column++) { dataSheet.GetCells().Get(row, column).PutValue(values[row][column]); } } auto chartSheetIndex = workbook.GetWorksheets().Add(Aspose::Cells::SheetType::Chart); auto chartSheet = workbook.GetWorksheets().Get(chartSheetIndex); chartSheet.SetName(u"ChartSheet"); auto lastChartRow = 55; auto lastChartColumn = 25; auto chartIndex = chartSheet.GetCharts().Add(Aspose::Cells::Charts::ChartType::Column, 0, 0, lastChartRow, lastChartColumn); auto chart = chartSheet.GetCharts().Get(chartIndex); const char16_t* seriesRanges[] = { u"DataSheet!A1:E1", u"DataSheet!A2:E2", u"DataSheet!A3:E3", u"DataSheet!A4:E4" }; for (auto range : seriesRanges) { chart.GetNSeries().Add(range, false); } workbook.GetWorksheets().SetActiveSheetIndex(chartSheetIndex); workbook.GetWorksheets().SetOleSize(0, lastChartRow, 0, lastChartColumn); // Render the chart preview and serialize the editable workbook separately. auto chartImageData = chart.ToImage(Aspose::Cells::Drawing::ImageType::Png); auto workbookData = workbook.Save(Aspose::Cells::SaveFormat::Xlsx); // Copy Cells buffers into the array type used by Slides. auto toSlidesArray = [](const Aspose::Cells::Vector& buffer) { auto result = System::MakeArray(buffer.GetLength(), 0); std::copy(buffer.GetData(), buffer.GetData() + buffer.GetLength(), result->data_ptr()); return result; }; auto chartImageBytes = toSlidesArray(chartImageData); auto workbookBytes = toSlidesArray(workbookData); auto chartImageStream = System::MakeObject(chartImageBytes); auto chartImage = Images::FromStream(chartImageStream); auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto slideSize = presentation->get_SlideSize()->get_Size(); // Fit the preview within the slide without changing its aspect ratio. auto scale = (std::min)(slideSize.get_Width() / chartImage->get_Width(), slideSize.get_Height() / chartImage->get_Height()); auto frameWidth = chartImage->get_Width() * scale; auto frameHeight = chartImage->get_Height() * scale; auto frameX = (slideSize.get_Width() - frameWidth) / 2; auto frameY = (slideSize.get_Height() - frameHeight) / 2; auto embeddedData = System::MakeObject(workbookBytes, u"xlsx"); auto oleFrame = slide->get_Shapes()->AddOleObjectFrame(frameX, frameY, frameWidth, frameHeight, embeddedData); auto previewImage = presentation->get_Images()->AddImage(chartImage); oleFrame->get_SubstitutePictureFormat()->get_Picture()->set_Image(previewImage); presentation->Save(u"OutputChart.pptx", Aspose::Slides::Export::SaveFormat::Pptx); presentation->Dispose(); chartImage->Dispose(); chartImageStream->Dispose(); } // Release Cells resources after all Cells objects have been destroyed. Aspose::Cells::Cleanup(); ``` ## **Expected Result** `OutputChart.pptx` contains one slide with an embedded Excel workbook and a chart preview. The workbook contains the original data and a column chart with four series. The preview is centered on the slide and retains its proportions. ![Excel column chart displayed as the preview of an embedded workbook](https://docs.aspose.com/slides/cpp/creating-excel-chart-and-embedding-it-in-presentation-as-ole-object/excel-chart-ole-preview.png) In a compatible desktop PowerPoint environment with Excel available, double-click the object to activate and edit the embedded workbook. Activation and editing depend on the host application's OLE support and security settings. ## **FAQ** **Why is a preview image needed?** The embedded workbook and its slide preview are separate content. Supply a chart image so the slide shows the chart instead of the default "EMBEDDED OLE OBJECT" placeholder. See [Object Preview Issue when Adding OleObjectFrame](https://docs.aspose.com/slides/cpp/object-preview-issue-when-adding-oleobjectframe/). **Does the preview update automatically when I change the workbook in code?** Treat the preview as a snapshot. When updating workbook data programmatically, regenerate the chart image and replace the preview as well as the embedded workbook data. **Can I use XLS instead of XLSX?** Yes. Save the workbook in XLS format and use `xls` as the embedded data extension. The extension must match the actual workbook format; changing the extension alone does not convert the data. **Why might the object change size after activation?** The host application can update the OLE object's presentation when it activates the workbook. The workbook's OLE display range and the slide frame dimensions both matter. See [Working Solution for Chart Resizing in PPTX](https://docs.aspose.com/slides/cpp/working-solution-for-chart-resizing-in-pptx/). ## **Related Sections** - [Working Solution for Chart Resizing in PPTX](https://docs.aspose.com/slides/cpp/working-solution-for-chart-resizing-in-pptx/) - [Object Preview Issue when Adding OleObjectFrame](https://docs.aspose.com/slides/cpp/object-preview-issue-when-adding-oleobjectframe/) ## Related articles - [Manage OLE in Presentations Using C++](https://docs.aspose.com/slides/cpp/manage-ole/) - [Working Solution for Chart Resizing in PPTX](https://docs.aspose.com/slides/cpp/working-solution-for-chart-resizing-in-pptx/) - [Object Preview Issue When Adding OleObjectFrame](https://docs.aspose.com/slides/cpp/object-preview-issue-when-adding-oleobjectframe/) # Create and Modify Custom Animation Behaviors in C++ > Create, inspect, and modify custom animation behaviors and editable motion paths in PowerPoint presentations with Aspose.Slides for C++. Source: https://docs.aspose.com/slides/cpp/custom-animation/ Updated: 2026-11-08 ## **Overview** Custom animation behaviors let you control individual operations within an animation effect, such as changing a color, rotating a shape, or following an editable motion path. This guide shows how to create and combine behaviors, configure their timing, inspect and modify existing animations, and verify that their properties survive saving and reopening a presentation. For predefined effects and click triggers, see [Shape Animation](https://docs.aspose.com/slides/cpp/shape-animation/). ## **Understand the Animation Model** An animation is organized as **Timeline → Sequence → Effect → Behaviors**: - The slide's [get_Timeline](https://reference.aspose.com/slides/cpp/aspose.slides/ibaseslide/get_timeline/) contains its main sequence and interactive sequences. - An [ISequence](https://reference.aspose.com/slides/cpp/aspose.slides.animation/isequence/) contains effects, potentially targeting different shapes. - An [IEffect](https://reference.aspose.com/slides/cpp/aspose.slides.animation/ieffect/) identifies a target shape, preset, subtype, and effect timing. - [IEffect::get_Behaviors](https://reference.aspose.com/slides/cpp/aspose.slides.animation/ieffect/get_behaviors/) contains the operations that implement the effect: changing color, moving, rotating, setting a property, and so on. ## **Create Individual Behaviors** Call [ISequence::AddEffect](https://reference.aspose.com/slides/cpp/aspose.slides.animation/isequence/addeffect/) to create an effect and access its [get_Behaviors](https://reference.aspose.com/slides/cpp/aspose.slides.animation/ieffect/get_behaviors/) collection. A preset can populate this collection automatically. Keep its operations when extending the preset, or use [Clear](https://reference.aspose.com/slides/cpp/aspose.slides.animation/ibehaviorcollection/clear/) when deliberately replacing them. [IBehaviorFactory](https://reference.aspose.com/slides/cpp/aspose.slides.animation/ibehaviorfactory/) creates the eight behavior types illustrated below. Motion is covered in [Build a Motion Path](https://docs.aspose.com/slides/cpp/custom-animation/#build-a-motion-path). Each creation example is self-contained code to run inside a function; later editing examples state which output file they use. ### **Rotation** Use [CreateRotationEffect](https://reference.aspose.com/slides/cpp/aspose.slides.animation/ibehaviorfactory/createrotationeffect/) to create a rotation. [get_By](https://reference.aspose.com/slides/cpp/aspose.slides.animation/irotationeffect/get_by/) specifies a relative angle in degrees; [get_From](https://reference.aspose.com/slides/cpp/aspose.slides.animation/irotationeffect/get_from/) and [get_To](https://reference.aspose.com/slides/cpp/aspose.slides.animation/irotationeffect/get_to/) specify endpoints. The example starts with a Spin effect, replaces its preset operations with one rotation behavior, and gives that operation a two-second duration. A relative angle of 90 degrees expresses a quarter-turn from the shape's starting orientation, so no explicit starting angle is needed. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Animation; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 100, 100, 160, 80); auto effect = slide->get_Timeline()->get_MainSequence()->AddEffect(shape, EffectType::Spin, EffectSubtype::None, EffectTriggerType::OnClick); effect->get_Behaviors()->Clear(); auto factory = MakeObject(); auto rotation = factory->CreateRotationEffect(); rotation->set_By(90.0f); rotation->get_Timing()->set_Duration(2.0f); effect->get_Behaviors()->Add(rotation); presentation->Save(u"rotation.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` `rotation.pptx` contains one shape and one rotation behavior. The collection, timing, and rotation-editing examples below use this file. ### **Scale** Use [CreateScaleEffect](https://reference.aspose.com/slides/cpp/aspose.slides.animation/ibehaviorfactory/createscaleeffect/) with X/Y percentages: [get_From](https://reference.aspose.com/slides/cpp/aspose.slides.animation/iscaleeffect/get_from/) and [get_To](https://reference.aspose.com/slides/cpp/aspose.slides.animation/iscaleeffect/get_to/) describe the starting and ending size, while [get_By](https://reference.aspose.com/slides/cpp/aspose.slides.animation/iscaleeffect/get_by/) describes a relative change. Here, 100 means the original size. The example grows both dimensions from 100% to 125% over two seconds. Using equal horizontal and vertical percentages keeps the shape's proportions; different percentages would stretch one dimension more than the other. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Animation; using namespace Aspose::Slides::Export; using namespace System; using namespace System::Drawing; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 100, 100, 160, 80); auto effect = slide->get_Timeline()->get_MainSequence()->AddEffect(shape, EffectType::GrowShrink, EffectSubtype::None, EffectTriggerType::OnClick); effect->get_Behaviors()->Clear(); auto factory = MakeObject(); auto scale = factory->CreateScaleEffect(); scale->set_From(PointF(100, 100)); scale->set_To(PointF(125, 125)); scale->get_Timing()->set_Duration(2.0f); effect->get_Behaviors()->Add(scale); presentation->Save(u"scale.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ### **Color** Use [CreateColorEffect](https://reference.aspose.com/slides/cpp/aspose.slides.animation/ibehaviorfactory/createcoloreffect/) to change the fill from blue to orange. [get_From](https://reference.aspose.com/slides/cpp/aspose.slides.animation/icoloreffect/get_from/) and [get_To](https://reference.aspose.com/slides/cpp/aspose.slides.animation/icoloreffect/get_to/) are colors; [get_By](https://reference.aspose.com/slides/cpp/aspose.slides.animation/icoloreffect/get_by/) is a color offset. [IBehavior::get_Properties](https://reference.aspose.com/slides/cpp/aspose.slides.animation/ibehavior/get_properties/) identifies the attribute being animated. The shape's solid fill is initialized to blue, matching the animation's starting color. Selecting the fill-color attribute tells the behavior which part of the shape to change; the color endpoints alone do not identify that attribute. The saved effect describes a two-second transition to orange. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Animation; using namespace Aspose::Slides::Export; using namespace System; using namespace System::Drawing; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 100, 100, 160, 80); shape->get_FillFormat()->set_FillType(FillType::Solid); shape->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Blue()); auto effect = slide->get_Timeline()->get_MainSequence()->AddEffect(shape, EffectType::ChangeFillColor, EffectSubtype::None, EffectTriggerType::OnClick); effect->get_Behaviors()->Clear(); auto factory = MakeObject(); auto color = factory->CreateColorEffect(); color->get_Properties()->Add(BehaviorProperty::get_FillColor()->get_Value()); color->get_From()->set_Color(Color::get_Blue()); color->get_To()->set_Color(Color::get_Orange()); color->get_Timing()->set_Duration(2.0f); effect->get_Behaviors()->Add(color); presentation->Save(u"color.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ### **Filter** Use [CreateFilterEffect](https://reference.aspose.com/slides/cpp/aspose.slides.animation/ibehaviorfactory/createfiltereffect/) to select a wipe. [get_Type](https://reference.aspose.com/slides/cpp/aspose.slides.animation/ifiltereffect/get_type/), [get_Subtype](https://reference.aspose.com/slides/cpp/aspose.slides.animation/ifiltereffect/get_subtype/), and [get_Reveal](https://reference.aspose.com/slides/cpp/aspose.slides.animation/ifiltereffect/get_reveal/) specify the filter, direction, and whether to reveal or hide the shape. This example configures a two-second wipe that reveals the shape using the right-direction subtype. The filter settings belong to the behavior inside the effect, so they are configured after the preset's original operations have been removed. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Animation; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 100, 100, 160, 80); auto effect = slide->get_Timeline()->get_MainSequence()->AddEffect(shape, EffectType::Wipe, EffectSubtype::None, EffectTriggerType::OnClick); effect->get_Behaviors()->Clear(); auto factory = MakeObject(); auto filter = factory->CreateFilterEffect(); filter->set_Type(FilterEffectType::Wipe); filter->set_Subtype(FilterEffectSubtype::Right); filter->set_Reveal(FilterEffectRevealType::In); filter->get_Timing()->set_Duration(2.0f); effect->get_Behaviors()->Add(filter); presentation->Save(u"filter.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ### **Property** Use [CreatePropertyEffect](https://reference.aspose.com/slides/cpp/aspose.slides.animation/ibehaviorfactory/createpropertyeffect/) to animate opacity. [get_From](https://reference.aspose.com/slides/cpp/aspose.slides.animation/ipropertyeffect/get_from/), [get_To](https://reference.aspose.com/slides/cpp/aspose.slides.animation/ipropertyeffect/get_to/), and [get_By](https://reference.aspose.com/slides/cpp/aspose.slides.animation/ipropertyeffect/get_by/) are strings interpreted using [get_ValueType](https://reference.aspose.com/slides/cpp/aspose.slides.animation/ipropertyeffect/get_valuetype/) and [get_CalcMode](https://reference.aspose.com/slides/cpp/aspose.slides.animation/ipropertyeffect/get_calcmode/). Choose endpoints or a relative offset rather than setting all three indiscriminately. Here, the selected attribute is opacity, and the numeric strings represent a change from 25% opacity to full opacity. Linear interpolation describes a gradual change between those values. When adapting this example to another attribute, choose a value type and endpoint values appropriate to that attribute. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Animation; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 100, 100, 160, 80); auto effect = slide->get_Timeline()->get_MainSequence()->AddEffect(shape, EffectType::Fade, EffectSubtype::None, EffectTriggerType::OnClick); effect->get_Behaviors()->Clear(); auto factory = MakeObject(); auto property = factory->CreatePropertyEffect(); property->get_Properties()->Add(BehaviorProperty::get_StyleOpacity()->get_Value()); property->set_ValueType(PropertyValueType::Number); property->set_CalcMode(PropertyCalcModeType::Linear); property->set_From(u"0.25"); property->set_To(u"1"); property->get_Timing()->set_Duration(2.0f); effect->get_Behaviors()->Add(property); presentation->Save(u"property.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ### **Set** Use [CreateSetEffect](https://reference.aspose.com/slides/cpp/aspose.slides.animation/ibehaviorfactory/createseteffect/) to assign visibility through [get_To](https://reference.aspose.com/slides/cpp/aspose.slides.animation/iseteffect/get_to/). A set behavior does not interpolate between endpoints. The example selects the visibility attribute and assigns the string `visible` when the behavior runs. In C++, box the string as an object before assigning it to the set behavior. The rectangle is already visible in this minimal presentation, so the assignment may not produce an obvious visual change on its own. Such an operation is useful as part of a larger effect that also controls when the shape becomes hidden or visible. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Animation; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 100, 100, 160, 80); auto effect = slide->get_Timeline()->get_MainSequence()->AddEffect(shape, EffectType::Appear, EffectSubtype::None, EffectTriggerType::OnClick); effect->get_Behaviors()->Clear(); auto factory = MakeObject(); auto set = factory->CreateSetEffect(); set->get_Properties()->Add(BehaviorProperty::get_StyleVisibility()->get_Value()); auto visibility = ObjectExt::Box(u"visible"); set->set_To(visibility); effect->get_Behaviors()->Add(set); presentation->Save(u"set.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ### **Command** Use [CreateCommandEffect](https://reference.aspose.com/slides/cpp/aspose.slides.animation/ibehaviorfactory/createcommandeffect/) and configure [get_Type](https://reference.aspose.com/slides/cpp/aspose.slides.animation/icommandeffect/get_type/), [get_CommandString](https://reference.aspose.com/slides/cpp/aspose.slides.animation/icommandeffect/get_commandstring/), and [get_ShapeTarget](https://reference.aspose.com/slides/cpp/aspose.slides.animation/icommandeffect/get_shapetarget/). Place a WAV recording named `sample.wav` in the working directory. This example embeds it with [AddAudioFrameEmbedded](https://reference.aspose.com/slides/cpp/aspose.slides/ishapecollection/addaudioframeembedded/) and attaches a play command to the audio frame. The audio frame is both the effect's target and the command's target. This connects the play request to the embedded recording; a command string by itself does not identify which media object to control. The effect is configured to start on a click during the slideshow. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Animation; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto audioStream = IO::File::OpenRead(u"sample.wav"); auto audioFrame = slide->get_Shapes()->AddAudioFrameEmbedded(100, 100, 40, 40, audioStream); auto effect = slide->get_Timeline()->get_MainSequence()->AddEffect(audioFrame, EffectType::MediaPlay, EffectSubtype::None, EffectTriggerType::OnClick); effect->get_Behaviors()->Clear(); auto factory = MakeObject(); auto command = factory->CreateCommandEffect(); command->set_Type(CommandEffectType::Call); command->set_CommandString(u"play"); command->set_ShapeTarget(audioFrame); effect->get_Behaviors()->Add(command); presentation->Save(u"command.pptx", SaveFormat::Pptx); audioStream->Close(); presentation->Dispose(); ``` Saving stores the command in `command.pptx`; it does not play the recording. Playback requires a slideshow player that supports the command and its media target. ## **Manage the Behavior Collection** [IBehaviorCollection](https://reference.aspose.com/slides/cpp/aspose.slides.animation/ibehaviorcollection/) supports [Add](https://reference.aspose.com/slides/cpp/aspose.slides.animation/ibehaviorcollection/add/), [Insert](https://reference.aspose.com/slides/cpp/aspose.slides.animation/ibehaviorcollection/insert/), [Remove](https://reference.aspose.com/slides/cpp/aspose.slides.animation/ibehaviorcollection/remove/), and [RemoveAt](https://reference.aspose.com/slides/cpp/aspose.slides.animation/ibehaviorcollection/removeat/). This example opens `rotation.pptx`, adds scaling, moves it before rotation, and removes the rotation. Removing and reinserting the same object changes its stored position without making a copy. The sequence of edits changes the collection from rotation–scale to scale–rotation, then to scale only. Indices refer to the current collection, so the removal uses the rotation's new index after reordering. The final enumeration confirms which behavior will be saved. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Animation; using namespace Aspose::Slides::Export; using namespace System; using namespace System::Drawing; auto presentation = MakeObject(u"rotation.pptx"); auto effect = presentation->get_Slide(0)->get_Timeline()->get_MainSequence()->idx_get(0); auto behaviors = effect->get_Behaviors(); auto factory = MakeObject(); auto scale = factory->CreateScaleEffect(); scale->set_To(PointF(125, 125)); scale->get_Timing()->set_Duration(2.0f); behaviors->Add(scale); behaviors->Remove(scale); behaviors->Insert(0, scale); behaviors->RemoveAt(1); for (auto behavior : behaviors) Console::WriteLine(behavior->GetType().get_Name()); presentation->Save(u"collection-edited.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` The output is `ScaleEffect`: only scaling remains. Collection order does not, by itself, schedule behaviors one after another. Clear the collection only when replacing all its operations. ## **Configure Behavior Timing** [IBehavior::get_Timing](https://reference.aspose.com/slides/cpp/aspose.slides.animation/ibehavior/get_timing/) exposes [ITiming](https://reference.aspose.com/slides/cpp/aspose.slides.animation/itiming/), independently of [IEffect::get_Timing](https://reference.aspose.com/slides/cpp/aspose.slides.animation/ieffect/get_timing/). Effect timing schedules the enclosing effect; behavior timing describes an operation inside it. ### **Set Duration, Delay, Repetition, and Acceleration** Open `rotation.pptx` and set [get_Duration](https://reference.aspose.com/slides/cpp/aspose.slides.animation/itiming/get_duration/) and [get_TriggerDelayTime](https://reference.aspose.com/slides/cpp/aspose.slides.animation/itiming/get_triggerdelaytime/) in seconds, then configure [get_RepeatCount](https://reference.aspose.com/slides/cpp/aspose.slides.animation/itiming/get_repeatcount/). [get_Accelerate](https://reference.aspose.com/slides/cpp/aspose.slides.animation/itiming/get_accelerate/) and [get_Decelerate](https://reference.aspose.com/slides/cpp/aspose.slides.animation/itiming/get_decelerate/) are fractions of the duration; keep their sum at most 1. The input file is the one created in the rotation example, where the first behavior is known to be a rotation. This example changes only that behavior's timing; its 90-degree angle remains intact. Keeping the angle and timing separate makes it easier to adjust the pace without rebuilding the animation. ```cpp #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Animation; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(u"rotation.pptx"); auto effect = presentation->get_Slide(0)->get_Timeline()->get_MainSequence()->idx_get(0); auto rotation = ExplicitCast(effect->get_Behaviors()->idx_get(0)); rotation->get_Timing()->set_Duration(2.0f); rotation->get_Timing()->set_TriggerDelayTime(0.5f); rotation->get_Timing()->set_RepeatCount(3.0f); rotation->get_Timing()->set_Accelerate(0.2f); rotation->get_Timing()->set_Decelerate(0.2f); presentation->Save(u"timing.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` The behavior uses a two-second duration, a half-second delay, and a repeat count of 3. The first and last 20% of its duration are used for acceleration and deceleration. Other repeat policies include [get_RepeatDuration](https://reference.aspose.com/slides/cpp/aspose.slides.animation/itiming/get_repeatduration/), [get_RepeatUntilEndSlide](https://reference.aspose.com/slides/cpp/aspose.slides.animation/itiming/get_repeatuntilendslide/), and [get_RepeatUntilNextClick](https://reference.aspose.com/slides/cpp/aspose.slides.animation/itiming/get_repeatuntilnextclick/); choose a policy rather than enabling them all together. [get_AutoReverse](https://reference.aspose.com/slides/cpp/aspose.slides.animation/itiming/get_autoreverse/) plays the animation backwards after the forward pass. Acceleration and deceleration apply to continuous changes, not discrete assignments or commands. ## **Build a Motion Path** Use [CreateMotionEffect](https://reference.aspose.com/slides/cpp/aspose.slides.animation/ibehaviorfactory/createmotioneffect/) to create motion. Its [get_From](https://reference.aspose.com/slides/cpp/aspose.slides.animation/imotioneffect/get_from/), [get_To](https://reference.aspose.com/slides/cpp/aspose.slides.animation/imotioneffect/get_to/), and [get_By](https://reference.aspose.com/slides/cpp/aspose.slides.animation/imotioneffect/get_by/) describe percentage-based coordinates or offsets. For an editable route, create a [MotionPath](https://reference.aspose.com/slides/cpp/aspose.slides.animation/motionpath/) and assign it to [IMotionEffect::get_Path](https://reference.aspose.com/slides/cpp/aspose.slides.animation/imotioneffect/get_path/). [IMotionPath](https://reference.aspose.com/slides/cpp/aspose.slides.animation/imotionpath/) stores the path commands. [MotionCommandPathType](https://reference.aspose.com/slides/cpp/aspose.slides.animation/motioncommandpathtype/) selects the operation: | Command | Points | Meaning | | --- | --- | --- | | MoveTo | One | Set the starting position. | | LineTo | One | Move along a straight segment to its endpoint. | | CurveTo | Three | Follow a cubic curve defined by two control points and an endpoint. | | CloseLoop | None | Return to the starting position. | | End | None | Finish the path. | [MotionPathPointsType](https://reference.aspose.com/slides/cpp/aspose.slides.animation/motionpathpointstype/) describes point-editing characteristics, such as corner or smooth points. It does not replace the command type. Use a curve point type for the curve example below, and a corner point type for the straight segments. Path coordinates are normalized to slide dimensions: an X displacement of 0.25 represents one quarter of the slide width, not 0.25 points. Positive Y runs downward. Absolute commands specify positions in the path coordinate system; relative commands specify offsets from the current position. This is separate from [get_Origin](https://reference.aspose.com/slides/cpp/aspose.slides.animation/imotioneffect/get_origin/), which selects the path's reference frame, and [get_PathEditMode](https://reference.aspose.com/slides/cpp/aspose.slides.animation/imotioneffect/get_patheditmode/), which controls how the path moves when the shape is moved. ### **Create a Straight Path** Create a motion behavior with a starting point, one straight segment, and an end command. [IMotionPath::Add](https://reference.aspose.com/slides/cpp/aspose.slides.animation/imotionpath/add/) takes the command type, its points, the point type, and a relative-coordinate flag. The starting command establishes (0, 0), and the line ends at (0.25, 0), giving the route a horizontal displacement of one quarter of the slide width. The ending command has no coordinate points. Once the path is assigned, adding the motion behavior to the effect connects that route to the rectangle. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Animation; using namespace Aspose::Slides::Export; using namespace System; using namespace System::Drawing; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 100, 100, 160, 80); auto effect = slide->get_Timeline()->get_MainSequence()->AddEffect(shape, EffectType::PathRight, EffectSubtype::None, EffectTriggerType::OnClick); effect->get_Behaviors()->Clear(); auto factory = MakeObject(); auto motion = factory->CreateMotionEffect(); motion->set_Origin(MotionOriginType::Layout); motion->get_Timing()->set_Duration(2.0f); auto path = MakeObject(); auto startPoints = MakeArray({ PointF(0, 0) }); path->Add(MotionCommandPathType::MoveTo, startPoints, MotionPathPointsType::Auto, false); auto linePoints = MakeArray({ PointF(0.25f, 0) }); path->Add(MotionCommandPathType::LineTo, linePoints, MotionPathPointsType::Corner, false); auto endPoints = MakeArray(0); path->Add(MotionCommandPathType::End, endPoints, MotionPathPointsType::None, false); motion->set_Path(path); effect->get_Behaviors()->Add(motion); presentation->Save(u"motion.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` `motion.pptx` contains one motion behavior with three path commands. The following file-editing examples use this known structure. ### **Compare Absolute and Relative Coordinates** These two path objects describe the same route. The absolute command ends at (0.3, 0.1); the relative command adds (0.1, 0.1) to the current position, (0.2, 0). Both paths start at the same position. For the relative line, add its X and Y offsets to the current position to obtain the endpoint; for the absolute line, read the endpoint directly. Switching the flag without converting the coordinates would describe a different route. ```cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Animation; using namespace System; using namespace System::Drawing; auto absolutePath = MakeObject(); auto startPoints = MakeArray({ PointF(0.2f, 0) }); absolutePath->Add(MotionCommandPathType::MoveTo, startPoints, MotionPathPointsType::Auto, false); auto absoluteEndPoints = MakeArray({ PointF(0.3f, 0.1f) }); absolutePath->Add(MotionCommandPathType::LineTo, absoluteEndPoints, MotionPathPointsType::Corner, false); auto relativePath = MakeObject(); auto relativeStartPoints = MakeArray({ PointF(0.2f, 0) }); relativePath->Add(MotionCommandPathType::MoveTo, relativeStartPoints, MotionPathPointsType::Auto, false); auto relativeOffsets = MakeArray({ PointF(0.1f, 0.1f) }); relativePath->Add(MotionCommandPathType::LineTo, relativeOffsets, MotionPathPointsType::Corner, true); ``` Assign either path to a motion behavior to use it in a presentation. The final Boolean argument selects relative coordinates for that command. [![Equivalent routes start at .2,0 and end at .3,.1, using either an absolute endpoint or a relative .1,.1 offset.](https://docs.aspose.com/slides/cpp/custom-animation/visual-custom-animation-2b5c03cbaedf.svg)](https://docs.aspose.com/slides/cpp/custom-animation/visual-custom-animation-2b5c03cbaedf.svg) *Both path commands end at (0.3, 0.1). The absolute command specifies that endpoint; the relative command adds (0.1, 0.1) to the current position (0.2, 0). The diagrams show path-coordinate arithmetic, not measured slide pixels.* ### **Replace a Line with a Curve** Open `motion.pptx` and replace its line command with a cubic curve. Supply the two control points first, followed by the endpoint. The starting position is supplied by the preceding command. The first two points shape the curve, while the third is its destination; they are not three successive destinations. Updating the command type, point-editing type, and point array together keeps the segment consistent with its new geometry. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Animation; using namespace Aspose::Slides::Export; using namespace System; using namespace System::Drawing; auto presentation = MakeObject(u"motion.pptx"); auto effect = presentation->get_Slide(0)->get_Timeline()->get_MainSequence()->idx_get(0); auto motion = ExplicitCast(effect->get_Behaviors()->idx_get(0)); auto path = motion->get_Path(); path->idx_get(1)->set_CommandType(MotionCommandPathType::CurveTo); path->idx_get(1)->set_PointsType(MotionPathPointsType::CurveSmooth); auto curvePoints = MakeArray({ PointF(0.1f, 0), PointF(0.2f, 0.1f), PointF(0.3f, 0.1f) }); path->idx_get(1)->set_Points(curvePoints); presentation->Save(u"curve.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` The path in `curve.pptx` still has three commands; its middle command now defines a curve. ## **Inspect and Edit a Saved Path** Each [IMotionCmdPath](https://reference.aspose.com/slides/cpp/aspose.slides.animation/imotioncmdpath/) exposes [get_Points](https://reference.aspose.com/slides/cpp/aspose.slides.animation/imotioncmdpath/get_points/), [get_CommandType](https://reference.aspose.com/slides/cpp/aspose.slides.animation/imotioncmdpath/get_commandtype/), [get_PointsType](https://reference.aspose.com/slides/cpp/aspose.slides.animation/imotioncmdpath/get_pointstype/), and [get_IsRelative](https://reference.aspose.com/slides/cpp/aspose.slides.animation/imotioncmdpath/get_isrelative/). The following examples use the known three-command path in `motion.pptx`. For arbitrary input, locate the intended effect and check command types and point counts before editing by index. ### **Read Commands and Coordinates** Read the path without changing it. End and close-loop commands need no points, so allow for a null point array. The output pairs each command with its relative-coordinate flag before listing its points. This lets you distinguish an endpoint from an offset before modifying the path. A curve would list three points, whereas the straight line in this file lists only one. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Animation; using namespace System; auto presentation = MakeObject(u"motion.pptx"); auto effect = presentation->get_Slide(0)->get_Timeline()->get_MainSequence()->idx_get(0); auto motion = ExplicitCast(effect->get_Behaviors()->idx_get(0)); auto path = motion->get_Path(); for (auto segment : path) { Console::WriteLine(u"{0}, relative: {1}", segment->get_CommandType(), segment->get_IsRelative()); if (segment->get_Points() != nullptr) for (auto point : segment->get_Points()) Console::WriteLine(u"X={0}, Y={1}", point.get_X(), point.get_Y()); } presentation->Dispose(); ``` The listing contains a starting point, an absolute line ending at (0.25, 0), and an end command. ### **Change an Endpoint** Open `motion.pptx` and replace the line's point array to move its endpoint. In the input file, index 0 is the starting command and index 1 is the line. Replacing the line's single point changes its destination without changing its command type, timing, or position in the collection. Because the command uses absolute coordinates, the new pair specifies a position rather than an added offset. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Animation; using namespace Aspose::Slides::Export; using namespace System; using namespace System::Drawing; auto presentation = MakeObject(u"motion.pptx"); auto effect = presentation->get_Slide(0)->get_Timeline()->get_MainSequence()->idx_get(0); auto motion = ExplicitCast(effect->get_Behaviors()->idx_get(0)); auto endpointPoints = MakeArray({ PointF(0.4f, 0.1f) }); motion->get_Path()->idx_get(1)->set_Points(endpointPoints); presentation->Save(u"motion-endpoint.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` The line in `motion-endpoint.pptx` ends at (0.4, 0.1); the original file is unchanged. ### **Replace a Segment** Use [Insert](https://reference.aspose.com/slides/cpp/aspose.slides.animation/imotionpath/insert/) and [RemoveAt](https://reference.aspose.com/slides/cpp/aspose.slides.animation/imotionpath/removeat/) to replace the line in `motion.pptx`. Inserting shifts the old line to index 2. This demonstrates replacing a command object rather than editing its existing coordinates. After insertion, the collection temporarily contains the starting command, the new line, the old line, and the end command. Removing index 2 discards the old line and leaves the new route in place. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Animation; using namespace Aspose::Slides::Export; using namespace System; using namespace System::Drawing; auto presentation = MakeObject(u"motion.pptx"); auto effect = presentation->get_Slide(0)->get_Timeline()->get_MainSequence()->idx_get(0); auto motion = ExplicitCast(effect->get_Behaviors()->idx_get(0)); auto path = motion->get_Path(); auto linePoints = MakeArray({ PointF(0.2f, 0.1f) }); path->Insert(1, MotionCommandPathType::LineTo, linePoints, MotionPathPointsType::Corner, false); path->RemoveAt(2); presentation->Save(u"motion-edited.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` The saved path still has three commands, with the new line ending at (0.2, 0.1) and the end command last. ## **Modify and Verify an Existing Behavior** When the behavior's index is unknown, select it by type. This example opens `rotation.pptx`, finds its [IRotationEffect](https://reference.aspose.com/slides/cpp/aspose.slides.animation/irotationeffect/), changes the angle, and checks the saved value after reopening. The type check allows the loop to skip behaviors that are not rotations. The second load reads the saved file into a separate presentation object, so the comparison checks persisted data rather than the value still held in memory. This example still assumes the known effect is first in the main sequence; selecting a behavior by type does not locate the correct effect in an arbitrary presentation. ```cpp #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Animation; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(u"rotation.pptx"); auto effect = presentation->get_Slide(0)->get_Timeline()->get_MainSequence()->idx_get(0); for (auto behavior : effect->get_Behaviors()) { auto rotation = DynamicCast(behavior); if (rotation != nullptr) rotation->set_By(180.0f); } presentation->Save(u"rotation-edited.pptx", SaveFormat::Pptx); auto reopened = MakeObject(u"rotation-edited.pptx"); auto savedEffect = reopened->get_Slide(0)->get_Timeline()->get_MainSequence()->idx_get(0); for (auto behavior : savedEffect->get_Behaviors()) { auto rotation = DynamicCast(behavior); if (rotation != nullptr) Console::WriteLine(u"Rotation preserved: {0}", std::abs(rotation->get_By() - 180.0f) < 0.001f); } presentation->Dispose(); reopened->Dispose(); ``` The output is `Rotation preserved: True`. Apply the same type-checking pattern to other behaviors. For a complete preservation check, compare the target shape, effect, behavior types and order, timing, and path commands. Use a numeric tolerance for floating-point values. For a presentation with an unknown animation layout, see [Read Shape Animations](https://docs.aspose.com/slides/cpp/shape-animation/#read-shape-animations) for traversal of main and interactive sequences. ## **Behavior Order, Presets, and Playback** The order in [IBehaviorCollection](https://reference.aspose.com/slides/cpp/aspose.slides.animation/ibehaviorcollection/) is the stored order of an effect's operations. It is not a playlist in which every behavior automatically waits for the preceding one. Timing and the enclosing effect determine scheduling. Behaviors can overlap, and operations on the same property may interact through [get_Additive](https://reference.aspose.com/slides/cpp/aspose.slides.animation/ibehavior/get_additive/) and [get_Accumulate](https://reference.aspose.com/slides/cpp/aspose.slides.animation/ibehavior/get_accumulate/). Do not use collection reordering alone to schedule “move, then rotate”; use explicit timing or separate effects as described in [Shape Animation](https://docs.aspose.com/slides/cpp/shape-animation/). The effect's [get_Type](https://reference.aspose.com/slides/cpp/aspose.slides.animation/ieffect/get_type/) and [get_Subtype](https://reference.aspose.com/slides/cpp/aspose.slides.animation/ieffect/get_subtype/) describe its preset. They are not a complete description of an edited behavior tree. Choose the preset and subtype before customizing behaviors: changing the preset can rebuild the collection and discard your custom operations. For example, changing a customized Spin effect to Fade can replace its rotation behavior with set and filter behaviors. Inspect the collection again after changing a preset or subtype. Clearing preset behaviors can also remove visibility or initialization operations that the preset needs. The examples deliberately use visible shapes and replace the behaviors; they do not reconstruct every preset's implementation. ## **Format Compatibility** A preserved behavior tree does not guarantee identical playback in every viewer or export renderer. Check the saved data and the rendered output separately. | Format or output | What to verify | | --- | --- | | PPTX | Use as the primary format for these examples. Reopen it to verify the editable behavior tree, then check playback in the intended PowerPoint version. | | PPT | Legacy binary representation can differ from PPTX. Test a separate save-and-reopen cycle and playback; do not infer support for every custom combination from successful PPTX output. | | PDF, PNG, JPEG, and other static slide images | Contain a static slide representation, not a playable behavior timeline or a guaranteed final animation frame. | | [HTML5](https://docs.aspose.com/slides/cpp/export-to-html5/) | Can play supported animations when shape animation is enabled in the export options. Test custom combinations in the browser. | | [Animated GIF](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-animated-gif/) | Stores rendered frames, not editable behaviors or click-triggered interaction. Check the actual rendered motion. | | [Video](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/) | Render animation frames and encode them as video. Support is limited to the renderer's [supported animations and effects](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/#supported-animations-and-effects); commands and interactive events do not become an editable timeline. | ## **FAQ** **Why does my effect contain behaviors before I add any?** Creating a predefined effect can create its underlying operations. Inspect them before deciding whether to extend the preset or replace its behaviors. **Does moving a behavior to the beginning make it play first?** Not necessarily. Collection order is not a substitute for timing. Check delays, durations, and interactions between operations on the same property. **Why does an end command have no points?** It marks the end of the path and needs no coordinates. Check for a null point array when inspecting a path read from a file. **Is a successful round trip sufficient to confirm playback?** No. Reopening confirms preservation of the properties you checked. Test the slideshow player or animated export separately to confirm its visual behavior. # Customize PowerPoint Fonts in C++ > Customize fonts in PowerPoint slides with Aspose.Slides for C++ to keep your presentations sharp and consistent across any device. Source: https://docs.aspose.com/slides/cpp/custom-font/ Updated: 2026-08-25 ## **Overview** Aspose.Slides allows you to use custom fonts in presentations without installing them on the operating system. You can load fonts from custom folders, provide fonts for a specific presentation through document-level font sources, or load external fonts directly from binary data. Loaded fonts are used when a presentation is rendered or exported, for example to PDF, images, and other supported formats. This helps keep the presentation output consistent across different environments. The article also explains how to inspect the font folders used by Aspose.Slides and how to clear the font cache after working with external fonts. Registering custom fonts for rendering is separate from embedding fonts into a PPTX file. If a font must be stored inside the presentation itself, use the font embedding features explicitly. A presentation theme can reference different font families for individual writing systems. These mappings store font names but do not install or load the font files. See [Script-Specific Theme Fonts](https://docs.aspose.com/slides/cpp/script-specific-font-mappings/) to manage the mappings, and use the loading options below to make the referenced fonts available for consistent rendering. Aspose Slides allows you to load these fonts using [FontsLoader::LoadExternalFonts](https://reference.aspose.com/slides/cpp/aspose.slides/fontsloader/loadexternalfonts/): * TrueType (.ttf) and TrueType Collection (.ttc) fonts. See [TrueType](https://en.wikipedia.org/wiki/TrueType). * OpenType (.otf) fonts. See [OpenType](https://en.wikipedia.org/wiki/OpenType). ## **Load Custom Fonts** Aspose.Slides allows you to load fonts used in a presentation without installing them on the system. This affects export output—such as PDF, images, and other supported formats—so the resulting documents look consistent across environments. Fonts are loaded from custom directories. 1. Specify one or more folders that contain the font files. 2. Call the static [FontsLoader::loadExternalFonts](https://reference.aspose.com/slides/cpp/aspose.slides/fontsloader/loadexternalfonts/) method to load fonts from those folders. 3. Load and render/export the presentation. 4. Call [FontsLoader.clearCache](https://reference.aspose.com/slides/cpp/aspose.slides/fontsloader/clearcache/) to clear the font cache. The following code example demonstrates the font loading process: ```cpp #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; // Define folders that contain custom font files. String externalFontFolder = u"assets/fonts"; auto fontFolders = MakeObject>(1, externalFontFolder ); // Load custom fonts from the specified folders. FontsLoader::LoadExternalFonts(fontFolders); auto presentation = MakeObject(u"sample.pptx"); // Render/export the presentation (e.g., to PDF, images, or other formats) using the loaded fonts. presentation->Save(u"output.pdf", SaveFormat::Pdf); presentation->Dispose(); // Clear the font cache after the work is finished. FontsLoader::ClearCache(); ``` [FontsLoader::loadExternalFonts](https://reference.aspose.com/slides/cpp/aspose.slides/fontsloader/loadexternalfonts/) adds additional folders to the font search paths, but it does not change the font initialization order. Fonts are initialized in this order: 1. The default operating system font path. 1. The paths loaded via [FontsLoader](https://reference.aspose.com/slides/cpp/aspose.slides/fontsloader/). ## **Get Custom Font Folders** Aspose.Slides provides [FontsLoader::GetFontFolders()](https://reference.aspose.com/slides/cpp/aspose.slides/fontsloader/getfontfolders/) to allow you to find font folders. This method returns folders added through the `LoadExternalFonts` method and system font folders. This C++ code shows you how to use [FontsLoader::GetFontFolders()](https://reference.aspose.com/slides/cpp/aspose.slides/fontsloader/getfontfolders/) method: ``` cpp #include using namespace Aspose::Slides; // This line outputs the folders that are checked for font files. // Those are folders added through the LoadExternalFonts method and system font folders. auto fontFolders = FontsLoader::GetFontFolders(); ``` ## **Specify Custom Fonts Used with a Presentation** Aspose.Slides provides the [LoadOptions::set_DocumentLevelFontSources](https://reference.aspose.com/slides/cpp/aspose.slides/loadoptions/set_documentlevelfontsources/) property to allow you to specify external fonts that will be used with the presentation. This C++ code shows you how to use the [LoadOptions::set_DocumentLevelFontSources](https://reference.aspose.com/slides/cpp/aspose.slides/loadoptions/set_documentlevelfontsources/) property: ``` cpp #include #include #include #include #include using namespace Aspose::Slides; using namespace System; using namespace System::IO; auto memoryFont1 = File::ReadAllBytes(u"customfonts\\CustomFont1.ttf"); auto memoryFont2 = File::ReadAllBytes(u"customfonts\\CustomFont2.ttf"); auto loadOptions = System::MakeObject(); loadOptions->get_DocumentLevelFontSources()->set_FontFolders(System::MakeArray({u"assets\\fonts", u"global\\fonts"})); loadOptions->get_DocumentLevelFontSources()->set_MemoryFonts(System::MakeArray>({memoryFont1, memoryFont2})); { auto presentation = System::MakeObject(u"MyPresentation.pptx", loadOptions); //work with the presentation //CustomFont1, CustomFont2 as well as fonts from assets\fonts & global\fonts folders and their subfolders are available to the presentation } ``` ## **Manage Fonts Externally** Aspose.Slides provides the [FontsLoader::LoadExternalFont](https://reference.aspose.com/slides/cpp/aspose.slides/fontsloader/loadexternalfont/) method to allow you to load external fonts into a byte array. This C++ code demonstrates the byte array font loading process: ```cpp #include #include #include #include #include using namespace Aspose::Slides; using namespace System; using namespace System::IO; // The path to the documents directory const String outPath = u"../out/SpecifyFontsUsedWithPresentation.pptx"; const String templatePath = u"../templates/AccessSlides.pptx"; ArrayPtr fontsLocation = MakeArray({ u"assets\\fonts", u"global\\fonts" });// ; ArrayPtr> memoryfontsLocation = MakeArray < ArrayPtr>({ File::ReadAllBytes(u"../templates/CustomFont1.ttf"), File::ReadAllBytes(u"../templates/CustomFont2.ttf") }); SharedPtr < Aspose::Slides::LoadOptions > loadOptions = MakeObject (); loadOptions->get_DocumentLevelFontSources()->set_FontFolders(fontsLocation); loadOptions->get_DocumentLevelFontSources()->set_MemoryFonts(memoryfontsLocation); SharedPtr pres = MakeObject(templatePath, loadOptions); ``` ## **FAQ** ### Do custom fonts affect export to all formats (PDF, PNG, SVG, HTML)? Yes. Connected fonts are used by the renderer across all export formats. ### Are custom fonts automatically embedded into the resulting PPTX? No. Registering a font for rendering is not the same as embedding it into a PPTX. If you need the font carried inside the presentation file, you must use the explicit [embedding features](https://docs.aspose.com/slides/cpp/embedded-font/). ### Can I control fallback behavior when a custom font lacks certain glyphs? Yes. Configure [font substitution](https://docs.aspose.com/slides/cpp/font-substitution/), [replacement rules](https://docs.aspose.com/slides/cpp/font-replacement/), and [fallback sets](https://docs.aspose.com/slides/cpp/fallback-font/) to define exactly which font is used when the requested glyph is missing. ### Can I use fonts in Linux/Docker containers without installing them system-wide? Yes. Point to your own font folders or load fonts from byte arrays. This removes any dependency on system font directories in the container image. ### What about licensing—can I embed any custom font without restrictions? You are responsible for font licensing compliance. Terms vary; some licenses prohibit embedding or commercial use. Always review the font’s EULA before distributing outputs. # Customize Presentation Shapes in C++ > Create and customize shapes in PowerPoint presentations with Aspose.Slides for C++: geometry paths, curved corners, composite shapes. Source: https://docs.aspose.com/slides/cpp/custom-shape/ Updated: 2026-10-22 ## **Overview** This article explains how to customize presentation shapes in Aspose.Slides by editing shape geometry through edit points and geometry paths. It shows how to work with [GeometryPath](https://reference.aspose.com/slides/cpp/aspose.slides/geometrypath/) and [IGeometryPath](https://reference.aspose.com/slides/cpp/aspose.slides/igeometrypath/) to modify existing shapes, perform basic path editing operations, add or remove points, and apply updated geometry back to a shape. It also demonstrates how to create custom and composite shapes, build shapes with curved corners, and determine whether a shape geometry is closed. ## **Change a Shape Using Edit Points** In PowerPoint, you can use **Edit Points** to modify a square: * Move a corner inward or outward. * Adjust the curvature at a point. * Add new points. Editing points lets you modify a shape’s outline or use an existing shape as the basis for a new one. ## **Shape Editing Tips** ![overview_image](https://docs.aspose.com/slides/cpp/custom-shape/custom_shape_0.png) When editing PowerPoint shapes, keep these concepts in mind: * A shape (or its path) can either be closed or open. * A shape’s path consists of anchor points connected by segments. * A segment can be straight or curved. Anchor points and control handles determine its shape. * Anchor points exist as corner points, straight points, or smooth points: * At a corner point, adjoining segments can meet at an angle. * At a smooth point, the two control handles are aligned and equally distant from the anchor point. * At a straight point, the two control handles are aligned but can be different distances from the anchor point. * Moving anchor points or adjusting their handles changes the shape’s outline. To edit PowerPoint shapes through edit points, **Aspose.Slides** provides the [GeometryPath](https://reference.aspose.com/slides/cpp/aspose.slides/geometrypath/) class and [IGeometryPath](https://reference.aspose.com/slides/cpp/aspose.slides/igeometrypath/) interface. * A [GeometryPath](https://reference.aspose.com/slides/cpp/aspose.slides/geometrypath/) instance represents a geometry path of the [IGeometryShape](https://reference.aspose.com/slides/cpp/aspose.slides/igeometryshape/) object. * To retrieve the [GeometryPath](https://reference.aspose.com/slides/cpp/aspose.slides/geometrypath/) from the [IGeometryShape](https://reference.aspose.com/slides/cpp/aspose.slides/igeometryshape/) instance, you can use the [IGeometryShape::GetGeometryPaths](https://reference.aspose.com/slides/cpp/aspose.slides/igeometryshape/getgeometrypaths/) method. * To set the [GeometryPath](https://reference.aspose.com/slides/cpp/aspose.slides/geometrypath/) for a shape, you can use these methods: [IGeometryShape::SetGeometryPath](https://reference.aspose.com/slides/cpp/aspose.slides/igeometryshape/setgeometrypath/) for shapes with a single path and [IGeometryShape::SetGeometryPaths](https://reference.aspose.com/slides/cpp/aspose.slides/igeometryshape/setgeometrypaths/) for shapes with multiple paths. * To add segments, you can use the methods under [IGeometryPath](https://reference.aspose.com/slides/cpp/aspose.slides/igeometrypath/). * Using the [IGeometryPath::set_Stroke](https://reference.aspose.com/slides/cpp/aspose.slides/igeometrypath/set_stroke/) and [IGeometryPath::set_FillMode](https://reference.aspose.com/slides/cpp/aspose.slides/igeometrypath/set_fillmode/) methods, you can set the appearance for a geometry path. * Using the [IGeometryPath::get_PathData](https://reference.aspose.com/slides/cpp/aspose.slides/igeometrypath/get_pathdata/) method, you can retrieve the geometry path of a [GeometryShape](https://reference.aspose.com/slides/cpp/aspose.slides/geometryshape/) as an array of path segments. ## **Simple Editing Operations** Use the following methods to edit a geometry path. Overloads that accept an index insert a segment at that zero-based position in the path’s segment array. | Operation | Method | | --- | --- | | Append or insert a straight line. | [GeometryPath::LineTo](https://reference.aspose.com/slides/cpp/aspose.slides/geometrypath/lineto/) | | Append or insert a cubic Bézier curve with two control points and an endpoint. | [GeometryPath::CubicBezierTo](https://reference.aspose.com/slides/cpp/aspose.slides/geometrypath/cubicbezierto/) | | Append or insert a quadratic Bézier curve with one control point and an endpoint. | [GeometryPath::QuadraticBezierTo](https://reference.aspose.com/slides/cpp/aspose.slides/geometrypath/quadraticbezierto/) | | Append an elliptical arc with the specified dimensions and angles in degrees. | [GeometryPath::ArcTo](https://reference.aspose.com/slides/cpp/aspose.slides/geometrypath/arcto/) | | Close the current figure by connecting its endpoint to its starting point. | [GeometryPath::CloseFigure](https://reference.aspose.com/slides/cpp/aspose.slides/geometrypath/closefigure/) | | Set the starting point of a figure. | [GeometryPath::MoveTo](https://reference.aspose.com/slides/cpp/aspose.slides/geometrypath/moveto/) | | Remove a segment at a zero-based index. | [GeometryPath::RemoveAt](https://reference.aspose.com/slides/cpp/aspose.slides/geometrypath/removeat/) | ## **Add Custom Points to a Shape** This example inserts two points into a rectangular shape using [GeometryPath::LineTo](https://reference.aspose.com/slides/cpp/aspose.slides/geometrypath/lineto/) and applies the edited path with [IGeometryShape::SetGeometryPath](https://reference.aspose.com/slides/cpp/aspose.slides/igeometryshape/setgeometrypath/). The coordinates are local to the shape: both new points are at its center, 100 points from the left and 50 points from the top. Segment indices 1 and 4 place them on the top and bottom edges, pulling those edges inward. ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 100.0f, 100.0f, 200.0f, 100.0f); auto geometryPath = shape->GetGeometryPaths()->idx_get(0); geometryPath->LineTo(100.0f, 50.0f, 1); geometryPath->LineTo(100.0f, 50.0f, 4); shape->SetGeometryPath(geometryPath); ``` ![example1_image](https://docs.aspose.com/slides/cpp/custom-shape/custom_shape_1.png) ## **Remove Points from a Shape** This example changes a heart-shaped outline by removing the segment at zero-based index 2 with [GeometryPath::RemoveAt](https://reference.aspose.com/slides/cpp/aspose.slides/geometrypath/removeat/). Applying the modified path with [IGeometryShape::SetGeometryPath](https://reference.aspose.com/slides/cpp/aspose.slides/igeometryshape/setgeometrypath/) updates the shape’s contour. ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Heart, 100.0f, 100.0f, 300.0f, 300.0f); auto path = shape->GetGeometryPaths()->idx_get(0); path->RemoveAt(2); shape->SetGeometryPath(path); ``` ![example2_image](https://docs.aspose.com/slides/cpp/custom-shape/custom_shape_2.png) ## **Create a Custom Shape** This example builds a five-pointed star with [GeometryPath](https://reference.aspose.com/slides/cpp/aspose.slides/geometrypath/). Alternating outer and inner radii of 100 and 50 points define the tips and indentations; a 72-degree step spaces the five tips evenly. The path is closed with [GeometryPath::CloseFigure](https://reference.aspose.com/slides/cpp/aspose.slides/geometrypath/closefigure/) and applied to a rectangular shape using [IGeometryShape::SetGeometryPath](https://reference.aspose.com/slides/cpp/aspose.slides/igeometryshape/setgeometrypath/), replacing its outline. ```cpp #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; using namespace System::Collections::Generic; using namespace System::Drawing; auto points = System::MakeObject>(); auto outerRadius = 100.0f; auto innerRadius = 50.0f; auto angleStep = 72; for (auto angle = -90; angle < 270; angle += angleStep) { auto radians = angle * (Math::PI / 180.f); auto x = outerRadius * Math::Cos(radians); auto y = outerRadius * Math::Sin(radians); points->Add(PointF((float)x + outerRadius, (float)y + outerRadius)); radians = Math::PI * (angle + angleStep / 2) / 180.0; x = innerRadius * Math::Cos(radians); y = innerRadius * Math::Sin(radians); points->Add(PointF((float)x + outerRadius, (float)y + outerRadius)); } auto starPath = System::MakeObject(); starPath->MoveTo(points->idx_get(0)); for (auto i = 1; i < points->get_Count(); i++) { starPath->LineTo(points->idx_get(i)); } starPath->CloseFigure(); auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 100.0f, 100.0f, outerRadius * 2, outerRadius * 2); shape->SetGeometryPath(starPath); ``` ![example3_image](https://docs.aspose.com/slides/cpp/custom-shape/custom_shape_3.png) ## **Create a Composite Custom Shape** This example defines two closed [GeometryPath](https://reference.aspose.com/slides/cpp/aspose.slides/geometrypath/) objects for the top and bottom thirds of a shape. Applying both paths with [IGeometryShape::SetGeometryPaths](https://reference.aspose.com/slides/cpp/aspose.slides/igeometryshape/setgeometrypaths/) creates a single composite shape with a gap across its middle third. ```cpp #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 100.0f, 100.0f, 200.0f, 100.0f); auto topPath = System::MakeObject(); topPath->MoveTo(0.0f, 0.0f); topPath->LineTo(shape->get_Width(), 0.0f); topPath->LineTo(shape->get_Width(), shape->get_Height() / 3); topPath->LineTo(0.0f, shape->get_Height() / 3); topPath->CloseFigure(); auto bottomPath = System::MakeObject(); bottomPath->MoveTo(0.0f, shape->get_Height() / 3 * 2); bottomPath->LineTo(shape->get_Width(), shape->get_Height() / 3 * 2); bottomPath->LineTo(shape->get_Width(), shape->get_Height()); bottomPath->LineTo(0.0f, shape->get_Height()); bottomPath->CloseFigure(); auto paths = System::MakeArray>({ topPath, bottomPath }); shape->SetGeometryPaths(paths); ``` ![example4_image](https://docs.aspose.com/slides/cpp/custom-shape/custom_shape_4.png) ## **Create a Custom Shape with Curved Corners** This example combines straight segments with [GeometryPath::ArcTo](https://reference.aspose.com/slides/cpp/aspose.slides/geometrypath/arcto/) to create a shape with inward-curved corners. Each corner size sets the arc’s width and height in points, and the -90-degree sweep draws a counterclockwise quarter ellipse. The completed path is applied with [IGeometryShape::SetGeometryPath](https://reference.aspose.com/slides/cpp/aspose.slides/igeometryshape/setgeometrypath/), and the presentation is saved in PPTX format. ```cpp #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System::Drawing; auto shapeX = 20.f; auto shapeY = 20.f; auto shapeWidth = 300.f; auto shapeHeight = 200.f; auto leftTopSize = 50.f; auto rightTopSize = 20.f; auto rightBottomSize = 40.f; auto leftBottomSize = 10.f; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Custom, shapeX, shapeY, shapeWidth, shapeHeight); auto topLeft = PointF(leftTopSize, 0.0f); auto topRight = PointF(shapeWidth - rightTopSize, 0.0f); auto rightBottom = PointF(shapeWidth, shapeHeight - rightBottomSize); auto bottomLeft = PointF(leftBottomSize, shapeHeight); auto leftTop = PointF(0.0f, leftTopSize); auto geometryPath = System::MakeObject(); geometryPath->MoveTo(topLeft); geometryPath->LineTo(topRight); geometryPath->ArcTo(rightTopSize, rightTopSize, 180.0f, -90.0f); geometryPath->LineTo(rightBottom); geometryPath->ArcTo(rightBottomSize, rightBottomSize, -90.0f, -90.0f); geometryPath->LineTo(bottomLeft); geometryPath->ArcTo(leftBottomSize, leftBottomSize, 0.0f, -90.0f); geometryPath->LineTo(leftTop); geometryPath->ArcTo(leftTopSize, leftTopSize, 90.0f, -90.0f); geometryPath->CloseFigure(); shape->SetGeometryPath(geometryPath); presentation->Save(u"output.pptx", SaveFormat::Pptx); ``` ## **Find Out If a Shape Geometry Is Closed** The following helper checks whether every nonempty geometry path ends with a closing segment. It reads [IGeometryPath::get_PathData](https://reference.aspose.com/slides/cpp/aspose.slides/igeometrypath/get_pathdata/) and compares the final segment’s [IPathSegment::get_PathCommand](https://reference.aspose.com/slides/cpp/aspose.slides/ipathsegment/get_pathcommand/) with [PathCommandType::Close](https://reference.aspose.com/slides/cpp/aspose.slides/pathcommandtype/). It returns false when there are no nonempty paths. This checks the final command of each path; it does not inspect every subfigure within a path. The example prints `True` for a rectangle. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto isGeometryClosed = [](SharedPtr geometryShape) { auto hasNonemptyPath = false; for (auto&& geometryPath : geometryShape->GetGeometryPaths()) { auto segments = geometryPath->get_PathData(); if (segments->get_Length() == 0) { continue; } hasNonemptyPath = true; auto lastSegment = segments->idx_get(segments->get_Length() - 1); if (lastSegment->get_PathCommand() != PathCommandType::Close) { return false; } } return hasNonemptyPath; }; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 100, 100, 200, 100); Console::WriteLine(isGeometryClosed(shape)); ``` ## **Extract and Inspect Shape Elements** Use [IGeometryShape::CreateShapeElements](https://reference.aspose.com/slides/cpp/aspose.slides/igeometryshape/createshapeelements/) to inspect an existing shape as elements containing path points and point types. Cast each returned [IShapeElement](https://reference.aspose.com/slides/cpp/aspose.slides/ishapeelement/) to [ShapeElement](https://reference.aspose.com/slides/cpp/aspose.slides/shapeelement/) to read the arrays returned by [get_PathPoints](https://reference.aspose.com/slides/cpp/aspose.slides/shapeelement/get_pathpoints/) and [get_PathTypes](https://reference.aspose.com/slides/cpp/aspose.slides/shapeelement/get_pathtypes/). This representation is useful for contour analysis or passing geometry to custom drawing tools. The example opens a presentation, finds the first geometry shape directly on the first slide, and prints its path segments. Use a presentation containing a shape with straight and curved segments to see both kinds of output. It does not search inside groups. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto presentation = MakeObject(u"input.pptx"); auto slide = presentation->get_Slide(0); SharedPtr shape; for (auto&& candidate : slide->get_Shapes()) { shape = AsCast(candidate); if (shape != nullptr) { break; } } if (shape == nullptr) { Console::WriteLine(u"No geometry shape found on the first slide."); return; } for (auto&& element : shape->CreateShapeElements()) { auto shapeElement = ExplicitCast(element); auto points = shapeElement->get_PathPoints(); auto types = shapeElement->get_PathTypes(); Console::WriteLine(u"Shape element:"); for (auto i = 0; i < points->get_Length(); i++) { auto pointType = types[i] & 0x07; // Keep the segment type, excluding flags. switch (pointType) { case 0: Console::WriteLine(u"Start figure at {0}", points[i]); break; case 1: Console::WriteLine(u"Line to {0}", points[i]); break; case 3: Console::WriteLine(u"Cubic Bezier: controls {0}, {1}; end {2}", points[i], points[i + 1], points[i + 2]); i += 2; // Consume both control points and the endpoint. break; } if ((types[i] & 0x80) != 0) { Console::WriteLine(u"Close subpath back to its starting point."); } } } ``` The arrays correspond by index: `points[i]` is a point and `types[i]` describes its role. Type `0` starts a figure, and type `1` draws a line from the previous point to the current point. A cubic Bézier segment starts at the previous endpoint and uses three consecutive type-`3` entries: two control points followed by the new endpoint. The loop consumes these three entries together and checks the endpoint for closure. Point types also contain flags. Mask with `0x07` to identify the segment type, and test `0x80` separately to detect a closed subpath. For example, `129` (`0x81`) means a line endpoint that closes a subpath, and `131` (`0x83`) means a Bézier endpoint that closes one. Comparing the raw value only with `1` or `3` would miss these cases. Other flags, such as dash (`0x10`) and marker (`0x20`), do not change the base segment type. **Coordinates and transformations.** Points are measured in points (1/72 inch), with X increasing to the right and Y increasing downward. For an ungrouped shape, the extracted coordinates already include the position returned by [get_X](https://reference.aspose.com/slides/cpp/aspose.slides/shape/get_x/) and [get_Y](https://reference.aspose.com/slides/cpp/aspose.slides/shape/get_y/) and reflect its current width and height. For example, an unrotated rectangle at `(100, 200)` with size `120 × 80` has contour bounds `(100, 200)`–`(220, 280)`. Do not add the shape's position again. Subtract its X and Y to obtain coordinates relative to its unrotated frame. The extracted points do not apply the rotation set through [set_Rotation](https://reference.aspose.com/slides/cpp/aspose.slides/shape/set_rotation/) or horizontal and vertical flips. To reproduce the displayed contour, apply those transformations around the shape's center. For grouped shapes, also account for the group coordinate mapping and transformations; do not assume that the extracted points are the final rendered slide coordinates or apply a translation or scale twice if it is already reflected in the child's frame. **Inspection versus editing.** Extracted arrays describe the contour; changing them does not update the original shape. Choose this approach when your analysis or drawing code needs point/type arrays. Use [GetGeometryPaths](https://reference.aspose.com/slides/cpp/aspose.slides/igeometryshape/getgeometrypaths/) when you need geometry commands in the shape's local coordinate system or want to edit its geometry. Apply edited paths through [SetGeometryPath](https://reference.aspose.com/slides/cpp/aspose.slides/igeometryshape/setgeometrypath/) or [SetGeometryPaths](https://reference.aspose.com/slides/cpp/aspose.slides/igeometryshape/setgeometrypaths/). ## **Convert GeometryPath to GraphicsPath** The current Aspose.Slides for C++ public API does not expose conversions between geometry paths and graphics paths. To inspect a contour, use shape elements as described above. To edit a shape, use geometry paths and apply the updated paths to the shape. ## **FAQ** **What will happen to the fill and outline after replacing the geometry?** The style remains with the shape; only the contour changes. The fill and outline are automatically applied to the new geometry. **How do I correctly rotate a custom shape along with its geometry?** Use the shape’s [set_Rotation](https://reference.aspose.com/slides/cpp/aspose.slides/shape/set_rotation/) method; the geometry rotates with the shape because it’s bound to the shape’s own coordinate system. **Can I convert a custom shape to an image to "lock in" the result?** Yes. Export the required [slide](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-png/) area or the [shape](https://docs.aspose.com/slides/cpp/shape-thumbnails/) itself to a raster format; this simplifies further work with complex geometries. # Customize Data Points in Treemap and Sunburst Charts in C++ > Learn how to create hierarchical data and customize levels, labels, and colors in Treemap and Sunburst charts with Aspose.Slides for C++. Source: https://docs.aspose.com/slides/cpp/data-points-of-treemap-and-sunburst-chart/ Updated: 2026-08-05 ## **Overview** Treemap and Sunburst charts display the same kind of hierarchical data, but they use different layouts. A Treemap draws the hierarchy as nested rectangles whose areas represent leaf values. A Sunburst draws it as concentric rings: top-level groups are near the center, and leaf categories are on the outer ring. In Aspose.Slides for C++, each numeric value is an [IChartDataPoint](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdatapoint/). Its [IChartDataPoint::get_DataPointLevels()](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdatapoint/get_datapointlevels/) method provides access to the leaf and its parent groups. This article explains that mapping and shows how to create and format both chart types from the same sample data. ![A Treemap chart with Consumer and Business branches](https://docs.aspose.com/slides/cpp/data-points-of-treemap-and-sunburst-chart/treemap-hierarchy.png) ![A Sunburst chart with the same Consumer and Business hierarchy](https://docs.aspose.com/slides/cpp/data-points-of-treemap-and-sunburst-chart/sunburst-hierarchy.png) ## **Understand Categories, Data Points, and Levels** The sample used below has three category levels and one numeric series: | Branch | Stem | Leaf | Revenue | | --- | --- | --- | ---: | | Consumer | Computers | Laptops | 12 | | Consumer | Computers | Desktops | 8 | | Consumer | Mobile | Phones | 15 | | Consumer | Mobile | Tablets | 6 | | Business | Services | Consulting | 10 | | Business | Services | Support | 7 | | Business | Software | Licenses | 11 | | Business | Software | Subscriptions | 14 | Each row creates one leaf category and one data point. The category grouping levels describe the path from that leaf to its parents. For the first row, the path is `Consumer > Computers > Laptops`. The indexes returned by [IChartDataPoint::get_DataPointLevels()](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdatapoint/get_datapointlevels/) run from the leaf upward: | `get_DataPointLevels()` index | Logical level | Treemap representation | Sunburst representation | | ---: | --- | --- | --- | | `0` | Leaf | Value rectangle | Outer-ring segment | | `1` | Stem | Parent rectangle or header | Middle-ring segment | | `2` | Branch | Top-level rectangle or header | Inner-ring segment | This order is the same for both chart types even though their visual layouts differ. A parent segment is shared by several leaves. To format it, use the corresponding level of the first data point in that group. For example, the `Consumer` branch starts with the `Laptops` point, while the `Software` stem starts with the `Licenses` point. Keeping references to those points is clearer and safer than using unexplained expressions such as `dataPoints->idx_get(0)` or `dataPoints->idx_get(6)`. ## **Create and Customize Both Chart Types** The following complete example creates a Treemap on the first slide and a Sunburst on the second slide. It builds the hierarchy, displays the value for `Tablets`, applies fixed colors to selected levels, formats a branch label, and saves the presentation. ```cpp auto presentation = MakeObject(); auto addHierarchyChart = [](SharedPtr slide, ChartType chartType) { const int worksheetIndex = 0; const int leafLevelIndex = 0; const int stemLevelIndex = 1; const int branchLevelIndex = 2; auto chart = slide->get_Shapes()->AddChart(chartType, 40, 40, 640, 440); chart->set_HasTitle(false); chart->set_HasLegend(false); chart->get_ChartData()->get_Categories()->Clear(); chart->get_ChartData()->get_Series()->Clear(); auto workbook = chart->get_ChartData()->get_ChartDataWorkbook(); workbook->Clear(worksheetIndex); auto addCategory = [&](int rowIndex, const String& leafName) { auto leafNameValue = ObjectExt::Box(leafName); auto categoryCell = workbook->GetCell(worksheetIndex, rowIndex, 2, leafNameValue); return chart->get_ChartData()->get_Categories()->Add(categoryCell); }; auto setGroupingItem = [](SharedPtr category, int levelIndex, const String& groupName) { auto groupNameValue = ObjectExt::Box(groupName); category->get_GroupingLevels()->SetGroupingItem(levelIndex, groupNameValue); }; // Add the leaf categories. A grouping item is set only when a new group begins; // the following categories remain in that group until another item is set. auto laptopsCategory = addCategory(1, u"Laptops"); setGroupingItem(laptopsCategory, stemLevelIndex, u"Computers"); setGroupingItem(laptopsCategory, branchLevelIndex, u"Consumer"); addCategory(2, u"Desktops"); auto phonesCategory = addCategory(3, u"Phones"); setGroupingItem(phonesCategory, stemLevelIndex, u"Mobile"); addCategory(4, u"Tablets"); auto consultingCategory = addCategory(5, u"Consulting"); setGroupingItem(consultingCategory, stemLevelIndex, u"Services"); setGroupingItem(consultingCategory, branchLevelIndex, u"Business"); addCategory(6, u"Support"); auto licensesCategory = addCategory(7, u"Licenses"); setGroupingItem(licensesCategory, stemLevelIndex, u"Software"); addCategory(8, u"Subscriptions"); auto seriesNameValue = ObjectExt::Box(u"Revenue"); auto seriesNameCell = workbook->GetCell(worksheetIndex, 0, 3, seriesNameValue); auto series = chart->get_ChartData()->get_Series()->Add(seriesNameCell, chartType); series->get_Labels()->get_DefaultDataLabelFormat()->set_ShowCategoryName(true); auto addDataPoint = [&](int rowIndex, double value) { auto valueObject = ObjectExt::Box(value); auto valueCell = workbook->GetCell(worksheetIndex, rowIndex, 3, valueObject); if (chartType == ChartType::Treemap) { return series->get_DataPoints()->AddDataPointForTreemapSeries(valueCell); } return series->get_DataPoints()->AddDataPointForSunburstSeries(valueCell); }; auto laptopsDataPoint = addDataPoint(1, 12); addDataPoint(2, 8); addDataPoint(3, 15); auto tabletsDataPoint = addDataPoint(4, 6); addDataPoint(5, 10); addDataPoint(6, 7); auto licensesDataPoint = addDataPoint(7, 11); addDataPoint(8, 14); auto setSolidFill = [](SharedPtr fillFormat, Color color) { fillFormat->set_FillType(FillType::Solid); fillFormat->get_SolidFillColor()->set_Color(color); }; // Show the category and value on the Tablets leaf. auto tabletsLeafLevel = tabletsDataPoint->get_DataPointLevels()->idx_get(leafLevelIndex); auto tabletsLabelFormat = tabletsLeafLevel->get_Label()->get_DataLabelFormat(); tabletsLabelFormat->set_ShowCategoryName(true); tabletsLabelFormat->set_ShowValue(true); tabletsLabelFormat->set_Separator(u"\n"); tabletsLabelFormat->set_NumberFormat(u"$0"); // Format the Consumer branch through the first leaf in that branch. auto consumerBranchLevel = laptopsDataPoint->get_DataPointLevels()->idx_get(branchLevelIndex); auto consumerBranchFill = consumerBranchLevel->get_Format()->get_Fill(); auto consumerBranchColor = Color::FromArgb(31, 78, 121); setSolidFill(consumerBranchFill, consumerBranchColor); auto consumerLabelFormat = consumerBranchLevel->get_Label()->get_DataLabelFormat(); consumerLabelFormat->set_ShowCategoryName(true); consumerLabelFormat->set_ShowSeriesName(false); auto consumerLabelTextFill = consumerLabelFormat->get_TextFormat() ->get_PortionFormat()->get_FillFormat(); setSolidFill(consumerLabelTextFill, Color::get_White()); // Format the Software stem through the first leaf in that stem. auto softwareStemLevel = licensesDataPoint->get_DataPointLevels()->idx_get(stemLevelIndex); auto softwareStemFill = softwareStemLevel->get_Format()->get_Fill(); auto softwareStemColor = Color::FromArgb(112, 173, 71); setSolidFill(softwareStemFill, softwareStemColor); // ParentLabelLayout affects Treemap parent labels; Sunburst uses ring segments. if (chartType == ChartType::Treemap) { series->set_ParentLabelLayout(ParentLabelLayoutType::Overlapping); } }; auto treemapSlide = presentation->get_Slide(0); addHierarchyChart(treemapSlide, ChartType::Treemap); auto layoutSlide = presentation->get_LayoutSlide(0); auto sunburstSlide = presentation->get_Slides()->AddEmptySlide(layoutSlide); addHierarchyChart(sunburstSlide, ChartType::Sunburst); presentation->Save(u"hierarchical-charts.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` The category cells and value cells use the same worksheet row, so their collection positions remain aligned. When you work with an existing chart rather than creating one, inspect the category rows first and store named references to the data points and levels you intend to format. ## **Behavior and Practical Considerations** ### **Treemap and Sunburst Differences** - A Treemap uses area to communicate value and nested rectangles to communicate hierarchy. The [IChartSeries::get_ParentLabelLayout()](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartseries/get_parentlabellayout/) method controls how parent labels appear in this chart type. - A Sunburst uses angle to communicate value and ring depth to communicate hierarchy. [IChartSeries::get_ParentLabelLayout()](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartseries/get_parentlabellayout/) does not control its ring labels. - Both chart types use the same category grouping levels and the same leaf-to-parent order returned by [IChartDataPoint::get_DataPointLevels()](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdatapoint/get_datapointlevels/), so the data-building and level-formatting code can be shared. - Parent values are calculated from their descendant leaves. Do not add separate numeric points for branches or stems. ### **Sorting and Segment Order** The chart layout engine determines the final placement of rectangles and ring segments. Arrange related category rows together before adding them, but do not rely on a specific rectangle position or start angle. If sequence carries meaning, include it in the labels or use a chart type with an explicit category axis. ### **Theme and Fixed Colors** Unformatted chart levels inherit colors from the presentation theme. The example uses explicit RGB fills for predictable output. If the chart should follow theme changes, use scheme colors instead of fixed RGB values and avoid overriding every level. Also check label contrast after changing a branch or stem fill. ### **Labels and Available Space** PowerPoint may hide or truncate labels when a segment is too small. Increasing the chart size, shortening category names, or showing fewer label fields usually produces a clearer result. A label can combine the category name, series name, and value through [IDataLabelFormat](https://reference.aspose.com/slides/cpp/aspose.slides.charts/idatalabelformat/), but enabling every field often makes hierarchical charts difficult to read. ### **Export and Rendering** Saving to PPTX keeps the chart editable. When Aspose.Slides renders the presentation to PDF or an image, the supported fills and label settings are rendered with the chart. Font substitution and small differences in available layout space can change line wrapping or label visibility, so install the required fonts and verify important export targets. ## **FAQ** **Why does changing a parent level affect several leaves?** A branch or stem is a shared visual segment. Its [IChartDataPointLevel](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartdatapointlevel/) can be reached through a descendant leaf, but the formatting belongs to the shared parent segment rather than only to that leaf. **Why is a data label missing?** First enable the required fields on the label's [IDataLabelFormat](https://reference.aspose.com/slides/cpp/aspose.slides.charts/idatalabelformat/) object. Then check whether the segment has enough space. Treemap parent-label layout, chart dimensions, label length, font size, and the number of enabled fields all affect whether a label can be displayed. **Can I set the exact order or coordinates of segments?** You can control the source-row order and keep each group contiguous, but you cannot assign exact Treemap rectangles or Sunburst angles. The chart layout engine calculates them from the hierarchy, values, and available space. **Why do colors change after the presentation theme changes?** Theme-based fills are designed to follow the presentation palette. Apply explicit RGB colors to the levels that must remain fixed, or keep scheme colors when adapting to a new theme is preferred. **Will custom formatting be preserved in PDF and image exports?** Yes, supported chart fills and label settings are included during rendering. For consistent results across systems, make the required fonts available and test the final export size because label fitting is layout-dependent. ## **See Also** - [Create Treemap charts](https://docs.aspose.com/slides/cpp/create-chart/#create-tree-map-charts) - [Create Sunburst charts](https://docs.aspose.com/slides/cpp/create-chart/#create-sunburst-charts) - [Export presentation charts](https://docs.aspose.com/slides/cpp/export-chart/) - [Manage presentation themes](https://docs.aspose.com/slides/cpp/presentation-theme/) # Declaration > Learn about Aspose.Slides for C++ trust requirements, permissions, and hosting limitations so you can safely deploy apps that process PPT, PPTX and ODP on servers. Source: https://docs.aspose.com/slides/cpp/declaration/ Updated: 2026-08-13 All Aspose C++ components require Full Trust permission set. The reason is, Aspose C++ components need to access registry settings, system files other than virtual directory for certain operations like parsing fonts etc. Moreover, Aspose C++ Components are based on core C++ system classes that also require Full Trust permission set in many cases. # Specify Default Presentation Fonts in C++ > Set default fonts in Aspose.Slides for C++ to ensure proper PowerPoint (PPT, PPTX) and OpenDocument (ODP) conversion to PDF, XPS and images. Source: https://docs.aspose.com/slides/cpp/default-font/ Updated: 2026-08-05 ## **Overview** Aspose.Slides allows you to specify default fonts that are used when a presentation is rendered. This is useful when generating slide thumbnails or exporting a presentation to formats such as PDF and XPS. Default fonts are configured through `LoadOptions` before the presentation is loaded. The `set_DefaultRegularFont` method defines the default font for regular text, while `set_DefaultAsianFont` defines the default font for Asian text. After these options are set, the presentation can be loaded and rendered using the specified fonts. ## **Use Default Fonts for Rendering a Presentation** Aspose.Slides lets you set the default font fore rendering the presentation to PDF, XPS or thumbnails. This article shows how to define DefaultRegular Font and DefaultAsian Font for use as default fonts. Please follow the steps below to loading fonts from external directories by using Aspose.Slides for C++ API: 1. Create an instance of LoadOptions. 1. Set the DefaultRegularFont to your desired font. In the following example, I have used Wingdings. 1. Set the DefaultAsianFont to your desired font. I have used Wingdings in following sample. 1. Load the presentation using Presentation and setting the load options. 1. Now, generate the slide thumbnail, PDF and XPS to verify the results. The implementation of the above is given below. ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; // Use the load options to specify default regular and Asian fonts auto loadOptions = MakeObject(LoadFormat::Auto); loadOptions->set_DefaultRegularFont(u"Wingdings"); loadOptions->set_DefaultAsianFont(u"Wingdings"); auto pptx = MakeObject(u"DefaultFonts.pptx", loadOptions); auto image = pptx->get_Slide(0)->GetImage(1, 1); image->Save(u"DefaultFonts_out.png", ImageFormat::Png); image->Dispose(); pptx->Save(u"DefaultFonts_out.pdf", SaveFormat::Pdf); pptx->Save(u"DefaultFonts_out.xps", SaveFormat::Xps); pptx->Dispose(); ``` ## **FAQ** ### What exactly do DefaultRegularFont and DefaultAsianFont affect—only export, or also thumbnails, PDF, XPS, HTML, and SVG? They participate in the rendering pipeline for all supported outputs. This includes slide thumbnails, [PDF](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-pdf/), [XPS](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-xps/), [raster images](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-png/), [HTML](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-html/), and [SVG](https://docs.aspose.com/slides/cpp/render-a-slide-as-an-svg-image/), because Aspose.Slides uses the same layout and glyph resolution logic across these targets. ### Are default fonts applied when simply reading and saving a PPTX without any rendering? No. Default fonts matter when text must be measured and drawn. A straight open–save of a presentation does not change stored font runs or the file’s structure. Default fonts come into play during operations that render or reflow text. ### If I add my own font folders or supply fonts from memory, will they be considered when choosing default fonts? Yes. [Custom font sources](https://docs.aspose.com/slides/cpp/custom-font/) expand the catalog of available families and glyphs that the engine can use. Default fonts and any [fallback rules](https://docs.aspose.com/slides/cpp/fallback-font/) will resolve against those sources first, yielding more reliable coverage on servers and in containers. ### Will default fonts affect text metrics (kerning, advances) and therefore line breaks and wrapping? Yes. Changing the font changes glyph metrics and can alter line breaks, wrapping, and pagination during rendering. For layout stability, [embed the original fonts](https://docs.aspose.com/slides/cpp/embedded-font/) or select metrically compatible default and fallback families. ### Is there any point in setting default fonts if all fonts used in the presentation are embedded? Often it’s not necessary, because [embedded fonts](https://docs.aspose.com/slides/cpp/embedded-font/) already ensure consistent appearance. Default fonts still help as a safety net for characters not covered by the embedded subset or when a file mixes embedded and non-embedded text. # Determine the Original Presentation Format in C++ > Read the original format of a loaded presentation in C++ with Aspose.Slides for C++, compare detection APIs, and handle files, streams, and legacy formats. Source: https://docs.aspose.com/slides/cpp/detect-presentation-source-format/ Updated: 2026-09-22 ## **Overview** After loading a presentation, call [Presentation::get_SourceFormat](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/get_sourceformat/) to determine its original format. The method is also available through [IPresentation::get_SourceFormat](https://reference.aspose.com/slides/cpp/aspose.slides/ipresentation/get_sourceformat/). Use it when subsequent processing depends on the format from which the current instance was loaded. The source format is distinct from the [SaveFormat](https://reference.aspose.com/slides/cpp/aspose.slides.export/saveformat/) selected for an output file. Saving to another format does not change the source format of the existing instance. ## **Read the Source Format of a File** This example requires an existing `sample.pptx` file. It loads the file and selects an application processing policy using [Presentation::get_SourceFormat](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/get_sourceformat/), rather than the filename. Change the input path to try other formats. The example prints the selected policy; replace the messages with your application logic. ```cpp #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto presentation = MakeObject(u"sample.pptx"); switch (presentation->get_SourceFormat()) { case SourceFormat::Ppt: case SourceFormat::Pps: case SourceFormat::Pot: Console::WriteLine(u"Use the legacy PowerPoint processing policy."); break; case SourceFormat::Pptx: Console::WriteLine(u"Use the standard PPTX processing policy."); break; default: Console::WriteLine(String::Format(u"Use the general policy for {0}.", ObjectExt::ToString(presentation->get_SourceFormat()))); break; } ``` ## **Recognize the Supported Values** The [SourceFormat](https://reference.aspose.com/slides/cpp/aspose.slides/sourceformat/) enumeration distinguishes the following presentation formats. The extensions below are conventional extensions, not a reconstruction of the original filename. | SourceFormat value | Extension | Format | | --- | --- | --- | | `Ppt` | `.ppt` | PowerPoint 97–2003 presentation | | `Pptx` | `.pptx` | Office Open XML presentation | | `Pptm` | `.pptm` | Macro-enabled Office Open XML presentation | | `Pps` | `.pps` | PowerPoint 97–2003 slide show | | `Ppsx` | `.ppsx` | Office Open XML slide show | | `Ppsm` | `.ppsm` | Macro-enabled Office Open XML slide show | | `Pot` | `.pot` | PowerPoint 97–2003 template | | `Potx` | `.potx` | Office Open XML template | | `Potm` | `.potm` | Macro-enabled Office Open XML template | | `Odp` | `.odp` | OpenDocument presentation | | `Otp` | `.otp` | OpenDocument presentation template | | `Fodp` | `.fodp` | Flat XML ODF presentation | | `Xml` | `.xml` | PowerPoint XML presentation | ## **Read the Source Format of a Stream** This example requires an existing `sample.pps` file. Reading its bytes into a memory stream models input received without a filename, such as a database value or an uploaded byte array. The [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) constructor receives only the stream. ```cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; using namespace System::IO; auto bytes = File::ReadAllBytes(u"sample.pps"); auto stream = MakeObject(bytes); auto presentation = MakeObject(stream); Console::WriteLine(String::Format(u"Source format: {0}", ObjectExt::ToString(presentation->get_SourceFormat()))); ``` PPT, PPS, and POT use the same underlying binary format. When loading by file path, the extension can help distinguish a slide show or template. Without a filename, legacy PPS and POT content may be reported as `SourceFormat::Ppt`; the PPS example above reports `Ppt`. If your application must preserve the distinction, keep the original filename or subtype metadata separately. An extension is a useful hint for these legacy subtypes, but should not be the only basis for identifying arbitrary presentation content. ## **Compare Detection Before and After Loading** Use [PresentationFactory::GetPresentationInfo](https://reference.aspose.com/slides/cpp/aspose.slides/presentationfactory/getpresentationinfo/) and [IPresentationInfo::get_LoadFormat](https://reference.aspose.com/slides/cpp/aspose.slides/ipresentationinfo/get_loadformat/) when you need to inspect a file before loading its complete presentation object model. Use [Presentation::get_SourceFormat](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/get_sourceformat/) when the instance already exists. This example requires `sample.pptx` and prints `Pptx` for both checks. In production, choose the API appropriate to your processing stage; an already loaded presentation does not need a second inspection solely to obtain its source format. ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto path = String(u"sample.pptx"); auto information = PresentationFactory::get_Instance()->GetPresentationInfo(path); Console::WriteLine(String::Format(u"Before loading: {0}", ObjectExt::ToString(information->get_LoadFormat()))); auto presentation = MakeObject(path); Console::WriteLine(String::Format(u"After loading: {0}", ObjectExt::ToString(presentation->get_SourceFormat()))); ``` The results have different enumeration types: [LoadFormat](https://reference.aspose.com/slides/cpp/aspose.slides/loadformat/) and [SourceFormat](https://reference.aspose.com/slides/cpp/aspose.slides/sourceformat/). Do not compare them by casting their numeric values or assume that every format has identical detection results. PowerPoint XML can be reported as `LoadFormat::Unknown` before loading and `SourceFormat::Xml` after loading. ## **Keep Source and Output Formats Separate** This example requires `sample.pptx` and writes `converted.odp`. It prints `Pptx` both before and after saving the original instance. Only the new instance loaded from the ODP output reports `Odp`. ```cpp #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; using namespace Aspose::Slides::Export; auto presentation = MakeObject(u"sample.pptx"); Console::WriteLine(String::Format(u"Before saving: {0}", ObjectExt::ToString(presentation->get_SourceFormat()))); presentation->Save(u"converted.odp", SaveFormat::Odp); Console::WriteLine(String::Format(u"After saving: {0}", ObjectExt::ToString(presentation->get_SourceFormat()))); auto reopened = MakeObject(u"converted.odp"); Console::WriteLine(String::Format(u"Reopened output: {0}", ObjectExt::ToString(reopened->get_SourceFormat()))); ``` A presentation created from scratch with `MakeObject()` reports `SourceFormat::Pptx`. It has no input file: this is the default value for a newly created instance, not evidence that a PPTX file was loaded. Track whether your application created or loaded the instance separately if that distinction matters. ## **Map a Source Format to an Extension** The following example requires `sample.pptx`. It maps every currently supported [SourceFormat](https://reference.aspose.com/slides/cpp/aspose.slides/sourceformat/) value to a conventional extension, without parsing the input filename. The fallback avoids silently assigning an extension to an unrecognized value. ```cpp #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto presentation = MakeObject(u"sample.pptx"); auto extension = String::Empty; switch (presentation->get_SourceFormat()) { case SourceFormat::Ppt: extension = u".ppt"; break; case SourceFormat::Pptx: extension = u".pptx"; break; case SourceFormat::Pptm: extension = u".pptm"; break; case SourceFormat::Pps: extension = u".pps"; break; case SourceFormat::Ppsx: extension = u".ppsx"; break; case SourceFormat::Ppsm: extension = u".ppsm"; break; case SourceFormat::Pot: extension = u".pot"; break; case SourceFormat::Potx: extension = u".potx"; break; case SourceFormat::Potm: extension = u".potm"; break; case SourceFormat::Odp: extension = u".odp"; break; case SourceFormat::Otp: extension = u".otp"; break; case SourceFormat::Fodp: extension = u".fodp"; break; case SourceFormat::Xml: extension = u".xml"; break; default: break; } Console::WriteLine(extension.IsEmpty() ? u"No extension mapping is available." : extension); ``` This mapping does not convert a file or recover a legacy PPS/POT subtype lost during stream loading. For actual saving, select a [SaveFormat](https://reference.aspose.com/slides/cpp/aspose.slides.export/saveformat/) explicitly, or use the conversion shown in [Save Presentations in Their Original Format](https://docs.aspose.com/slides/cpp/save-presentation/#save-presentations-in-their-original-format). ## **Verify Formats by Saving and Reopening** This self-contained example creates a presentation and writes three files in the working directory, overwriting files with the same names. It reopens each output both by path and through a memory stream. For PPTX and ODP, both routes report the saved format. For PPS, loading by path reports `Pps`, while loading the same bytes without a filename reports `Ppt`. ```cpp #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; using namespace Aspose::Slides::Export; using namespace System::IO; auto presentation = MakeObject(); auto formats = MakeArray({SaveFormat::Pptx, SaveFormat::Odp, SaveFormat::Pps}); for (auto format : formats) { auto formatName = ObjectExt::ToString(format); auto path = String::Format(u"roundtrip.{0}", formatName.ToLowerInvariant()); presentation->Save(path, format); auto fromFile = MakeObject(path); auto bytes = File::ReadAllBytes(path); auto stream = MakeObject(bytes); auto fromStream = MakeObject(stream); Console::WriteLine(String::Format(u"{0}: file={1}, stream={2}", formatName, ObjectExt::ToString(fromFile->get_SourceFormat()), ObjectExt::ToString(fromStream->get_SourceFormat()))); } ``` The following table summarizes source-format identification for presentations with matching extensions: | Saved format | SourceFormat from a file path | SourceFormat from a nameless stream | | --- | --- | --- | | PPT | `Ppt` | `Ppt` | | PPTX, PPTM | `Pptx`, `Pptm` respectively | Same as file path | | PPS | `Pps` | `Ppt` | | PPSX, PPSM | `Ppsx`, `Ppsm` respectively | Same as file path | | POT | `Pot` | `Ppt` | | POTX, POTM | `Potx`, `Potm` respectively | Same as file path | | ODP, OTP | `Odp`, `Otp` respectively | Same as file path | | FODP | `Fodp` | `Fodp` | | PowerPoint XML | `Xml` | `Xml` | Legacy PPS/POT content is normalized to `Ppt` for nameless streams. The table describes format identification, not preservation of every presentation feature during conversion. ## **FAQ** **Does saving to ODP change the source format of a presentation loaded from PPTX?** No. The existing instance still reports `Pptx`. An instance loaded from the saved ODP file reports `Odp`. **Can a stream always distinguish a legacy presentation, slide show, and template?** No. PPT, PPS, and POT share the binary format. Keep filename or subtype metadata separately when that distinction is required. **Which API should I use if the presentation is already loaded?** Read [Presentation::get_SourceFormat](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/get_sourceformat/). Use [PresentationFactory::GetPresentationInfo](https://reference.aspose.com/slides/cpp/aspose.slides/presentationfactory/getpresentationinfo/) for inspection before loading. # Developer Guide > Discover the Aspose.Slides for C++ Developer Guide for step-by-step APIs to build, edit, and convert PPT, PPTX and ODP presentations with ease. Source: https://docs.aspose.com/slides/cpp/developer-guide/ Updated: 2025-11-19 --- lastmod: 2025-11-19T22:55:59+04:00 title: Developer Guide type: docs weight: 20 url: /cpp/developer-guide/ keywords: - developer guide - manage presentation - presentation design - professional presentation - create presentation - presentation viewer - presentation security - presentation properties - view properties - presentation comments - presentation notes - animation - 3D presentation - VBA project - image processing - PowerPoint - OpenDocument - presentation - C++ - Aspose.Slides description: "Discover the Aspose.Slides for C++ Developer Guide for step-by-step APIs to build, edit, and convert PPT, PPTX and ODP presentations with ease." --- # Different File Formats and Conversions > Source: https://docs.aspose.com/slides/cpp/different-file-formats-and-conversions/ Updated: 2026-08-05 ## **Microsoft PowerPoint (PPT)** ### **About PPT** [PPT](https://en.wikipedia.org/wiki/Microsoft_PowerPoint) is the presentation document file format that can be created, read, manipulated and written by different versions of Microsoft PowerPoint. This is the binary format for presentation documents developed by Microsoft. ### **PPT in Aspose.Slides for C++** Aspose.Slides for C++ can read PPT files created by the software listed below. - Microsoft PowerPoint 97 - Microsoft PowerPoint 2000 - Microsoft PowerPoint XP - Microsoft PowerPoint 2003 Similarly, PPT files created by Aspose.Slides for C++ can be read by the above set of software. ### **Comprehensive Support for PPT** Aspose.Slides for C++ provides support for almost all the features related with PPT document file format. It not only covers the basic / advanced features provided by different Microsoft PowerPoint versions for PPT document manipulations, but also some features that are not even supported by Microsoft PowerPoint. The main advantage of using the Aspose.Slides for C++ API library is the ease of use for handling such features. In addition to the basic tasks related to creating, reading and writing PPT document files, there are several features that are provided by Aspose.Slides for C++ like: - Import other MS Office file formats as OLE Objects in PPT documents. - Export PPT documents to PDF, TIFF, XPS formats. - Export slides in the PPT documents to SVG formats. - Render slide to any image format supported by C++ Framework. - Set size of slides in the PPT document. - Manage animations on shapes. - Manage slide shows. - Format text on slides. - Scan text from the PPT documents. - Handle tables on slides. - Automatic copying of masters using cloning feature. A PPT file generated by Aspose.Slides for C++ and opened in Microsoft PowerPoint ## **PresentationML (PPTX, XML)** ### **About PresentationML** PresentationML is a name for a family of XML-based formats for presentation documents. Office OpenXML (OOXML) is the XML-based format introduced in Microsoft Office 2007 applications. Office OpenXML is a container format for several specialized XML-based markup languages. PresentationML is the markup language used by Microsoft Office PowerPoint 2007 to store its documents. ### **PresentationML in Aspose.Slides for C++** OOXML PresentationML documents come as PPTX files which are zipped XML packages following the [OOXML ECMA-376](https://www.ecma-international.org/publications-and-standards/standards/ecma-376/) specifications. Aspose.Slides for C++ extensively supports creating, reading, manipulating and writing PresentationML documents. In addition, Aspose.Slides for C++ is capable of exporting PresentationML documents to different widely used document formats like PDF, TIFF and XPS. This is possible because Aspose.Slides for C++ was designed with the aim to comprehensively handle presentation documents and PresentationML basically holds the internal presentation of documents as zipped XML package. A PPTX document generated by Aspose.Slides for C++ and opened in Microsoft PowerPoint Viewing PPTX document generated by Aspose.Slides for C++ in Zip Application ### **PresentationML is Open, Why Use Aspose.Slides for C++** Since PresentationML is XML based, it is quite possible to build applications for processing and generating of PresentationML documents by using XML classes without relying on the third party class libraries such as Aspose.Slides for C++. However, there are several advantages of using Aspose.Slides for C++ over XML classes while working with PresentationML documents. The OOXML specification is too long to several thousands of pages. It means, in order to properly handle the PresentationML documents, you will have to spend a lot of time and effort to understand the format of such documents. On the other hand, while using Aspose.Slides for C++, you simply have to use the relevant classes and their respective methods / properties for performing operations which seem quite complex if performed via XML classes. The following are some of the features which are even unavailable when dealing with PresentationML documents through XML classes: - Export PPT documents to PDF, TIFF, XPS formats - Export slides in the PPT documents to SVG formats - Render slide to any image format supported by C++ Framework - Automatic copying of masters from source presentations using cloning feature - Applying protection on shapes Let us take an example of a PresentationML document having single slide with one text box containing “Hello World” text. In order to read the text through XML classes, you will have to write a program that can parse this simple text from the following fragment: ``` xml Hello World ``` ## **PPT to PPTX conversion** ### **About Conversion** Aspose.Slides now also support converting PPT to PPTX. ### **Features Supported in Conversion** Aspose.Slides for C++ provides partial support for converting PPT document file format presentations to PPTX file format presentations. As the support for the mentioned presentation conversion feature has justbeen introduced in Aspose.Slides for C++, so at the moment it has got the limited capability and works only for the simple form of presentations. The main advantage that Aspose.Slides for C++ API library provides for converting PPT presentation to PPTX format presentation is the ease of using API in achieving the desired goal. Please proceed to this[link]() to code snippets section for further details.The following section clearly illustrates which of features are supported and unsupported while converting PPT format presentations to PPTX format presentations. ### **Supported Features** Following features are supported during conversion: - Conversion of structure of masters, layouts and slides - Conversion of structure of masters, layouts and slides - Conversion of Charts - Group shapes - Conversion of Auto-shapes including Rectangles and Ellipses. However, it is possible that Auto-shapes may have wrong adjustments values - Shapes with custom geometry. Sometimes may not be converted - Textures and Pictures fill style for Auto-shapes. Sometimes may not be converted - Conversion of Placeholders - Conversion of text in text frames and text holders. However, bullets, alignment and tabulations are not fully implemented ### **Unsupported Features** Following features are not supported during conversion: - Slide with notes as reading Notes is not implemented in PPTX. In case PPT has it then it can't be saved as PPTX yet* Conversion of Lines and Polylines - Line and fill formats - Gradient fill styles - OLE frames, Tables, Video and Audio frames etc - Animation and other slideshow properties are skipped New or missing features will be added subsequently in the upcoming releases of Aspose.Slides for C++. Source PPT Presentation Converted PPTX presentation ## **Portable Document Format (PDF)** ### **About PDF** The [Portable Document Format](https://en.wikipedia.org/wiki/PDF) is a file format that was created by Adobe System for exchange of documents between different organizations. The purpose of this format was to make it possible that contents of the documents may be represented in such a way that their visual appearance is not dependent of the platform on which it is being viewed. ### **PDF in Aspose.Slides for C++** Any presentation document that can be loaded into Aspose.Slides for C++ can be converted to PDF document which may conform to [PDF 1.5](https://en.wikipedia.org/wiki/PDF/A) or [PDF /A-1b](https://en.wikipedia.org/wiki/PDF/A) depending upon your choice. Aspose.Slides for C++ exports the presentation documents to PDF in such a way that most of the time, the exported PDF document look almost similar to the original presentation document. The Aspose solution supports the following features of the presentation documents while converting to PDF documents: - Images, Text Boxes and other Shapes - Text and Formatting - Paragraphs and Formatting - Hyperlinks - Headers and Footers - Bullets - Tables You can export the presentation documents to PDF documents directly using Aspose.Slides for C++ component only. That is, you do not need any other third party or Aspose.Pdf component for this purpose. Further, you can customize the presentation to PDF export with different options as explained in [this topic](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-pdf/). A Presentation Document Converted to PDF Document through Aspose.Slides for C++ ## **XML Parser Specification (XPS)** ### **About XPS** The [XML Parser Specification](https://en.wikipedia.org/wiki/Open_XML_Paper_Specification) is a page description language and a fixed-document format originally developed by Microsoft. Like PDF, XPS is a fixed-layout document format designed to preserve document fidelity and provide device-independent document appearance. ### **XPS in Aspose.Slides for C++** Any presentation document that can be loaded by Aspose.Slides for C++ can be converted to XPS format. Aspose.Slides for C++ uses the high-fidelity page layout and rendering engine to produce output in fixed-layout XPS document format. It is worth-mentioning that Aspose.Slides for C++ directly generates XPS without depending upon the Windows Presentation Foundation (WPF) classes that are packaged with C++ Framework 3.5 hence allowing Aspose.Slides for C++ to produce XPS documents on machines running C++ Framework versions earlier than version 3.5. You can learn about exporting the presentation documents to XPS documents through Aspose.Slides for C++ in [this topic](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-xps/). A Presentation Document Converted to XPS Document through Aspose.Slides for C++ ## Related articles - [PresentationML (PPTX, XML)](https://docs.aspose.com/slides/cpp/presentationml-pptx-xml/) - [Microsoft PowerPoint (PPT)](https://docs.aspose.com/slides/cpp/microsoft-powerpoint-ppt/) - [XML Parser Specification (XPS)](https://docs.aspose.com/slides/cpp/xml-parser-specification-xps/) # Add Digital Signatures to Presentations in C++ > Learn how to sign existing PPTX presentations with PFX certificates and use Aspose.Slides for C++ to validate or remove digital signatures. Source: https://docs.aspose.com/slides/cpp/digital-signature-in-powerpoint/ Updated: 2026-08-25 ## **Overview** A digital signature helps a recipient determine who signed a presentation and whether the signed content has changed. Three related security concepts are important here: - A **digital certificate** is an electronic credential that associates an identity with a public key. A trusted certificate authority (CA) can issue a certificate, or an organization can use a self-signed certificate for internal workflows. - A **digital signature** is created from the presentation content and the certificate holder's private key. The certificate's public key can then be used to verify the signature. A signature provides evidence of origin and integrity; it does not encrypt the presentation. - **Password protection** controls whether a user can open or modify a presentation. It is separate from digital signing and is described in [Password-Protected Presentations](https://docs.aspose.com/slides/cpp/password-protected-presentation/). PowerPoint provides the **Add a Digital Signature** command under **File > Info > Protect Presentation**. ![PowerPoint Protect Presentation menu with Add a Digital Signature highlighted](https://docs.aspose.com/slides/cpp/digital-signature-in-powerpoint/add-digital-signature-in-powerpoint.png) After a signed presentation is opened, PowerPoint can display a signature-status notification. ![PowerPoint notification stating that the presentation contains valid signatures](https://docs.aspose.com/slides/cpp/digital-signature-in-powerpoint/digital-signature-status-in-powerpoint.png) Aspose.Slides exposes signatures through [IPresentation::get_DigitalSignatures](https://reference.aspose.com/slides/cpp/aspose.slides/ipresentation/get_digitalsignatures/), which returns an [IDigitalSignatureCollection](https://reference.aspose.com/slides/cpp/aspose.slides/idigitalsignaturecollection/) whose items implement [IDigitalSignature](https://reference.aspose.com/slides/cpp/aspose.slides/idigitalsignature/). A presentation can contain multiple signatures. ## **Understand PFX Certificates and Passwords** A PFX file, also known as a PKCS#12 file and commonly given a `.pfx` or `.p12` extension, can contain an X.509 certificate, its private key, and the certificate chain. The private key is what allows the holder to create a signature. A certificate without an accessible private key cannot be used to sign a presentation. The PFX password protects the certificate package and private key. It is **not** a password for opening or editing the presentation. Do not commit PFX files or their passwords to source control. In production, limit access to the certificate file and obtain its password from a secret store or another protected configuration source. The examples below use an environment variable only to avoid embedding the password in code. ## **Add a Digital Signature to a Presentation** To sign a real presentation workflow, load an existing PPTX file, create a [DigitalSignature](https://reference.aspose.com/slides/cpp/aspose.slides/digitalsignature/) from a PFX certificate and its password, add the signature to the presentation's collection, and save to a PPTX file. ```cpp auto certificatePassword = Environment::GetEnvironmentVariable(u"PFX_PASSWORD"); if (certificatePassword.IsNullOrEmpty()) { throw InvalidOperationException(u"Set the PFX_PASSWORD environment variable."); } auto presentation = MakeObject(u"InputPresentation.pptx"); auto signature = MakeObject(u"signing-certificate.pfx", certificatePassword); signature->set_Comments(u"Approved for release."); presentation->get_DigitalSignatures()->Add(signature); presentation->Save(u"InputPresentation-signed.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` Saving the result under a new name preserves the unsigned source file. The [IDigitalSignature::set_Comments](https://reference.aspose.com/slides/cpp/aspose.slides/idigitalsignature/set_comments/) value describes the purpose of the signature; it is not a security control. ## **Validate Digital Signatures** When you load a signed PPTX file, inspect every item returned by [IPresentation::get_DigitalSignatures](https://reference.aspose.com/slides/cpp/aspose.slides/ipresentation/get_digitalsignatures/). The [IDigitalSignature::get_IsValid](https://reference.aspose.com/slides/cpp/aspose.slides/idigitalsignature/get_isvalid/) method indicates whether the embedded signature is valid for the current presentation content. ```cpp auto presentation = MakeObject(u"InputPresentation-signed.pptx"); auto signatureCount = presentation->get_DigitalSignatures()->get_Count(); if (signatureCount == 0) { Console::WriteLine(u"The presentation does not contain digital signatures."); } else { bool allSignaturesAreValid = true; for (int signatureIndex = 0; signatureIndex < signatureCount; ++signatureIndex) { auto signature = presentation->get_DigitalSignature(signatureIndex); auto signatureIsValid = signature->get_IsValid(); auto signatureStatus = signatureIsValid ? u"VALID" : u"INVALID"; auto signerName = signature->get_Certificate()->get_SubjectName()->get_Name(); auto signingTime = signature->get_SignTime().ToString(u"yyyy-MM-dd HH:mm:ss"); Console::WriteLine(u"{0}, {1} -- {2}", signerName, signingTime, signatureStatus); allSignaturesAreValid = allSignaturesAreValid && signatureIsValid; } if (allSignaturesAreValid) { Console::WriteLine(u"All embedded signatures are valid for the current presentation."); } else { Console::WriteLine(u"At least one embedded signature is invalid."); } } presentation->Dispose(); ``` An invalid result commonly means that the signed presentation content or signature data changed after signing, or that the file is damaged. Removing every signature produces an unsigned presentation, so checking only the validity of items is not enough: a security-sensitive workflow must also verify that the expected number of signatures and expected signer identities are present. This validity result should not be treated as a complete certificate-trust decision. Depending on your security policy, your application may also need to build and validate the X.509 certificate chain, check certificate validity dates and revocation status, confirm the expected subject or thumbprint, verify key usage, and evaluate a trusted timestamp. The [IDigitalSignature::get_SignTime](https://reference.aspose.com/slides/cpp/aspose.slides/idigitalsignature/get_signtime/) value by itself is not proof from a trusted timestamp authority. ## **Remove Digital Signatures** Removing signatures changes the presentation's security state. The following example loads a signed PPTX file, removes all signatures with [IDigitalSignatureCollection::Clear](https://reference.aspose.com/slides/cpp/aspose.slides/idigitalsignaturecollection/clear/), and saves an unsigned copy. ```cpp auto presentation = MakeObject(u"InputPresentation-signed.pptx"); presentation->get_DigitalSignatures()->Clear(); presentation->Save(u"InputPresentation-unsigned.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` To remove only one signature, call [IDigitalSignatureCollection::RemoveAt](https://reference.aspose.com/slides/cpp/aspose.slides/idigitalsignaturecollection/removeat/) with its zero-based index. Save to a new file unless overwriting the signed original is an explicit part of your workflow. ## **Editing and Format Considerations** - A signature does not make a presentation read-only. Users and applications can still edit the file, but changes to signed content normally invalidate the existing signature. - Complete all intended edits before signing. If a presentation must be changed, save the revised presentation and sign that revision again. - Keep the final output in PPTX format. Converting a signed presentation to another format does not transfer the original PPTX signature as a valid signature for the converted file. - Treat the certificate's private key as sensitive. Anyone who obtains the private key and its password may be able to create signatures that appear to come from that certificate holder. - Retain the unsigned source or another controlled copy when your document-retention policy requires it. ## **FAQ** **Does a digital signature encrypt the presentation?** No. A digital signature provides evidence about origin and integrity, but presentation content remains readable unless separate encryption is applied. Use [password protection](https://docs.aspose.com/slides/cpp/password-protected-presentation/) when access to the content must be restricted. **Is the PFX password the same as a presentation password?** No. The PFX password unlocks the private key stored in the certificate package. It does not control who can open or edit the PPTX file. **Can I use a self-signed certificate?** Technically, a self-signed certificate can be used when it includes an accessible private key. Recipients will not automatically trust it, however, unless that certificate has been explicitly added to their trusted environment. Public or cross-organization workflows generally use a certificate issued by a trusted CA. **What makes a signature invalid?** Changing signed presentation content or the signature data after signing can invalidate the signature. File corruption can also cause validation to fail. If all signatures are removed, the presentation is unsigned rather than a file containing an invalid signature. **Does a valid signature mean that I should trust the signer?** Not by itself. Signature integrity and signer trust are separate decisions. A production validation policy should also check the certificate chain, validity period, revocation status, expected identity, key usage, and any trusted timestamp requirements. **What happens when the certificate expires?** Certificate expiration does not alter the presentation bytes, but it affects certificate-trust evaluation. Whether a signature remains acceptable depends on your policy and on whether a valid trusted timestamp proves that signing occurred while the certificate was valid. Do not rely on the displayed signing time alone as a trusted timestamp. **Can a signed presentation still be edited?** Yes. Signing does not lock the file. Editing signed content generally makes the existing signature invalid, so finish the presentation first and sign the final revision. **Can a presentation contain more than one signature?** Yes. Add each signature to the collection returned by [IPresentation::get_DigitalSignatures](https://reference.aspose.com/slides/cpp/aspose.slides/ipresentation/get_digitalsignatures/) before saving. During validation, inspect every signature and confirm that all required signers are present. **Which presentation formats support these operations?** Aspose.Slides supports the digital-signature operations described here only for PPTX. PPT and OpenDocument presentation formats are not supported by this API workflow. **Can I remove a signature without affecting the slides?** Yes. You can remove one signature or clear the entire collection and then save the presentation. The slide content remains available, but the saved file no longer carries the removed signature evidence. # Customize Doughnut Charts in Presentations Using C++ > Discover how to create and customize doughnut charts in Aspose.Slides for C++, supporting PowerPoint formats for dynamic presentations. Source: https://docs.aspose.com/slides/cpp/doughnut-chart/ Updated: 2026-08-02 ## **Overview** This article shows how to work with a doughnut chart in Aspose.Slides by adding the chart to a slide, setting the size of its center hole, and saving the presentation. It focuses on the `set_DoughnutHoleSize` method and demonstrates the basic steps required to customize this chart type in code. ## **Specify the Center Gap in a Doughnut Chart** In order to specify the size of the hole in a doughnut chart. Please follow the steps below: - Instantiate [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) class. - Add doughnut chart on the slide. - Specify the size of the hole in a doughnut chart. - Write presentation to disk. In the example given below, we have set the size of the hole in a doughnut chart. ```cpp For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C // The path to the documents directory. const String outPath = u"../out/DoughnutChartHole_out.pptx"; //Instantiate Presentation class that represents PPTX file SharedPtr pres = MakeObject(); //Access first slide SharedPtr slide = pres->get_Slides()->idx_get(0); // Add chart with default data SharedPtr chart = slide->get_Shapes()->AddChart(Aspose::Slides::Charts::ChartType::Doughnut, 0, 0, 500, 500); chart->get_ChartData()->get_SeriesGroups()->idx_get(0)->set_DoughnutHoleSize(90); // Write the presentation file to disk pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx); ``` [Source: Examples-SlidesCPP-DoughnutChartHole-DoughnutChartHole.cpp](https://gist.githubusercontent.com/aspose-slides/a690df625dc0b1fff869ab198affe7a4/raw/ab9b2154f9e7aa79f2404b5d9c5ca6b466ec12e6/Examples-SlidesCPP-DoughnutChartHole-DoughnutChartHole.cpp) ## **FAQ** ### Can I create a multi-level doughnut with multiple rings? Yes. Add multiple series to a single doughnut chart—each series becomes a separate ring. The ring order is determined by the order of the series in the collection. ### Is an "exploded" doughnut (separated slices) supported? Yes. There is an Exploded Doughnut [chart type](https://reference.aspose.com/slides/cpp/aspose.slides.charts/charttype/) and an explosion property on data points; you can separate individual slices. ### How can I get an image of a doughnut chart (PNG/SVG) for a report? A chart is a shape; you can render it to a [raster image](https://reference.aspose.com/slides/cpp/aspose.slides/shape/getimage/) or export the chart to an [SVG image](https://reference.aspose.com/slides/cpp/aspose.slides/shape/writeassvg/). # Manage Drawing Guides in Presentations in C++ > Add, access, and clear horizontal and vertical drawing guides in PowerPoint presentations using Aspose.Slides for C++. Source: https://docs.aspose.com/slides/cpp/drawing-guides/ Updated: 2026-11-08 ## **Overview** Drawing guides are adjustable horizontal and vertical lines that help users align shapes consistently while editing a presentation in PowerPoint. They are especially useful when an application generates a presentation that will later be refined manually: the application can save the same alignment aids that authors should follow when adding or moving content. Drawing guides are editing aids, not slide content. They do not appear in a slide show or rendered output. Aspose.Slides for C++ exposes them through the [IDrawingGuidesCollection](https://reference.aspose.com/slides/cpp/aspose.slides/idrawingguidescollection/) interface. A guide is represented by [IDrawingGuide](https://reference.aspose.com/slides/cpp/aspose.slides/idrawingguide/) and has an orientation, a position, and a color. The position is measured in points from the top-left corner of the relevant slide or master. A vertical guide uses a horizontal coordinate, typically between zero and the slide width. A horizontal guide uses a vertical coordinate, typically between zero and the slide height. ## **Add Guides to the Slide View** Use [ICommonSlideViewProperties::get_DrawingGuides](https://reference.aspose.com/slides/cpp/aspose.slides/icommonslideviewproperties/get_drawingguides/) to manage guides displayed while editing normal slides. Call [IDrawingGuidesCollection::Add](https://reference.aspose.com/slides/cpp/aspose.slides/idrawingguidescollection/add/) with an [Orientation](https://reference.aspose.com/slides/cpp/aspose.slides/orientation/) value and a position in points. The following example adds one vertical guide to the right of the slide center and one horizontal guide below it: ```cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(); auto slideSize = presentation->get_SlideSize()->get_Size(); auto guides = presentation->get_ViewProperties()->get_SlideViewProperties()->get_DrawingGuides(); guides->Add(Orientation::Vertical, slideSize.get_Width() / 2 + 12.5f); guides->Add(Orientation::Horizontal, slideSize.get_Height() / 2 + 12.5f); presentation->Save(u"drawing-guides.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` [![A 720 by 540 point slide has its origin at top-left; guides sit at x = 372.5 and y = 282.5, 12.5 points beyond each center.](https://docs.aspose.com/slides/cpp/drawing-guides/visual-drawing-guides-7a8220358e23.svg)](https://docs.aspose.com/slides/cpp/drawing-guides/visual-drawing-guides-7a8220358e23.svg) *Conceptual editing overlay with coordinates verified in the saved .NET 26.11 fixture. The example adds guides at width/2 + 12.5 and height/2 + 12.5 points. Existing center guides may also be present. Guide visibility depends on the editor; static slide rendering does not draw them.* ## **Access Drawing Guides** The [IDrawingGuidesCollection::get_Count](https://reference.aspose.com/slides/cpp/aspose.slides/idrawingguidescollection/get_count/) method and [IDrawingGuidesCollection::idx_get](https://reference.aspose.com/slides/cpp/aspose.slides/idrawingguidescollection/idx_get/) method provide access to existing guides. The [IDrawingGuide::get_Orientation](https://reference.aspose.com/slides/cpp/aspose.slides/idrawingguide/get_orientation/), [IDrawingGuide::get_Position](https://reference.aspose.com/slides/cpp/aspose.slides/idrawingguide/get_position/), and [IDrawingGuide::get_Color](https://reference.aspose.com/slides/cpp/aspose.slides/idrawingguide/get_color/) methods return the current properties of a guide. Their corresponding setter methods can change those properties. The following example reads the slide-view guides from the presentation created above: ```cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; auto presentation = System::MakeObject(u"drawing-guides.pptx"); auto guides = presentation->get_ViewProperties()->get_SlideViewProperties()->get_DrawingGuides(); for (int32_t index = 0; index < guides->get_Count(); index++) { auto guide = guides->idx_get(index); System::Console::WriteLine( System::String::Format( u"Guide {0}: orientation = {1}, position = {2}, color = {3}", index, guide->get_Orientation(), guide->get_Position(), guide->get_Color())); } presentation->Dispose(); ``` ## **Add Guides to Master and Layout Slides** A slide master and each of its layout slides can have their own drawing-guide collections. Use [IMasterSlide::get_DrawingGuides](https://reference.aspose.com/slides/cpp/aspose.slides/imasterslide/get_drawingguides/) for a master slide and [ILayoutSlide::get_DrawingGuides](https://reference.aspose.com/slides/cpp/aspose.slides/ilayoutslide/get_drawingguides/) for a layout slide. The following example adds a vertical guide to the first master slide and a horizontal guide to the first layout slide: ```cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(); auto slideSize = presentation->get_SlideSize()->get_Size(); auto masterGuides = presentation->get_Master(0)->get_DrawingGuides(); auto layoutGuides = presentation->get_LayoutSlide(0)->get_DrawingGuides(); masterGuides->Add(Orientation::Vertical, slideSize.get_Width() / 2 - 20.0f); layoutGuides->Add(Orientation::Horizontal, slideSize.get_Height() / 2 + 20.0f); presentation->Save(u"master-layout-drawing-guides.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ## **Add Guides to Notes and Handout Masters** Notes masters and handout masters also support drawing guides. Use [IMasterNotesSlide::get_DrawingGuides](https://reference.aspose.com/slides/cpp/aspose.slides/imasternotesslide/get_drawingguides/) and [IMasterHandoutSlide::get_DrawingGuides](https://reference.aspose.com/slides/cpp/aspose.slides/imasterhandoutslide/get_drawingguides/) to access their collections. If a presentation does not contain one of these masters, [IMasterNotesSlideManager::SetDefaultMasterNotesSlide](https://reference.aspose.com/slides/cpp/aspose.slides/imasternotesslidemanager/setdefaultmasternotesslide/) or [IMasterHandoutSlideManager::SetDefaultMasterHandoutSlide](https://reference.aspose.com/slides/cpp/aspose.slides/imasterhandoutslidemanager/setdefaultmasterhandoutslide/) creates the default master and returns it. The following example adds a horizontal guide to a notes master and a vertical guide to a handout master: ```cpp #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(); auto notesSize = presentation->get_NotesSize()->get_Size(); auto notesMaster = presentation->get_MasterNotesSlideManager()->SetDefaultMasterNotesSlide(); auto handoutMaster = presentation->get_MasterHandoutSlideManager()->SetDefaultMasterHandoutSlide(); notesMaster->get_DrawingGuides()->Add(Orientation::Horizontal, notesSize.get_Height() / 2 + 50.0f); handoutMaster->get_DrawingGuides()->Add(Orientation::Vertical, notesSize.get_Width() / 2 - 50.0f); presentation->Save(u"notes-handout-drawing-guides.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ## **Clear Drawing Guides** Call [IDrawingGuidesCollection::Clear](https://reference.aspose.com/slides/cpp/aspose.slides/idrawingguidescollection/clear/) to remove every guide from a particular collection. Clearing one collection does not affect guides stored in another scope. The following example clears the slide-view guides and all guides on slide masters, layout slides, the notes master, and the handout master without creating missing masters: ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(u"presentation-with-guides.pptx"); presentation->get_ViewProperties()->get_SlideViewProperties()->get_DrawingGuides()->Clear(); for (auto&& masterSlide : presentation->get_Masters()) { masterSlide->get_DrawingGuides()->Clear(); } for (auto&& layoutSlide : presentation->get_LayoutSlides()) { layoutSlide->get_DrawingGuides()->Clear(); } auto notesMaster = presentation->get_MasterNotesSlideManager()->get_MasterNotesSlide(); if (notesMaster != nullptr) { notesMaster->get_DrawingGuides()->Clear(); } auto handoutMaster = presentation->get_MasterHandoutSlideManager()->get_MasterHandoutSlide(); if (handoutMaster != nullptr) { handoutMaster->get_DrawingGuides()->Clear(); } presentation->Save(u"presentation-without-guides.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ## **FAQ** **Do drawing guides appear in a slide show or exported images?** No. Drawing guides are alignment aids for editing and are not rendered as presentation content. **Can a drawing guide be added directly to an individual normal slide?** Normal-slide editing guides are stored in the presentation's slide-view properties. Separate guide collections are available for slide masters, layout slides, notes masters, and handout masters. **Which units are used for guide positions?** Positions are specified in points, where 72 points equal one inch. Vertical positions are measured from the left edge, and horizontal positions are measured from the top edge. **Does clearing drawing guides remove shapes or change slide content?** No. The `Clear` method removes only the guides in the selected collection. Shapes and other slide content remain unchanged. # Edit PDF Documents in C++ > Edit PDF documents in C++ by importing them into Aspose.Slides, replacing text, and saving the modified presentation back to PDF. Source: https://docs.aspose.com/slides/cpp/edit-pdf/ Updated: 2026-09-21 ## **Overview** Aspose.Slides for C++ lets you edit PDF content by importing its pages as slides, modifying the presentation, and exporting it back to PDF. This article shows a simple text replacement. The presentation stays in memory, so saving an intermediate PPTX file is optional. ## **Replace Text in a PDF** Use [SlideCollection::AddFromPdf](https://reference.aspose.com/slides/cpp/aspose.slides/slidecollection/addfrompdf/) to import the pages, [Presentation::ReplaceText](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/replacetext/) to update the text, and [Presentation::Save](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/save/) to export the result. The following example expects `input.pdf` to contain the word "Draft" as editable text after import. It replaces that word with "Final" and writes `edited.pdf`. Clearing the initial slide before import prevents an extra blank page in the output. The search matches whole words with the same letter case; `nullptr` means no result callback is needed. ```cpp #include #include #include #include #include using namespace System; using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = MakeObject(); presentation->get_Slides()->RemoveAt(0); presentation->get_Slides()->AddFromPdf(u"input.pdf"); auto searchOptions = MakeObject(); searchOptions->set_WholeWordsOnly(true); searchOptions->set_CaseSensitive(true); presentation->ReplaceText(u"Draft", u"Final", searchOptions, nullptr); presentation->Save(u"edited.pdf", SaveFormat::Pdf); presentation->Dispose(); ``` For more options, see [Search and Replace Text](https://docs.aspose.com/slides/cpp/search-and-replace-text/) and [Convert PowerPoint to PDF](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-pdf/). Text replacement works on imported text, not text inside scanned images. The conversion can affect layout and formatting, so review the output, especially when the replacement text is longer than the original. ## **FAQ** **Do I need to save a PPTX file before exporting the PDF?** No. You can edit and export the same presentation in memory. Save a PPTX copy only if you also want to continue editing it in PowerPoint; see [Save Presentations](https://docs.aspose.com/slides/cpp/save-presentation/). **Why might some text remain unchanged?** The example matches the whole word "Draft" with exact case. Text imported as an image or split across separate text frames will not necessarily match the search. Check the imported content and adjust the search for your document. # Add Ellipses to Presentations in C++ > Learn how to create, format, and manipulate ellipse shapes in Aspose.Slides for C++ across PPT and PPTX presentations — C++ code examples included. Source: https://docs.aspose.com/slides/cpp/ellipse/ Updated: 2026-08-02 ## **Overview** This article shows how to add ellipse shapes to PowerPoint slides by using Aspose.Slides. It covers creating a simple ellipse, creating a formatted ellipse, and saving the updated presentation as a PPTX file. It also touches on related questions such as working with ellipse position and size, controlling stacking order, and applying animation effects. ## **Create an Ellipse** In this topic, we will introduce developers about adding ellipse shapes to their slides using Aspose.Slides for C++ . Aspose.Slides for C++ provides an easier set of APIs to draw different kinds of shapes with just a few lines of code. To add a simple ellipse to a selected slide of the presentation, please follow the steps below: 1. Create an instance of [Presentation class](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) 1. Obtain the reference of a slide by using its Index 1. Add an AutoShape of Ellipse type using AddAutoShape method exposed by IShapes object 1. Write the modified presentation as a PPTX file In the example given below, we have added an ellipse to the first slide. ```cpp For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C // The path to the documents directory. const String outPath = u"../out/SimpleEllipse.pptx"; const String templatePath = u"../templates/HelloWorld.pptx"; // Load the desired the presentation SharedPtr pres = MakeObject(); // Access first slide SharedPtr slide = pres->get_Slides()->idx_get(0); // Add autoshape of ellipse type SharedPtr ashp = slide->get_Shapes()->AddAutoShape(ShapeType::Ellipse, 50, 150, 150, 50); // Save PPTX to Disk pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx); ``` [Source: Examples-SlidesCPP-SimpleEllipse-SimpleEllipse.cpp](https://gist.githubusercontent.com/aspose-slides/a690df625dc0b1fff869ab198affe7a4/raw/fb98c260907364987033143e9761545c39de9c12/Examples-SlidesCPP-SimpleEllipse-SimpleEllipse.cpp) ## **Create a Formatted Ellipse** To add a better formatted ellipse to a slide, please follow the steps below: 1. Create an instance of [Presentation class](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/). 1. Obtain the reference of a slide by using its Index. 1. Add an AutoShape of Ellipse type using AddAutoShape method exposed by IShapes object. 1. Set the Fill Type of the Ellipse to Solid. 1. Set the Color of the Ellipse using SolidFillColor.Color property as exposed by FillFormat object associated with the IShape object. 1. Set the Color of the lines of the Ellipse. 1. Set the Width of the lines of the Ellipse. 1. Write the modified presentation as a PPTX file. In the example given below, we have added a formatted ellipse to the first slide of the presentation. ```cpp For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C // The path to the documents directory. const String outPath = u"../out/FormattedEllipse_out.pptx"; const String templatePath = u"../templates/AltText.pptx"; // Load the desired the presentation SharedPtr pres = MakeObject(); // Access first slide SharedPtr slide = pres->get_Slides()->idx_get(0); // Add an autoshape of type line SharedPtr shape = slide->get_Shapes()->AddAutoShape(ShapeType::Ellipse, 50, 150, 150, 50); // Set the fill color of the rectangle shape shape->get_FillFormat()->set_FillType(FillType::Solid); shape->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Chocolate()); // Apply some formatting on the line shape->get_LineFormat()->set_Style(LineStyle::ThickThin); shape->get_LineFormat()->set_Width(5); shape->get_LineFormat()->set_DashStyle(LineDashStyle::DashDot); shape->get_LineFormat()->get_FillFormat()->set_FillType(FillType::Solid); shape->get_LineFormat()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Black()); //Write the PPTX to Disk pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx); ``` [Source: Examples-SlidesCPP-FormattedEllipse-FormattedEllipse.cpp](https://gist.githubusercontent.com/aspose-slides/a690df625dc0b1fff869ab198affe7a4/raw/f89b31502e550358daaaccf7f27f6a5c225ba0f9/Examples-SlidesCPP-FormattedEllipse-FormattedEllipse.cpp) ## **FAQ** ### How do I set the exact position and size of an ellipse with respect to the slide's units? Coordinates and sizes are typically specified **in points**. For predictable results, base your calculations on the slide size and convert required millimeters or inches to points before assigning values. ### How can I place an ellipse above or below other objects (control stacking order)? Adjust the drawing order of the object by bringing it to front or sending it to back. This lets the ellipse overlap other objects or reveal those beneath it. ### How do I animate the appearance or emphasis of an ellipse? [Apply](https://docs.aspose.com/slides/cpp/shape-animation/) entrance, emphasis, or exit effects to the shape, and configure triggers and timing to orchestrate when and how the animation plays. ## Related articles - [Add Rectangles to Presentations in C++](https://docs.aspose.com/slides/cpp/rectangle/) - [Shape Types in Aspose.Slides for C++](https://docs.aspose.com/slides/cpp/shape-types/) # Embed Fonts in Presentations in C++ > Manage embedded fonts in PowerPoint with Aspose.Slides for C++. Add, retrieve, remove, and compress fonts to preserve text appearance and reduce file size. Source: https://docs.aspose.com/slides/cpp/embedded-font/ Updated: 2026-09-03 ## **Introduction** Embedding fonts stores font data inside a PowerPoint presentation. When a viewer supports embedded fonts, it can display text using those fonts even if they are not installed on the target system. This helps preserve line breaks, text spacing, and slide layout. Aspose.Slides for C++ lets you retrieve, add, and remove embedded fonts through the [Presentation::get_FontsManager](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/get_fontsmanager/) method of a [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/). You can also reduce the size of embedded font data by removing characters that the presentation does not use. The examples below work with PPTX files. Before embedding a font, make sure its font data is available to Aspose.Slides and its license permits embedding. ## **Get and Remove Embedded Fonts** Use [IFontsManager::GetEmbeddedFonts](https://reference.aspose.com/slides/cpp/aspose.slides/ifontsmanager/getembeddedfonts/) to list the fonts stored in a presentation. To remove one, pass a font from that list to [IFontsManager::RemoveEmbeddedFont](https://reference.aspose.com/slides/cpp/aspose.slides/ifontsmanager/removeembeddedfont/), then save the presentation. The following example lists the embedded fonts in `EmbeddedFonts.pptx` and removes Calibri if it is present: ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(u"EmbeddedFonts.pptx"); auto fontsManager = presentation->get_FontsManager(); auto embeddedFonts = fontsManager->GetEmbeddedFonts(); SharedPtr fontToRemove; for (auto&& font : embeddedFonts) { Console::WriteLine(font->get_FontName()); if (String::Equals(font->get_FontName(), u"Calibri", StringComparison::OrdinalIgnoreCase)) { fontToRemove = font; } } if (fontToRemove != nullptr) { fontsManager->RemoveEmbeddedFont(fontToRemove); presentation->Save(u"WithoutEmbeddedCalibri.pptx", SaveFormat::Pptx); } else { Console::WriteLine(u"Calibri is not embedded. No output file was created."); } presentation->Dispose(); ``` Removing an embedded font removes its stored font data; it does not change the font assigned to the text. If the font is installed on the target system, the text can still use it. Otherwise, rendering may require [font substitution](https://docs.aspose.com/slides/cpp/font-substitution/), which can affect the layout. ## **Inspect Font Data and Embedding Permissions** Use the [IFontsManager](https://reference.aspose.com/slides/cpp/aspose.slides/ifontsmanager/) interface to inspect fonts before embedding them. Call [IFontsManager::GetFonts](https://reference.aspose.com/slides/cpp/aspose.slides/ifontsmanager/getfonts/) to retrieve the fonts used in the presentation. For each font, pass an [IFontData](https://reference.aspose.com/slides/cpp/aspose.slides/ifontdata/) object and the required [FontStyleType](https://reference.aspose.com/slides/cpp/aspose.slides/fontstyletype/) value to [IFontsManager::GetFontBytes](https://reference.aspose.com/slides/cpp/aspose.slides/ifontsmanager/getfontbytes/). The method returns the binary data for that font style, or `nullptr` when the requested font or style is unavailable. Do not pass a `nullptr` result to [IFontsManager::GetFontEmbeddingLevel](https://reference.aspose.com/slides/cpp/aspose.slides/ifontsmanager/getfontembeddinglevel/), because that method requires a byte array. [EmbeddingLevel](https://reference.aspose.com/slides/cpp/aspose.slides/embeddinglevel/) is a flags enumeration that reports the embedding restrictions stored in the font: - `Installable` permits embedding and permanent installation on another system, subject to the font license. - `Restricted` prohibits embedding unless permission is obtained from the font's legal owner when it is the only usage-permission flag. - `PreviewPrint` permits temporary use for viewing and printing; a document containing the font must be read-only. - `Editable` permits temporary use and allows the document to be edited and saved. - `NoSubsetting` is an additional restriction that prohibits embedding only a subset of the glyphs. Embed all characters when this flag is present. - `BitmapOnly` is an additional restriction that permits only bitmap strikes to be embedded, not outline data. If the font has no bitmap strikes, it cannot be embedded. The first four values describe usage permission, while `NoSubsetting` and `BitmapOnly` can be combined with them. Check the modifiers with bitwise operations. Because `Installable` is zero, mask the usage-permission bits and compare the result with `Installable`. Current fonts should set at most one usage-permission bit. For compatibility with older fonts that set more than one, the helper below selects the least restrictive permission: `Editable`, then `PreviewPrint`, then `Restricted`. The following example audits the regular, bold, italic, and bold-italic data available for every font returned by `GetFonts`. It skips unavailable styles, restricted fonts, bitmap-only fonts, fonts limited to preview and print because the output remains editable, and fonts that are already embedded. If any available style has `NoSubsetting`, it embeds all characters for that font family. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::Collections::Generic; auto getUsagePermission = [](EmbeddingLevel level) { const auto permissionMask = EmbeddingLevel::Restricted | EmbeddingLevel::PreviewPrint | EmbeddingLevel::Editable; auto permissions = level & permissionMask; if ((permissions & EmbeddingLevel::Editable) != EmbeddingLevel::Installable) { return EmbeddingLevel::Editable; } if ((permissions & EmbeddingLevel::PreviewPrint) != EmbeddingLevel::Installable) { return EmbeddingLevel::PreviewPrint; } if ((permissions & EmbeddingLevel::Restricted) != EmbeddingLevel::Installable) { return EmbeddingLevel::Restricted; } return EmbeddingLevel::Installable; }; auto presentation = MakeObject(u"Fonts.pptx"); auto fontsManager = presentation->get_FontsManager(); auto fontStyles = MakeArray({ FontStyleType::Regular, FontStyleType::Bold, FontStyleType::Italic, FontStyleType::Bold | FontStyleType::Italic }); auto fontStyleNames = MakeArray({u"regular", u"bold", u"italic", u"bold-italic"}); auto embeddedFontNames = MakeObject>(StringComparer::get_OrdinalIgnoreCase()); for (auto&& embeddedFont : fontsManager->GetEmbeddedFonts()) { embeddedFontNames->Add(embeddedFont->get_FontName()); } auto fontsToEmbedAll = MakeObject>>(); auto fontsToEmbedUsedOnly = MakeObject>>(); for (auto&& font : fontsManager->GetFonts()) { if (embeddedFontNames->Contains(font->get_FontName())) { Console::WriteLine(u"{0}: already embedded.", font->get_FontName()); continue; } auto hasAvailableData = false; auto allAvailableStylesCanBeEmbedded = true; auto previewPrintOnly = false; auto requiresFullFont = false; for (auto styleIndex = 0; styleIndex < fontStyles->get_Length(); styleIndex++) { auto fontStyle = fontStyles[styleIndex]; auto fontBytes = fontsManager->GetFontBytes(font, fontStyle); if (fontBytes == nullptr) { Console::WriteLine(u"{0} ({1}): font data is unavailable.", font->get_FontName(), fontStyleNames[styleIndex]); continue; } hasAvailableData = true; auto embeddingLevel = fontsManager->GetFontEmbeddingLevel(fontBytes, font->get_FontName()); auto usagePermission = getUsagePermission(embeddingLevel); auto noSubsetting = (embeddingLevel & EmbeddingLevel::NoSubsetting) != EmbeddingLevel::Installable; auto bitmapOnly = (embeddingLevel & EmbeddingLevel::BitmapOnly) != EmbeddingLevel::Installable; requiresFullFont |= noSubsetting; previewPrintOnly |= usagePermission == EmbeddingLevel::PreviewPrint; allAvailableStylesCanBeEmbedded &= usagePermission != EmbeddingLevel::Restricted && !bitmapOnly; Console::WriteLine(u"{0} ({1}): embedding level {2}.", font->get_FontName(), fontStyleNames[styleIndex], static_cast(embeddingLevel)); } if (!hasAvailableData) { Console::WriteLine(u"{0}: skipped because no requested style is available.", font->get_FontName()); } else if (!allAvailableStylesCanBeEmbedded) { Console::WriteLine(u"{0}: skipped because at least one available style does not permit outline embedding.", font->get_FontName()); } else if (previewPrintOnly) { Console::WriteLine(u"{0}: skipped because this example produces an editable presentation.", font->get_FontName()); } else if (requiresFullFont) { fontsToEmbedAll->Add(font); } else { fontsToEmbedUsedOnly->Add(font); } } for (auto&& font : fontsToEmbedAll) { fontsManager->AddEmbeddedFont(font, EmbedFontCharacters::All); } for (auto&& font : fontsToEmbedUsedOnly) { fontsManager->AddEmbeddedFont(font, EmbedFontCharacters::OnlyUsed); } presentation->Save(u"WithAuditedFonts.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` This inspection reports the restrictions encoded in each font file. It does not grant a license, prove that you obtained the font legally, or replace checking the font's license agreement before distributing an embedded copy. ## **Add Embedded Fonts** Use [IFontsManager::AddEmbeddedFont](https://reference.aspose.com/slides/cpp/aspose.slides/ifontsmanager/addembeddedfont/) to embed a font. Its overloads accept either an [IFontData](https://reference.aspose.com/slides/cpp/aspose.slides/ifontdata/) object or a byte array containing the font data. The [EmbedFontCharacters](https://reference.aspose.com/slides/cpp/aspose.slides.export/embedfontcharacters/) enumeration controls which characters are included: - [All](https://reference.aspose.com/slides/cpp/aspose.slides.export/embedfontcharacters/) embeds all characters in the font. Use this option when recipients need to edit the presentation and enter new text. - [OnlyUsed](https://reference.aspose.com/slides/cpp/aspose.slides.export/embedfontcharacters/) embeds only the characters used in the presentation to reduce file size. Choose this option for a finished presentation that is primarily intended for viewing. The following example uses [IFontsManager::GetFonts](https://reference.aspose.com/slides/cpp/aspose.slides/ifontsmanager/getfonts/) to retrieve the fonts used in `Fonts.pptx` and embeds those that are not already embedded. The fonts to add must be available on the machine running the code. Existing embedded fonts retain their current character sets. ```cpp #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::Collections::Generic; auto presentation = MakeObject(u"Fonts.pptx"); auto fontsManager = presentation->get_FontsManager(); auto allFonts = fontsManager->GetFonts(); auto embeddedFonts = fontsManager->GetEmbeddedFonts(); auto embeddedFontNames = MakeObject>(StringComparer::get_OrdinalIgnoreCase()); for (auto&& embeddedFont : embeddedFonts) { embeddedFontNames->Add(embeddedFont->get_FontName()); } for (auto&& font : allFonts) { if (!embeddedFontNames->Contains(font->get_FontName())) { fontsManager->AddEmbeddedFont(font, EmbedFontCharacters::All); embeddedFontNames->Add(font->get_FontName()); } } presentation->Save(u"WithEmbeddedFonts.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ## **Compress Embedded Fonts** [Compress::CompressEmbeddedFonts](https://reference.aspose.com/slides/cpp/aspose.slides.lowcode/compress/compressembeddedfonts/) reduces embedded font data by removing unused characters. It operates on fonts that are already embedded, so the size reduction depends on how much unused font data the presentation contains. The following example compresses the fonts in `EmbeddedFonts.pptx` and saves the result as a separate file: ```cpp #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace Aspose::Slides::LowCode; using namespace System; auto presentation = MakeObject(u"EmbeddedFonts.pptx"); Compress::CompressEmbeddedFonts(presentation); presentation->Save(u"CompressedEmbeddedFonts.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` Keep the original file if recipients may need to add text later. Characters removed during compression are no longer available from the embedded font, even if you originally embedded all characters. ## **FAQ** **How can I check whether an embedded font will still be substituted during rendering?** Call [IFontsManager::GetSubstitutions](https://reference.aspose.com/slides/cpp/aspose.slides/ifontsmanager/getsubstitutions/) in the environment where you render the presentation to see which fonts Aspose.Slides will replace. Also check [font substitution](https://docs.aspose.com/slides/cpp/font-substitution/) settings and [font fallback](https://docs.aspose.com/slides/cpp/fallback-font/) rules. Fallback handles missing characters, so embedding a font does not resolve characters that the font itself does not contain. **Should I embed common fonts such as Arial and Calibri?** Base the decision on the target environment. If the required fonts are available on every machine that opens or renders the presentation, embedding them may add unnecessary file size. If recipients or servers may lack those fonts, embedding them can help preserve the intended appearance, provided their licenses allow it. # Customize Error Bars in Presentation Charts Using C++ > Learn how to add and customize error bars in charts with Aspose.Slides for C++ — optimize data visuals in PowerPoint presentations. Source: https://docs.aspose.com/slides/cpp/error-bar/ Updated: 2026-08-02 ## **Overview** This article explains how to work with error bars in presentation charts by using Aspose.Slides. It shows how to add error bars to a chart series, configure X and Y error bar settings, and apply different value types such as fixed, percentage, and custom values. It also demonstrates how to assign custom error bar values for individual data points in a series by using the corresponding data point collection. In addition, the article includes brief notes about how error bars behave during export, their compatibility with markers and data labels, and where to find the related API reference classes and enums. ## **Add Error Bars** Aspose.Slides for C++ provides a simple API for managing error bar values. The sample code applies when using a custom value type. To specify a value, use the **ErrorBarCustomValues** property of a specific data point in the **DataPoints** collection of series: 1. Create an instance of the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) class. 1. Add a bubble chart on the desired slide. 1. Access the first chart series and set the error bar X format. 1. Access the first chart series and set the error bar Y format. 1. Setting bars values and format. 1. Write the modified presentation to a PPTX file. ```cpp For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C // The path to the documents directory. const String outPath = u"../out/ErrorBars_out.pptx"; //Instantiate Presentation class that represents PPTX file SharedPtr pres = MakeObject(); //Access first slide SharedPtr sld = pres->get_Slides()->idx_get(0); // Add chart with default data SharedPtr chart = sld->get_Shapes()->AddChart(Aspose::Slides::Charts::ChartType::Bubble, 0, 0, 500, 500, true); // Adding custom Error chart and setting its format SharedPtr series = chart->get_ChartData()->get_Series()->idx_get(0); SharedPtr errBarX = series->get_ErrorBarsXFormat(); SharedPtr errBarY = series->get_ErrorBarsYFormat(); errBarX->set_IsVisible(true); errBarY->set_IsVisible(true); errBarX->set_ValueType(ErrorBarValueType::Fixed); errBarX->set_Value( 0.1f); errBarY->set_ValueType(ErrorBarValueType::Percentage); errBarX->set_Value(5); errBarX->set_Type (ErrorBarType::Plus); errBarY->get_Format()->get_Line()->set_Width(2); errBarX->set_HasEndCap ( true); // Saving presentation pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx); ``` [Source: Examples-SlidesCPP-AddErrorBars-AddErrorBars.cpp](https://gist.githubusercontent.com/aspose-slides/a690df625dc0b1fff869ab198affe7a4/raw/81e88a25bc404689d7b2b9e9e242439f0f681c4d/Examples-SlidesCPP-AddErrorBars-AddErrorBars.cpp) ## **Add Custom Error Bars** Aspose.Slides for C++ provides a simple API for managing custom error bar values. The sample code applies when **IErrorBarsFormat.ValueType** property is equal to **Custom**. To specify a value, use the **ErrorBarCustomValues** property of a specific data point in the **DataPoints** collection of series: 1. Create an instance of the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) class. 1. Add a bubble chart on the desired slide. 1. Access the first chart series and set the error bar X format. 1. Access the first chart series and set the error bar Y format. 1. Access the chart series individual data points and setting the Error Bar values for an individual series data point. 1. Setting bars values and format. 1. Write the modified presentation to a PPTX file. ```cpp For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C // The path to the documents directory. const String outPath = u"../out/ErrorBarsCustomValues_out.pptx"; //Instantiate Presentation class that represents PPTX file SharedPtr pres = MakeObject(); //Access first slide SharedPtr sld = pres->get_Slides()->idx_get(0); // Add chart with default data SharedPtr chart = sld->get_Shapes()->AddChart(Aspose::Slides::Charts::ChartType::Bubble, 0, 0, 500, 500,true); // Adding custom Error chart and setting its format SharedPtr series = chart->get_ChartData()->get_Series()->idx_get(0); SharedPtr errBarX = series->get_ErrorBarsXFormat(); SharedPtr errBarY = series->get_ErrorBarsYFormat(); errBarX->set_IsVisible(true); errBarY->set_IsVisible(true); errBarX->set_ValueType(ErrorBarValueType::Custom); errBarY->set_ValueType(ErrorBarValueType::Custom); // Accessing chart series data point and setting error bars values for individual point SharedPtr points = series->get_DataPoints(); points->get_DataSourceTypeForErrorBarsCustomValues()->set_DataSourceTypeForXPlusValues(DataSourceType::DoubleLiterals); points->get_DataSourceTypeForErrorBarsCustomValues()->set_DataSourceTypeForXMinusValues(DataSourceType::DoubleLiterals); points->get_DataSourceTypeForErrorBarsCustomValues()->set_DataSourceTypeForYPlusValues (DataSourceType::DoubleLiterals); points->get_DataSourceTypeForErrorBarsCustomValues()->set_DataSourceTypeForYMinusValues(DataSourceType::DoubleLiterals); // Setting error bars for chart series points for (int i = 0; i < points->get_Count(); i++) { points->idx_get(i)->get_ErrorBarsCustomValues()->get_XMinus()->set_AsLiteralDouble(i + 1); points->idx_get(i)->get_ErrorBarsCustomValues()->get_XPlus()->set_AsLiteralDouble (i + 1); points->idx_get(i)->get_ErrorBarsCustomValues()->get_YMinus()->set_AsLiteralDouble( i + 1); points->idx_get(i)->get_ErrorBarsCustomValues()->get_YPlus()->set_AsLiteralDouble ( i + 1); } // Saving presentation pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx); ``` [Source: Examples-SlidesCPP-AddCustomError-AddCustomError.cpp](https://gist.githubusercontent.com/aspose-slides/a690df625dc0b1fff869ab198affe7a4/raw/9b118e63a8c064496dfd513007f23caa73d71ada/Examples-SlidesCPP-AddCustomError-AddCustomError.cpp) ## **FAQ** ### What happens to error bars when exporting a presentation to PDF or images? They are rendered as part of the chart and preserved during conversion along with the rest of the chart formatting, assuming a compatible version or renderer. ### Can error bars be combined with markers and data labels? Yes. Error bars are a separate element and are compatible with markers and data labels; if elements overlap, you may need to adjust formatting. ### Where can I find the list of properties and enums for working with error bars in the API? In the API reference: the [ErrorBarsFormat](https://reference.aspose.com/slides/cpp/aspose.slides.charts/errorbarsformat/) class and the related enums [ErrorBarType](https://reference.aspose.com/slides/cpp/aspose.slides.charts/errorbartype/) and [ErrorBarValueType](https://reference.aspose.com/slides/cpp/aspose.slides.charts/errorbarvaluetype/). # Evaluate Aspose.Slides > Evaluate Aspose.Slides for C++ and explore API features for PowerPoint (PPT, PPTX) and OpenDocument (ODP) presentations—start your free trial. Source: https://docs.aspose.com/slides/cpp/evaluate-aspose-slides/ Updated: 2026-09-27 ## **Aspose.Slides Evaluation** You can download Aspose.Slides for evaluation. The evaluation package is the same as the purchased package; it becomes licensed after you add a few lines of code to apply the license, as shown in [Licensing](https://docs.aspose.com/slides/cpp/licensing/). Without a license, Aspose.Slides provides its full functionality in evaluation mode, with two limitations: * It adds one evaluation watermark text box to the middle of every slide of each presentation it saves. Opening a presentation adds no watermark, but a watermark saved earlier is loaded as a shape on its slide. So if you open a presentation that was saved in evaluation mode and save it again, each slide has two watermarks. * Text that your code reads from a presentation is truncated to its first few characters, followed by a notice about the evaluation limitation. This applies to every slide, and also to text that your code has just set. Text that your code writes is saved in full. If you want to test Aspose.Slides without the evaluation version limitations, you can also request a 30-day Temporary License. Please refer to [How to get a Temporary License?](https://purchase.aspose.com/temporary-license) ## **FAQ** ### Can I test multiple presentations in parallel across different threads in evaluation mode? Yes. You can process different documents in parallel; you should not share the same presentation object [across threads](https://docs.aspose.com/slides/cpp/multithreading/). Evaluation mode does not affect this. ### Do I need to install Microsoft PowerPoint to evaluate the library on a server or in CI? No. Aspose.Slides is a standalone engine and does not require PowerPoint installed for either evaluation or production. ### Can I fully test conversion of PPT/PPTX to PDF and images in evaluation mode? Yes. The [converters](https://docs.aspose.com/slides/cpp/convert-presentation/) work; the output will include a watermark. ### Can I use a temporary license for load testing without a watermark? Yes. A 30-day temporary license removes evaluation-mode limitations and allows testing without a watermark. ## Related articles - [Licensing](https://docs.aspose.com/slides/cpp/licensing/) # Retrieve and Update Presentation Information in C++ > Explore slides, structure and metadata in PowerPoint and OpenDocument presentations using C++ for faster insights and smarter content audits. Source: https://docs.aspose.com/slides/cpp/examine-presentation/ Updated: 2026-09-22 ## **Overview** Aspose.Slides can identify a presentation's format and read its document metadata without creating a complete presentation object model. This is useful when you need to classify files, build an inventory, or inspect properties before deciding whether to load and process the presentation content. This article demonstrates lightweight inspection through [PresentationFactory](https://reference.aspose.com/slides/cpp/aspose.slides/presentationfactory/) and [IPresentationInfo](https://reference.aspose.com/slides/cpp/aspose.slides/ipresentationinfo/), as well as targeted updates through [IDocumentProperties](https://reference.aspose.com/slides/cpp/aspose.slides/idocumentproperties/). ## **Check a Presentation Format** If you already have a loaded presentation, see [Determine the Original Presentation Format](https://docs.aspose.com/slides/cpp/detect-presentation-source-format/) for detection after loading and the limitations of legacy PPT, PPS, and POT streams. Use [IPresentationFactory::GetPresentationInfo](https://reference.aspose.com/slides/cpp/aspose.slides/ipresentationfactory/getpresentationinfo/) to inspect a file without creating a [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) instance. The [IPresentationInfo::get_LoadFormat](https://reference.aspose.com/slides/cpp/aspose.slides/ipresentationinfo/get_loadformat/) method reports the detected format, such as PPTX, PPT, or ODP. ```cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto fileNames = MakeArray({u"pres.pptx", u"pres.ppt", u"pres.odp"}); for (const auto& fileName : fileNames) { auto presentationInfo = PresentationFactory::get_Instance()->GetPresentationInfo(fileName); Console::WriteLine(String::Format(u"{0}: {1}", fileName, ObjectExt::ToString(presentationInfo->get_LoadFormat()))); } ``` ## **Build a Lightweight Presentation Inventory** When you process many presentation files, you may need a compact inventory for validation, indexing, or a document-management system. In this scenario, use [IPresentationFactory::GetPresentationInfo](https://reference.aspose.com/slides/cpp/aspose.slides/ipresentationfactory/getpresentationinfo/) to obtain an [IPresentationInfo](https://reference.aspose.com/slides/cpp/aspose.slides/ipresentationinfo/) object, and then call [IPresentationInfo::ReadDocumentProperties](https://reference.aspose.com/slides/cpp/aspose.slides/ipresentationinfo/readdocumentproperties/) to read the document metadata. This approach does not create a [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) instance or require you to traverse the complete presentation object model. The extended properties exposed by [IDocumentProperties](https://reference.aspose.com/slides/cpp/aspose.slides/idocumentproperties/) provide the following inventory values: | Method | Inventory value | | --- | --- | | [get_Slides](https://reference.aspose.com/slides/cpp/aspose.slides/idocumentproperties/get_slides/) | Total number of slides. | | [get_HiddenSlides](https://reference.aspose.com/slides/cpp/aspose.slides/idocumentproperties/get_hiddenslides/) | Number of hidden slides. | | [get_Notes](https://reference.aspose.com/slides/cpp/aspose.slides/idocumentproperties/get_notes/) | Number of slides that contain notes. | | [get_Paragraphs](https://reference.aspose.com/slides/cpp/aspose.slides/idocumentproperties/get_paragraphs/) | Total number of paragraphs, when available. | | [get_Words](https://reference.aspose.com/slides/cpp/aspose.slides/idocumentproperties/get_words/) | Total number of words. | | [get_MultimediaClips](https://reference.aspose.com/slides/cpp/aspose.slides/idocumentproperties/get_multimediaclips/) | Total number of audio and video clips. | The following example reads these values without creating a [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) object and prints a compact inventory. It also combines [IDocumentProperties::get_HeadingPairs](https://reference.aspose.com/slides/cpp/aspose.slides/idocumentproperties/get_headingpairs/) with [IDocumentProperties::get_TitlesOfParts](https://reference.aspose.com/slides/cpp/aspose.slides/idocumentproperties/get_titlesofparts/) to display content groups such as fonts, themes, and slide titles. ```cpp #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; using namespace System::IO; auto filePath = String(u"sample.pptx"); auto presentationInfo = PresentationFactory::get_Instance()->GetPresentationInfo(filePath); auto documentProperties = presentationInfo->ReadDocumentProperties(); Console::WriteLine(String::Format(u"File: {0}", Path::GetFileName(filePath))); Console::WriteLine(String::Format(u"Format: {0}", ObjectExt::ToString(presentationInfo->get_LoadFormat()))); Console::WriteLine(String::Format(u"Title: {0}", documentProperties->get_Title())); Console::WriteLine(String::Format(u"Author: {0}", documentProperties->get_Author())); Console::WriteLine(u"Statistics:"); Console::WriteLine(String::Format(u" Slides: {0}", documentProperties->get_Slides())); Console::WriteLine(String::Format(u" Hidden slides: {0}", documentProperties->get_HiddenSlides())); Console::WriteLine(String::Format(u" Slides with notes: {0}", documentProperties->get_Notes())); Console::WriteLine(String::Format(u" Paragraphs: {0}", documentProperties->get_Paragraphs())); Console::WriteLine(String::Format(u" Words: {0}", documentProperties->get_Words())); Console::WriteLine(String::Format(u" Multimedia clips: {0}", documentProperties->get_MultimediaClips())); auto headingPairs = documentProperties->get_HeadingPairs(); auto titlesOfParts = documentProperties->get_TitlesOfParts(); auto partIndex = 0; if (headingPairs == nullptr || titlesOfParts == nullptr || headingPairs->get_Length() == 0 || titlesOfParts->get_Length() == 0) { Console::WriteLine(u"Content groups: not available"); } else { Console::WriteLine(u"Content groups:"); for (const auto& headingPair : headingPairs) { auto partCount = headingPair->get_Count(); Console::WriteLine(String::Format(u" {0} ({1})", headingPair->get_Name(), partCount)); for (auto partOffset = 0; partOffset < partCount && partIndex < titlesOfParts->get_Length(); partOffset++) { Console::WriteLine(String::Format(u" - {0}", titlesOfParts[partIndex])); partIndex++; } } if (partIndex < titlesOfParts->get_Length()) { Console::WriteLine(u" Other parts:"); while (partIndex < titlesOfParts->get_Length()) { Console::WriteLine(String::Format(u" - {0}", titlesOfParts[partIndex])); partIndex++; } } } ``` Each [IHeadingPair](https://reference.aspose.com/slides/cpp/aspose.slides/iheadingpair/) supplies a group name through [IHeadingPair::get_Name](https://reference.aspose.com/slides/cpp/aspose.slides/iheadingpair/get_name/) and the number of items in that group through [IHeadingPair::get_Count](https://reference.aspose.com/slides/cpp/aspose.slides/iheadingpair/get_count/). [IDocumentProperties::get_TitlesOfParts](https://reference.aspose.com/slides/cpp/aspose.slides/idocumentproperties/get_titlesofparts/) returns a flat, ordered array, so consume the number of consecutive titles specified by each heading pair. ### **Stored Metadata and Format Limitations** The inventory properties returned by [IPresentationInfo::ReadDocumentProperties](https://reference.aspose.com/slides/cpp/aspose.slides/ipresentationinfo/readdocumentproperties/) reflect metadata available in the source document. Aspose.Slides does not load and traverse the presentation object model to recalculate these values for this call. Missing properties are represented by default values, and stored values may be stale if the application that last saved the file did not update its document properties. - **PPTX:** The format provides extended document properties for slide, note, hidden-slide, paragraph, word, and multimedia counts, as well as heading pairs and part titles. Availability depends on which properties were written by the document producer. - **PPT:** The binary format can store corresponding document-summary properties. If a property is absent or was not refreshed by the document producer, Aspose.Slides returns its stored or default value rather than calculating it from the slides. - **ODP:** OpenDocument metadata provides general document statistics, such as page, paragraph, and word counts, but these values do not map to every PowerPoint-specific extended property. Hidden-slide, notes-slide, multimedia, heading-pair, and part-title metadata may be unavailable, and the inventory properties may return default values. Do not treat a zero value or an empty array as authoritative proof that the corresponding content is absent. Use the lightweight metadata approach for inventories and preliminary checks. Load the presentation and inspect its live object model when the result must reflect in-memory changes or when you need to verify the actual presentation content. ## **Update Presentation Properties** The properties returned by [IPresentationInfo::ReadDocumentProperties](https://reference.aspose.com/slides/cpp/aspose.slides/ipresentationinfo/readdocumentproperties/) can also be changed without creating a [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) instance. Apply the changes with [IPresentationInfo::UpdateDocumentProperties](https://reference.aspose.com/slides/cpp/aspose.slides/ipresentationinfo/updatedocumentproperties/), and then write the bound presentation with [IPresentationInfo::WriteBindedPresentation](https://reference.aspose.com/slides/cpp/aspose.slides/ipresentationinfo/writebindedpresentation/). The following image shows the original document properties. ![Original document properties of the PowerPoint presentation](https://docs.aspose.com/slides/cpp/examine-presentation/input_properties.png) The following example changes the title and last-saved time and writes the result to a new file: ```cpp #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto sourceFile = String(u"sample.pptx"); auto outputFile = String(u"sample_with_updated_properties.pptx"); auto presentationInfo = PresentationFactory::get_Instance()->GetPresentationInfo(sourceFile); auto documentProperties = presentationInfo->ReadDocumentProperties(); documentProperties->set_Title(u"Quarterly sales report"); documentProperties->set_LastSavedTime(DateTime::get_UtcNow()); presentationInfo->UpdateDocumentProperties(documentProperties); presentationInfo->WriteBindedPresentation(outputFile); ``` The following image shows the updated document properties. ![Changed document properties of the PowerPoint presentation](https://docs.aspose.com/slides/cpp/examine-presentation/output_properties.png) ## **Useful Links** For related security checks and protection settings, see the following articles: - [Password-Protect Presentations](https://docs.aspose.com/slides/cpp/password-protected-presentation/) - [Write-Protect Presentations](https://docs.aspose.com/slides/cpp/write-protected-presentation/) ## **FAQ** **How can I check whether fonts are embedded and which ones they are?** Load the presentation and use [Presentation::get_FontsManager](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/get_fontsmanager/). Call [FontsManager::GetEmbeddedFonts](https://reference.aspose.com/slides/cpp/aspose.slides/fontsmanager/getembeddedfonts/) to obtain the embedded fonts and [FontsManager::GetFonts](https://reference.aspose.com/slides/cpp/aspose.slides/fontsmanager/getfonts/) to obtain the fonts used by the presentation. Compare the two results to find fonts that are required for rendering but are not embedded. **How can I quickly tell if the file has hidden slides and how many?** When stored document metadata is sufficient, read [IDocumentProperties::get_HiddenSlides](https://reference.aspose.com/slides/cpp/aspose.slides/idocumentproperties/get_hiddenslides/) through [IPresentationFactory::GetPresentationInfo](https://reference.aspose.com/slides/cpp/aspose.slides/ipresentationfactory/getpresentationinfo/) and [IPresentationInfo::ReadDocumentProperties](https://reference.aspose.com/slides/cpp/aspose.slides/ipresentationinfo/readdocumentproperties/). This is suitable for a lightweight inventory. If the presentation has been modified in memory, the stored metadata may be missing or stale, or you need to verify live values, iterate through [Presentation::get_Slides](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/get_slides/) and inspect each slide's [Slide::get_Hidden](https://reference.aspose.com/slides/cpp/aspose.slides/slide/get_hidden/) method instead. **Can I detect whether custom slide size and orientation are used, and whether they differ from the defaults?** Yes. Load the presentation and read [Presentation::get_SlideSize](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/get_slidesize/). Inspect [ISlideSize::get_Type](https://reference.aspose.com/slides/cpp/aspose.slides/islidesize/get_type/), [ISlideSize::get_Size](https://reference.aspose.com/slides/cpp/aspose.slides/islidesize/get_size/), and [ISlideSize::get_Orientation](https://reference.aspose.com/slides/cpp/aspose.slides/islidesize/get_orientation/) to compare the current settings with the expected preset and dimensions. **Is there a quick way to see if charts reference external data sources?** Yes. Locate each [Chart](https://reference.aspose.com/slides/cpp/aspose.slides.charts/chart/) and inspect [ChartData::get_DataSourceType](https://reference.aspose.com/slides/cpp/aspose.slides.charts/chartdata/get_datasourcetype/). For an external workbook, read [ChartData::get_ExternalWorkbookPath](https://reference.aspose.com/slides/cpp/aspose.slides.charts/chartdata/get_externalworkbookpath/). The data source type and path identify an external reference, but verifying whether the target is available requires a separate resource check. **How can I assess 'heavy' slides that may slow rendering or PDF export?** There is no single complexity property. Traverse [Presentation::get_Slides](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/get_slides/) and each slide's [IBaseSlide::get_Shapes](https://reference.aspose.com/slides/cpp/aspose.slides/ibaseslide/get_shapes/) collection. Use shape counts and the presence of large images, effects, animations, or multimedia as screening signals, and measure a representative render or export before treating a slide as a confirmed performance bottleneck. # Examples > Explore Aspose.Slides for C++ code examples with snippets for creating, editing, and converting presentations in PPT, PPTX, and ODP formats. Source: https://docs.aspose.com/slides/cpp/examples/ Updated: 2026-02-19 --- lastmod: 2026-02-19T15:53:31+06:00 title: Examples type: docs weight: 40 url: /cpp/examples/ keywords: - code example - PowerPoint - OpenDocument - presentation - C++ - Aspose.Slides description: "Explore Aspose.Slides for C++ code examples with snippets for creating, editing, and converting presentations in PPT, PPTX, and ODP formats." --- ## Related articles - [Chart](https://docs.aspose.com/slides/cpp/examples/elements/chart/) # Elements > Browse Aspose.Slides for C++ elements examples: add, style, and animate shapes, text, images, charts, and tables in PowerPoint and OpenDocument presentations. Source: https://docs.aspose.com/slides/cpp/examples/elements/ Updated: 2026-02-19 --- lastmod: 2026-02-19T15:53:31+06:00 title: Elements type: docs weight: 40 url: /cpp/examples/elements/ keywords: - code example - element - PowerPoint - OpenDocument - presentation - C++ - Aspose.Slides description: "Browse Aspose.Slides for C++ elements examples: add, style, and animate shapes, text, images, charts, and tables in PowerPoint and OpenDocument presentations." --- # ActiveX > See Aspose.Slides for C++ ActiveX examples: insert, configure, and control ActiveX objects in PPT and PPTX presentations with clear C++ code. Source: https://docs.aspose.com/slides/cpp/examples/elements/activex/ Updated: 2026-08-05 This article demonstrates how to add, access, remove, and configure ActiveX controls in a presentation using **Aspose.Slides for C++**. ## **Add an ActiveX Control** Insert a new ActiveX control and optionally set its properties. ```cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; static void AddActiveX() { auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); // Add a new ActiveX control. auto control = slide->get_Controls()->AddControl(ControlType::WindowsMediaPlayer, 50, 50, 100, 50); // Optionally set some properties. control->get_Properties()->Add(u"Value", u"Default text"); presentation->Save(u"add_activex.pptm", SaveFormat::Pptm); presentation->Dispose(); } ``` ## **Access an ActiveX Control** Read information from the first ActiveX control on the slide. ```cpp #include #include #include #include #include using namespace Aspose::Slides; using namespace System; static void AccessActiveX() { auto presentation = MakeObject(u"add_activex.pptm"); auto slide = presentation->get_Slide(0); if (slide->get_Controls()->get_Count() > 0) { // Access the first ActiveX control. auto control = slide->get_Control(0); Console::WriteLine(u"Control Name: {0}", control->get_Name()); Console::WriteLine(u"Value: {0}", control->get_Property(u"Value")); } presentation->Dispose(); } ``` ## **Remove an ActiveX Control** Delete an existing ActiveX control from the slide. ```cpp #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; static void RemoveActiveX() { auto presentation = MakeObject(u"add_activex.pptm"); auto slide = presentation->get_Slide(0); if (slide->get_Controls()->get_Count() > 0) { // Remove the first ActiveX control. slide->get_Controls()->RemoveAt(0); } presentation->Save(u"removed_activex.pptm", SaveFormat::Pptm); presentation->Dispose(); } ``` ## **Set ActiveX Properties** Add a control and configure several ActiveX properties. ```cpp #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; static void SetActiveXProperties() { auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); // Add a Windows Media Player control and configure properties. auto control = slide->get_Controls()->AddControl(ControlType::WindowsMediaPlayer, 50, 50, 150, 50); control->set_Property(u"Caption", u"Click Me"); control->set_Property(u"Enabled", u"true"); presentation->Save(u"set_activex_props.pptm", SaveFormat::Pptm); presentation->Dispose(); } ``` ## Related articles - [Manage PowerPoint Shapes in C++](https://docs.aspose.com/slides/cpp/powerpoint-shapes/) - [Manage ActiveX Controls in Presentations Using C++](https://docs.aspose.com/slides/cpp/activex/) - [Audio](https://docs.aspose.com/slides/cpp/examples/elements/audio/) # Animation > Explore Aspose.Slides for C++ animation examples: add, sequence, and customize effects and transitions with C++ for PPT, PPTX, and ODP presentations. Source: https://docs.aspose.com/slides/cpp/examples/elements/animation/ Updated: 2026-08-05 This article demonstrates how to create simple animations and manage their sequence using **Aspose.Slides for C++**. ## **Add an Animation** Create a rectangle shape and apply a fade-in effect triggered on click. ```cpp #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Animation; using namespace System; static void AddAnimation() { auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 50.0f, 50.0f, 100.0f, 100.0f); // Fade effect. slide->get_Timeline()->get_MainSequence()->AddEffect( shape, EffectType::Fade, EffectSubtype::None, EffectTriggerType::OnClick); presentation->Dispose(); } ``` ## **Access an Animation** Retrieve the first animation effect from the slide timeline. ```cpp #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Animation; using namespace System; static void AccessAnimation() { auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 50.0f, 50.0f, 100.0f, 100.0f); slide->get_Timeline()->get_MainSequence()->AddEffect( shape, EffectType::Fade, EffectSubtype::None, EffectTriggerType::OnClick); // Access the first animation effect. auto effect = slide->get_Timeline()->get_MainSequenceEffect(0); presentation->Dispose(); } ``` ## **Remove an Animation** Remove an animation effect from the sequence. ```cpp #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Animation; using namespace System; static void RemoveAnimation() { auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 50.0f, 50.0f, 100.0f, 100.0f); auto effect = slide->get_Timeline()->get_MainSequence()->AddEffect( shape, EffectType::Fade, EffectSubtype::None, EffectTriggerType::OnClick); // Remove the effect. slide->get_Timeline()->get_MainSequence()->Remove(effect); presentation->Dispose(); } ``` ## **Sequence Animations** Add multiple effects and demonstrate the order in which animations occur. ```cpp #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Animation; using namespace System; static void SequenceAnimations() { auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto shape1 = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 50.0f, 50.0f, 100.0f, 100.0f); auto shape2 = slide->get_Shapes()->AddAutoShape(ShapeType::Ellipse, 200.0f, 50.0f, 100.0f, 100.0f); auto sequence = slide->get_Timeline()->get_MainSequence(); sequence->AddEffect(shape1, EffectType::Fly, EffectSubtype::Bottom, EffectTriggerType::OnClick); sequence->AddEffect(shape2, EffectType::Fly, EffectSubtype::Bottom, EffectTriggerType::OnClick); presentation->Dispose(); } ``` ## Related articles - [Animate PowerPoint Text in C++](https://docs.aspose.com/slides/cpp/animated-text/) - [Slide Transition](https://docs.aspose.com/slides/cpp/examples/elements/slide-transition/) - [Manage PowerPoint Shapes in C++](https://docs.aspose.com/slides/cpp/powerpoint-shapes/) # Audio > Discover Aspose.Slides for C++ audio examples: insert, play, trim, and extract sound in PPT, PPTX, and ODP presentations with clear C++ code. Source: https://docs.aspose.com/slides/cpp/examples/elements/audio/ Updated: 2026-08-05 This article demonstrates how to embed audio frames and control playback with **Aspose.Slides for C++**. The following examples show basic audio operations. ## **Add an Audio Frame** Insert an empty audio frame that can later hold embedded sound data. ```cpp #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; using namespace System::IO; static void AddAudio() { auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); // Create an empty audio frame (audio will be embedded later). auto audioFrame = slide->get_Shapes()->AddAudioFrameEmbedded(50.0f, 50.0f, 100.0f, 100.0f, MakeObject()); presentation->Dispose(); } ``` ## **Access an Audio Frame** This code retrieves the first audio frame on a slide. ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; using namespace System::IO; static void AccessAudio() { auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); slide->get_Shapes()->AddAudioFrameEmbedded(50.0f, 50.0f, 100.0f, 100.0f, MakeObject()); // Access the first audio frame on the slide. auto firstAudio = SharedPtr(); for (auto&& shape : slide->get_Shapes()) { if (ObjectExt::Is(shape)) { firstAudio = ExplicitCast(shape); break; } } presentation->Dispose(); } ``` ## **Remove an Audio Frame** Delete a previously added audio frame. ```cpp #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; using namespace System::IO; static void RemoveAudio() { auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto audioFrame = slide->get_Shapes()->AddAudioFrameEmbedded(50.0f, 50.0f, 100.0f, 100.0f, MakeObject()); // Remove the audio frame. slide->get_Shapes()->Remove(audioFrame); presentation->Dispose(); } ``` ## **Set Audio Playback** Configure the audio frame to play automatically when the slide appears. ```cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; using namespace System::IO; static void SetAudioPlayback() { auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto audioFrame = slide->get_Shapes()->AddAudioFrameEmbedded(50.0f, 50.0f, 100.0f, 100.0f, MakeObject()); // Play automatically when the slide appears. audioFrame->set_PlayMode(AudioPlayModePreset::Auto); presentation->Dispose(); } ``` ## Related articles - [Video](https://docs.aspose.com/slides/cpp/examples/elements/video/) - [Manage Audio in Presentations Using C++](https://docs.aspose.com/slides/cpp/audio-frame/) - [Manage Media Files in C++](https://docs.aspose.com/slides/cpp/manage-media-files/) # Chart > Master charts with Aspose.Slides for C++: create, format, bind data, and export charts in PPT, PPTX, and ODP with C++ examples. Source: https://docs.aspose.com/slides/cpp/examples/elements/chart/ Updated: 2026-08-05 Examples for adding, accessing, removing, and updating different chart types with **Aspose.Slides for C++**. The snippets below demonstrate basic chart operations. ## **Add a Chart** This method adds a simple area chart to the first slide. ```cpp #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace System; static void AddChart() { auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); // Add a simple area chart to the first slide. auto chart = slide->get_Shapes()->AddChart(ChartType::Area, 50, 50, 400, 300); presentation->Dispose(); } ``` ## **Access a Chart** After creating a chart, you can retrieve it through the shape collection. ```cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace System; static void AccessChart() { auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::Line, 50, 50, 400, 300); // Access the first chart on the slide. auto firstChart = SharedPtr(); for (auto&& shape : slide->get_Shapes()) { if (ObjectExt::Is(shape)) { firstChart = ExplicitCast(shape); break; } } presentation->Dispose(); } ``` ## **Remove a Chart** The following code removes a chart from a slide. ```cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace System; static void RemoveChart() { auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::Pie, 50, 50, 400, 300); // Remove the chart. slide->get_Shapes()->Remove(chart); presentation->Dispose(); } ``` ## **Update Chart Data** You can change chart properties such as the title. ```cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace System; static void UpdateChartData() { auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::Column3D, 50, 50, 400, 300); // Change the chart title. chart->get_ChartTitle()->AddTextFrameForOverriding(u"Sales Report"); presentation->Dispose(); } ``` ## Related articles - [Create and Customize PowerPoint Charts in C++](https://docs.aspose.com/slides/cpp/powerpoint-charts/) - [Note](https://docs.aspose.com/slides/cpp/examples/elements/note/) - [Examples](https://docs.aspose.com/slides/cpp/examples/) # Comment > Work with slide comments in Aspose.Slides for C++: add, reply, edit, resolve, and export comments in PPT, PPTX, and ODP presentations with C++ code examples. Source: https://docs.aspose.com/slides/cpp/examples/elements/comment/ Updated: 2026-08-05 This article demonstrates adding, reading, removing, and replying to modern comments using **Aspose.Slides for C++**. ## **Add a Modern Comment** Create a comment authored by a user and save the presentation. ```cpp #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::Drawing; static void AddModernComment() { auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto author = presentation->get_CommentAuthors()->AddAuthor(u"User", u"U1"); author->get_Comments()->AddModernComment( u"This is a modern comment", slide, nullptr, PointF(100, 100), DateTime::get_Now()); presentation->Save(u"modern_comment.pptx", SaveFormat::Pptx); presentation->Dispose(); } ``` ## **Access a Modern Comment** Read a modern comment from an existing presentation. ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; static void AccessModernComment() { auto presentation = MakeObject(u"modern_comment.pptx"); auto author = presentation->get_CommentAuthor(0); auto comment = ExplicitCast>(author->get_Comment(0)); Console::WriteLine(u"Author: {0}, Comment: {1}, Position: {2}", author->get_Name(), comment->get_Text(), comment->get_Position()); presentation->Dispose(); } ``` ## **Remove a Modern Comment** Remove a comment and save the updated file. ```cpp #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; static void RemoveModernComment() { auto presentation = MakeObject(u"modern_comment.pptx"); auto author = presentation->get_CommentAuthor(0); auto comment = author->get_Comment(0); comment->Remove(); presentation->Save(u"modern_comment_removed.pptx", SaveFormat::Pptx); presentation->Dispose(); } ``` ## **Reply to a Modern Comment** Add replies to a parent modern comment. ```cpp #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::Drawing; static void ReplyToModernComment() { auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto author = presentation->get_CommentAuthors()->AddAuthor(u"User", u"U1"); auto parentComment = author->get_Comments()->AddModernComment( u"Parent comment", slide, nullptr, PointF(100, 100), DateTime::get_Now()); auto reply1 = author->get_Comments()->AddModernComment( u"Reply 1", slide, nullptr, PointF(110, 100), DateTime::get_Now()); auto reply2 = author->get_Comments()->AddModernComment( u"Reply 2", slide, nullptr, PointF(120, 100), DateTime::get_Now()); reply1->set_ParentComment(parentComment); reply2->set_ParentComment(parentComment); presentation->Save(u"modern_comment_replies.pptx", SaveFormat::Pptx); presentation->Dispose(); } ``` ## Related articles - [Manage Presentation Comments in C++](https://docs.aspose.com/slides/cpp/presentation-comments/) # Connector > Learn how to add, route, and style connectors between shapes using Aspose.Slides for C++, with examples for PPT, PPTX, and ODP presentations. Source: https://docs.aspose.com/slides/cpp/examples/elements/connector/ Updated: 2026-08-05 This article demonstrates how to connect shapes with connectors and change their targets using **Aspose.Slides for C++**. ## **Add a Connector** Insert a connector shape between two points on the slide. ```cpp #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; static void AddConnector() { auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto connector = slide->get_Shapes()->AddConnector(ShapeType::BentConnector2, 0, 0, 100, 100); presentation->Dispose(); } ``` ## **Access a Connector** Retrieve the first connector shape added to a slide. ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; static void AccessConnector() { auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); slide->get_Shapes()->AddConnector(ShapeType::BentConnector2, 0, 0, 100, 100); // Access the first connector on the slide. auto connector = SharedPtr(); for (auto&& shape : IterateOver(slide->get_Shapes())) { if (ObjectExt::Is(shape)) { connector = ExplicitCast(shape); break; } } presentation->Dispose(); } ``` ## **Remove a Connector** Delete a connector from the slide. ```cpp #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; static void RemoveConnector() { auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto connector = slide->get_Shapes()->AddConnector(ShapeType::BentConnector2, 0, 0, 100, 100); slide->get_Shapes()->Remove(connector); presentation->Dispose(); } ``` ## **Reconnect Shapes** Attach a connector to two shapes by assigning start and end targets. ```cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; static void ReconnectShapes() { auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto shape1 = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 0, 0, 50, 50); auto shape2 = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 100, 100, 50, 50); auto connector = slide->get_Shapes()->AddConnector(ShapeType::BentConnector2, 0, 0, 100, 100); connector->set_StartShapeConnectedTo(shape1); connector->set_EndShapeConnectedTo(shape2); presentation->Dispose(); } ``` ## Related articles - [Shape Types in Aspose.Slides for C++](https://docs.aspose.com/slides/cpp/shape-types/) - [Manage Connectors in Presentations Using C++](https://docs.aspose.com/slides/cpp/connector/) # Group Shape > Manage grouped shapes in Aspose.Slides for C++: create, nest, align, reorder, and style group shapes with C++ examples in PPT, PPTX, and ODP presentations. Source: https://docs.aspose.com/slides/cpp/examples/elements/group-shape/ Updated: 2026-08-05 Examples for creating groups of shapes, accessing them, ungrouping, and removal using **Aspose.Slides for C++**. ## **Add a Group Shape** Create a group containing two basic shapes. ```cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; static void AddGroupShape() { auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto group = slide->get_Shapes()->AddGroupShape(); group->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 0, 0, 50, 50); group->get_Shapes()->AddAutoShape(ShapeType::Ellipse, 60, 0, 50, 50); presentation->Dispose(); } ``` ## **Access a Group Shape** Retrieve the first group shape from a slide. ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; static void AccessGroupShape() { auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto group = slide->get_Shapes()->AddGroupShape(); group->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 0, 0, 50, 50); auto firstGroup = SharedPtr(); for (auto&& shape : slide->get_Shapes()) { if (ObjectExt::Is(shape)) { firstGroup = ExplicitCast(shape); break; } } presentation->Dispose(); } ``` ## **Remove a Group Shape** Delete a group shape from the slide. ```cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; static void RemoveGroupShape() { auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto group = slide->get_Shapes()->AddGroupShape(); slide->get_Shapes()->Remove(group); presentation->Dispose(); } ``` ## **Ungroup Shapes** Move shapes out of a group container. ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; static void UngroupShapes() { auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto group = slide->get_Shapes()->AddGroupShape(); auto rect = group->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 0, 0, 50, 50); // Move shape out of the group. slide->get_Shapes()->AddClone(rect); group->get_Shapes()->Remove(rect); presentation->Dispose(); } ``` ## Related articles - [Group Presentation Shapes in C++](https://docs.aspose.com/slides/cpp/group/) - [Section](https://docs.aspose.com/slides/cpp/examples/elements/section/) - [Shape Types in Aspose.Slides for C++](https://docs.aspose.com/slides/cpp/shape-types/) # Header Footer > Control slide headers and footers with Aspose.Slides for C++: add dates, slide numbers, and custom text in PPT, PPTX, and ODP with C++ examples. Source: https://docs.aspose.com/slides/cpp/examples/elements/header-footer/ Updated: 2026-08-05 This article demonstrates how to add footers and update date and time placeholders using **Aspose.Slides for C++**. ## **Add a Footer** Add text to the footer area of a slide and make it visible. ```cpp #include #include #include using namespace Aspose::Slides; using namespace System; static void AddHeaderFooter() { auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); slide->get_HeaderFooterManager()->SetFooterText(u"My footer"); slide->get_HeaderFooterManager()->SetFooterVisibility(true); presentation->Dispose(); } ``` ## **Update Date and Time** Modify the date and time placeholder on a slide. ```cpp #include #include #include using namespace Aspose::Slides; using namespace System; static void UpdateDateTime() { auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); slide->get_HeaderFooterManager()->SetDateTimeText(u"01/01/2024"); slide->get_HeaderFooterManager()->SetDateTimeVisibility(true); presentation->Dispose(); } ``` ## Related articles - [Manage Presentation Headers and Footers in C++](https://docs.aspose.com/slides/cpp/presentation-header-and-footer/) - [Apply or Change Slide Layouts in C++](https://docs.aspose.com/slides/cpp/slide-layout/) # Hyperlink > Add and manage hyperlinks in Aspose.Slides for C++: link text, shapes, and images, set targets and actions for PPT, PPTX, and ODP with C++ examples. Source: https://docs.aspose.com/slides/cpp/examples/elements/hyperlink/ Updated: 2026-08-05 This article demonstrates adding, accessing, removing, and updating hyperlinks on shapes using **Aspose.Slides for C++**. ## **Add a Hyperlink** Create a rectangle shape with a hyperlink pointing to an external website. ```cpp #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; static void AddHyperlink() { auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 50, 50, 150, 50); shape->get_TextFrame()->set_Text(u"Aspose"); auto paragraph = shape->get_TextFrame()->get_Paragraph(0); auto textPortion = paragraph->get_Portion(0); textPortion->get_PortionFormat()->set_HyperlinkClick(MakeObject(u"https://www.aspose.com")); presentation->Dispose(); } ``` ## **Access a Hyperlink** Read hyperlink information from a shape's text portion. ```cpp #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; static void AccessHyperlink() { auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 50, 50, 150, 50); shape->get_TextFrame()->set_Text(u"Aspose"); auto paragraph = shape->get_TextFrame()->get_Paragraph(0); auto textPortion = paragraph->get_Portion(0); textPortion->get_PortionFormat()->set_HyperlinkClick(MakeObject(u"https://www.aspose.com")); auto hyperlink = textPortion->get_PortionFormat()->get_HyperlinkClick(); presentation->Dispose(); } ``` ## **Remove a Hyperlink** Clear the hyperlink from a shape's text. ```cpp #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; static void RemoveHyperlink() { auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 50, 50, 150, 50); shape->get_TextFrame()->set_Text(u"Aspose"); auto paragraph = shape->get_TextFrame()->get_Paragraph(0); auto textPortion = paragraph->get_Portion(0); textPortion->get_PortionFormat()->set_HyperlinkClick(MakeObject(u"https://www.aspose.com")); textPortion->get_PortionFormat()->set_HyperlinkClick(nullptr); presentation->Dispose(); } ``` ## **Update a Hyperlink** Change the target of an existing hyperlink. Use `HyperlinkManager` to modify text that already contains a hyperlink, which mimics how PowerPoint updates hyperlinks safely. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; static void UpdateHyperlink() { auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 50, 50, 150, 50); shape->get_TextFrame()->set_Text(u"Aspose"); auto paragraph = shape->get_TextFrame()->get_Paragraph(0); auto textPortion = paragraph->get_Portion(0); textPortion->get_PortionFormat()->set_HyperlinkClick(MakeObject(u"https://old.example.com")); // Changing a hyperlink inside existing text should be done via // HyperlinkManager rather than setting the property directly. // This mimics how PowerPoint safely updates hyperlinks. textPortion->get_PortionFormat()->get_HyperlinkManager()->SetExternalHyperlinkClick(u"https://new.example.com"); presentation->Dispose(); } ``` ## Related articles - [Manage Presentation Hyperlinks in C++](https://docs.aspose.com/slides/cpp/manage-hyperlinks/) # Ink > Work with Ink in Aspose.Slides for C++: draw, import, and edit strokes, adjust color and width, and export to PPT, PPTX, and ODP using C++ examples. Source: https://docs.aspose.com/slides/cpp/examples/elements/ink/ Updated: 2026-08-05 This article provides examples of accessing existing ink shapes and removing them using **Aspose.Slides for C++**. > ❗ **Note:** Ink shapes represent user input from specialized devices. Aspose.Slides cannot create new ink strokes programmatically, but you can read and modify existing ink. ## **Access Ink** Read the tags from the first ink shape on a slide. ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Ink; using namespace System; static void AccessInk() { auto presentation = MakeObject(u"ink.pptx"); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shape(0); if (ObjectExt::Is(shape)) { auto inkShape = ExplicitCast(shape); auto tags = inkShape->get_CustomData()->get_Tags(); if (tags->get_Count() > 0) { auto tagName = tags->GetNameByIndex(0); // Use tagName as needed. } } presentation->Dispose(); } ``` ## **Remove Ink** Delete an ink shape from the slide if one exists. ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Ink; using namespace System; static void RemoveInk() { auto presentation = MakeObject(u"ink.pptx"); auto slide = presentation->get_Slide(0); auto ink = SharedPtr(); for (auto&& shape : slide->get_Shapes()) { if (ObjectExt::Is(shape)) { ink = ExplicitCast(shape); break; } } if (ink != nullptr) { slide->get_Shapes()->Remove(ink); } presentation->Dispose(); } ``` ## Related articles - [Manage Presentation Content in C++](https://docs.aspose.com/slides/cpp/presentation-content/) - [Manage Presentation Ink Objects in C++](https://docs.aspose.com/slides/cpp/manage-ink/) # Layout Slide > Master layout slides in Aspose.Slides for C++: choose, apply, and customize slide layouts, placeholders, and masters with C++ examples for PPT, PPTX, and ODP presentations. Source: https://docs.aspose.com/slides/cpp/examples/elements/layout-slide/ Updated: 2026-08-05 This article demonstrates how to work with **Layout Slides** in Aspose.Slides for C++. A layout slide defines the design and formatting inherited by normal slides. You can add, access, clone, and remove layout slides, as well as clean up unused ones to reduce presentation size. ## **Add a Layout Slide** You can create a custom layout slide to define reusable formatting. For example, you might add a text box that appears on all slides using this layout. ```cpp #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; static void AddLayoutSlide() { auto presentation = MakeObject(); auto masterSlide = presentation->get_Master(0); // Create a layout slide with a blank layout type and a custom name. auto layoutSlide = presentation->get_LayoutSlides()->Add(masterSlide, SlideLayoutType::Blank, u"Main layout"); // Add a text box to the layout slide. auto layoutTextBox = layoutSlide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 75, 75, 150, 150); layoutTextBox->get_TextFrame()->set_Text(u"Layout Slide Text"); // Add two slides using this layout; both will inherit the text from the layout. presentation->get_Slides()->AddEmptySlide(layoutSlide); presentation->get_Slides()->AddEmptySlide(layoutSlide); presentation->Dispose(); } ``` > 💡 **Note 1:** Layout slides act as templates for individual slides. You can define common elements once and reuse them across many slides. > 💡 **Note 2:** When you add shapes or text to a layout slide, all slides based on that layout will display this shared content automatically. > The screenshot below shows two slides, each inheriting a text box from the same layout slide. ![Slides Inheriting Layout Content](https://docs.aspose.com/slides/cpp/examples/elements/layout-slide/layout-slide-result.png) ## **Access a Layout Slide** Layout slides can be accessed by index or by layout type (e.g., `Blank`, `Title`, `SectionHeader`, etc.). ```cpp #include #include #include #include #include using namespace Aspose::Slides; using namespace System; static void AccessLayoutSlide() { auto presentation = MakeObject(); // Access a layout slide by index. auto firstLayoutSlide = presentation->get_LayoutSlide(0); // Access a layout slide by type. auto blankLayoutSlide = presentation->get_LayoutSlides()->GetByType(SlideLayoutType::Blank); presentation->Dispose(); } ``` ## **Remove a Layout Slide** You can remove a specific layout slide if it's no longer needed. ```cpp #include #include #include #include #include using namespace Aspose::Slides; using namespace System; static void RemoveLayoutSlide() { auto presentation = MakeObject(); // Get a layout slide by type and remove it. auto blankLayoutSlide = presentation->get_LayoutSlides()->GetByType(SlideLayoutType::Custom); presentation->get_LayoutSlides()->Remove(blankLayoutSlide); presentation->Dispose(); } ``` ## **Remove Unused Layout Slides** To reduce the presentation size, you may want to remove layout slides that are not used by any normal slides. ```cpp #include #include #include using namespace Aspose::Slides; using namespace System; static void RemoveUnusedLayoutSlides() { auto presentation = MakeObject(); // Automatically removes all layout slides not referenced by any slide. presentation->get_LayoutSlides()->RemoveUnused(); presentation->Dispose(); } ``` ## **Clone a Layout Slide** You can duplicate a layout slide using the `AddClone` method. ```cpp #include #include #include #include #include using namespace Aspose::Slides; using namespace System; static void CloneLayoutSlides() { auto presentation = MakeObject(); // Get an existing layout slide by type. auto blankLayoutSlide = presentation->get_LayoutSlides()->GetByType(SlideLayoutType::Blank); // Clone the layout slide to the end of the layout slide collection. auto clonedLayoutSlide = presentation->get_LayoutSlides()->AddClone(blankLayoutSlide); presentation->Dispose(); } ``` > ✅ **Summary:** Layout slides are powerful tools for managing consistent formatting across slides. Aspose.Slides allows full control over creating, managing, and optimizing layout slides. ## Related articles - [Master Slide](https://docs.aspose.com/slides/cpp/examples/elements/master-slide/) - [Manage Presentation Slide Masters in C++](https://docs.aspose.com/slides/cpp/slide-master/) - [Apply or Change Slide Layouts in C++](https://docs.aspose.com/slides/cpp/slide-layout/) # Master Slide > Explore Aspose.Slides for C++ master slide examples: create, edit, and style masters, placeholders, and themes in PPT, PPTX, and ODP with clear C++ code. Source: https://docs.aspose.com/slides/cpp/examples/elements/master-slide/ Updated: 2026-08-05 Master slides form the top level of the slide inheritance hierarchy in PowerPoint. A **master slide** defines common design elements such as backgrounds, logos, and text formatting. **Layout slides** inherit from master slides, and **normal slides** inherit from layout slides. This article demonstrates how to create, modify, and manage master slides using Aspose.Slides for C++. ## **Add a Master Slide** This example shows how to create a new master slide by cloning the default one. It then adds a company name banner to all slides through layout inheritance. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto presentation = MakeObject(); // Clone the default master slide. auto defaultMasterSlide = presentation->get_Master(0); auto newMasterSlide = presentation->get_Masters()->AddClone(defaultMasterSlide); // Add a banner with company name to the top of the master slide. auto textBox = newMasterSlide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 0, 0, 720, 25); textBox->get_TextFrame()->set_Text(u"Company Name"); auto paragraph = textBox->get_TextFrame()->get_Paragraph(0); auto textFormat = paragraph->get_ParagraphFormat()->get_DefaultPortionFormat(); textFormat->get_FillFormat()->set_FillType(FillType::Solid); textFormat->get_FillFormat()->get_SolidFillColor()->set_Color(System::Drawing::Color::get_Black()); textBox->get_FillFormat()->set_FillType(FillType::NoFill); // Assign the new master slide to a layout slide. auto layoutSlide = presentation->get_LayoutSlide(0); layoutSlide->set_MasterSlide(newMasterSlide); // Assign the layout slide to the first slide in the presentation. presentation->get_Slide(0)->set_LayoutSlide(layoutSlide); presentation->Dispose(); ``` > 💡 **Note 1:** Master slides provide a way to apply consistent branding or shared design elements across all slides. Any changes made to the master will automatically reflect on dependent layout and normal slides. > 💡 **Note 2:** Any shapes or formatting added to a master slide are inherited by layout slides and, in turn, all normal slides using those layouts. > The image below illustrates how a text box added on a master slide is automatically rendered on the final slide. ![Master Inheritance Example](https://docs.aspose.com/slides/cpp/examples/elements/master-slide/master-slide-banner.png) ## **Access a Master Slide** You can access master slides using the presentation master collection. Here’s how to retrieve and work with them: ```cpp #include #include #include #include using namespace Aspose::Slides; using namespace System; auto presentation = MakeObject(); auto firstMasterSlide = presentation->get_Master(0); // Change the background type. firstMasterSlide->get_Background()->set_Type(BackgroundType::OwnBackground); presentation->Dispose(); ``` ## **Remove a Master Slide** Master slides can be removed either by index or by reference. ```cpp #include #include #include using namespace Aspose::Slides; using namespace System; auto presentation = MakeObject(u"sample.pptx"); // Remove a master slide by index. presentation->get_Masters()->RemoveAt(0); // Remove a master slide by reference. auto firstMasterSlide = presentation->get_Master(0); presentation->get_Masters()->Remove(firstMasterSlide); presentation->Dispose(); ``` ## **Remove Unused Master Slides** Some presentations contain master slides that are not in use. Removing these slides can help reduce file size. ```cpp #include #include using namespace Aspose::Slides; using namespace System; auto presentation = MakeObject(); // Remove all unused master slides (even those marked as Preserve). presentation->get_Masters()->RemoveUnused(true); presentation->Dispose(); ``` ## Related articles - [Layout Slide](https://docs.aspose.com/slides/cpp/examples/elements/layout-slide/) - [Manage Presentation Slide Masters in C++](https://docs.aspose.com/slides/cpp/slide-master/) # Math Text > Explore Aspose.Slides for C++ MathematicalText examples: create and format equations, fractions, matrices, and symbols with C++ in PPT, PPTX, and ODP presentations. Source: https://docs.aspose.com/slides/cpp/examples/elements/math-text/ Updated: 2026-08-05 This article demonstrates working with mathematical text shapes and formatting equations using **Aspose.Slides for C++**. ## **Add Math Text** Create a math shape containing a fraction and the Pythagorean formula. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::MathText; using namespace System; static void AddMathText() { auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); // Add a Math shape to the slide. auto mathShape = slide->get_Shapes()->AddMathShape(0.0f, 0.0f, 720.0f, 150.0f); // Access the math paragraph. auto paragraph = mathShape->get_TextFrame()->get_Paragraph(0); auto textPortion = paragraph->get_Portion(0); auto mathParagraph = ExplicitCast(textPortion)->get_MathParagraph(); // Add a simple fraction: x / y. auto fraction = MakeObject(u"x")->Divide(u"y"); mathParagraph->Add(MakeObject(fraction)); // Add equation: c² = a² + b². auto mathBlock = MakeObject(u"c") ->SetSuperscript(u"2") ->Join(u"=") ->Join(MakeObject(u"a")->SetSuperscript(u"2")) ->Join(u"+") ->Join(MakeObject(u"b")->SetSuperscript(u"2")); mathParagraph->Add(mathBlock); presentation->Dispose(); } ``` ## **Access Math Text** Locate a shape that contains a math paragraph on the slide. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::MathText; using namespace System; static void AccessMathText() { auto presentation = MakeObject(u"sample.pptx"); auto slide = presentation->get_Slide(0); // Find the first shape that contains a math paragraph. auto mathShape = SharedPtr(); for (auto&& shape : slide->get_Shapes()) { if (ObjectExt::Is(shape)) { auto autoShape = ExplicitCast(shape); auto textFrame = autoShape->get_TextFrame(); auto hasMath = false; for (auto&& paragraph : textFrame->get_Paragraphs()) { for (auto&& textPortion : paragraph->get_Portions()) { if (ObjectExt::Is(textPortion)) { hasMath = true; break; } } if (hasMath) break; } if (hasMath) { mathShape = autoShape; break; } } } if (mathShape != nullptr) { auto paragraph = mathShape->get_TextFrame()->get_Paragraph(0); auto textPortion = paragraph->get_Portion(0); auto mathParagraph = ExplicitCast(textPortion)->get_MathParagraph(); // Example: create a fraction (not added here). auto fraction = MakeObject(u"x")->Divide(u"y"); // Use mathParagraph or fraction as needed... } presentation->Dispose(); } ``` ## **Remove Math Text** Delete a math shape from the slide. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::MathText; using namespace System; static void RemoveMathText() { auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto mathShape = slide->get_Shapes()->AddMathShape(50.0f, 50.0f, 100.0f, 50.0f); auto paragraph = mathShape->get_TextFrame()->get_Paragraph(0); auto textPortion = paragraph->get_Portion(0); auto mathParagraph = ExplicitCast(textPortion)->get_MathParagraph(); auto fraction = MakeObject(u"x")->Divide(u"y"); mathParagraph->Add(MakeObject(fraction)); // Remove the math shape. slide->get_Shapes()->Remove(mathShape); presentation->Dispose(); } ``` ## **Format Math Text** Set font properties for a math portion. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::MathText; using namespace System; static void FormatMathText() { auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto mathShape = slide->get_Shapes()->AddMathShape(50.0f, 50.0f, 100.0f, 50.0f); auto paragraph = mathShape->get_TextFrame()->get_Paragraph(0); auto textPortion = paragraph->get_Portion(0); auto mathParagraph = ExplicitCast(textPortion)->get_MathParagraph(); auto fraction = MakeObject(u"x")->Divide(u"y"); mathParagraph->Add(MakeObject(fraction)); textPortion->get_PortionFormat()->set_FontHeight(20); presentation->Dispose(); } ``` ## Related articles - [Add Math Equations to PowerPoint Presentations in C++](https://docs.aspose.com/slides/cpp/powerpoint-math-equations/) # Note > Work with slide notes in Aspose.Slides for C++: add, read, edit, and export speaker notes in PPT, PPTX, and ODP using clear C++ examples. Source: https://docs.aspose.com/slides/cpp/examples/elements/note/ Updated: 2026-08-05 This article demonstrates how to add, read, remove, and update notes slides using **Aspose.Slides for C++**. ## **Add a Notes Slide** Create a notes slide and assign text to it. ```cpp #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; static void AddNote() { auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto notesSlide = slide->get_NotesSlideManager()->AddNotesSlide(); slide->get_NotesSlideManager()->get_NotesSlide()->get_NotesTextFrame()->set_Text(u"My note"); presentation->Dispose(); } ``` ## **Access a Notes Slide** Read text from an existing notes slide. ```cpp #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; static void AccessNote() { auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto notesSlide = slide->get_NotesSlideManager()->AddNotesSlide(); auto notes = notesSlide->get_NotesTextFrame()->get_Text(); presentation->Dispose(); } ``` ## **Remove a Notes Slide** Remove the notes slide associated with a slide. ```cpp #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; static void RemoveNote() { auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto notesSlide = slide->get_NotesSlideManager()->AddNotesSlide(); slide->get_NotesSlideManager()->RemoveNotesSlide(); presentation->Dispose(); } ``` ## **Update Notes Text** Change the text of a notes slide. ```cpp #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; static void UpdateNoteText() { auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto notesSlide = slide->get_NotesSlideManager()->AddNotesSlide(); slide->get_NotesSlideManager()->get_NotesSlide()->get_NotesTextFrame()->set_Text(u"Old"); slide->get_NotesSlideManager()->get_NotesSlide()->get_NotesTextFrame()->set_Text(u"Updated"); presentation->Dispose(); } ``` ## Related articles - [Convert PowerPoint Presentations to PDF with Notes in C++](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-pdf-with-notes/) - [Create and Customize PowerPoint Charts in C++](https://docs.aspose.com/slides/cpp/powerpoint-charts/) - [Chart](https://docs.aspose.com/slides/cpp/examples/elements/chart/) # OLE Object > Handle OLE objects in Aspose.Slides for C++: insert, link, update, and extract embedded content with C++ in PPT, PPTX, and ODP presentations. Source: https://docs.aspose.com/slides/cpp/examples/elements/ole-object/ Updated: 2026-08-05 This article demonstrates embedding a file as an OLE object and updating its data using **Aspose.Slides for C++**. ## **Add an OLE Object** Embed a PDF file into the presentation. ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::DOM::Ole; using namespace System; using namespace System::IO; static void AddOleObject() { auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto pdfData = File::ReadAllBytes(u"doc.pdf"); auto dataInfo = MakeObject(pdfData, u"pdf"); auto oleFrame = slide->get_Shapes()->AddOleObjectFrame(20, 20, 50, 50, dataInfo); presentation->Dispose(); } ``` ## **Access an OLE Object** Retrieve the first OLE object frame on a slide. ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::DOM::Ole; using namespace System; using namespace System::IO; static void AccessOleObject() { auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto pdfData = File::ReadAllBytes(u"doc.pdf"); auto dataInfo = MakeObject(pdfData, u"pdf"); auto oleFrame = slide->get_Shapes()->AddOleObjectFrame(20, 20, 50, 50, dataInfo); auto firstOleFrame = SharedPtr(); for (auto&& shape : slide->get_Shapes()) { if (ObjectExt::Is(shape)) { firstOleFrame = ExplicitCast(shape); break; } } presentation->Dispose(); } ``` ## **Remove an OLE Object** Delete an embedded OLE object from the slide. ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::DOM::Ole; using namespace System; using namespace System::IO; static void RemoveOleObject() { auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto pdfData = File::ReadAllBytes(u"doc.pdf"); auto dataInfo = MakeObject(pdfData, u"pdf"); auto oleFrame = slide->get_Shapes()->AddOleObjectFrame(20, 20, 50, 50, dataInfo); slide->get_Shapes()->Remove(oleFrame); presentation->Dispose(); } ``` ## **Update OLE Object Data** Replace the data embedded in an existing OLE object. ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::DOM::Ole; using namespace System; using namespace System::IO; static void UpdateOleObjectData() { auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto pdfData = File::ReadAllBytes(u"doc.pdf"); auto dataInfo = MakeObject(pdfData, u"pdf"); auto oleFrame = slide->get_Shapes()->AddOleObjectFrame(20, 20, 50, 50, dataInfo); auto newData = File::ReadAllBytes(u"Picture.png"); auto newDataInfo = MakeObject(newData, u"png"); oleFrame->SetEmbeddedData(newDataInfo); presentation->Dispose(); } ``` ## Related articles - [Manage OLE in Presentations Using C++](https://docs.aspose.com/slides/cpp/manage-ole/) - [Create Excel Charts and Embed Them in Presentations as OLE Objects](https://docs.aspose.com/slides/cpp/creating-excel-chart-and-embedding-it-in-presentation-as-ole-object/) - [Object Preview Issue When Adding OleObjectFrame](https://docs.aspose.com/slides/cpp/object-preview-issue-when-adding-oleobjectframe/) # Picture > Work with pictures in Aspose.Slides for C++: insert, crop, compress, recolor, and export images with C++ examples for PPT, PPTX, and ODP presentations. Source: https://docs.aspose.com/slides/cpp/examples/elements/picture/ Updated: 2026-08-05 This article demonstrates how to insert and access pictures from in-memory images using **Aspose.Slides for C++**. The examples below create an image in memory, place it on a slide, and then retrieve it. ## **Add a Picture** This code generates a small bitmap, converts it to a stream, and inserts it as a picture frame on the first slide. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::Drawing; using namespace System::IO; static void AddPicture() { auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); // Create a simple in-memory image. auto bitmap = MakeObject(100, 100, System::Drawing::Imaging::PixelFormat::Format32bppArgb); auto graphics = Graphics::FromImage(bitmap.get()); graphics->FillRectangle(MakeObject(Color::FromArgb(144, 238, 144)), 0, 0, 100, 100); graphics->Dispose(); // Convert the bitmap to a byte array. auto bitmapStream = MakeObject(); bitmap->Save(bitmapStream, System::Drawing::Imaging::ImageFormat::get_Png()); auto pngBytes = bitmapStream->ToArray(); // Add the image to the presentation. auto image = presentation->get_Images()->AddImage(MakeObject(pngBytes)); // Insert a picture frame showing the image on the first slide. slide->get_Shapes()->AddPictureFrame( ShapeType::Rectangle, 50, 50, bitmap->get_Width(), bitmap->get_Height(), image); presentation->Save(u"picture.pptx", SaveFormat::Pptx); presentation->Dispose(); } ``` ## **Access a Picture** This example ensures a slide contains a picture frame and then accesses the first one it finds. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; using namespace System::Drawing; using namespace System::IO; static void AccessPicture() { auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto bitmap = MakeObject(40, 40, System::Drawing::Imaging::PixelFormat::Format32bppArgb); auto bitmapStream = MakeObject(); bitmap->Save(bitmapStream, System::Drawing::Imaging::ImageFormat::get_Png()); auto pngBytes = bitmapStream->ToArray(); auto image = presentation->get_Images()->AddImage(MakeObject(pngBytes)); slide->get_Shapes()->AddPictureFrame(ShapeType::Rectangle, 0, 0, 40, 40, image); auto pictureFrame = SharedPtr(); for (auto&& shape : slide->get_Shapes()) { if (ObjectExt::Is(shape)) { pictureFrame = ExplicitCast(shape); break; } } presentation->Dispose(); } ``` # Section > Manage slide sections in Aspose.Slides for C++: create, rename, reorder, and group slides with C++ examples for PPT, PPTX, and ODP. Source: https://docs.aspose.com/slides/cpp/examples/elements/section/ Updated: 2026-08-05 Examples for managing presentation sections—add, access, remove, and rename them programmatically using **Aspose.Slides for C++**. ## **Add a Section** Create a section that starts at a specific slide. ```cpp #include #include using namespace Aspose::Slides; using namespace System; static void AddSection() { auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); // Specify the slide that marks the beginning of the section. presentation->get_Sections()->AddSection(u"New Section", slide); presentation->Dispose(); } ``` ## **Access a Section** Read section information from a presentation. ```cpp #include #include #include using namespace Aspose::Slides; using namespace System; static void AccessSection() { auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); presentation->get_Sections()->AddSection(u"My Section", slide); // Access a section by index. auto section = presentation->get_Section(0); auto sectionName = section->get_Name(); presentation->Dispose(); } ``` ## **Remove a Section** Delete a previously added section. ```cpp #include #include using namespace Aspose::Slides; using namespace System; static void RemoveSection() { auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto section = presentation->get_Sections()->AddSection(u"Temporary Section", slide); // Remove the first section. presentation->get_Sections()->RemoveSection(section); presentation->Dispose(); } ``` ## **Rename a Section** Change the name of an existing section. ```cpp #include #include #include using namespace Aspose::Slides; using namespace System; static void RenameSection() { auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); presentation->get_Sections()->AddSection(u"Old Name", slide); auto section = presentation->get_Section(0); section->set_Name(u"New Name"); presentation->Dispose(); } ``` ## Related articles - [Manage Slide Sections in Presentations Using C++](https://docs.aspose.com/slides/cpp/slide-section/) - [Group Shape](https://docs.aspose.com/slides/cpp/examples/elements/group-shape/) # Slide Transition > Master slide transitions in Aspose.Slides for C++: add, customize, and sequence effects and durations with C++ examples for PPT, PPTX, and ODP presentations. Source: https://docs.aspose.com/slides/cpp/examples/elements/slide-transition/ Updated: 2026-08-05 This article demonstrates applying slide transition effects and timings with **Aspose.Slides for C++**. ## **Add a Slide Transition** Apply a fade transition effect to the first slide. ```cpp #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::SlideShow; using namespace System; static void AddSlideTransition() { auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); // Apply a fade transition. slide->get_SlideShowTransition()->set_Type(TransitionType::Fade); presentation->Dispose(); } ``` ## **Access a Slide Transition** Read the transition type currently assigned to a slide. ```cpp #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::SlideShow; using namespace System; static void AccessSlideTransition() { auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); slide->get_SlideShowTransition()->set_Type(TransitionType::Push); // Access the transition type. auto type = slide->get_SlideShowTransition()->get_Type(); presentation->Dispose(); } ``` ## **Remove a Slide Transition** Clear any transition effect by setting the type to `None`. ```cpp #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::SlideShow; using namespace System; static void RemoveSlideTransition() { auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); slide->get_SlideShowTransition()->set_Type(TransitionType::Fade); // Remove transition by setting none. slide->get_SlideShowTransition()->set_Type(TransitionType::None); presentation->Dispose(); } ``` ## **Set Transition Duration** Specify how long the slide is displayed before advancing automatically. ```cpp #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::SlideShow; using namespace System; static void SetTransitionDuration() { auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); slide->get_SlideShowTransition()->set_AdvanceOnClick(true); slide->get_SlideShowTransition()->set_AdvanceAfterTime(2000); // In milliseconds. presentation->Dispose(); } ``` ## Related articles - [Animation](https://docs.aspose.com/slides/cpp/examples/elements/animation/) - [Manage Slide Transitions in Presentations Using C++](https://docs.aspose.com/slides/cpp/slide-transition/) - [Manage Presentation Slides in C++](https://docs.aspose.com/slides/cpp/presentation-slide/) # Slide > Control slides in Aspose.Slides for C++: create, clone, reorder, resize, set backgrounds, and apply transitions with C++ for PPT, PPTX, and ODP presentations. Source: https://docs.aspose.com/slides/cpp/examples/elements/slide/ Updated: 2026-08-05 This article provides a series of examples that demonstrate how to work with slides using **Aspose.Slides for C++**. You’ll learn how to add, access, clone, reorder, and remove slides using the `Presentation` class. Each example below includes a brief explanation followed by a code snippet in C++. ## **Add a Slide** To add a new slide, you must first select a layout. In this example, we use the `Blank` layout and add an empty slide to the presentation. ```cpp #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; static void AddSlide() { auto presentation = MakeObject(); auto blankLayout = presentation->get_LayoutSlides()->GetByType(SlideLayoutType::Blank); presentation->get_Slides()->AddEmptySlide(blankLayout); presentation->Dispose(); } ``` > 💡 **Note:** Each slide layout is derived from a master slide, which defines the overall design and placeholder structure. The image below illustrates how master slides and their associated layouts are organized in PowerPoint. ![Master and Layout Relationship](https://docs.aspose.com/slides/cpp/examples/elements/slide/master-layout-slide.png) ## **Access Slides by Index** You can access slides using their index, or find a slide’s index based on a reference. This is useful for iterating through or modifying specific slides. ```cpp #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; static void AccessSlide() { auto presentation = MakeObject(); // Add another empty slide. auto blankLayout = presentation->get_LayoutSlides()->GetByType(SlideLayoutType::Blank); presentation->get_Slides()->AddEmptySlide(blankLayout); // Access slides by index. auto firstSlide = presentation->get_Slide(0); auto secondSlide = presentation->get_Slide(1); // Get slide index from a reference, then access it by index. auto secondSlideIndex = presentation->get_Slides()->IndexOf(secondSlide); auto secondSlideByIndex = presentation->get_Slide(secondSlideIndex); presentation->Dispose(); } ``` ## **Clone a Slide** This example demonstrates how to clone an existing slide. The cloned slide is automatically added to the end of the slide collection. ```cpp #include #include #include #include using namespace Aspose::Slides; using namespace System; static void CloneSlide() { auto presentation = MakeObject(); auto firstSlide = presentation->get_Slide(0); auto clonedSlide = presentation->get_Slides()->AddClone(firstSlide); auto clonedSlideIndex = presentation->get_Slides()->IndexOf(clonedSlide); presentation->Dispose(); } ``` ## **Reorder Slides** You can change the order of slides by moving one to a new index. In this case, we move a cloned slide to the first position. ```cpp #include #include #include #include using namespace Aspose::Slides; using namespace System; static void ReorderSlide() { auto presentation = MakeObject(); auto firstSlide = presentation->get_Slide(0); auto clonedSlide = presentation->get_Slides()->AddClone(firstSlide); presentation->get_Slides()->Reorder(0, clonedSlide); presentation->Dispose(); } ``` ## **Remove a Slide** To remove a slide, simply reference it and call `Remove`. This example adds a second slide and then removes the original, leaving only the new one. ```cpp #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; static void RemoveSlide() { auto presentation = MakeObject(); auto blankLayout = presentation->get_LayoutSlides()->GetByType(SlideLayoutType::Blank); auto secondSlide = presentation->get_Slides()->AddEmptySlide(blankLayout); auto firstSlide = presentation->get_Slide(0); presentation->get_Slides()->Remove(firstSlide); presentation->Dispose(); } ``` # SmartArt > Work with SmartArt in Aspose.Slides for C++: create, edit, convert, and style diagrams with C++ for PowerPoint and OpenDocument presentations. Source: https://docs.aspose.com/slides/cpp/examples/elements/smart-art/ Updated: 2026-08-05 This article demonstrates how to add SmartArt graphics, access them, remove them, and change layouts using **Aspose.Slides for C++**. ## **Add SmartArt** Insert a SmartArt graphic using one of the built-in layouts. ```cpp #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::SmartArt; using namespace System; static void AddSmartArt() { auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto smartArt = slide->get_Shapes()->AddSmartArt(50.0f, 50.0f, 400.0f, 300.0f, SmartArtLayoutType::BasicProcess); presentation->Dispose(); } ``` ## **Access SmartArt** Retrieve the first SmartArt object on a slide. ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::SmartArt; using namespace System; static void AccessSmartArt() { auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto smartArt = slide->get_Shapes()->AddSmartArt(50.0f, 50.0f, 400.0f, 300.0f, SmartArtLayoutType::BasicProcess); auto firstSmartArt = SharedPtr(); for (auto&& shape : slide->get_Shapes()) { if (ObjectExt::Is(shape)) { firstSmartArt = ExplicitCast(shape); break; } } presentation->Dispose(); } ``` ## **Remove SmartArt** Delete a SmartArt shape from the slide. ```cpp #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::SmartArt; using namespace System; static void RemoveSmartArt() { auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto smartArt = slide->get_Shapes()->AddSmartArt(50.0f, 50.0f, 400.0f, 300.0f, SmartArtLayoutType::BasicProcess); slide->get_Shapes()->Remove(smartArt); presentation->Dispose(); } ``` ## **Change SmartArt Layout** Update the layout type of an existing SmartArt graphic. ```cpp #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::SmartArt; using namespace System; static void ChangeSmartArtLayout() { auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto smartArt = slide->get_Shapes()->AddSmartArt(50.0f, 50.0f, 400.0f, 300.0f, SmartArtLayoutType::BasicBlockList); smartArt->set_Layout(SmartArtLayoutType::VerticalPictureList); presentation->Dispose(); } ``` ## Related articles - [Create and Customize PowerPoint SmartArt in C++](https://docs.aspose.com/slides/cpp/powerpoint-smartart/) - [Manage SmartArt Graphics in Presentations Using C++](https://docs.aspose.com/slides/cpp/manage-smartart-shape/) - [Manage SmartArt in PowerPoint Presentations Using C++](https://docs.aspose.com/slides/cpp/manage-smartart/) # Table > Work with tables in Aspose.Slides for C++: create, format, merge cells, apply styles, import data, and export with C++ examples for PPT, PPTX, and ODP. Source: https://docs.aspose.com/slides/cpp/examples/elements/table/ Updated: 2026-08-05 Examples for adding tables, accessing them, removing them, and merging cells using **Aspose.Slides for C++**. ## **Add a Table** Create a simple table with two rows and two columns. ```cpp #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; static void AddTable() { auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto widths = MakeArray({ 80, 80 }); auto heights = MakeArray({ 30, 30 }); auto table = slide->get_Shapes()->AddTable(50, 50, widths, heights); presentation->Dispose(); } ``` ## **Access a Table** Retrieve the first table shape on the slide. ```cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; static void AccessTable() { auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto widths = MakeArray({ 80, 80 }); auto heights = MakeArray({ 30, 30 }); auto table = slide->get_Shapes()->AddTable(50, 50, widths, heights); // Access first table on slide. auto firstTable = SharedPtr(); for (auto&& shape : slide->get_Shapes()) { if (ObjectExt::Is(shape)) { firstTable = ExplicitCast(shape); break; } } presentation->Dispose(); } ``` ## **Remove a Table** Delete a table from a slide. ```cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; static void RemoveTable() { auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto widths = MakeArray({ 80, 80 }); auto heights = MakeArray({ 30, 30 }); auto table = slide->get_Shapes()->AddTable(50, 50, widths, heights); slide->get_Shapes()->Remove(table); presentation->Dispose(); } ``` ## **Merge Table Cells** Merge adjacent cells of a table into a single cell. ```cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; static void MergeTableCells() { auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto widths = MakeArray({ 80, 80 }); auto heights = MakeArray({ 30, 30 }); auto table = slide->get_Shapes()->AddTable(50, 50, widths, heights); // Merge cells. table->MergeCells(table->idx_get(0, 0), table->idx_get(1, 1), false); presentation->Dispose(); } ``` ## Related articles - [Create and Customize PowerPoint Tables in C++](https://docs.aspose.com/slides/cpp/powerpoint-table/) - [Manage Table Cells in Presentations Using C++](https://docs.aspose.com/slides/cpp/manage-cells/) # Text Box > Work with text boxes in Aspose.Slides for C++: add, format, align, wrap, autofit, and style text using C++ for PPT, PPTX, and ODP presentations. Source: https://docs.aspose.com/slides/cpp/examples/elements/text-box/ Updated: 2026-08-05 In Aspose.Slides, a **text box** is represented by an `AutoShape`. Nearly any shape can contain text, but a typical text box has no fill or border and displays only text. This guide explains how to add, access, and remove text boxes programmatically. ## **Add a Text Box** A text box is simply an `AutoShape` with no fill or border and some formatted text. Here's how to create one: ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; using namespace System::Drawing; static void AddTextBox() { auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); // Create a rectangle shape (defaults to filled with border and no text). auto textBox = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 50, 75, 150, 100); // Remove fill and border to make it look like a typical text box. textBox->get_FillFormat()->set_FillType(FillType::NoFill); textBox->get_LineFormat()->get_FillFormat()->set_FillType(FillType::NoFill); // Set text formatting. auto paragraph = textBox->get_TextFrame()->get_Paragraph(0); auto textFormat = paragraph->get_ParagraphFormat()->get_DefaultPortionFormat(); textFormat->get_FillFormat()->set_FillType(FillType::Solid); textFormat->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Black()); // Assign the actual text content. textBox->get_TextFrame()->set_Text(u"Some text..."); presentation->Dispose(); } ``` > 💡 **Note:** Any `AutoShape` that contains a non-empty `TextFrame` can function as a text box. ## **Access Text Boxes by Content** To find all text boxes containing a specific keyword (e.g. "Slide"), iterate through the shapes and check their text: ```cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; static void AccessTextBox() { auto presentation = MakeObject(u"sample.pptx"); auto slide = presentation->get_Slide(0); for (auto&& shape : slide->get_Shapes()) { // Only AutoShapes can contain editable text. if (ObjectExt::Is(shape)) { auto autoShape = ExplicitCast(shape); auto text = autoShape->get_TextFrame()->get_Text(); if (text.Contains(u"Slide")) { // Do something with the matching text box. } } } presentation->Dispose(); } ``` ## **Remove Text Boxes by Content** This example finds and deletes all text boxes on the first slide that contain a specific keyword: ```cpp #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; using namespace System::Collections::Generic; static void RemoveTextBox() { auto presentation = MakeObject(u"sample.pptx"); auto slide = presentation->get_Slide(0); auto shapesToRemove = MakeObject>>(); for (auto&& shape : slide->get_Shapes()) { if (ObjectExt::Is(shape)) { auto autoShape = ExplicitCast(shape); if (autoShape->get_TextFrame()->get_Text().Contains(u"Slide")) { shapesToRemove->Add(shape); } } } for (auto&& shape : shapesToRemove) { slide->get_Shapes()->Remove(shape); } presentation->Dispose(); } ``` > 💡 **Tip:** Always create a copy of the shape collection before modifying it during iteration to avoid collection modification errors. ## Related articles - [Manage Text Boxes in Presentations Using C++](https://docs.aspose.com/slides/cpp/manage-textbox/) - [Enhance Your Presentations with AutoFit in C++](https://docs.aspose.com/slides/cpp/manage-autofit-settings/) # VBA Macro > Automate presentations with Aspose.Slides for C++: create, run, import, and secure VBA macros in PPT, PPTX, and ODP using clear C++ examples. Source: https://docs.aspose.com/slides/cpp/examples/elements/vba-macro/ Updated: 2026-08-05 This article demonstrates how to add, access, and remove VBA macros using **Aspose.Slides for C++**. ## **Add a VBA Macro** Create a presentation with a VBA project and a simple macro module. ```cpp #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Vba; using namespace System; static void AddVbaMacro() { auto presentation = MakeObject(); presentation->set_VbaProject(MakeObject()); auto module = presentation->get_VbaProject()->get_Modules()->AddEmptyModule(u"Module"); module->set_SourceCode(u"Sub Test()\n MsgBox \"Hi\" \nEnd Sub"); presentation->Dispose(); } ``` ## **Access a VBA Macro** Retrieve the first module from the VBA project. ```cpp #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Vba; using namespace System; static void AccessVbaMacro() { auto presentation = MakeObject(); presentation->set_VbaProject(MakeObject()); auto module = presentation->get_VbaProject()->get_Modules()->AddEmptyModule(u"Module"); module->set_SourceCode(u"Sub Test()\n MsgBox \"Hi\" \nEnd Sub"); auto firstModule = presentation->get_VbaProject()->get_Module(0); presentation->Dispose(); } ``` ## **Remove a VBA Macro** Delete a module from the VBA project. ```cpp #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Vba; using namespace System; static void RemoveVbaMacro() { auto presentation = MakeObject(); presentation->set_VbaProject(MakeObject()); auto module = presentation->get_VbaProject()->get_Modules()->AddEmptyModule(u"Module"); module->set_SourceCode(u"Sub Test()\n MsgBox \"Hi\" \nEnd Sub"); presentation->get_VbaProject()->get_Modules()->Remove(module); presentation->Dispose(); } ``` ## Related articles - [Manage VBA Projects in Presentations Using C++](https://docs.aspose.com/slides/cpp/presentation-via-vba/) # Video > Add and control videos with Aspose.Slides for C++: insert, play, trim, set poster frames, and export with C++ examples for PPT, PPTX, and ODP presentations. Source: https://docs.aspose.com/slides/cpp/examples/elements/video/ Updated: 2026-08-05 This article demonstrates how to embed video frames and set playback options using **Aspose.Slides for C++**. ## **Add a Video Frame** Insert an empty video frame onto a slide. ```cpp #include #include #include #include #include using namespace Aspose::Slides; using namespace System; static void AddVideo() { auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); // Add a video. auto videoFrame = slide->get_Shapes()->AddVideoFrame(50, 50, 320, 240, u"video.mp4"); presentation->Dispose(); } ``` ## **Access a Video Frame** Retrieve the first video frame added to a slide. ```cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; static void AccessVideo() { auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto videoFrame = slide->get_Shapes()->AddVideoFrame(50, 50, 320, 240, u"video.mp4"); // Access the first video frame on the slide. auto firstVideo = SharedPtr(); for (auto&& shape : slide->get_Shapes()) { if (ObjectExt::Is(shape)) { firstVideo = ExplicitCast(shape); break; } } presentation->Dispose(); } ``` ## **Remove a Video Frame** Delete a video frame from the slide. ```cpp #include #include #include #include #include using namespace Aspose::Slides; using namespace System; static void RemoveVideo() { auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto videoFrame = slide->get_Shapes()->AddVideoFrame(50, 50, 320, 240, u"video.mp4"); // Remove the video frame. slide->get_Shapes()->Remove(videoFrame); presentation->Dispose(); } ``` ## **Set Video Playback** Configure the video to play automatically when the slide is displayed. ```cpp #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; static void SetVideoPlayback() { auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto videoFrame = slide->get_Shapes()->AddVideoFrame(50, 50, 320, 240, u"video.mp4"); // Configure the video to play automatically. videoFrame->set_PlayMode(VideoPlayModePreset::Auto); presentation->Dispose(); } ``` ## Related articles - [Audio](https://docs.aspose.com/slides/cpp/examples/elements/audio/) - [Manage Video Frames in Presentations Using C++](https://docs.aspose.com/slides/cpp/video-frame/) # Integrate Excel Data into PowerPoint Presentations > Read data from Excel workbooks in Aspose.Slides using the ExcelDataWorkbook API. Load sheets and cells and use values to generate data-driven PowerPoint presentations. Source: https://docs.aspose.com/slides/cpp/excel-integration/ Updated: 2026-08-12 ## **Introduction** PowerPoint presentations are a powerful way to display and communicate information. They are often used in conjunction with Excel workbooks, where Excel serves as an excellent source of structured data and PowerPoint excels at visualizing that data for an audience. There are many practical scenarios where combining Excel and PowerPoint is essential: mail merges, populating data tables, generating one slide per data record (batch slide generation), creating training materials, and consolidating multiple Excel reports into a single presentation, to name a few. Until now, implementing such features with the Aspose.Slides API required relying on third-party solutions like Aspose.Cells. While these tools are robust, they can be overly complex and costly for users who only need basic data integration functionality. ## **How It Works** To make working with Excel data easier and more streamlined, Aspose.Slides has introduced new classes for reading data from Excel workbooks and importing content into a presentation. This feature opens up powerful new possibilities for API users who want to leverage Excel as a data source within their presentation workflows. The new functionality is designed for general-purpose data access and is not integrated into the Presentation Document Object Model (DOM). That means *it does not allow editing or saving Excel files* — its sole purpose is to open workbooks and navigate through their content to retrieve cell data. At the core of this feature is the new [ExcelDataWorkbook](https://reference.aspose.com/slides/cpp/aspose.slides.excel/exceldataworkbook/) class. This class allows you to load an Excel workbook from a local file or a stream. Once loaded, it provides several overloads of the [ExcelDataWorkbook::GetCell](https://reference.aspose.com/slides/cpp/aspose.slides.excel/exceldataworkbook/getcell/) method, which you can use to retrieve specific cells by their position (e.g., row and column indices or named ranges). Each call to [ExcelDataWorkbook::GetCell](https://reference.aspose.com/slides/cpp/aspose.slides.excel/exceldataworkbook/getcell/) returns an instance of the [ExcelDataCell](https://reference.aspose.com/slides/cpp/aspose.slides.excel/exceldatacell/) class. This object represents a single cell in the Excel workbook and gives you access to its value in a simple and intuitive way. #### **Import an Excel Chart** The next step to extend functionality is the [ExcelWorkbookImporter](https://reference.aspose.com/slides/cpp/aspose.slides.import/excelworkbookimporter/) class. This utility class provides functionality for importing content from an Excel workbook into a presentation. It contains several overloads of the [ExcelWorkbookImporter::AddChartFromWorkbook](https://reference.aspose.com/slides/cpp/aspose.slides.import/excelworkbookimporter/addchartfromworkbook/) method, which help you to retrieve the selected chart from the specified Excel workbook and add it to the end of the given shape collection at the specified coordinates. #### **Import an Excel Table** The [ExcelWorkbookImporter](https://reference.aspose.com/slides/cpp/aspose.slides.import/excelworkbookimporter/) class also contains several overloads of the [ExcelWorkbookImporter::AddTableFromWorkbook](https://reference.aspose.com/slides/cpp/aspose.slides.import/excelworkbookimporter/addtablefromworkbook/) method. These methods allow you to import a specified cell range from a specified worksheet and add it as a table to the end of the given shape collection at the specified coordinates. In short, it's a lightweight and straightforward API for reading Excel data — exactly what many developers need without the overhead of a full spreadsheet processing library. ## **Let's Code** ### **Mail Merge Scenario Example** In the following example, we'll implement a simple Mail Merge scenario by generating multiple presentations based on data stored in an Excel workbook. To get started, we need two things: 1. An Excel workbook containing the data ![Excel data example](https://docs.aspose.com/slides/cpp/excel-integration/example1_image0.png) 2. PowerPoint presentation template ![PowerPoint template example](https://docs.aspose.com/slides/cpp/excel-integration/example1_image1.png) ```cpp #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Excel; using namespace Aspose::Slides::Export; using namespace System; // Load the Excel workbook with employee data. auto workbook = MakeObject(u"TemplateData.xlsx"); auto worksheetIndex = 0; // Load the presentation template. auto templatePresentation = MakeObject(u"PresentationTemplate.pptx"); // Loop through Excel rows (excluding header at row 0). for (auto rowIndex = 1; rowIndex <= 4; rowIndex++) { // Create a new presentation for each employee record. auto employeePresentation = MakeObject(); // Remove the default blank slide. employeePresentation->get_Slides()->RemoveAt(0); // Clone the template slide into the new presentation. auto slide = employeePresentation->get_Slides()->AddClone(templatePresentation->get_Slide(0)); // Get paragraphs from the target shape (assumes shape index 1 is used). auto paragraphs = ExplicitCast(slide->get_Shape(1))->get_TextFrame()->get_Paragraphs(); // Replace the placeholders with data from Excel. auto employeeName = workbook->GetCell(worksheetIndex, rowIndex, 0)->get_Value()->ToString(); auto namePortion = paragraphs->idx_get(0)->get_Portion(0); namePortion->set_Text(namePortion->get_Text().Replace(u"{{EmployeeName}}", employeeName)); auto department = workbook->GetCell(worksheetIndex, rowIndex, 1)->get_Value()->ToString(); auto departmentPortion = paragraphs->idx_get(1)->get_Portion(0); departmentPortion->set_Text(departmentPortion->get_Text().Replace(u"{{Department}}", department)); auto yearsOfService = workbook->GetCell(worksheetIndex, rowIndex, 2)->get_Value()->ToString(); auto yearsPortion = paragraphs->idx_get(2)->get_Portion(0); yearsPortion->set_Text(yearsPortion->get_Text().Replace(u"{{YearsOfService}}", yearsOfService)); // Save the personalized presentation to a separate file. employeePresentation->Save(String::Format(u"{0} Report.pptx", employeeName), SaveFormat::Pptx); employeePresentation->Dispose(); } templatePresentation->Dispose(); ``` ![Result](https://docs.aspose.com/slides/cpp/excel-integration/example1_image2.png) ### **Excel Table Example** In the second example, we simply copy data from an Excel table and display it on a PowerPoint slide in a more visually appealing format. In this example, we reuse the same Excel workbook from the first example, which contains a simple employee table. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Excel; using namespace Aspose::Slides::Export; using namespace System; // Load the Excel workbook containing the employee data. auto workbook = MakeObject(u"TemplateData.xlsx"); auto worksheetIndex = 0; // Create a new PowerPoint presentation. auto presentation = MakeObject(); // Add a table shape to the first slide. auto table = presentation->get_Slide(0)->get_Shapes()->AddTable( 50, 200, MakeArray({200, 200, 200}), MakeArray({30, 30, 30, 30, 30}) ); // Fill the PowerPoint table with data from the Excel workbook. for (auto rowIndex = 0; rowIndex < 5; rowIndex++) { for (auto columnIndex = 0; columnIndex < 3; columnIndex++) { auto cellValue = workbook->GetCell(worksheetIndex, rowIndex, columnIndex)->get_Value()->ToString(); table->get_Column(columnIndex)->idx_get(rowIndex)->get_TextFrame()->set_Text(cellValue); } } // Save the resulting presentation to a file. presentation->Save(u"Table.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ![Result](https://docs.aspose.com/slides/cpp/excel-integration/example2_image0.png) ### **Import an Excel Chart Example** In this example, we import a chart from the first worksheet of the Excel workbook used in the previous example. The chart will link to the external workbook in the resulting presentation. First, we add a Pie chart to the Excel workbook based on the employees table. ![Excel Chart example](https://docs.aspose.com/slides/cpp/excel-integration/example3_image0.png) ```cpp #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace Aspose::Slides::Import; using namespace System; // Create a new PowerPoint presentation. auto presentation = MakeObject(); // Get the shapes collection of the first slide. auto shapes = presentation->get_Slide(0)->get_Shapes(); // Import the chart named "Chart 1" from the first sheet of the workbook and add it to the shapes collection. ExcelWorkbookImporter::AddChartFromWorkbook(shapes, 10.0, 10.0, u"TemplateData.xlsx", u"Sheet1", u"Chart 1", false); // Save the resulting presentation to a file. presentation->Save(u"Chart.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ![Result](https://docs.aspose.com/slides/cpp/excel-integration/example3_image1.png) ### **Import All Excel Charts Example** Let's imagine you have an Excel workbook full of charts and you need to import them all into a presentation. Each chart should be placed on a new slide. The following code iterates through all worksheets in the source Excel file, extracts the charts from each worksheet, and adds each chart to a separate slide using a blank slide layout. In the resulting presentation, only the chart data will be embedded, not the entire workbook. ```cpp #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Excel; using namespace Aspose::Slides::Export; using namespace Aspose::Slides::Import; using namespace System; // Load the Excel workbook containing the employee data. auto workbook = MakeObject(u"ExcelWithCharts.xlsx"); // Create a new PowerPoint presentation. auto presentation = MakeObject(); // Retrieve the blank slide layout. auto blankLayout = presentation->get_LayoutSlides()->GetByType(SlideLayoutType::Blank); // Get the names of all worksheets contained in the Excel workbook. auto worksheetNames = workbook->GetWorksheetNames(); for (auto&& name : worksheetNames) { // Retrieve a dictionary that maps chart indexes to chart names for the worksheet. auto worksheetCharts = workbook->GetChartsFromWorksheet(name); for (auto&& chart : worksheetCharts) { // Add a new slide using the blank layout. auto slide = presentation->get_Slides()->AddEmptySlide(blankLayout); // Import the specified chart from the Excel workbook into the slide's shapes collection. ExcelWorkbookImporter::AddChartFromWorkbook(slide->get_Shapes(), 10.0, 10.0, workbook, name, chart.get_Key(), false); } } // Save the resulting presentation to a file. presentation->Save(u"Charts.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ### **Import an Excel Table Example** In this example, we import a formatted table from an Excel worksheet directly into a PowerPoint presentation. The source Excel worksheet contains a formatted table with employee data: ![Excel Table example](https://docs.aspose.com/slides/cpp/excel-integration/example4_image0.png) ```cpp #include #include #include #include #include using Aspose::Slides::Presentation; using Aspose::Slides::Export::SaveFormat; using Aspose::Slides::Import::ExcelWorkbookImporter; using System::MakeObject; // Create a new PowerPoint presentation. auto presentation = MakeObject(); // Get the shapes collection of the first slide. auto shapes = presentation->get_Slide(0)->get_Shapes(); // Import the table from the first sheet of the workbook and add it to the shapes collection. ExcelWorkbookImporter::AddTableFromWorkbook( shapes, 10.0f, 10.0f, u"TemplateData.xlsx", u"Sheet1", u"A1:C5"); // Save the resulting presentation to a file. presentation->Save(u"FormattedTable.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ![Result](https://docs.aspose.com/slides/cpp/excel-integration/example4_image1.png) ## **Summary** This mechanism, available directly in Aspose.Slides, combines working with Excel data and presentations in one place. It allows you to create slides with visual charts and data presented as Excel tables - without any additional libraries or complex integrations. # Export Presentation Charts in C++ > Learn how to export presentation charts with Aspose.Slides for C++, supporting PPT and PPTX formats, and streamline reporting into any workflow. Source: https://docs.aspose.com/slides/cpp/export-chart/ Updated: 2026-08-05 ## **Overview** Aspose.Slides allows you to export a chart from a presentation as an image. This article shows how to get an image from a chart and save it, which is useful when you need to reuse chart visuals outside a PowerPoint presentation. ## **Get a Chart Image** Aspose.Slides for C++ provides support for extracting image of specific chart. Below sample example is given.  ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace System; auto presentation = MakeObject(u"test.pptx"); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::ClusteredColumn, 0, 0, 500, 500); auto image = chart->GetImage(); image->Save(u"image.png", ImageFormat::Png); image->Dispose(); presentation->Dispose(); ``` ## **FAQ** ### Can I export a chart as a vector (SVG) instead of a raster image? Yes. A chart is a shape, and its contents can be saved to SVG using the [shape-to-SVG saving method](https://reference.aspose.com/slides/cpp/aspose.slides/shape/writeassvg/). ### How can I set the exact size of the exported chart in pixels? Use the image-rendering overloads that let you specify size or scale—the library supports rendering objects with given dimensions/scale. ### What should I do if fonts in labels and the legend look wrong after export? [Load the required fonts](https://docs.aspose.com/slides/cpp/custom-font/) via [FontsLoader](https://reference.aspose.com/slides/cpp/aspose.slides/fontsloader/) so the chart rendering preserves metrics and text appearance. ### Does export honor the PowerPoint theme, styles, and effects? Yes. Aspose.Slides’ renderer follows the presentation’s formatting (themes, styles, fills, effects), so the chart’s appearance is preserved. ### Where can I find available rendering/export capabilities beyond chart images? See the export section of the [API](https://reference.aspose.com/slides/cpp/aspose.slides.export/)/[documentation](https://docs.aspose.com/slides/cpp/convert-powerpoint/) for output targets ([PDF](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-pdf/), [SVG](https://docs.aspose.com/slides/cpp/render-a-slide-as-an-svg-image/), [XPS](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-xps/), [HTML](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-html/), etc.) and related rendering options. # Convert Presentations to HTML5 in C++ > Export PowerPoint & OpenDocument presentations to responsive HTML5 with Aspose.Slides for C++. Preserve formatting, animations, and interactivity. Source: https://docs.aspose.com/slides/cpp/export-to-html5/ Updated: 2026-10-05 ## **Overview** This article explains how to convert PowerPoint presentations to HTML5 using Aspose.Slides for C++. It covers basic export, control of shape animations and slide transitions, and comment layout. It also compares HTML5 output with the SVG-based output of standard HTML export. ## **Export PowerPoint to HTML5** The following example loads a presentation from the working directory and saves it in HTML5 format. It uses the default export settings; the next example shows how to control animation playback explicitly. Replace the input path with the path to your presentation. ```cpp #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(u"pres.pptx"); presentation->Save(u"pres.html", SaveFormat::Html5); presentation->Dispose(); ``` Besides the HTML document, the export writes supporting CSS and JavaScript files for slide styling, animations, effects, and navigation. Keep these files with the HTML document when moving or publishing the output. The generated page also loads jQuery and Anime.js from public CDNs; without them, slide navigation and animations do not run. To export without playing shape animations or slide transitions, pass `false` to [set_AnimateShapes](https://reference.aspose.com/slides/cpp/aspose.slides.export/html5options/set_animateshapes/) and [set_AnimateTransitions](https://reference.aspose.com/slides/cpp/aspose.slides.export/html5options/set_animatetransitions/) in [Html5Options](https://reference.aspose.com/slides/cpp/aspose.slides.export/html5options/). These settings are independent, so you can enable one while disabling the other. The example exports the presentation with both types of animation disabled in the generated page. ```cpp #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto html5Options = System::MakeObject(); html5Options->set_AnimateShapes(false); html5Options->set_AnimateTransitions(false); auto presentation = System::MakeObject(u"pres.pptx"); presentation->Save(u"pres5.html", SaveFormat::Html5, html5Options); presentation->Dispose(); ``` ## **Export PowerPoint to HTML** The standard HTML export uses a different rendering approach: slide content is represented by SVG inside an HTML page. The following example converts a presentation to an HTML document using this rendering approach. ```cpp #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(u"pres.pptx"); presentation->Save(u"pres.html", SaveFormat::Html); presentation->Dispose(); ``` The simplified markup below illustrates the structure of the generated page. The SVG element contains the rendered slide content; the placeholder text represents that content and is not literal export output. ```html
THE SLIDE CONTENT GOES HERE
``` The SVG-based export does not expose PowerPoint shapes as individual HTML elements. Use HTML5 export when you need the shape-animation and slide-transition options demonstrated in this article. ## **Export PowerPoint to HTML5 Slide View** HTML5 export produces a page for viewing and navigating the presentation slides in a browser. This example passes `true` to both [set_AnimateShapes](https://reference.aspose.com/slides/cpp/aspose.slides.export/html5options/set_animateshapes/) and [set_AnimateTransitions](https://reference.aspose.com/slides/cpp/aspose.slides.export/html5options/set_animatetransitions/) so that the exported slide view can play effects from the source presentation. Use a presentation that already contains shape animations and slide transitions to see the effect of these settings. Enabling them does not add new effects to slides that have none. After export, open the generated HTML5 document in a browser with its supporting files available. ```cpp #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto html5Options = System::MakeObject(); html5Options->set_AnimateShapes(true); html5Options->set_AnimateTransitions(true); auto presentation = System::MakeObject(u"pres.pptx"); presentation->Save(u"HTML5-slide-view.html", SaveFormat::Html5, html5Options); presentation->Dispose(); ``` ## **Convert a Presentation to an HTML5 Document with Comments** You can include existing slide comments in HTML5 output so that readers can see feedback alongside the slide content. The example in this section expects the source presentation to contain comments, as illustrated below. It exports those comments; it does not create new ones. ![Two comments on the presentation slide](https://docs.aspose.com/slides/cpp/export-to-html5/two_comments_pptx.png) Pass a [NotesCommentsLayoutingOptions](https://reference.aspose.com/slides/cpp/aspose.slides.export/notescommentslayoutingoptions/) object to the [set_SlidesLayoutOptions](https://reference.aspose.com/slides/cpp/aspose.slides.export/html5options/set_slideslayoutoptions/) method of [Html5Options](https://reference.aspose.com/slides/cpp/aspose.slides.export/html5options/). Call [set_CommentsPosition](https://reference.aspose.com/slides/cpp/aspose.slides.export/notescommentslayoutingoptions/set_commentsposition/) with `CommentsPositions::Right` from the [CommentsPositions](https://reference.aspose.com/slides/cpp/aspose.slides.export/commentspositions/) enumeration to place the comments to the right of each slide. The following example exports the presentation to HTML5 with this comment layout. A presentation without comments will have no comment text to display. ```cpp #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto layoutOptions = System::MakeObject(); layoutOptions->set_CommentsPosition(CommentsPositions::Right); auto html5Options = System::MakeObject(); html5Options->set_SlidesLayoutOptions(layoutOptions); auto presentation = System::MakeObject(u"sample.pptx"); presentation->Save(u"output.html", SaveFormat::Html5, html5Options); presentation->Dispose(); ``` The image below shows the exported HTML5 document with the comments displayed beside the slide. ![The comments in the output HTML5 document](https://docs.aspose.com/slides/cpp/export-to-html5/two_comments_html5.png) ## **Exclude JavaScript Hyperlinks During Export** Suppose `hyperlinks.pptx` contains linked text with a `javascript:alert('Hello')` target and an ordinary `https://example.com/` link. To exclude the JavaScript hyperlink during export, call [SaveOptions::set_SkipJavaScriptLinks](https://reference.aspose.com/slides/cpp/aspose.slides.export/saveoptions/set_skipjavascriptlinks/) with `true`. The default is `false`, so these links are not filtered unless you enable the option. The following example loads the presentation from the working directory and exports it using [Html5Options](https://reference.aspose.com/slides/cpp/aspose.slides.export/html5options/): ```cpp #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto html5Options = System::MakeObject(); html5Options->set_SkipJavaScriptLinks(true); auto presentation = System::MakeObject(u"hyperlinks.pptx"); presentation->Save(u"filtered-html5.html", SaveFormat::Html5, html5Options); presentation->Dispose(); ``` The exported file omits the JavaScript hyperlink while retaining its text and the ordinary HTTPS link. The source presentation is unchanged. This option filters JavaScript hyperlinks; it does not remove all scripts or other active content, nor does it guarantee CSP compliance. For example, HTML5 output still includes scripts for slide navigation and animations. ## **FAQ** **Can I control whether object animations and slide transitions will play in HTML5?** Yes, HTML5 export provides separate options to enable or disable [shape animations](https://reference.aspose.com/slides/cpp/aspose.slides.export/html5options/set_animateshapes/) and [slide transitions](https://reference.aspose.com/slides/cpp/aspose.slides.export/html5options/set_animatetransitions/). **Are comments supported, and where can they be placed relative to the slide?** Yes, existing comments can be included in HTML5 output and positioned (for example, to the right of the slide) through [layout settings](https://reference.aspose.com/slides/cpp/aspose.slides.export/html5options/set_slideslayoutoptions/) for notes and comments. **Can I skip links that invoke JavaScript for security or CSP reasons?** Yes, the [set_SkipJavaScriptLinks](https://reference.aspose.com/slides/cpp/aspose.slides.export/saveoptions/set_skipjavascriptlinks/) method allows you to skip hyperlinks with JavaScript calls during saving. The default is `false`. See [Exclude JavaScript Hyperlinks During Export](https://docs.aspose.com/slides/cpp/export-to-html5/#exclude-javascript-hyperlinks-during-export) for an HTML5 export example and the scope of the filter. This setting does not remove the JavaScript used by the HTML5 viewer for navigation and animations. # Export Presentations to XAML in C++ > Convert PowerPoint and OpenDocument slides to XAML in C++ using Aspose.Slides—quick, Office-free solution that keeps your layout intact. Source: https://docs.aspose.com/slides/cpp/export-to-xaml/ Updated: 2026-09-16 ## **Overview** This article explains how to export PowerPoint presentations to XAML using Aspose.Slides. It includes a brief introduction to XAML, shows how to save a presentation to XAML with default settings, and demonstrates how to customize the export through [XamlOptions](https://reference.aspose.com/slides/cpp/aspose.slides.export.xaml/xamloptions/), including exporting hidden slides. The article also answers a few common questions related to fallback fonts, XAML stack compatibility, and hidden slide export behavior. ## **About XAML** XAML is an XML-based markup language used to describe user interfaces in frameworks such as WPF (Windows Presentation Foundation), UWP (Universal Windows Platform), and Xamarin.Forms. You can work with XAML files in a visual designer or write and edit the markup directly. ## **Export Presentations to XAML With Default Options** The following C++ example shows how to export a presentation to XAML with default settings: ```cpp #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export::Xaml; auto presentation = System::MakeObject(u"pres.pptx"); auto xamlOptions = System::MakeObject(); presentation->Save(xamlOptions); ``` By default, the exported slides are saved in a `pres` subfolder of the process's current working directory, as returned by [Directory::GetCurrentDirectory](https://reference.aspose.com/slides/cpp/system.io/directory/getcurrentdirectory/). The folder is created automatically, and any required images are saved there as well. The output folder name is taken from the source file name without its extension. For `pres.pptx`, the output files are named `pres/Slide_1.xaml`, `pres/Slide_2.xaml`, and so on. Even if you pass an absolute path to the input presentation, the output folder is created relative to the current working directory, rather than alongside the input file. ## **Export Presentations to XAML With Custom Options** Use the [IXamlOptions](https://reference.aspose.com/slides/cpp/aspose.slides.export.xaml/ixamloptions/) interface to control how Aspose.Slides exports a presentation to XAML. To save the output to a custom location, implement [IXamlOutputSaver](https://reference.aspose.com/slides/cpp/aspose.slides.export.xaml/ixamloutputsaver/) and pass an instance of your implementation to the [set_OutputSaver](https://reference.aspose.com/slides/cpp/aspose.slides.export.xaml/xamloptions/set_outputsaver/) method of [XamlOptions](https://reference.aspose.com/slides/cpp/aspose.slides.export.xaml/xamloptions/). To include hidden slides in the XAML output, pass `true` to the [set_ExportHiddenSlides](https://reference.aspose.com/slides/cpp/aspose.slides.export.xaml/xamloptions/set_exporthiddenslides/) method, as shown in the following C++ example: ```cpp #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export::Xaml; auto presentation = System::MakeObject(u"pres.pptx"); auto xamlOptions = System::MakeObject(); xamlOptions->set_ExportHiddenSlides(true); presentation->Save(xamlOptions); ``` ## **Capture All Generated XAML Artifacts** A XAML export can produce a XAML document for each exported slide plus separate images and supporting resources. Pass a custom [IXamlOutputSaver](https://reference.aspose.com/slides/cpp/aspose.slides.export.xaml/ixamloutputsaver/) to [XamlOptions::set_OutputSaver](https://reference.aspose.com/slides/cpp/aspose.slides.export.xaml/xamloptions/set_outputsaver/) to receive these artifacts instead of using the default file-system saver. Start the export with the XAML-specific [Presentation::Save](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/save/) overload that accepts XAML options. ### **Understand the Callback Lifecycle** The exporter calls [IXamlOutputSaver::Save](https://reference.aspose.com/slides/cpp/aspose.slides.export.xaml/ixamloutputsaver/save/) separately for each generated artifact: - `path` identifies the artifact and may include relative directories. Retain this information because XAML may reference resources using relative paths. - `data` contains the artifact's bytes. Images and other binary resources must not be decoded as text. - The saver is responsible for retaining or persisting the data before returning. The examples copy each byte array into application-owned memory. - Treat export as successful only when the presentation save operation returns and every callback has completed successfully. Do not swallow storage errors or start unobserved background writes. If persistence happens afterward, report overall success only after that step also succeeds. [XamlOptions::set_ExportHiddenSlides](https://reference.aspose.com/slides/cpp/aspose.slides.export.xaml/xamloptions/set_exporthiddenslides/) also applies to a custom saver. The default setting, `false`, excludes hidden-slide XAML documents. Setting it to `true` includes them and any resources required for their export. Resource counts depend on the presentation; do not assume one callback per slide or a fixed callback order. ### **Export to Memory and Inspect the Artifacts** This complete example loads `pres.pptx`, collects every artifact in a [Dictionary>](https://reference.aspose.com/slides/cpp/system.collections.generic/dictionary/), and prints its name, type, and byte count. It preserves the supplied names exactly. Duplicate names cause collection to fail instead of silently overwriting an artifact. ```cpp #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export::Xaml; using namespace System; using namespace System::Collections::Generic; using namespace System::IO; using namespace System::Text; class InMemoryXamlExample { class MemoryXamlSaver : public IXamlOutputSaver { public: using ArtifactDictionary = Dictionary>; SharedPtr Artifacts = MakeObject(StringComparer::get_Ordinal()); void Save(String path, ArrayPtr data) override { auto retainedData = data->Clone(); Artifacts->Add(path, retainedData); } }; public: static void Run() { auto saver = MakeObject(); auto presentation = MakeObject(u"pres.pptx"); auto options = MakeObject(); options->set_OutputSaver(saver); options->set_ExportHiddenSlides(true); presentation->Save(options); auto inspectXamlText = false; for (const auto& artifact : saver->Artifacts) { auto extension = Path::GetExtension(artifact.get_Key()).ToLowerInvariant(); auto isXaml = extension == u".xaml"; auto isImage = extension == u".png" || extension == u".jpg" || extension == u".jpeg" || extension == u".gif" || extension == u".bmp" || extension == u".tif" || extension == u".tiff" || extension == u".svg"; String kind = isXaml ? u"slide XAML" : isImage ? u"image" : u"supporting resource"; Console::WriteLine(u"{0}: {1} bytes ({2})", artifact.get_Key(), artifact.get_Value()->get_Length(), kind); // Decode only XAML, and only when textual inspection is needed. if (isXaml && inspectXamlText) { auto markup = Encoding::get_UTF8()->GetString(artifact.get_Value()); Console::WriteLine(markup); } } } }; ``` Call `InMemoryXamlExample::Run` from your application. Extension checks are useful for inspection; retain all artifacts, including unfamiliar resource types. Leave the bytes unchanged when storing or transmitting them. Use [Encoding::GetString](https://reference.aspose.com/slides/cpp/system.text/encoding/getstring/) with UTF-8 encoding only for XAML that needs textual processing. ### **Package Collected Artifacts in a ZIP Archive** This independent example collects the export, validates its names, and writes the original bytes into a ZIP archive. A unique archive name separates concurrent export jobs. ZIP entries use forward slashes and retain relative directories. Unsafe names or names that collide after normalization reject the entire package before it is written. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export::Xaml; using namespace System; using namespace System::Collections::Generic; using namespace System::IO; using namespace Aspose::Zip; class ZipXamlExample { class CollectedXamlSaver : public IXamlOutputSaver { public: using ArtifactDictionary = Dictionary>; SharedPtr Artifacts = MakeObject(StringComparer::get_Ordinal()); void Save(String path, ArrayPtr data) override { auto retainedData = data->Clone(); Artifacts->Add(path, retainedData); } }; public: static void Run() { auto saver = MakeObject(); auto presentation = MakeObject(u"pres.pptx"); auto options = MakeObject(); options->set_OutputSaver(saver); options->set_ExportHiddenSlides(false); presentation->Save(options); auto entries = MakeObject>>(StringComparer::get_OrdinalIgnoreCase()); for (const auto& artifact : saver->Artifacts) { auto entryName = artifact.get_Key().Replace(u'\\', u'/'); auto segments = entryName.Split(u'/'); auto unsafeName = entryName.StartsWith(u"/", StringComparison::Ordinal) || entryName.Contains(u":"); for (const auto& segment : segments) { unsafeName |= String::IsNullOrWhiteSpace(segment) || segment == u"." || segment == u".."; } if (unsafeName || entries->ContainsKey(entryName)) { Console::WriteLine(u"Export rejected: unsafe or duplicate artifact name: {0}", artifact.get_Key()); return; } entries->Add(entryName, artifact.get_Value()); } auto jobId = Guid::NewGuid(); auto archivePath = u"xaml-" + jobId.ToString(u"N") + u".zip"; auto archive = MakeObject(); for (const auto& artifact : entries) { auto fileName = Path::GetFileName(artifact.get_Key()); auto directoryName = Path::GetDirectoryName(artifact.get_Key()).Replace(u'\\', u'/'); archive->AddEntry(fileName, directoryName, artifact.get_Value()); } auto output = MakeObject(archivePath, FileMode::CreateNew, FileAccess::Write); archive->Save(output); output->Close(); archive->Dispose(); // Save finalizes the ZIP directory; close the file before reporting success. Console::WriteLine(u"Saved {0} artifacts to {1}", entries->get_Count(), archivePath); } }; ``` Call `ZipXamlExample::Run` from your application. The example uses `Aspose::Zip::ZipFile` from the C++ runtime to write one local archive; the exporter itself does not write loose XAML or image files. For remote storage, replace the archive-writing stage with uploads of the collected byte arrays. Use an export-job identifier plus the full relative artifact name as a blob key, or store the job identifier, relative name, and binary data in a database row. Publish the job only after all uploads complete or the database transaction commits. Clean up partial output if persistence fails. For large presentations, a custom saver can persist each artifact directly to application storage to avoid keeping an additional copy of the entire export in application memory. The exporter still collects all generated artifacts in memory before calling the saver. Keep each callback synchronous from the exporter's perspective: return only after the destination has accepted the bytes, and allow failures to reach the caller. ### **Preserve Resource Names and Verify References** - Normalize path separators when the destination requires it, but preserve relative directories. Do not use only [Path::GetFileName](https://reference.aspose.com/slides/cpp/system.io/path/getfilename/) unless every generated name is known to be unique and resource references remain valid. - Apply destination-specific name validation. When writing loose files, reject rooted paths and traversal segments, resolve the destination with [Path::GetFullPath](https://reference.aspose.com/slides/cpp/system.io/path/getfullpath/), and verify it stays beneath the intended export directory, including the directory separator in the containment check. Use an application-controlled directory without symbolic links that could redirect writes. - Use a separate saver and storage namespace for each export job. Detect collisions after separator normalization and according to the destination's case-sensitivity rules. - Before publishing, parse each XAML document as XML and inspect its file-based resource references, such as image `Source` or `ImageSource` attributes. Resolve each relative URI against the containing XAML artifact's directory, normalize the resulting storage name, and confirm that the corresponding dictionary key, ZIP entry, or stored object exists. Treat external URIs and XAML markup expressions separately from relative file names. For example, if `pres/Slide_1.xaml` references `images/image1.png`, the stored resource must be available as `pres/images/image1.png`. Keeping just `image1.png` would break that relationship. For object storage, preserve the same layout beneath the job prefix and make those resource URLs accessible to the XAML consumer. Reopen the completed ZIP to verify entry names and resource bytes, and load representative slides in the target XAML environment to confirm that images resolve correctly. ## **FAQ** **How can I ensure predictable fonts if the original font is not available on the machine?** Use [set_DefaultRegularFont](https://reference.aspose.com/slides/cpp/aspose.slides.export/saveoptions/set_defaultregularfont/) in [XamlOptions](https://reference.aspose.com/slides/cpp/aspose.slides.export.xaml/xamloptions/) — it is used as a fallback font during export when the original is missing. This does not guarantee that the generated XAML references the fallback font or that the font is available on the target machine. Ensure that the fonts referenced by the XAML are available in the environment where it is displayed. **Is the exported XAML intended only for WPF, or can it be used in other XAML stacks as well?** Aspose.Slides exports WPF XAML through its public API. Compatibility with other XAML stacks, such as UWP and Xamarin.Forms, is not guaranteed. Test the generated markup in your target environment. **Are hidden slides supported, and how can I prevent them from being exported by default?** By default, hidden slides are not included. You can control this behavior via [set_ExportHiddenSlides](https://reference.aspose.com/slides/cpp/aspose.slides.export.xaml/xamloptions/set_exporthiddenslides/) in [XamlOptions](https://reference.aspose.com/slides/cpp/aspose.slides.export.xaml/xamloptions/) — keep it disabled if you do not need to export them. # Export Math Equations from Presentations in C++ > Export math equations from PowerPoint presentations to LaTeX or MathML directly with Aspose.Slides for C++. Source: https://docs.aspose.com/slides/cpp/exporting-math-equations/ Updated: 2026-08-13 ## **Introduction** Aspose.Slides for C++ allows you to export math equations from presentations. For example, you may need to extract the mathematical equations on slides (from a specific presentation) and use them in another program or platform. You can export equations directly to LaTeX or to MathML, a popular standard for mathematical content used on the web and in many applications. ## **Export Math Equations to LaTeX** Aspose.Slides can convert a PowerPoint math equation directly to LaTeX; an intermediate MathML file and an external converter are not required. A math equation is stored in a text frame as an [IMathPortion](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imathportion/). Use [IMathPortion::get_MathParagraph](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imathportion/get_mathparagraph/) to get an [IMathParagraph](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imathparagraph/), and then call [IMathParagraph::ToLatex](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imathparagraph/tolatex/). The method returns a string that you can save, display, send to another application, or process further. The following example examines every text frame on every slide, finds all math portions, and writes each equation to a separate `.tex` file: ```cpp auto presentation = MakeObject(u"equations.pptx"); auto slideCount = presentation->get_Slides()->get_Count(); for (int slideIndex = 0; slideIndex < slideCount; slideIndex++) { auto slide = presentation->get_Slide(slideIndex); int slideNumber = slideIndex + 1; int equationNumber = 1; auto textFrames = SlideUtil::GetAllTextBoxes(slide); for (const auto&& textFrame : textFrames) { for (const auto&& paragraph : textFrame->get_Paragraphs()) { for (const auto&& portion : paragraph->get_Portions()) { auto mathPortion = System::AsCast(portion); if (mathPortion == nullptr) continue; auto mathParagraph = mathPortion->get_MathParagraph(); auto latexPath = String::Format(u"slide_{0}_equation_{1}.tex", slideNumber, equationNumber); auto latexText = mathParagraph->ToLatex(); File::WriteAllText(latexPath, latexText); equationNumber++; } } } } presentation->Dispose(); ``` [SlideUtil::GetAllTextBoxes](https://reference.aspose.com/slides/cpp/aspose.slides.util/slideutil/getalltextboxes/) returns all text frames found on a slide. The [IMathPortion](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imathportion/) type check separates genuine editable equations from ordinary text and images. LaTeX engines and document templates do not all support the same commands, packages, or Unicode characters. Test the returned string with the LaTeX engine used by your application. If a symbol or Office Math element has no suitable representation in that environment, replace it in the returned string with a project-specific command or skip the equation and record the issue for review. ## **Save Math Equations as MathML** While humans easily write the code for some equation formats like LaTeX, they struggle to write the code for MathML because the latter is meant to be generated automatically by apps. Programs read and parse MathML easily because its code is in XML, so MathML is commonly used as an output and printing format in many fields. This sample code shows you how to export a math equation from a presentation to MathML: ``` cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::MathText; using namespace System; using namespace System::IO; SharedPtr pres = System::MakeObject(); auto autoShape = pres->get_Slides()->idx_get(0)->get_Shapes()->AddMathShape(0.0f, 0.0f, 500.0f, 50.0f); auto mathPortion = System::ExplicitCast(autoShape->get_TextFrame()->get_Paragraphs()->idx_get(0)->get_Portions()->idx_get(0)); auto mathParagraph = mathPortion->get_MathParagraph(); mathParagraph->Add(System::MakeObject(u"a") ->SetSuperscript(u"2") ->Join(u"+") ->Join(System::MakeObject(u"b") ->SetSuperscript(u"2")) ->Join(u"=") ->Join(System::MakeObject(u"c") ->SetSuperscript(u"2"))); SharedPtr stream = System::MakeObject(u"mathml.xml", FileMode::Create); mathParagraph->WriteAsMathMl(stream); ``` ## **FAQ** **What exactly is exported to MathML—a paragraph or an individual formula block?** You can export either an entire math paragraph ([MathParagraph](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/mathparagraph/)) or an individual block ([MathBlock](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/mathblock/)) to MathML. Both types provide a method to write to MathML. **How can I tell that an object on a slide is a math formula rather than regular text or an image?** A formula lives in a [MathPortion](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/mathportion/) and has a [MathParagraph](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/mathparagraph/). Images and regular text portions without a [MathParagraph](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/mathparagraph/) are not exportable formulas. **Where does the MathML come from in a presentation—is it PowerPoint-specific or a standard?** The export targets standard MathML (XML). Aspose uses Presentation MathML—the presentation subset of the standard—which is widely used across applications and the web. **Is exporting formulas inside tables, SmartArt, groups, etc., supported?** Yes, if those objects contain text portions with a [MathParagraph](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/mathparagraph/) (i.e., genuine PowerPoint formulas), they are exported. If a formula is embedded as an image, it is not. **Does exporting to MathML modify the original presentation?** No. Writing MathML is a serialization of the formula’s content; it does not modify the presentation file. ## Related articles - [Add Math Equations to PowerPoint Presentations in C++](https://docs.aspose.com/slides/cpp/powerpoint-math-equations/) # Export Presentations to HTML with Externally Linked Images > Export PowerPoint and OpenDocument presentations to HTML in C++ using Aspose.Slides with images and other resources saved as external linked files. Source: https://docs.aspose.com/slides/cpp/exporting-presentations-to-html-with-externally-linked-images/ Updated: 2026-08-05 ## **Overview** By default, Aspose.Slides exports a presentation to a self-contained HTML file. Images and other resources are written directly into the HTML, usually as Base64 data. This is convenient when you need one portable file, but it is not always the best format for a website, a CMS, or a server-side conversion pipeline. Use externally linked resources when you want to: - reduce the size of the HTML document; - cache images, fonts, audio, or video separately in a browser or CDN; - inspect, replace, compress, or post-process generated resources after export; - keep the output structure closer to what a web application expects. For the general HTML conversion workflow, see [Convert PowerPoint Presentations to HTML](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-html/). This article focuses on the resource-linking part of the export. ## **How Linked Resource Export Works** [ILinkEmbedController](https://reference.aspose.com/slides/cpp/aspose.slides.export/ilinkembedcontroller/) lets your application decide, resource by resource, whether the exporter embeds the data in the HTML or saves it externally and writes a link. The interface has three methods: - [ILinkEmbedController::GetObjectStoringLocation](https://reference.aspose.com/slides/cpp/aspose.slides.export/ilinkembedcontroller/getobjectstoringlocation/) decides whether a resource should be linked or embedded. - [ILinkEmbedController::GetUrl](https://reference.aspose.com/slides/cpp/aspose.slides.export/ilinkembedcontroller/geturl/) returns the URL that will be written to the generated HTML or to another linked resource. - [ILinkEmbedController::SaveExternal](https://reference.aspose.com/slides/cpp/aspose.slides.export/ilinkembedcontroller/saveexternal/) writes the linked resource data to disk or to another storage target. The file system path and the browser URL are separate concerns. For example, the sample below writes resource files to `html-output/assets` on disk, while the HTML contains relative URLs such as `assets/resource-1.svg`. A browser resolves those URLs relative to the file that contains the link. Therefore, a link from `presentation.html` to an SVG file uses `assets/resource-1.svg`, while a link from that SVG file to an image saved in the same `assets` folder uses `resource-4.jpg`. ## **Export HTML with Linked Resources** The following C++ example creates an output directory, saves the HTML file there, and stores linked resources in an `assets` subdirectory. The controller links common image, font, audio, video, and CSS resources when Aspose.Slides provides or can infer a safe file extension. Resources that are not recognized remain embedded. ```cpp #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides::Export; using namespace System; using namespace System::Collections::Generic; using namespace System::IO; class ExternalResourceController : public ILinkEmbedController { public: ExternalResourceController(String assetDirectory, String assetUrlPrefix) { if (IsNullOrWhiteSpace(assetDirectory)) { throw Exception(u"The asset output directory must not be empty."); } m_assetDirectory = assetDirectory; m_assetUrlPrefix = NormalizeUrlPrefix(assetUrlPrefix); m_fileNamesByResourceId = MakeObject>(); } LinkEmbedDecision GetObjectStoringLocation( int resourceId, ArrayPtr entityData, String semanticName, String contentType, String recommendedExtension) override { auto extension = ResolveExtension(contentType, recommendedExtension); if (String::IsNullOrEmpty(extension)) { return LinkEmbedDecision::Embed; } auto fileName = String::Format(u"resource-{0}{1}", resourceId, extension); m_fileNamesByResourceId->Add(resourceId, fileName); return LinkEmbedDecision::Link; } String GetUrl(int resourceId, int referrer) override { String fileName; if (!m_fileNamesByResourceId->TryGetValue(resourceId, fileName)) { return nullptr; } if (m_fileNamesByResourceId->ContainsKey(referrer)) { return fileName; } return m_assetUrlPrefix + fileName; } void SaveExternal(int resourceId, ArrayPtr entityData) override { String fileName; if (!m_fileNamesByResourceId->TryGetValue(resourceId, fileName)) { auto message = String::Format(u"Resource {0} was not registered for external storage.", resourceId); throw Exception(message); } if (entityData == nullptr || entityData->get_Length() == 0) { auto message = String::Format(u"Resource {0} contains no data and cannot be saved.", resourceId); throw Exception(message); } Directory::CreateDirectory_(m_assetDirectory); auto filePath = Path::Combine(m_assetDirectory, fileName); auto fileStream = MakeObject(filePath, FileMode::Create, FileAccess::Write); fileStream->Write(entityData, 0, entityData->get_Length()); fileStream->Close(); } private: String m_assetDirectory; String m_assetUrlPrefix; SharedPtr> m_fileNamesByResourceId; static SharedPtr> GetExtensionsByContentType() { auto extensionsByContentType = MakeObject>(); extensionsByContentType->Add(u"image/jpeg", u".jpg"); extensionsByContentType->Add(u"image/png", u".png"); extensionsByContentType->Add(u"image/gif", u".gif"); extensionsByContentType->Add(u"image/bmp", u".bmp"); extensionsByContentType->Add(u"image/svg+xml", u".svg"); extensionsByContentType->Add(u"image/tiff", u".tiff"); extensionsByContentType->Add(u"image/x-emf", u".emf"); extensionsByContentType->Add(u"image/x-wmf", u".wmf"); extensionsByContentType->Add(u"font/woff", u".woff"); extensionsByContentType->Add(u"font/woff2", u".woff2"); extensionsByContentType->Add(u"font/ttf", u".ttf"); extensionsByContentType->Add(u"application/font-woff", u".woff"); extensionsByContentType->Add(u"application/vnd.ms-fontobject", u".eot"); extensionsByContentType->Add(u"application/x-font-ttf", u".ttf"); extensionsByContentType->Add(u"text/css", u".css"); extensionsByContentType->Add(u"audio/mpeg", u".mp3"); extensionsByContentType->Add(u"audio/mp4", u".m4a"); extensionsByContentType->Add(u"audio/wav", u".wav"); extensionsByContentType->Add(u"video/mp4", u".mp4"); extensionsByContentType->Add(u"video/webm", u".webm"); return extensionsByContentType; } static String ResolveExtension(String contentType, String recommendedExtension) { auto normalizedContentType = NormalizeContentType(contentType); auto extensionsByContentType = GetExtensionsByContentType(); String mappedExtension; if (!String::IsNullOrEmpty(normalizedContentType) && extensionsByContentType->TryGetValue(normalizedContentType, mappedExtension)) { return mappedExtension; } if (!IsSupportedContentType(normalizedContentType)) { return nullptr; } return NormalizeExtension(recommendedExtension); } static bool IsSupportedContentType(String contentType) { return !String::IsNullOrEmpty(contentType) && (contentType.StartsWith(u"image/") || contentType.StartsWith(u"font/") || contentType.StartsWith(u"audio/") || contentType.StartsWith(u"video/")); } static String NormalizeContentType(String contentType) { if (IsNullOrWhiteSpace(contentType)) { return nullptr; } return contentType.Trim().ToLowerInvariant(); } static String NormalizeExtension(String extension) { if (IsNullOrWhiteSpace(extension)) { return nullptr; } auto extensionCharacters = extension.Trim(); if (extensionCharacters.StartsWith(u".")) { extensionCharacters = extensionCharacters.Substring(1); } if (String::IsNullOrEmpty(extensionCharacters)) { return nullptr; } auto extensionLength = extensionCharacters.get_Length(); for (int index = 0; index < extensionLength; index++) { auto character = extensionCharacters[index]; if (!Char::IsLetterOrDigit(character)) { return nullptr; } } return u"." + extensionCharacters.ToLowerInvariant(); } static String NormalizeUrlPrefix(String urlPrefix) { if (String::IsNullOrEmpty(urlPrefix)) { return String::Empty; } auto normalizedUrlPrefix = urlPrefix.Replace(u"\\", u"/"); if (normalizedUrlPrefix.EndsWith(u"/")) { return normalizedUrlPrefix; } return normalizedUrlPrefix + u"/"; } static bool IsNullOrWhiteSpace(String value) { return String::IsNullOrEmpty(value) || String::IsNullOrEmpty(value.Trim()); } }; ``` ```cpp #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::IO; int main() { auto inputFilePath = String(u"presentation.pptx"); auto outputDirectory = String(u"html-output"); auto assetDirectoryName = String(u"assets"); auto assetDirectory = Path::Combine(outputDirectory, assetDirectoryName); Directory::CreateDirectory_(outputDirectory); Directory::CreateDirectory_(assetDirectory); auto assetUrlPrefix = assetDirectoryName + u"/"; auto controller = MakeObject(assetDirectory, assetUrlPrefix); auto svgOptions = MakeObject(controller); auto slideImageFormat = SlideImageFormat::Svg(svgOptions); auto htmlOptions = MakeObject(controller); htmlOptions->set_HtmlFormatter(HtmlFormatter::CreateDocumentFormatter(String::Empty, false)); htmlOptions->set_SlideImageFormat(slideImageFormat); auto presentation = MakeObject(inputFilePath); auto htmlFilePath = Path::Combine(outputDirectory, u"presentation.html"); presentation->Save(htmlFilePath, SaveFormat::Html, htmlOptions); presentation->Dispose(); return 0; } ``` After the export, the output folder has this structure: ```text html-output/ presentation.html assets/ resource-1.svg resource-2.svg resource-3.svg resource-4.jpg resource-5.png ``` The exact files depend on the presentation content and export options. For example, raster images are commonly exported as JPEG or PNG. Aspose.Slides may choose a different image codec than the one used in the source presentation when that produces a smaller or more suitable file. Images with transparency are exported as PNG. ## **Choosing URLs for Deployment** The sample uses a relative URL prefix: `assets/`. If `presentation.html` is opened from `html-output/presentation.html`, the browser loads `html-output/assets/resource-1.svg`. When one linked resource refers to another linked resource, the sample uses the `referrer` parameter in [ILinkEmbedController::GetUrl](https://reference.aspose.com/slides/cpp/aspose.slides.export/ilinkembedcontroller/geturl/) and returns only the file name. For example, if `resource-1.svg` and `resource-4.jpg` are both in the `assets` folder, the SVG file should refer to `resource-4.jpg`, not to `assets/resource-4.jpg`. Use a different URL prefix when the files are deployed elsewhere: - Use `assets/` when the asset directory is next to the HTML file. - Use `../assets/` when the asset directory is one level above the HTML file. - Use `https://cdn.example.com/presentations/job-123/assets/` when the files are uploaded to a CDN or static file server. The URL returned by [ILinkEmbedController::GetUrl](https://reference.aspose.com/slides/cpp/aspose.slides.export/ilinkembedcontroller/geturl/) must match the final deployed location of the file written by [ILinkEmbedController::SaveExternal](https://reference.aspose.com/slides/cpp/aspose.slides.export/ilinkembedcontroller/saveexternal/). In server applications, use a unique output directory or object-storage prefix for each conversion job to avoid overwriting files from another export. ## **When to Embed Instead** Embedded Base64 HTML is still useful when the output must be a single file, such as an email attachment, an offline preview, or a document that will be moved without a supporting asset folder. Linked resources are a better fit when the HTML will be served by a web application, stored in a CMS, optimized by a build pipeline, or cached by browsers independently from the HTML. ## **FAQ** ### Can I externalize only images and keep other resources embedded? Yes. In [ILinkEmbedController::GetObjectStoringLocation](https://reference.aspose.com/slides/cpp/aspose.slides.export/ilinkembedcontroller/getobjectstoringlocation/), return `LinkEmbedDecision::Link` only for the content types you want to save as separate files, and return `LinkEmbedDecision::Embed` for everything else. ### Why does the exported image extension differ from the source presentation? Aspose.Slides may re-encode raster images during HTML export to improve size or browser compatibility. For example, an image from the source file may be written as JPEG or PNG depending on the rendered result. ### Do relative URLs work after I move the HTML file? Relative URLs work only when the same relative folder structure is preserved. If the HTML references `assets/resource-1.png`, the `assets` folder must stay next to the HTML file unless you generate a different URL prefix. ### Should server applications reuse the same output folder? No. Use a unique output directory or storage prefix for each conversion job. This avoids filename collisions and prevents one export from overwriting resources generated by another export. ## Related articles - [Convert PowerPoint Presentations to HTML in C++](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-html/) # Advanced Text Extraction from Presentations in C++ > Quickly extract text from PowerPoint and OpenDocument presentations using Aspose.Slides for C++. Follow our simple, step-by-step guide to save time. Source: https://docs.aspose.com/slides/cpp/extract-text-from-presentation/ Updated: 2026-08-05 ## **Overview** Extracting text from presentations is a common yet essential task for developers working with slide content. Whether you're dealing with Microsoft PowerPoint files in PPT or PPTX format, or OpenDocument presentations (ODP), accessing and retrieving textual data can be critical for analysis, automation, indexing, or content migration purposes. This article provides a comprehensive guide on how to efficiently extract text from various presentation formats, including PPT, PPTX, and ODP, using Aspose.Slides for C++. You'll learn how to systematically iterate through presentation elements to accurately retrieve the text content you need. ## **Extract Text from a Slide** Aspose.Slides for C++ provides the [Aspose.Slides.Util](https://reference.aspose.com/slides/cpp/aspose.slides.util/) namespace, which includes the [SlideUtil](https://reference.aspose.com/slides/cpp/aspose.slides.util/slideutil/) class. This class exposes several overloaded static methods for extracting all text from a presentation or slide. To extract text from a slide in a presentation, use the [GetAllTextBoxes](https://reference.aspose.com/slides/cpp/aspose.slides.util/slideutil/getalltextboxes/) method. This method accepts an object of type [IBaseSlide](https://reference.aspose.com/slides/cpp/aspose.slides/ibaseslide/) as a parameter. When executed, the method scans the entire slide for text and returns an array of objects of type [ITextFrame](https://reference.aspose.com/slides/cpp/aspose.slides/itextframe/), preserving any text formatting. The following code snippet extracts all the text from the first slide of the presentation: ```cpp #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Util; using namespace System; auto slideIndex = 0; auto presentation = System::MakeObject(u"demo.pptx"); auto slide = presentation->get_Slide(slideIndex); auto textFrames = Util::SlideUtil::GetAllTextBoxes(slide); for (const auto& textFrame : textFrames) { for (const auto& paragraph : textFrame->get_Paragraphs()) { for (const auto& portion : paragraph->get_Portions()) { auto portionText = portion->get_Text(); Console::WriteLine(portionText); auto portionFormat = portion->get_PortionFormat(); auto fontHeight = portionFormat->get_FontHeight(); Console::WriteLine(fontHeight); auto latinFont = portionFormat->get_LatinFont(); if (latinFont != nullptr) { auto fontName = latinFont->get_FontName(); Console::WriteLine(fontName); } } } } presentation->Dispose(); ``` ## **Extract Text from a Presentation** To scan text from the entire presentation, use the [GetAllTextFrames](https://reference.aspose.com/slides/cpp/aspose.slides.util/slideutil/getalltextframes/) static method exposed by the [SlideUtil](https://reference.aspose.com/slides/cpp/aspose.slides.util/slideutil/) class. It accepts two parameters: 1. First, an [IPresentation](https://reference.aspose.com/slides/cpp/aspose.slides/ipresentation/) object representing a PowerPoint or OpenDocument presentation from which text will be extracted. 1. Second, a `Boolean` value indicating whether the master slides should be included when scanning text from the presentation. The method returns an array of objects of type [ITextFrame](https://reference.aspose.com/slides/cpp/aspose.slides/itextframe/), including text formatting information. The code below scans the text and formatting details from a presentation, including the master slides. ```cpp #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Util; using namespace System; auto presentation = System::MakeObject(u"demo.pptx"); auto includeMasterSlides = true; auto textFrames = Util::SlideUtil::GetAllTextFrames(presentation, includeMasterSlides); for (const auto& textFrame : textFrames) { for (const auto& paragraph : textFrame->get_Paragraphs()) { for (const auto& portion : paragraph->get_Portions()) { auto portionText = portion->get_Text(); Console::WriteLine(portionText); auto portionFormat = portion->get_PortionFormat(); auto fontHeight = portionFormat->get_FontHeight(); Console::WriteLine(fontHeight); auto latinFont = portionFormat->get_LatinFont(); if (latinFont != nullptr) { auto fontName = latinFont->get_FontName(); Console::WriteLine(fontName); } } } } presentation->Dispose(); ``` ## **Categorized and Fast Text Extraction** The [PresentationFactory](https://reference.aspose.com/slides/cpp/aspose.slides/presentationfactory/) class also provides methods for extracting all text from presentations: ```cpp #include #include #include #include #include #include using namespace Aspose::Slides; System::SharedPtr GetPresentationText(System::String file, TextExtractionArrangingMode mode); System::SharedPtr GetPresentationText(System::SharedPtr stream, TextExtractionArrangingMode mode); System::SharedPtr GetPresentationText(System::SharedPtr stream, TextExtractionArrangingMode mode, System::SharedPtr options); ``` The [TextExtractionArrangingMode](https://reference.aspose.com/slides/cpp/aspose.slides/textextractionarrangingmode/) enum argument indicates the mode for organizing the text extraction result and can be set to the following values: - `Unarranged` - The raw text without regard to its position on the slide. - `Arranged` - The text is arranged in the same order as on the slide. The unarranged mode can be used when speed is critical; it's faster than the arranged mode. [IPresentationText](https://reference.aspose.com/slides/cpp/aspose.slides/ipresentationtext/) represents the raw text extracted from the presentation. Its `get_SlidesText()` method returns an array of objects of type [ISlideText](https://reference.aspose.com/slides/cpp/aspose.slides/islidetext/). Each object represents the text on the corresponding slide. The object of type [ISlideText](https://reference.aspose.com/slides/cpp/aspose.slides/islidetext/) has the following methods: - `get_Text()` - The text within the slide's shapes. - `get_MasterText()` - The text within the master slide's shapes associated with this slide. - `get_LayoutText()` - The text within the layout slide's shapes associated with this slide. - `get_NotesText()` - The text within the notes slide's shapes associated with this slide. - `get_CommentsText()` - The text within comments associated with this slide. ```cpp #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto presentationPath = u"presentation.ppt"; auto arrangingMode = TextExtractionArrangingMode::Unarranged; auto presentationText = PresentationFactory::get_Instance()->GetPresentationText(presentationPath, arrangingMode); auto firstSlideText = presentationText->get_SlidesText()[0]; Console::WriteLine(firstSlideText->get_Text()); Console::WriteLine(firstSlideText->get_LayoutText()); Console::WriteLine(firstSlideText->get_MasterText()); Console::WriteLine(firstSlideText->get_NotesText()); Console::WriteLine(firstSlideText->get_CommentsText()); ``` ## **FAQ** ### How fast does Aspose.Slides process large presentations during text extraction? Aspose.Slides is optimized for high performance and can process even [large presentations](https://docs.aspose.com/slides/cpp/open-presentation/), making it suitable for real-time or bulk processing scenarios. ### Can Aspose.Slides extract text from tables and charts within presentations? Yes. Aspose.Slides can extract text from many slide elements, including tables and chart-related objects, so you can access and analyze textual content in common presentation structures. ### Do I need a special Aspose.Slides license to extract text from presentations? You can extract text using the free trial version of Aspose.Slides, although it will have [certain limitations](https://docs.aspose.com/slides/cpp/licensing/), such as processing only a limited number of slides. For unrestricted use and to handle larger presentations, purchasing a full license is recommended. # Extract Images from Presentation Shapes in C++ > Extract images from shapes in PowerPoint and OpenDocument presentations with Aspose.Slides for C++ - quick, code-friendly solution. Source: https://docs.aspose.com/slides/cpp/extracting-images-from-presentation-shapes/ Updated: 2026-08-13 ## **Overview** Images in a presentation can appear in several shape types: as ordinary picture frames, as picture fills applied to shapes, as OLE object preview images, as video or audio frame thumbnails, as zoom images, or as images nested inside table, chart, and SmartArt shapes. Aspose.Slides stores those images in the presentation image collection, exposed through [IImageCollection](https://reference.aspose.com/slides/cpp/aspose.slides/iimagecollection/) and [IPPImage](https://reference.aspose.com/slides/cpp/aspose.slides/ippimage/) objects. If you only need to export every image resource embedded in a presentation, iterate through `presentation->get_Images()`. This article focuses on a different task: traversing shapes to find where images are used on slides, so the saved files can keep useful context such as the slide number, shape position, and source type (picture frame, fill image, media preview, OLE preview, or zoom image). Use [IPPImage](https://reference.aspose.com/slides/cpp/aspose.slides/ippimage/)::`get_BinaryData()` to preserve the original encoded image data and file type. Use [IPPImage](https://reference.aspose.com/slides/cpp/aspose.slides/ippimage/)::`get_Image()` with [IImage](https://reference.aspose.com/slides/cpp/aspose.slides/iimage/)::`Save` when you want to normalize the output to a specific format such as PNG. ## **Shared Helper Methods** The helper methods below keep the examples short. `SaveOriginalImage` writes the original embedded bytes, chooses a safe extension from the MIME type, and skips duplicate image binaries by SHA-256 hash. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; using namespace System::Collections::Generic; using namespace System::IO; using namespace System::Security::Cryptography; using namespace System::Text; struct ShapeInfo { SharedPtr Shape; String NamePart; }; String GetSha256Hash(ArrayPtr data); String GetExtensionFromContentType(String contentType); String MakeSafeFileNamePart(String value); bool SaveOriginalImage( SharedPtr image, String outputDirectory, String fileNameBase, SharedPtr> savedImageHashes) { auto imageData = image->get_BinaryData(); String imageHash = GetSha256Hash(imageData); if (savedImageHashes->Contains(imageHash)) { return false; } savedImageHashes->Add(imageHash); String extension = GetExtensionFromContentType(image->get_ContentType()); String fileName = String::Format(u"{0}.{1}", fileNameBase, extension); String outputPath = Path::Combine(outputDirectory, fileName); File::WriteAllBytes(outputPath, imageData); return true; } void SaveImageAsPng(SharedPtr image, String outputDirectory, String fileNameBase) { String fileName = String::Format(u"{0}.png", fileNameBase); String outputPath = Path::Combine(outputDirectory, fileName); auto outputImage = image->get_Image(); outputImage->Save(outputPath, ImageFormat::Png); outputImage->Dispose(); } SharedPtr GetPictureFillImage(SharedPtr fillFormat) { if (fillFormat == nullptr || fillFormat->get_FillType() != FillType::Picture) { return nullptr; } return fillFormat->get_PictureFillFormat()->get_Picture()->get_Image(); } void EnumerateShapes( SharedPtr shapes, String prefix, bool includeGroupedShapes, std::vector& result) { int shapeCount = shapes->get_Count(); for (int shapeIndex = 0; shapeIndex < shapeCount; shapeIndex++) { auto shape = shapes->idx_get(shapeIndex); int displayIndex = shapeIndex + 1; String shapeNamePart = String::Format(u"{0}_shape_{1}", prefix, displayIndex); result.push_back({ shape, shapeNamePart }); auto groupShape = System::AsCast(shape); if (includeGroupedShapes && groupShape != nullptr) { EnumerateShapes(groupShape->get_Shapes(), shapeNamePart, includeGroupedShapes, result); } } } String GetSha256Hash(ArrayPtr data) { auto sha256 = HashAlgorithm::Create(u"SHA256"); auto hash = sha256->ComputeHash(data); auto builder = MakeObject(); int hashLength = hash->get_Length(); for (int index = 0; index < hashLength; index++) { uint8_t hashByte = hash[index]; builder->Append(String::Format(u"{0:x2}", hashByte)); } return builder->ToString(); } String GetExtensionFromContentType(String contentType) { if (String::IsNullOrWhiteSpace(contentType)) { return u"bin"; } int separatorIndex = contentType.IndexOf(u";"); String mediaType = separatorIndex >= 0 ? contentType.Substring(0, separatorIndex) : contentType; mediaType = mediaType.Trim().ToLower(); if (mediaType == u"image/jpeg") { return u"jpg"; } if (mediaType == u"image/png") { return u"png"; } if (mediaType == u"image/gif") { return u"gif"; } if (mediaType == u"image/bmp") { return u"bmp"; } if (mediaType == u"image/tiff") { return u"tiff"; } if (mediaType == u"image/x-emf" || mediaType == u"image/emf") { return u"emf"; } if (mediaType == u"image/x-wmf" || mediaType == u"image/wmf") { return u"wmf"; } if (mediaType == u"image/svg+xml") { return u"svg"; } if (mediaType.StartsWith(u"image/")) { String extension = mediaType.Substring(String(u"image/").get_Length()); return MakeSafeFileNamePart(extension); } return u"bin"; } String MakeSafeFileNamePart(String value) { auto invalidCharacters = Path::GetInvalidFileNameChars(); int invalidCharacterCount = invalidCharacters->get_Length(); for (int index = 0; index < invalidCharacterCount; index++) { value = value.Replace(invalidCharacters[index], u'_'); } return value; } ``` ## **Extract Images from Picture Frames** Use this approach for pictures inserted as standalone objects. An [IPictureFrame](https://reference.aspose.com/slides/cpp/aspose.slides/ipictureframe/) stores its picture in `get_PictureFormat()->get_Picture()->get_Image()`, which returns an [IPPImage](https://reference.aspose.com/slides/cpp/aspose.slides/ippimage/) object. ```cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; using namespace System::Collections::Generic; using namespace System::IO; int main() { String inputPath = u"sample.pptx"; String outputDirectory = Path::Combine(Environment::get_CurrentDirectory(), u"extracted-images"); Directory::CreateDirectory_(outputDirectory); auto savedImageHashes = MakeObject>(); auto presentation = MakeObject(inputPath); int slideCount = presentation->get_Slides()->get_Count(); for (int slideIndex = 0; slideIndex < slideCount; slideIndex++) { auto slide = presentation->get_Slide(slideIndex); String slidePrefix = String::Format(u"slide_{0}", slide->get_SlideNumber()); std::vector shapeInfos; EnumerateShapes(slide->get_Shapes(), slidePrefix, false, shapeInfos); for (const ShapeInfo& item : shapeInfos) { auto pictureFrame = System::AsCast(item.Shape); if (pictureFrame != nullptr) { auto image = pictureFrame->get_PictureFormat()->get_Picture()->get_Image(); SaveOriginalImage(image, outputDirectory, item.NamePart, savedImageHashes); } } } presentation->Dispose(); return 0; } ``` ## **Extract Images from Picture-Filled Shapes** Shapes can use a picture as their fill. Check the shape's fill type first: if it is not [FillType](https://reference.aspose.com/slides/cpp/aspose.slides/filltype/)::`Picture`, there is no picture to extract from that fill. The example below handles [IAutoShape](https://reference.aspose.com/slides/cpp/aspose.slides/iautoshape/) objects and saves each image as PNG through [IPPImage](https://reference.aspose.com/slides/cpp/aspose.slides/ippimage/)::`get_Image()`. ```cpp #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; using namespace System::IO; int main() { String inputPath = u"sample.pptx"; String outputDirectory = Path::Combine(Environment::get_CurrentDirectory(), u"shape-fill-images"); Directory::CreateDirectory_(outputDirectory); auto presentation = MakeObject(inputPath); int slideCount = presentation->get_Slides()->get_Count(); for (int slideIndex = 0; slideIndex < slideCount; slideIndex++) { auto slide = presentation->get_Slide(slideIndex); String slidePrefix = String::Format(u"slide_{0}", slide->get_SlideNumber()); std::vector shapeInfos; EnumerateShapes(slide->get_Shapes(), slidePrefix, false, shapeInfos); for (const ShapeInfo& item : shapeInfos) { auto autoShape = System::AsCast(item.Shape); if (autoShape != nullptr) { auto image = GetPictureFillImage(autoShape->get_FillFormat()); if (image != nullptr) { SaveImageAsPng(image, outputDirectory, item.NamePart); } } } } presentation->Dispose(); return 0; } ``` ## **Extract Preview Images from OLE Object Frames** An [IOleObjectFrame](https://reference.aspose.com/slides/cpp/aspose.slides/ioleobjectframe/) can have a substitute picture that PowerPoint uses as the object's preview on a slide. This image is available through `get_SubstitutePictureFormat()->get_Picture()->get_Image()`. Extracting this picture gives you the preview image, not the embedded OLE package contents. ```cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; using namespace System::Collections::Generic; using namespace System::IO; int main() { String inputPath = u"sample.pptx"; String outputDirectory = Path::Combine(Environment::get_CurrentDirectory(), u"ole-preview-images"); Directory::CreateDirectory_(outputDirectory); auto savedImageHashes = MakeObject>(); auto presentation = MakeObject(inputPath); int slideCount = presentation->get_Slides()->get_Count(); for (int slideIndex = 0; slideIndex < slideCount; slideIndex++) { auto slide = presentation->get_Slide(slideIndex); String slidePrefix = String::Format(u"slide_{0}", slide->get_SlideNumber()); std::vector shapeInfos; EnumerateShapes(slide->get_Shapes(), slidePrefix, false, shapeInfos); for (const ShapeInfo& item : shapeInfos) { auto oleObjectFrame = System::AsCast(item.Shape); if (oleObjectFrame != nullptr) { auto image = oleObjectFrame->get_SubstitutePictureFormat()->get_Picture()->get_Image(); if (image != nullptr) { String fileNameBase = String::Format(u"{0}_ole_preview", item.NamePart); SaveOriginalImage(image, outputDirectory, fileNameBase, savedImageHashes); } } } } presentation->Dispose(); return 0; } ``` ## **Extract Preview Images from Video Frames** An [IVideoFrame](https://reference.aspose.com/slides/cpp/aspose.slides/ivideoframe/) can also store a preview image in `get_PictureFormat()->get_Picture()->get_Image()`. This is the poster or thumbnail shown on the slide, not a frame decoded from the video stream. ```cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; using namespace System::Collections::Generic; using namespace System::IO; int main() { String inputPath = u"sample.pptx"; String outputDirectory = Path::Combine(Environment::get_CurrentDirectory(), u"video-preview-images"); Directory::CreateDirectory_(outputDirectory); auto savedImageHashes = MakeObject>(); auto presentation = MakeObject(inputPath); int slideCount = presentation->get_Slides()->get_Count(); for (int slideIndex = 0; slideIndex < slideCount; slideIndex++) { auto slide = presentation->get_Slide(slideIndex); String slidePrefix = String::Format(u"slide_{0}", slide->get_SlideNumber()); std::vector shapeInfos; EnumerateShapes(slide->get_Shapes(), slidePrefix, false, shapeInfos); for (const ShapeInfo& item : shapeInfos) { auto videoFrame = System::AsCast(item.Shape); if (videoFrame != nullptr) { auto image = videoFrame->get_PictureFormat()->get_Picture()->get_Image(); if (image != nullptr) { String fileNameBase = String::Format(u"{0}_video_preview", item.NamePart); SaveOriginalImage(image, outputDirectory, fileNameBase, savedImageHashes); } } } } presentation->Dispose(); return 0; } ``` ## **Extract Preview Images from Audio Frames** An [IAudioFrame](https://reference.aspose.com/slides/cpp/aspose.slides/iaudioframe/) can store a thumbnail in `get_PictureFormat()->get_Picture()->get_Image()`. This is the image shown for the audio object on the slide. ```cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; using namespace System::Collections::Generic; using namespace System::IO; int main() { String inputPath = u"sample.pptx"; String outputDirectory = Path::Combine(Environment::get_CurrentDirectory(), u"audio-preview-images"); Directory::CreateDirectory_(outputDirectory); auto savedImageHashes = MakeObject>(); auto presentation = MakeObject(inputPath); int slideCount = presentation->get_Slides()->get_Count(); for (int slideIndex = 0; slideIndex < slideCount; slideIndex++) { auto slide = presentation->get_Slide(slideIndex); String slidePrefix = String::Format(u"slide_{0}", slide->get_SlideNumber()); std::vector shapeInfos; EnumerateShapes(slide->get_Shapes(), slidePrefix, false, shapeInfos); for (const ShapeInfo& item : shapeInfos) { auto audioFrame = System::AsCast(item.Shape); if (audioFrame != nullptr) { auto image = audioFrame->get_PictureFormat()->get_Picture()->get_Image(); if (image != nullptr) { String fileNameBase = String::Format(u"{0}_audio_preview", item.NamePart); SaveOriginalImage(image, outputDirectory, fileNameBase, savedImageHashes); } } } } presentation->Dispose(); return 0; } ``` ## **Extract Images from Zoom Objects** [IZoomFrame](https://reference.aspose.com/slides/cpp/aspose.slides/izoomframe/) and [ISectionZoomFrame](https://reference.aspose.com/slides/cpp/aspose.slides/isectionzoomframe/) shapes can use custom images. Read `get_ZoomImage()` from the zoom frame. ```cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; using namespace System::Collections::Generic; using namespace System::IO; int main() { String inputPath = u"sample.pptx"; String outputDirectory = Path::Combine(Environment::get_CurrentDirectory(), u"zoom-images"); Directory::CreateDirectory_(outputDirectory); auto savedImageHashes = MakeObject>(); auto presentation = MakeObject(inputPath); int slideCount = presentation->get_Slides()->get_Count(); for (int slideIndex = 0; slideIndex < slideCount; slideIndex++) { auto slide = presentation->get_Slide(slideIndex); String slidePrefix = String::Format(u"slide_{0}", slide->get_SlideNumber()); std::vector shapeInfos; EnumerateShapes(slide->get_Shapes(), slidePrefix, false, shapeInfos); for (const ShapeInfo& item : shapeInfos) { auto zoomFrame = System::AsCast(item.Shape); if (zoomFrame != nullptr && zoomFrame->get_ZoomImage() != nullptr) { String fileNameBase = String::Format(u"{0}_zoom", item.NamePart); SaveOriginalImage(zoomFrame->get_ZoomImage(), outputDirectory, fileNameBase, savedImageHashes); continue; } auto sectionZoomFrame = System::AsCast(item.Shape); if (sectionZoomFrame != nullptr && sectionZoomFrame->get_ZoomImage() != nullptr) { String fileNameBase = String::Format(u"{0}_section_zoom", item.NamePart); SaveOriginalImage(sectionZoomFrame->get_ZoomImage(), outputDirectory, fileNameBase, savedImageHashes); continue; } } } presentation->Dispose(); return 0; } ``` ## **Extract Images from Summary Zoom Frames** An [ISummaryZoomFrame](https://reference.aspose.com/slides/cpp/aspose.slides/isummaryzoomframe/) is also a shape. Its section items can use custom images, exposed through each summary zoom section's `get_ZoomImage()` method. ```cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; using namespace System::Collections::Generic; using namespace System::IO; int main() { String inputPath = u"sample.pptx"; String outputDirectory = Path::Combine(Environment::get_CurrentDirectory(), u"summary-zoom-images"); Directory::CreateDirectory_(outputDirectory); auto savedImageHashes = MakeObject>(); auto presentation = MakeObject(inputPath); int slideCount = presentation->get_Slides()->get_Count(); for (int slideIndex = 0; slideIndex < slideCount; slideIndex++) { auto slide = presentation->get_Slide(slideIndex); String slidePrefix = String::Format(u"slide_{0}", slide->get_SlideNumber()); std::vector shapeInfos; EnumerateShapes(slide->get_Shapes(), slidePrefix, false, shapeInfos); for (const ShapeInfo& item : shapeInfos) { auto summaryZoomFrame = System::AsCast(item.Shape); if (summaryZoomFrame != nullptr) { auto summaryZoomCollection = summaryZoomFrame->get_SummaryZoomCollection(); int sectionCount = summaryZoomCollection->get_Count(); for (int sectionIndex = 0; sectionIndex < sectionCount; sectionIndex++) { auto section = summaryZoomCollection->idx_get(sectionIndex); if (section->get_ZoomImage() != nullptr) { int displayIndex = sectionIndex + 1; String fileNameBase = String::Format(u"{0}_summary_zoom_{1}", item.NamePart, displayIndex); SaveOriginalImage(section->get_ZoomImage(), outputDirectory, fileNameBase, savedImageHashes); } } } } } presentation->Dispose(); return 0; } ``` ## **Extract Images from Table Shapes** An [ITable](https://reference.aspose.com/slides/cpp/aspose.slides/itable/) is a shape. Images in a table are usually stored as picture fills in table cells. ```cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; using namespace System::Collections::Generic; using namespace System::IO; int main() { String inputPath = u"sample.pptx"; String outputDirectory = Path::Combine(Environment::get_CurrentDirectory(), u"table-images"); Directory::CreateDirectory_(outputDirectory); auto savedImageHashes = MakeObject>(); auto presentation = MakeObject(inputPath); int slideCount = presentation->get_Slides()->get_Count(); for (int slideIndex = 0; slideIndex < slideCount; slideIndex++) { auto slide = presentation->get_Slide(slideIndex); String slidePrefix = String::Format(u"slide_{0}", slide->get_SlideNumber()); std::vector shapeInfos; EnumerateShapes(slide->get_Shapes(), slidePrefix, true, shapeInfos); for (const ShapeInfo& item : shapeInfos) { auto table = System::AsCast(item.Shape); if (table != nullptr) { int rowCount = table->get_Rows()->get_Count(); int columnCount = table->get_Columns()->get_Count(); for (int rowIndex = 0; rowIndex < rowCount; rowIndex++) { for (int columnIndex = 0; columnIndex < columnCount; columnIndex++) { auto column = table->get_Column(columnIndex); auto cell = column->idx_get(rowIndex); auto image = GetPictureFillImage(cell->get_CellFormat()->get_FillFormat()); if (image != nullptr) { String fileNameBase = String::Format( u"{0}_cell_{1}_{2}", item.NamePart, rowIndex + 1, columnIndex + 1); SaveOriginalImage(image, outputDirectory, fileNameBase, savedImageHashes); } } } } } } presentation->Dispose(); return 0; } ``` ## **Extract Images from Chart Shapes** An [IChart](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichart/) is a shape. The example below extracts an image from the chart area's picture fill. ```cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; using namespace System::Collections::Generic; using namespace System::IO; int main() { String inputPath = u"sample.pptx"; String outputDirectory = Path::Combine(Environment::get_CurrentDirectory(), u"chart-images"); Directory::CreateDirectory_(outputDirectory); auto savedImageHashes = MakeObject>(); auto presentation = MakeObject(inputPath); int slideCount = presentation->get_Slides()->get_Count(); for (int slideIndex = 0; slideIndex < slideCount; slideIndex++) { auto slide = presentation->get_Slide(slideIndex); String slidePrefix = String::Format(u"slide_{0}", slide->get_SlideNumber()); std::vector shapeInfos; EnumerateShapes(slide->get_Shapes(), slidePrefix, true, shapeInfos); for (const ShapeInfo& item : shapeInfos) { auto chart = System::AsCast(item.Shape); if (chart != nullptr) { auto fillFormat = chart->get_FillFormat(); auto image = GetPictureFillImage(fillFormat); if (image != nullptr) { String fileNameBase = String::Format(u"{0}_chart_area", item.NamePart); SaveOriginalImage(image, outputDirectory, fileNameBase, savedImageHashes); } } } } presentation->Dispose(); return 0; } ``` ## **Extract Images from SmartArt Shapes** An [ISmartArt](https://reference.aspose.com/slides/cpp/aspose.slides.smartart/ismartart/) object is a shape. Depending on the SmartArt layout, images may be stored in node bullet fills or in the fill formats of node shapes. ```cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; using namespace System::Collections::Generic; using namespace System::IO; int main() { String inputPath = u"sample.pptx"; String outputDirectory = Path::Combine(Environment::get_CurrentDirectory(), u"smartart-images"); Directory::CreateDirectory_(outputDirectory); auto savedImageHashes = MakeObject>(); auto presentation = MakeObject(inputPath); int slideCount = presentation->get_Slides()->get_Count(); for (int slideIndex = 0; slideIndex < slideCount; slideIndex++) { auto slide = presentation->get_Slide(slideIndex); String slidePrefix = String::Format(u"slide_{0}", slide->get_SlideNumber()); std::vector shapeInfos; EnumerateShapes(slide->get_Shapes(), slidePrefix, true, shapeInfos); for (const ShapeInfo& item : shapeInfos) { auto smartArt = System::AsCast(item.Shape); if (smartArt != nullptr) { int nodeCount = smartArt->get_AllNodes()->get_Count(); for (int nodeIndex = 0; nodeIndex < nodeCount; nodeIndex++) { auto node = smartArt->get_NodeFromAll(nodeIndex); auto bulletImage = GetPictureFillImage(node->get_BulletFillFormat()); if (bulletImage != nullptr) { String fileNameBase = String::Format( u"{0}_smartart_node_{1}_bullet", item.NamePart, nodeIndex + 1); SaveOriginalImage(bulletImage, outputDirectory, fileNameBase, savedImageHashes); } int nodeShapeCount = node->get_Shapes()->get_Count(); for (int nodeShapeIndex = 0; nodeShapeIndex < nodeShapeCount; nodeShapeIndex++) { auto nodeShape = node->get_Shape(nodeShapeIndex); auto image = GetPictureFillImage(nodeShape->get_FillFormat()); if (image != nullptr) { String fileNameBase = String::Format( u"{0}_smartart_node_{1}_shape_{2}", item.NamePart, nodeIndex + 1, nodeShapeIndex + 1); SaveOriginalImage(image, outputDirectory, fileNameBase, savedImageHashes); } } } } } } presentation->Dispose(); return 0; } ``` ## **Include Images Inside Grouped Shapes** Grouped shapes contain their own shape collections. The shared `EnumerateShapes` helper has an `includeGroupedShapes` option. Set it to `true` when you want to inspect shapes inside [IGroupShape](https://reference.aspose.com/slides/cpp/aspose.slides/igroupshape/) objects. The example below extracts images from picture frames, picture-filled shapes, OLE object previews, video frame thumbnails, and audio frame thumbnails. To include table, chart, SmartArt, and summary zoom images as well, reuse the specialized extraction logic from the previous sections while keeping the same recursive shape traversal. ```cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; using namespace System::Collections::Generic; using namespace System::IO; int main() { String inputPath = u"sample.pptx"; String outputDirectory = Path::Combine(Environment::get_CurrentDirectory(), u"all-shape-images"); Directory::CreateDirectory_(outputDirectory); auto savedImageHashes = MakeObject>(); auto presentation = MakeObject(inputPath); int slideCount = presentation->get_Slides()->get_Count(); for (int slideIndex = 0; slideIndex < slideCount; slideIndex++) { auto slide = presentation->get_Slide(slideIndex); String slidePrefix = String::Format(u"slide_{0}", slide->get_SlideNumber()); std::vector shapeInfos; EnumerateShapes(slide->get_Shapes(), slidePrefix, true, shapeInfos); for (const ShapeInfo& item : shapeInfos) { auto pictureFrame = System::AsCast(item.Shape); if (pictureFrame != nullptr) { auto image = pictureFrame->get_PictureFormat()->get_Picture()->get_Image(); SaveOriginalImage(image, outputDirectory, item.NamePart, savedImageHashes); continue; } auto autoShape = System::AsCast(item.Shape); if (autoShape != nullptr) { auto image = GetPictureFillImage(autoShape->get_FillFormat()); if (image != nullptr) { SaveOriginalImage(image, outputDirectory, item.NamePart, savedImageHashes); } continue; } auto oleObjectFrame = System::AsCast(item.Shape); if (oleObjectFrame != nullptr) { auto image = oleObjectFrame->get_SubstitutePictureFormat()->get_Picture()->get_Image(); if (image != nullptr) { String fileNameBase = String::Format(u"{0}_ole_preview", item.NamePart); SaveOriginalImage(image, outputDirectory, fileNameBase, savedImageHashes); } continue; } auto videoFrame = System::AsCast(item.Shape); if (videoFrame != nullptr) { auto image = videoFrame->get_PictureFormat()->get_Picture()->get_Image(); if (image != nullptr) { String fileNameBase = String::Format(u"{0}_video_preview", item.NamePart); SaveOriginalImage(image, outputDirectory, fileNameBase, savedImageHashes); } continue; } auto audioFrame = System::AsCast(item.Shape); if (audioFrame != nullptr) { auto image = audioFrame->get_PictureFormat()->get_Picture()->get_Image(); if (image != nullptr) { String fileNameBase = String::Format(u"{0}_audio_preview", item.NamePart); SaveOriginalImage(image, outputDirectory, fileNameBase, savedImageHashes); } } } } presentation->Dispose(); return 0; } ``` ## **Edge Cases and Practical Notes** - **Duplicate images:** Multiple shapes may reference the same image or separate images with identical bytes. Hash [IPPImage](https://reference.aspose.com/slides/cpp/aspose.slides/ippimage/)::`get_BinaryData()` before writing files if you want one output file per unique image. - **Original data vs. converted output:** Saving [IPPImage](https://reference.aspose.com/slides/cpp/aspose.slides/ippimage/)::`get_BinaryData()` preserves the embedded JPEG, PNG, GIF, SVG, EMF, or WMF data. Saving [IPPImage](https://reference.aspose.com/slides/cpp/aspose.slides/ippimage/)::`get_Image()` through [IImage](https://reference.aspose.com/slides/cpp/aspose.slides/iimage/)::`Save` is useful when you want a consistent output format. - **Unsupported fill types:** Solid, gradient, pattern, and no-fill shapes do not contain a picture fill. Check [FillType](https://reference.aspose.com/slides/cpp/aspose.slides/filltype/) before reading `get_PictureFillFormat()`. - **Grouped shapes:** The top-level slide shape collection does not flatten groups. Recursively inspect [IGroupShape](https://reference.aspose.com/slides/cpp/aspose.slides/igroupshape/)::`get_Shapes()` when grouped content matters. - **OLE object previews:** An [IOleObjectFrame](https://reference.aspose.com/slides/cpp/aspose.slides/ioleobjectframe/) may expose a preview image through `get_SubstitutePictureFormat()`, but that image is only the slide preview. It is not the embedded file inside the OLE object. - **Video frame thumbnails:** An [IVideoFrame](https://reference.aspose.com/slides/cpp/aspose.slides/ivideoframe/) may expose a preview image through `get_PictureFormat()`, but that image is only the poster shown on the slide. It is not extracted from the video stream. - **Audio frame thumbnails:** An [IAudioFrame](https://reference.aspose.com/slides/cpp/aspose.slides/iaudioframe/) may expose an icon or thumbnail through `get_PictureFormat()`; it is not the embedded audio data. - **Zoom images:** Slide zoom, section zoom, and summary zoom shapes may use custom [IPPImage](https://reference.aspose.com/slides/cpp/aspose.slides/ippimage/) objects through `get_ZoomImage()`. - **Nested shape models:** Table, chart, and SmartArt objects implement [IShape](https://reference.aspose.com/slides/cpp/aspose.slides/ishape/), but their images are often stored in nested table cell, chart element, or SmartArt node formatting objects. - **Cropped or transformed pictures:** Accessing [IPPImage](https://reference.aspose.com/slides/cpp/aspose.slides/ippimage/) gives you the stored image resource. It does not render cropping, transparency, recoloring, rotation, or other visual effects applied by the shape. ## **FAQ** ### Can I extract the original image without cropping, effects, or shape transformations? Yes. Access the [IPPImage](https://reference.aspose.com/slides/cpp/aspose.slides/ippimage/) object and write [IPPImage](https://reference.aspose.com/slides/cpp/aspose.slides/ippimage/)::`get_BinaryData()` to disk. This preserves the original encoded image stored in the presentation, not the way the image is rendered on the slide. ### Can I export every extracted image as PNG? Yes. Use [IPPImage](https://reference.aspose.com/slides/cpp/aspose.slides/ippimage/)::`get_Image()` to get an [IImage](https://reference.aspose.com/slides/cpp/aspose.slides/iimage/) object, and then call [IImage](https://reference.aspose.com/slides/cpp/aspose.slides/iimage/)::`Save` with [ImageFormat](https://reference.aspose.com/slides/cpp/aspose.slides/imageformat/)::`Png`. This converts the output and may not preserve the original file type or vector data. ### How do I avoid saving the same image more than once? Use a hash of [IPPImage](https://reference.aspose.com/slides/cpp/aspose.slides/ippimage/)::`get_BinaryData()` and keep the hashes in a set. If a new image has a hash that already exists, skip it or record another reference to the existing output file. ### Why do some shapes not produce an image? Picture frames, picture-filled shapes, OLE object frames, media frames, zoom frames, tables, charts, and SmartArt objects can reference images. Some shape types expose images through nested formatting objects, so a simple `get_PictureFormat()` or shape `get_FillFormat()` check is not always enough. ### Can I extract the thumbnail shown for a video frame? Yes. Use [IVideoFrame](https://reference.aspose.com/slides/cpp/aspose.slides/ivideoframe/)::`get_PictureFormat()` and read `get_PictureFormat()->get_Picture()->get_Image()`. This extracts the poster image stored with the video frame, not a frame generated from the video file. ### How can I determine which shapes use a specific image from the presentation image collection? Aspose.Slides does not store reverse links from [IPPImage](https://reference.aspose.com/slides/cpp/aspose.slides/ippimage/) to shapes. Build a mapping during traversal: whenever you find an image reference, record the slide number, shape path, and image hash or collection item. ### Can I extract images embedded inside OLE objects, such as attached documents? You can extract the OLE object's slide preview from [IOleObjectFrame](https://reference.aspose.com/slides/cpp/aspose.slides/ioleobjectframe/)::`get_SubstitutePictureFormat()`. However, that preview is not the embedded document itself. To extract images from inside the embedded file, extract the OLE data and inspect it with tools for that file type. # Extracting Text from PPT, PPTX, ODP > Source: https://docs.aspose.com/slides/cpp/extracting-text-from-ppt-pptx-odp-on-cloud-platforms/ Updated: 2025-09-30 --- lastmod: 2025-09-30T12:47:20+06:00 title: Extracting Text from PPT, PPTX, ODP type: docs weight: 40 url: /cpp/extracting-text-from-ppt-pptx-odp-on-cloud-platforms/ --- # Manage Fallback Fonts for Presentations in C++ > See how Aspose.Slides for C++ uses fallback fonts to keep text readable in PowerPoint and OpenDocument presentations when original fonts aren’t available. Source: https://docs.aspose.com/slides/cpp/fallback-font/ Updated: 2026-08-02 ## **Introduction** Fallback fonts are used when the font specified for text is available in the system but does not contain a required glyph. In this case, Aspose.Slides can use one of the specified fallback fonts to replace the missing glyph. ## **Fallback Font** Fallback font is used when the font specified for text is available in the system, but this font does not contain a necessary glyph. In this case, it is possible to use one of the specified fallback fonts for the glyph replacement. Aspose.Slides allows to create fallback fonts, add them to fallback fonts collection, set fallback font collection for a certain presentation, remove fallback fonts from presentation, specify the rules to apply fallback fonts and others. To get familiar with these features, use the following links: - [Create Fallback Font](https://docs.aspose.com/slides/cpp/create-fallback-font) - [Create Fallback Fonts Collection](https://docs.aspose.com/slides/cpp/create-fallback-fonts-collection) - [Render Presentation with Fallback Font](https://docs.aspose.com/slides/cpp/render-presentation-with-fallback-font) ## **FAQ** ### How do fallback fonts differ from font substitution? Fallback is applied per character or per range of Unicode when the primary font lacks specific glyphs; it fills just the missing characters. [Substitution](https://docs.aspose.com/slides/cpp/font-substitution/) replaces a missing or unavailable font for an entire run or text portion with another font. They can be combined, but their scope and selection logic are different. ### Are fallback settings saved inside the presentation file? No. Fallback configuration lives at processing/rendering time in the library and is not serialized into the PPTX. The presentation does not store your fallback rules. ### Does fallback affect elements created by PowerPoint objects (SmartArt, charts, WordArt)? Yes. Text inside these objects goes through the same rendering pipeline, so the same fallback rules apply to it as to regular text. ## Related articles - [Specify Fallback Fonts for Presentations in C++](https://docs.aspose.com/slides/cpp/create-fallback-font/) - [Configure Fallback Font Collections in C++](https://docs.aspose.com/slides/cpp/create-fallback-fonts-collection/) - [Render Presentations with Fallback Fonts in C++](https://docs.aspose.com/slides/cpp/render-presentation-with-fallback-font/) # FAQ > Get answers to FAQ on Aspose.Slides for C++, covering PowerPoint and OpenDocument support, installation guidance, licensing, troubleshooting. Source: https://docs.aspose.com/slides/cpp/faqs/ Updated: 2026-08-05 ## **Overview** This FAQ provides answers to common questions about Aspose.Slides. It covers supported file formats, handling exceptions when working with large presentations, changing slide sizes, previewing slides, retrieving text from presentations, formatting table borders, placing pictures, and resolving font-related issues when converting presentations to PDF or images. ## **Supported File Formats** ### Q: What file formats does Aspose.Slides for C++ support? **A**: Aspose.Slides for C++ supports the file formats described in [Supported File Formats](https://docs.aspose.com/slides/cpp/supported-file-formats/). ## **Exceptions** ### Q: I am getting an out of memory exception while loading a large PPT file with images. Is there a limitation in Aspose.Slides regarding file size? **A**: There is no specific formula for calculating the presentation size supported by Aspose.Slides. There should be enough space to accommodate the whole presentation structure and images in memory. Normally, images in the memory occupy more space than the hard disk, especially when images have additional effects. In general, Aspose.Slides for C++ can easily handle presentation files of around 300 MB on a server with 4 GB RAM. ## **Working with Slides** ### Q: Can I change the size of the slides in a presentation? **A**: You can use the `get_SlideSize` method exposed by the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) class to define the size of the slides in a presentation. ### Q: Is there a way to define slides of different size in a presentation? **A**: Since the size of slides is defined at presentation level in Microsoft PowerPoint documents, there is no way to do this. ### Q: Does Aspose.Slides for C++ support previewing a slide before saving? **A**: You can render the presentation slides to images and can use these images for previewing the slides. ## **Working with Text** ### Q: Is it possible to retrieve all the text from a presentation? **A**: Aspose.Slides for C++ provides the [SlideUtil](https://reference.aspose.com/slides/cpp/aspose.slides.util/slideutil/) class under the `Aspose::Slides::Util` namespace that provides various methods for retrieving whole text from the presentations. ### Q: Why are paragraph sizes different on Windows and Linux operating systems? **A**: The calculation of paragraph sizes is based on the calculation of the text size representing the given paragraph. The text size calculation is based on the metrics of the font specified in the PowerPoint presentation. If the specified font is missing, it is replaced with the most similar font, but this font has metrics different from the original ones. As a result, the calculation of paragraph sizes in different systems will lead to different results depending on the set of installed fonts. To achieve the same result on different operating systems, you need to install the same fonts on the systems or load them at runtime as [external fonts](https://docs.aspose.com/slides/cpp/custom-font/). ## **Formatting and Images** ### Q: How can I set the color of a table border? **A**: You can change the color of all table borders or just the border around the entire table. For changing all borders, please use the `get_CellFormat` method from the [ICell](https://reference.aspose.com/slides/cpp/aspose.slides/icell/) interface. For the border of the entire table, you should iterate cells and change the color of the outer borders. ### Q: What measure does Aspose.Slides for C++ use to place pictures? **A**: The coordinates and sizes of all shapes on the slides are measured in points (72 dpi). ## **Working with Fonts** ### Q: When converting PPT to PDF or images, why are the fonts different in the output documents? **A**: This issue might indicate that the fonts used in the presentation are missing from the operating system on which the code was executed. You should install the fonts on the operating system or load them as external fonts using the [FontsLoader](https://reference.aspose.com/slides/cpp/aspose.slides/fontsloader/) class as shown below: ```cpp #include #include #include using namespace Aspose::Slides; using namespace System; auto folders = MakeObject>(1, "path_to_a_folder_with_fonts"); FontsLoader::LoadExternalFonts(folders); ``` # Features Overview > Discover Aspose.Slides for C++: a powerful API to create, edit, automate, and convert PowerPoint and OpenDocument presentations efficiently. Source: https://docs.aspose.com/slides/cpp/features-overview/ Updated: 2026-10-27 Browse the [features and support catalogue](https://docs.aspose.com/slides/features/) for short descriptions and links to the relevant guides. ## **File Formats and Conversions** Aspose.Slides forC++ supports most of the PowerPoint document formats and also exports them to popular formats used widely for exchange among organizations. Following table enlists these formats: |**Feature**|**Description**| | :- | :- | |[Microsoft PowerPoint (PPT)](https://docs.aspose.com/slides/cpp/microsoft-powerpoint-ppt/)|Aspose.Slides for C++ provides the fastest processing for this presentation document format.| |[Portable Document Format (PDF)](https://docs.aspose.com/slides/cpp/portable-document-format-pdf/)|The supported file formats can be exported to Adobe Portable Document Format (PDF) documents with a single method.| |[XML Parser Specification (XPS)](https://docs.aspose.com/slides/cpp/xml-parser-specification-xps/)|All of the supported file formats can be exported to XML Parser Specification (XPS) documents with a single method.| |[PresentationML (PPTX, XML)](https://docs.aspose.com/slides/cpp/presentationml-pptx-xml/)|Aspose.Slides for C++ supports the processing of OOXML presentation format also known as PresentationML or PPTX.| |[PPTX To HTML Conversion](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-html/)|Aspose.Slides for C++ supports the conversion of Presentation to HTML format.| ## **Presentation Rendering** Aspose.Slides for C++ supports high fidelity rendering of slides in the presentation documents to various graphics formats as listed below: |**Feature**|**Description**| | :- | :- | |C++ Supported Image Formats|Using Aspose.Slides for C++, you will be able to render not only presentation slides, but also images on slides to all the C++ supported graphics formats like PNG, BMP and JPEG| |SVG Format|Aspose.Slides for C++ also provides built-in method to export presentation slides to Scalable Vector Graphics (SVG) formats| ## **Content Features** Aspose.Slides forC++ enables you to access, modify or create almost all the possible contents of the presentation documents. |**Feature**|**Description**| | :- | :- | |Master Slides|The master Slides define the layout of the normal slides. Aspose.Slides for C++ enables you to access and modify the Master Slides of the presentation documents| |Normal Slides|Using Aspose.Slides for C++, you can not only create new slides of different types, but also access and modify existing slides in the presentation documents| |Cloning / Copying Slides|There are built-in methods provided by Aspose.Slides for C++ to clone or copy existing slides not only within a presentation, but also from one presentation to the other. Since a slide inherits its layout from master slide, the built-in cloning methods automatically copy the master as well on cloning| |Place Holders and Text Holders|You can also access the place holders and text holders in a slide. Moreover, you can create a slide with text holders from scratch using the appropriate method| |Header and Footers|Aspose.Slides for C++ also facilitates to handle headers / footers in the slides| |Notes in Slides|With Aspose.Slides for C++, you can not only access and modify notes associated with a slide, but also add notes| |Finding a Shape|You can also find a particular shape from a slide using the alternative text associated with the shape| |Backgrounds|Aspose.Slides for C++ enables to work with background associated with a master or normal slide of the Presentation| |Text Boxes|The text boxes can be created from scratch. The existing text boxes can be accessed and their text can also be modified without losing the original text format| |Rectangle Shapes|Rectangle shapes can be created or modified by Aspose.Slides for C++| |Poly Line Shapes|Poly line shapes can also be created or modified by Aspose.Slides for C++| |Ellipse Shapes|Ellipse shapes are also created or modified by Aspose.Slides for C++| |Group Shapes|Aspose.Slides for C++ supports group shapes as well| |Auto Shapes|Auto shapes are also supported by Aspose.Slides for C++| |Shapes Serialization|Although Aspose.Slides for C++ supports a large number of shapes. However, if a shape is not supported by Aspose.Slides for C++, there is a serialization method provided by the Aspose.Slides for C++ through which you can serialize that shape from an existing slide for further use by Aspose.Slides for C++ as per requirement| |Picture Frames|The pictures are managed in picture frames using Aspose.Slides for C++| |Audio Frames|The audio files can be linked or embedded on slides in audio frames by Aspose.Slides for C++| |Video Frames|The video files are handled in video frames through Aspose.Slides for C++| |OLE Frame|The OLE Objects are managed in OLE frames by Aspose.Slides for C++| |Tables|Tables on slides are also supported by Aspose.Slides for C++| |Text Frame|The text associated with any shape can be accessed through text frame associated with that shape| |Text Scanning|Text in a presentation can be scanned at the presentation or slide level through the built-in scanning methods| |Animations|Animations can be applied on shapes| |Slide Shows|Slide shows, slide transitions and Morph Transitions are also supported| ## **Formatting Features** It is possible to format text and shapes on slides in a presentation document using Aspose.Slides for C++. |**Feature**|**Description**| | :- | :- | |Text Formatting|

In Aspose.Slides for C++, the text is managed through text frames associated with the shapes. Hence, the text can be formatted using the paragraphs and portions associated with the text frames. The following text elements can be formatted through Aspose.Slides for C++.

- Font Type

- Font Size

- Font Color

- Font Shades

- Paragraph Alignment

- Paragraph Bulleting

- Paragraph Orientation

| |Shape Formatting|

In Aspose.Slides for C++, the basic element of a slide is shape. The following Shape elements can be formatted using Aspose.Slides for C++:

- Position

- Size

- Line

- Fill (including Pattern, Gradient, Solid)

- Text

- Image

| ## **FAQ** ### Do I need to install Microsoft PowerPoint on the server/PC for the library to work? No. PowerPoint is not required; Aspose.Slides is a standalone engine for creating, editing, converting, and rendering presentations. ### How does multithreading work? Can processing be parallelized? It is safe to process different documents in different threads; the same [presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) object must not be used by [multiple threads](https://docs.aspose.com/slides/cpp/multithreading/) at the same time. ### Are file passwords and encryption supported? Yes. [You can](https://docs.aspose.com/slides/cpp/password-protected-presentation/) open encrypted presentations, set or remove an open and write password, and check the protection status. ### Do I need to care about font packages in Linux containers? Yes. It is recommended to install common font packages and/or explicitly [specify font directories](https://docs.aspose.com/slides/cpp/custom-font/) in your application to avoid unexpected substitutions. ### Are there limitations in the evaluation version? In [evaluation mode](https://docs.aspose.com/slides/cpp/licensing/), a watermark is added to the output and certain limitations apply; a [30-day temporary license](https://purchase.aspose.com/temporary-license/) is available for full-feature testing. ### Is importing external formats into a presentation (PDF/HTML → PPTX) supported? Yes. You can add [PDF pages and HTML content](https://docs.aspose.com/slides/cpp/import-presentation/) to a presentation, turning them into slides. ## Related articles - [Different File Formats and Conversions](https://docs.aspose.com/slides/cpp/different-file-formats-and-conversions/) - [Product Overview](https://docs.aspose.com/slides/cpp/product-overview/) # File Formats and Conversions - C++ PowerPoint API > C++ PowerPoint API supports conversions of PowerPoint file formats including PPT, PPTX, XML, PDF, XPS and others. Source: https://docs.aspose.com/slides/cpp/file-formats-and-conversions/ Updated: 2024-11-01 --- lastmod: 2024-11-01T16:01:00+05:00 title: File Formats and Conversions - C++ PowerPoint API linktitle: File Formats and Conversions type: docs weight: 40 url: /cpp/file-formats-and-conversions/ description: C++ PowerPoint API supports conversions of PowerPoint file formats including PPT, PPTX, XML, PDF, XPS and others. --- ## Related articles - [API Reference](https://docs.aspose.com/slides/cpp/api-reference/) # Extract Flash Objects from Presentations in C++ > Learn how to extract Flash objects from PowerPoint and OpenDocument slides in C++ with Aspose.Slides, complete code samples and best practices. Source: https://docs.aspose.com/slides/cpp/flash/ Updated: 2026-08-05 ## **Overview** This article explains how to extract Flash objects from presentations by using Aspose.Slides. It shows how to find a Flash control by name in a slide’s controls collection and work with the embedded SWF object data. ## **Extract Flash Objects from Presentations** Aspose.Slides for C++ provides a facility for extracting flash objects from a presentation. You can access the flash control by name and extract it from the presentation and including store SWF object data. ``` cpp #include #include #include #include #include using namespace Aspose::Slides; auto pres = System::MakeObject(u"withFlash.pptm"); auto controls = pres->get_Slides()->idx_get(0)->get_Controls(); System::SharedPtr flashControl; for (const auto& control : controls) { if (control->get_Name() == u"ShockwaveFlash1") { flashControl = System::ExplicitCast(control); } } ``` ## **FAQ** ### What presentation formats are supported when extracting Flash content? [Aspose.Slides supports](https://docs.aspose.com/slides/cpp/supported-file-formats/) the main PowerPoint formats such as PPT and PPTX, since it can load these containers and access their controls, including Flash-related ActiveX elements. ### Can I convert a presentation with Flash to HTML5 and preserve Flash interactivity? No. Aspose.Slides does not execute SWF content or convert its interactivity. While export to [HTML](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-html/)/[HTML5](https://docs.aspose.com/slides/cpp/export-to-html5/) is supported, Flash will not play in modern browsers due to end of support. The recommended path is to replace Flash with alternatives such as video or HTML5 animations before export. ### From a security perspective, does Aspose.Slides execute SWF files while reading a presentation? No. Aspose.Slides treats Flash as binary data embedded in the file and does not execute SWF content during processing. ### How should I handle presentations that include Flash along with other embedded files via OLE? Aspose.Slides supports [extracting embedded OLE objects](https://docs.aspose.com/slides/cpp/manage-ole/), so you can process all related embedded content in one pass, handling Flash controls and other OLE-embedded documents together. ## Related articles - [Convert PowerPoint Presentations to SWF Flash in C++](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-swf-flash/) - [Manage Media Files in C++](https://docs.aspose.com/slides/cpp/manage-media-files/) # Streamline Font Replacement in Presentations Using C++ > Seamlessly replace fonts in Aspose.Slides for C++ to ensure consistent typography in PowerPoint and OpenDocument presentations. Source: https://docs.aspose.com/slides/cpp/font-replacement/ Updated: 2026-08-05 ## **Overview** Aspose.Slides allows you to replace one font with another throughout a presentation. When a font is replaced, all instances of the original font are changed to the new font. To perform font replacement, load the presentation, define the source font and the replacement font, call the font replacement method, and save the modified presentation as a PPTX file. This approach is useful when you intentionally want to switch from one font family to another across the presentation. ## **Replace Fonts** If you change your mind about using a font, you can replace that font with another font. All instances of the old font will be replaced by the new font. Aspose.Slides allows you to replace a font this way: 1. Load the relevant presentation. 2. Load the font that will be replaced. 3. Load the new font. 4. Replace the font. 5. Write the modified presentation as a PPTX file. This C++ code demonstrates font replacement: ``` cpp #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; // Loads a presentation auto presentation = System::MakeObject(u"Fonts.pptx"); // Loads the source font that will be replaced auto sourceFont = System::MakeObject(u"Arial"); // Loads the new font auto destFont = System::MakeObject(u"Times New Roman"); // Replaces the fonts presentation->get_FontsManager()->ReplaceFont(sourceFont, destFont); // Saves the presentation presentation->Save(u"UpdatedFont_out.pptx", SaveFormat::Pptx); ``` To set rules that determine what happens in certain conditions (if a font cannot be accessed, for example), see [**Font Substitution**](https://docs.aspose.com/slides/cpp/font-substitution/). ## **FAQ** ### What is the difference between "font replacement", "font substitution", and "fallback fonts"? Replacement is an intentional switch from one family to another across the whole document. [Substitution](https://docs.aspose.com/slides/cpp/font-substitution/) is a rule like "if the font is unavailable, use X." [Fallback](https://docs.aspose.com/slides/cpp/fallback-font/) is applied surgically for individual missing glyphs when the base font is installed but does not contain the required characters. ### Does replacement apply to master slides, layouts, notes, and comments? Yes. Replacement affects all presentation objects that use the original font, including master slides and notes; comments are also part of the document and are taken into account by the font engine. ### Will the font change inside embedded OLE objects (for example, Excel)? No. [OLE content](https://docs.aspose.com/slides/cpp/manage-ole/) is controlled by its own application. Replacement in the presentation does not reformat the internal OLE data; it may be displayed as an image or as externally editable content. ### Can I replace a font only in part of the presentation (by slides or regions)? Targeted replacement is possible if you change the font at the level of the required objects/ranges rather than applying a global replacement to the entire document. The overall font selection logic during rendering remains the same. ### How can I determine in advance which fonts the presentation uses at all? Use the presentation’s [font manager](https://reference.aspose.com/slides/cpp/aspose.slides/fontsmanager/): it provides a list of the [families in use](https://reference.aspose.com/slides/cpp/aspose.slides/fontsmanager/getfonts/) and information about [substitutions/"unknown" fonts](https://reference.aspose.com/slides/cpp/aspose.slides/fontsmanager/getsubstitutions/), which helps plan the replacement. ### Does font replacement work when converting to PDF/images? Yes. During export, Aspose.Slides applies the same [font selection/substitution sequence](https://docs.aspose.com/slides/cpp/font-selection-sequence/), so a replacement performed in advance will be honored during conversion. ### Do I need to install the target font in the system, or can I attach a fonts folder? Installation is not required: the library allows [loading external fonts](https://docs.aspose.com/slides/cpp/custom-font/) from user folders for use during [rendering and export](https://docs.aspose.com/slides/cpp/convert-powerpoint/). ### Will replacement fix "tofu" (squares) instead of characters? Only if the target font actually contains the required glyphs. If not, [configure fallback](https://docs.aspose.com/slides/cpp/fallback-font/) to cover the missing characters. ## Related articles - [Font Selection Sequence in Aspose.Slides for C++](https://docs.aspose.com/slides/cpp/font-selection-sequence/) - [Configure Font Substitution in Presentations Using C++](https://docs.aspose.com/slides/cpp/font-substitution/) - [Manage Fallback Fonts for Presentations in C++](https://docs.aspose.com/slides/cpp/fallback-font/) # Font Selection Sequence in Aspose.Slides for C++ > Discover how Aspose.Slides for C++ selects fonts, ensuring crisp, consistent presentation of PPT, PPTX and ODP files—improve your slides now. Source: https://docs.aspose.com/slides/cpp/font-selection-sequence/ Updated: 2026-11-08 ## **Overview** When a presentation is loaded, rendered, or converted to another format, Aspose.Slides checks whether the fonts used in the presentation are available in the operating system. If a required font is missing, Aspose.Slides selects a replacement font that is as close as possible to the one PowerPoint would use. Aspose.Slides first searches for the selected font in the operating system. If the font is found, it is used. If it is not found, a suitable replacement is applied. When font substitution rules are defined through [FontSubstRule](https://reference.aspose.com/slides/cpp/aspose.slides/fontsubstrule/), those rules are also taken into account. You can also add fonts at application runtime, use embedded fonts from a presentation, or load external fonts for output documents such as PDF files. ## **Font Selection** Text can reference a theme font, such as `+mn-lt`, rather than an explicit family name. See [Resolve Theme Font References](https://docs.aspose.com/slides/cpp/presentation-theme/#resolve-theme-font-references) to obtain the family specified by the applicable theme. Resolving that reference is separate from checking font availability and applying rendering-time substitution or glyph fallback; it does not identify the font file ultimately used to render the text. Certain rules apply to fonts in a presentation when the presentation is loaded, rendered, or converted to another format. For example, when you try to convert a presentation (its slides) to images, the presentation's fonts are checked to verify that the chosen fonts are available in the operating system. If the fonts are confirmed to be missing, they are replaced — see [**Font Replacement**](https://docs.aspose.com/slides/cpp/font-replacement/) and [**Font Substitution**](https://docs.aspose.com/slides/cpp/font-substitution/). This is the process Aspose.Slides follows when dealing with fonts: 1. Aspose.Slides searches for fonts in the operating system to find the font that matches the presentation's chosen font. 2. If the chosen font is found, Aspose.Slides uses it. Otherwise, Aspose.Slides uses a replacement font that is as close as possible to what PowerPoint would use. 3. If font replacement rules have been set through [FontSubstRule](https://reference.aspose.com/slides/cpp/aspose.slides/fontsubstrule/), they are applied. Aspose.Slides allows you to add fonts at application runtime and then use those fonts. See [**Custom fonts**](https://docs.aspose.com/slides/cpp/custom-font/). When additional fonts are placed within a presentation, they are called [**Embedded fonts**](https://docs.aspose.com/slides/cpp/embedded-font/). Aspose.Slides allows you to add fonts that are applied to *only* output documents. For example, if a presentation you are looking to convert to PDF contains fonts that are neither installed on your system nor embedded in the presentation, you can add or load the needed fonts as **external fonts**. We do not distribute any fonts, either paid or free. Our API allows you to load external fonts and embed them in documents, but you do so with fonts at your discretion and responsibility. [![A font selection schematic separates theme resolution, unavailable families and missing glyphs.](https://docs.aspose.com/slides/cpp/font-selection-sequence/visual-font-selection-sequence-503e4c9ad302.svg)](https://docs.aspose.com/slides/cpp/font-selection-sequence/visual-font-selection-sequence-503e4c9ad302.svg) *Resolve the theme token to a family first. An unavailable family can trigger substitution, while a missing character can trigger glyph fallback.* ## **FAQ** **How can I determine which fonts are actually used in a presentation before conversion?** Aspose.Slides lets you inspect the fonts used via the [font manager](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/get_fontsmanager/), so you can decide whether to [embed](https://docs.aspose.com/slides/cpp/embedded-font/), [replace](https://docs.aspose.com/slides/cpp/font-replacement/), or add [external sources](https://docs.aspose.com/slides/cpp/custom-font/). This helps you prevent unwanted substitutions during rendering and export. **Can I add extra font directories without installing them on the operating system?** Yes. You can register [external font sources](https://docs.aspose.com/slides/cpp/custom-font/) such as folders or in-memory streams for rendering and export. This removes dependency on host system fonts and keeps layout predictable. **How do I prevent a silent fallback to an unsuitable font when a glyph is missing?** Define explicit [font replacement](https://docs.aspose.com/slides/cpp/font-replacement/) and font [fallback rules](https://docs.aspose.com/slides/cpp/fallback-font/) in advance. By analyzing used fonts and setting a controlled priority for substitutes, you ensure consistent typography and avoid unexpected results. ## Related articles - [Configure Font Substitution in Presentations Using C++](https://docs.aspose.com/slides/cpp/font-substitution/) - [Streamline Font Replacement in Presentations Using C++](https://docs.aspose.com/slides/cpp/font-replacement/) - [Master PowerPoint Fonts in C++](https://docs.aspose.com/slides/cpp/powerpoint-fonts/) # Configure Font Substitution in Presentations in C++ > Configure font substitution rules and inspect substituted fonts in Aspose.Slides for C++ when rendering or converting PowerPoint and OpenDocument presentations. Source: https://docs.aspose.com/slides/cpp/font-substitution/ Updated: 2026-10-08 ## **Overview** Font substitution allows Aspose.Slides to use an available font in place of a font that cannot be accessed when a presentation is rendered or converted. The substitution affects the rendered output; it does not change the font assigned to the presentation content. You can define the font to use when a particular font is unavailable, and you can inspect the substitutions that Aspose.Slides will make during rendering. This helps keep output consistent across environments with different installed fonts. If a font is available but has no dedicated bold typeface, see [Handle Fonts Without a Dedicated Bold Typeface](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-pdf/#handle-fonts-without-a-dedicated-bold-typeface). That section explains how to rasterize the affected text during PDF export and the consequences for text selection, searching, and scaling. ## **Get Font Substitutions** Use the [IFontsManager::GetSubstitutions](https://reference.aspose.com/slides/cpp/aspose.slides/ifontsmanager/getsubstitutions/) method to determine which fonts will be substituted when the presentation is rendered. The method returns [FontSubstitutionInfo](https://reference.aspose.com/slides/cpp/aspose.slides/fontsubstitutioninfo/) objects that identify the original and substituted font names. The following C++ example lists all font substitutions for a presentation: ```cpp #include #include #include #include using namespace Aspose::Slides; using namespace System; auto presentation = MakeObject(u"Presentation.pptx"); for (auto&& substitution : presentation->get_FontsManager()->GetSubstitutions()) { Console::WriteLine(u"{0} -> {1}", substitution->get_OriginalFontName(), substitution->get_SubstitutedFontName()); } presentation->Dispose(); ``` ## **Get Font Substitutions for Selected Slides** Use the [IFontsManager::GetSubstitutions](https://reference.aspose.com/slides/cpp/aspose.slides/ifontsmanager/getsubstitutions/) overload with a `System::ArrayPtr slides` argument to inspect only the substitutions required to render specific slides. This is useful when you are rendering or exporting part of a presentation, checking a large presentation incrementally, locating slides that depend on unavailable fonts, preparing a minimal font package for a server or container, or diagnosing rendering differences without processing unrelated slides. The `slides` array contains one-based slide indexes: `1` identifies the first slide. By contrast, the [Presentation::get_Slide](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/get_slide/) method uses a zero-based index, so that same slide is accessed as `presentation->get_Slide(0)`. Keep this difference in mind when building the array to avoid off-by-one errors. Call the overload through the [Presentation::get_FontsManager](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/get_fontsmanager/) method. It returns only the substitutions determined while rendering the selected slides. Each result is a [FontSubstitutionInfo](https://reference.aspose.com/slides/cpp/aspose.slides/fontsubstitutioninfo/) object containing the original and substituted font names. The result reflects the current font environment, configured fallback rules, substitution rules stored in an [IFontSubstRuleCollection](https://reference.aspose.com/slides/cpp/aspose.slides/ifontsubstrulecollection/), and [externally loaded fonts](https://docs.aspose.com/slides/cpp/custom-font/). The same substitution can be required by more than one selected slide. Deduplicate the results when you create a font inventory or preflight report. The following example reports every returned substitution and then creates a sorted list of unique font mappings: ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; using namespace System::Collections::Generic; auto presentation = MakeObject(u"Presentation.pptx"); auto selectedSlides = MakeArray({1, 3, 5}); auto substitutions = presentation->get_FontsManager()->GetSubstitutions(selectedSlides); auto sortedPreflightEntries = MakeObject>(StringComparer::get_OrdinalIgnoreCase()); Console::WriteLine(u"Substitutions for the selected slides:"); for (auto&& substitution : substitutions) { auto entry = String::Format(u"{0} -> {1}", substitution->get_OriginalFontName(), substitution->get_SubstitutedFontName()); Console::WriteLine(entry); sortedPreflightEntries->Add(entry); } Console::WriteLine(u"Deduplicated font preflight report:"); for (auto&& entry : sortedPreflightEntries) { Console::WriteLine(entry); } presentation->Dispose(); ``` The [IFontsManager](https://reference.aspose.com/slides/cpp/aspose.slides/ifontsmanager/) interface provides both overloads. Choose one according to the scope of the rendering operation: | Overload | Use it when | |---|---| | [GetSubstitutions](https://reference.aspose.com/slides/cpp/aspose.slides/ifontsmanager/getsubstitutions/) with no arguments | You need substitutions for the entire presentation. | | [GetSubstitutions](https://reference.aspose.com/slides/cpp/aspose.slides/ifontsmanager/getsubstitutions/) with `System::ArrayPtr slides` | You need substitutions for a selected range, incremental check, or partial export. | ## **Set Font Substitution Rules** To specify the font that Aspose.Slides should use when a source font is unavailable: 1. Load the presentation. 2. Create font definitions for the source and substitute fonts. 3. Create a [FontSubstRule](https://reference.aspose.com/slides/cpp/aspose.slides/fontsubstrule/) with the [WhenInaccessible](https://reference.aspose.com/slides/cpp/aspose.slides/fontsubstcondition/) condition. 4. Add the rule to a [FontSubstRuleCollection](https://reference.aspose.com/slides/cpp/aspose.slides/fontsubstrulecollection/). 5. Assign the collection by using the [IFontsManager::set_FontSubstRuleList](https://reference.aspose.com/slides/cpp/aspose.slides/ifontsmanager/set_fontsubstrulelist/) method. 6. Render or convert the presentation. The following C++ example substitutes `Arial` for `SomeRareFont` when `SomeRareFont` is unavailable, and then renders the first slide to verify the result. The substitute font must be available to Aspose.Slides. ```cpp #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto presentation = MakeObject(u"Fonts.pptx"); auto sourceFont = MakeObject(u"SomeRareFont"); auto substituteFont = MakeObject(u"Arial"); auto substitutionRule = MakeObject(sourceFont, substituteFont, FontSubstCondition::WhenInaccessible); auto substitutionRules = MakeObject(); substitutionRules->Add(substitutionRule); presentation->get_FontsManager()->set_FontSubstRuleList(substitutionRules); auto image = presentation->get_Slide(0)->GetImage(1.0f, 1.0f); image->Save(u"slide.jpg", ImageFormat::Jpeg); image->Dispose(); presentation->Dispose(); ``` For an unconditional change to the fonts used throughout a presentation, see [Font Replacement](https://docs.aspose.com/slides/cpp/font-replacement/). ## **Limitations for Math Equation Fonts** Font substitution rules are part of the standard font selection process used during rendering and conversion. They work for regular text when Aspose.Slides can replace an inaccessible font with the available font specified by a rule. Office Math equations have an additional requirement. If an equation uses **Cambria Math**, Aspose.Slides may need that exact font to calculate and render the equation layout. A rule that substitutes another math font, such as **STIX Two Math**, cannot replace **Cambria Math** for this purpose, and rendering may still report that **Cambria Math** is required. To render or convert such a presentation, make **Cambria Math** available to Aspose.Slides. Install it in the operating system or load it as an [external font](https://docs.aspose.com/slides/cpp/custom-font/). This limitation applies to equation layout. The substitution rules described above still apply to regular presentation text. ## **FAQ** **What is the difference between font replacement and font substitution?** [Font replacement](https://docs.aspose.com/slides/cpp/font-replacement/) intentionally changes one font to another throughout the presentation. Font substitution selects a font for rendered output when the configured condition is met, such as when the original font is unavailable. **When are substitution rules applied?** The rules participate in the [font selection sequence](https://docs.aspose.com/slides/cpp/font-selection-sequence/) during rendering and conversion. With `WhenInaccessible`, a rule is used only when Aspose.Slides cannot access the source font. **What happens when a font is missing and no substitution rule is configured?** Aspose.Slides selects the closest available font according to its font selection process. The result depends on the fonts available in the runtime environment. **Can I load external fonts to avoid substitution?** Yes. You can [load external fonts](https://docs.aspose.com/slides/cpp/custom-font/) so Aspose.Slides can use them during rendering and conversion. **Does Aspose distribute fonts with the library?** No. You are responsible for providing fonts and complying with their licenses. **Can substitution results differ between Windows, Linux, and macOS?** Yes. Installed fonts and font search locations differ by operating system, so a font available on one machine may require substitution on another. **How can I make font selection consistent in batch conversions?** Use the same font files and versions on every machine or container, [load required external fonts](https://docs.aspose.com/slides/cpp/custom-font/), and [embed fonts](https://docs.aspose.com/slides/cpp/embedded-font/) when licensing permits. You can also call [IFontsManager::GetSubstitutions](https://reference.aspose.com/slides/cpp/aspose.slides/ifontsmanager/getsubstitutions/) before export to identify unexpected substitutions. ## Related articles - [Font Selection Sequence in Aspose.Slides for C++](https://docs.aspose.com/slides/cpp/font-selection-sequence/) - [Streamline Font Replacement in Presentations Using C++](https://docs.aspose.com/slides/cpp/font-replacement/) - [Master PowerPoint Fonts in C++](https://docs.aspose.com/slides/cpp/powerpoint-fonts/) # Get the Entire Slide Background from a Presentation as an Image > Extract full slide backgrounds as images from PowerPoint and OpenDocument presentations using Aspose.Slides for C++, streamlining visual workflows. Source: https://docs.aspose.com/slides/cpp/get-the-entire-presentation-slide-background-as-an-image/ Updated: 2026-08-05 ## **Overview** In PowerPoint presentations, a slide background may be formed from multiple elements, including the slide background image, presentation theme, color scheme, and objects placed on the master slide or layout slide. This article shows how to extract the entire slide background as an image using Aspose.Slides. Since there is no single method for this task, the approach involves cloning the selected slide into a temporary presentation, removing the slide shapes, and then converting the resulting slide background to an image. ## **Get the Entire Slide Background** Aspose.Slides for C++ does not provide a simple method to extract the entire presentation slide background as an image, but you can follow the steps below to do this: 1. Load the presentation using the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) class. 1. Get the slide size from the presentation. 1. Select a slide. 1. Create a temporary presentation. 1. Set the same slide size in the temporary presentation. 1. Clone the selected slide into the temporary presentation. 1. Delete the shapes from the cloned slide. 1. Convert the cloned slide to an image. The following code example extracts the entire presentation slide background as an image. ```cpp #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; auto slideIndex = 0; auto imageScale = 1; auto presentation = System::MakeObject(u"sample.pptx"); auto slideSize = presentation->get_SlideSize()->get_Size(); auto slide = presentation->get_Slides()->idx_get(slideIndex); auto tempPresentation = System::MakeObject(); auto slideWidth = slideSize.get_Width(); auto slideHeight = slideSize.get_Height(); tempPresentation->get_SlideSize()->SetSize(slideWidth, slideHeight, SlideSizeScaleType::DoNotScale); auto clonedSlide = tempPresentation->get_Slides()->AddClone(slide); clonedSlide->get_Shapes()->Clear(); auto background = clonedSlide->GetImage(imageScale, imageScale); background->Save(u"output.png", ImageFormat::Png); tempPresentation->Dispose(); presentation->Dispose(); ``` ## **FAQ** ### Will complex gradients, textures, or picture fills from a master slide be preserved in the resulting background image? Yes. Aspose.Slides renders gradient, picture, and texture fills defined on the slide, layout, or master. If you need to isolate the look from inherited masters, [set an own background](https://docs.aspose.com/slides/cpp/presentation-background/) on the current slide before exporting. ### Can I add a watermark to the resulting background image before saving it? Yes. You can [add a watermark](https://docs.aspose.com/slides/cpp/watermark/) shape or image on a working [copy of the slide](https://docs.aspose.com/slides/cpp/clone-slides/) (placed behind other content) and then export. This lets you generate a background image with the watermark baked in. ### Can I get the background for a specific layout or master without tying it to an existing slide? Yes. Access the desired master or layout, apply it to a [temporary slide](https://docs.aspose.com/slides/cpp/clone-slides/) with the required size, and export that slide to obtain the background derived from that layout or master. ### Are there licensing limitations that affect image export? Rendering features are fully available with a [valid license](https://docs.aspose.com/slides/cpp/licensing/). In evaluation mode, output may include limitations such as a watermark. Activate the license once per process before running batch exports. # Getting Started > Get started with Aspose.Slides for C++: install, create, edit, and convert presentations with code—supporting PowerPoint and OpenDocument formats. Source: https://docs.aspose.com/slides/cpp/getting-started/ Updated: 2025-11-19 --- lastmod: 2025-11-19T22:55:59+04:00 title: Getting Started type: docs weight: 10 url: /cpp/getting-started/ keywords: - getting started - PPT processing - PPTX processing - ODP processing - PowerPoint - OpenDocument - presentation - C++ - Aspose.Slides description: "Get started with Aspose.Slides for C++: install, create, edit, and convert presentations with code—supporting PowerPoint and OpenDocument formats." --- # Group Presentation Shapes in C++ > Learn to group and ungroup shapes in PowerPoint decks using Aspose.Slides for C++ — fast, step-by-step guide with free C++ code. Source: https://docs.aspose.com/slides/cpp/group/ Updated: 2026-08-02 ## **Overview** This article explains how to work with group shapes in Aspose.Slides. It shows how to add a group shape to a slide, place shapes inside it, and save the updated presentation. It also demonstrates how to access shapes stored inside a group and read their `AlternativeText` values. In addition, the article briefly covers related group-shape capabilities such as nested groups, z-order, and locking options. ## **Add a Group Shape** Aspose.Slides support working with group shapes on slides. This feature helps developers support richer presentations. Aspose.Slides for C++ supports adding or accessing group shapes. It is possible to add shapes to an added group shape to populate it or access any property of group shape. To add a group shape to a slide using Aspose.Slides for C++: 1. Create an instance of the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) class. 1. Obtain the reference of a slide by using its Index 1. Add a group shape to the slide. 1. Add the shapes to the added group shape. 1. Save the modified presentation as a PPTX file. The example below adds a group shape to a slide. ```cpp For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C // The path to the documents directory. const String outPath = u"../out/CreateGroupShape_out.pptx"; const String templatePath = u"../templates/Source Frame.pptx"; // Load the desired the presentation SharedPtr pres = MakeObject(); // Access first slide SharedPtr slide = pres->get_Slides()->idx_get(0); // Accessing shapes collection for selected slide SharedPtr slideShapes = slide->get_Shapes(); // Adding a group shape to the slide SharedPtr groupShape = slideShapes->AddGroupShape(); // Adding shapes inside added group shape groupShape->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 300, 100, 100, 100); groupShape->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 500, 100, 100, 100); groupShape->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 300, 300, 100, 100); groupShape->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 500, 300, 100, 100); // Adding group shape frame groupShape->set_Frame( MakeObject(100, 300, 500, 40, NullableBool::False, NullableBool::False, 0)); //Write the PPTX to Disk pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx); ``` [Source: Examples-SlidesCPP-CreateGroupShape-CreateGroupShape.cpp](https://gist.githubusercontent.com/aspose-slides/a690df625dc0b1fff869ab198affe7a4/raw/c3e13295607742566f9eeec8465c9dfc2105c71b/Examples-SlidesCPP-CreateGroupShape-CreateGroupShape.cpp) ## **Access the AltText Property** This topic shows simple steps, complete with code examples, for adding a group shape and accessing AltText property of group shapes on slides. To access AltText of a group shape in a slide using Aspose.Slides for C++: 1. Instantiate `Presentation` class that represents a PPTX file. 1. Obtain the reference of a slide by using its Index. 1. Accessing the shape collection of slides. 1. Accessing the group shape. 1. Accessing the AltText property. The example below accesses the alternative text of group shape. ```cpp For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C // The path to the documents directory. //const String outPath = u"../out/EmbeddedVideoFrame_out.pptx"; const String templatePath = u"../templates/AltText.pptx"; // Load the desired the presentation SharedPtr pres = MakeObject(templatePath); // Access first slide SharedPtr slide = pres->get_Slides()->idx_get(0); for (int i = 0; i < slide->get_Shapes()->get_Count(); i++) { // Accessing the shape collection of slides System::SharedPtr shape = slide->get_Shapes()->idx_get(i); if (System::ObjectExt::Is(shape)) { // Accessing the group shape. SharedPtr grphShape = DynamicCast(shape); for (int j = 0; j < grphShape->get_Shapes()->get_Count(); j++) { SharedPtr shape2 = grphShape->get_Shapes()->idx_get(j); String st = shape2->get_AlternativeText(); // Accessing the AltText property System::Console::WriteLine(u"Shape Name : " + st); } } } ``` [Source: Examples-SlidesCPP-AccessingAltTextinGroupshapes-AccessingAltTextinGroupshapes.cpp](https://gist.githubusercontent.com/aspose-slides/a690df625dc0b1fff869ab198affe7a4/raw/d0147eba3d028eb02dde2a6c62cd368424863048/Examples-SlidesCPP-AccessingAltTextinGroupshapes-AccessingAltTextinGroupshapes.cpp) ## **FAQ** ### Is nested grouping (a group inside a group) supported? Yes. [GroupShape](https://reference.aspose.com/slides/cpp/aspose.slides/groupshape/) has a [get_ParentGroup](https://reference.aspose.com/slides/cpp/aspose.slides/shape/get_parentgroup/) method, which directly indicates hierarchy support (a group can be a child of another group). ### How do I control the group’s z-order relative to other objects on the slide? Use the [GroupShape](https://reference.aspose.com/slides/cpp/aspose.slides/groupshape/)’s [Z-Order position](https://reference.aspose.com/slides/cpp/aspose.slides/shape/get_zorderposition/) to inspect its position in the display stack. ### Can I prevent moving/editing/ungrouping? Yes. The group’s lock section is exposed via [get_GroupShapeLock](https://reference.aspose.com/slides/cpp/aspose.slides/groupshape/get_groupshapelock/), which lets you restrict operations on the object. ## Related articles - [Group Shape](https://docs.aspose.com/slides/cpp/examples/elements/group-shape/) # Hello World Application using Aspose.Slides for C++ > Create your first C++ app with Aspose.Slides, a simple Hello World example that gets you ready to automate PPT, PPTX and ODP presentations. Source: https://docs.aspose.com/slides/cpp/hello-world-application-using-aspose-slides/ Updated: 2026-05-13 ## **Overview** This article shows how to create a simple **Hello World** PowerPoint presentation using Aspose.Slides. The example demonstrates how to create a new presentation, access the first slide, add a rectangle AutoShape at a specified position, insert a text frame containing the **Hello World** text, and adjust the shape and text formatting. It also explains how to make the text visible by changing its color to black, hide the shape border by setting the line color to white, remove the shape fill, and save the presentation as a PPTX file. ## **Steps to Create a Hello World Application** Follow the steps below to create **Hello World** application by using Aspose.Slides for C++ API: - Create an instance of Presentation class - Obtain the reference of the first slide in the presentation which is created on instantiation of Presentation. - Add an AutoShape with ShapeType as Rectangle at a specified position of the slide. - Add a TextFrame to the AutoShape containing Hello World as default text - Change the Text Color to Black as it is white by default and is not visible on the slide with white background - Change the Line Color of the shape to white in order to hide the shape border - Remove the default Fill Format of the shape - Finally, write the presentation to desired file format using the Presentation object The implementation of above steps is demonstrated below in an example. ``` cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose; using namespace Slides; using namespace Export; using namespace System; int main(int argc, const char argv[]) { auto pres = System::MakeObject(); // get the first slide auto slide = pres->get_Slides()->idx_get(0); // add an AutoShape of Rectangle type auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 150.0f, 75.0f, 150.0f, 50.0f); // add TextFrame to the Rectangle shape->AddTextFrame(u"Hello World"); // change the text color to Black (which is White by default) auto portionFillFormat = shape->get_TextFrame()->get_Paragraphs()->idx_get(0)->get_Portions()->idx_get(0)->get_PortionFormat()->get_FillFormat(); portionFillFormat->set_FillType(FillType::Solid); portionFillFormat->get_SolidFillColor()->set_Color(System::Drawing::Color::get_Black()); // change the line color of the rectangle to White shape->get_ShapeStyle()->get_LineColor()->set_Color(System::Drawing::Color::get_White()); // remove any fill formatting in the shape shape->get_FillFormat()->set_FillType(FillType::NoFill); // save the presentation to disk pres->Save(u"output.pptx", SaveFormat::Pptx); return 0; } ``` # How to Run Aspose.Slides for C++ in Docker > Run Aspose.Slides in Docker containers: configure images, dependencies, fonts, and licensing to build scalable services that process PowerPoint and OpenDocument. Source: https://docs.aspose.com/slides/cpp/how-to-run-aspose-slides-cpp-in-docker/ Updated: 2026-08-05 ## **Introduction** Aspose.Slides for C++ can run inside docker containers. To run Aspose.Slides for C++ in a Linux environment, you can use a docker file. ## **Dockerfile Description** For example, you can use this docker file for Aspose.Slides for C++ with Ubuntu 16.04: ``` FROM ubuntu:16.04 RUN apt-get update && apt-get install software-properties-common -y \ && add-apt-repository ppa:ubuntu-toolchain-r/test \ && apt-get update && apt-get upgrade libstdc++6 -y --no-install-recommends\ && apt-get install -y --no-install-recommends \ unzip \ cmake \ make \ clang-3.9 \ gcc-6 \ g++-6 \ fontconfig \ libglu1-mesa \  && update-alternatives --install /usr/bin/clang clang /usr/bin/clang-3.9 30 \ && update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-3.9 30 \ && update-alternatives --install /usr/bin/cc cc /usr/bin/clang-3.9 40 \ && update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++-3.9 40 \ && update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 30 \ && update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-6 30 \ && update-alternatives --install /usr/bin/cc cc /usr/bin/gcc-6 30 \ && update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++-6 30 ARG accept_msttcorefonts_eula=false ARG DEBIAN_FRONTEND=teletype RUN apt-get install -y --no-install-recommends apt-transport-https debconf-utils RUN echo msttcorefonts msttcorefonts/accepted-mscorefonts-eula select $accept_msttcorefonts_eula | \ debconf-set-selections RUN apt-get install -y msttcorefonts \ && fc-cache -f -v VOLUME /slides-cpp WORKDIR /slides-cpp/sample/ CMD ./build_sample.sh ``` The file contains three main parts (procedures): 1. Installing the tools required to run Aspose.Slides for C++: ``` FROM ubuntu:16.04 RUN apt-get update && apt-get install software-properties-common -y \ && add-apt-repository ppa:ubuntu-toolchain-r/test \ && apt-get update && apt-get upgrade libstdc++6 -y --no-install-recommends\ && apt-get install -y --no-install-recommends \ unzip \ cmake \ make \ clang-3.9 \ gcc-6 \ g++-6 \ fontconfig \ libglu1-mesa \  && update-alternatives --install /usr/bin/clang clang /usr/bin/clang-3.9 30 \ && update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-3.9 30 \ && update-alternatives --install /usr/bin/cc cc /usr/bin/clang-3.9 40 \ && update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++-3.9 40 \ && update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 30 \ && update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-6 30 \ && update-alternatives --install /usr/bin/cc cc /usr/bin/gcc-6 30 \ && update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++-6 30 ``` 2. Installing the msttcorefonts package (by default, the msttcorefonts package EULA isn't accepted): ``` ARG accept_msttcorefonts_eula=false ARG DEBIAN_FRONTEND=teletype RUN apt-get install -y --no-install-recommends apt-transport-https debconf-utils RUN echo msttcorefonts msttcorefonts/accepted-mscorefonts-eula select $accept_msttcorefonts_eula | \ debconf-set-selections RUN apt-get install -y msttcorefonts \ && fc-cache -f -v ``` 3. Declaring the /slides-cpp folder as a mounting point to provide access to the slides-cpp sources folder on the host machine; Building and running examples: ``` dockerfile VOLUME /slides-cpp WORKDIR /slides-cpp/sample/ CMD ./build_sample.sh ``` ## **Building and Running an Image** 1. [Install Docker](https://docs.docker.com/engine/install/) on a host system. 2. Build an image. A terminal working directory should contain a file Dockerfile with the content above. ``` docker build -t aspose-slides-ubuntu-16.04 . ``` 3. Download and unzip [Aspose.Slides for C++ YY.M Linux](https://downloads.aspose.com/slides/cpp). 4. Share the folder with Aspose.Slides for C++ to allow Docker use it: - In Windows, right-click the Docker icon on your taskbar. Select Settings. - Go through Resources > File Sharing. 5. Run the image as a container through either of these methods: * Method A: create and execute a named container: ``` docker run --name slides-cpp-ubuntu -v d:\aspose-slides-cpp-linux-20.6:/slides-cpp aspose-slides-ubuntu-16.04 ``` For the second and subsequent launches, you have to use: ``` docker start slides-cpp-ubuntu -i ``` * Method B: create and execute an unnamed temporary container: ``` docker run --rm -v d:\aspose-slides-cpp-linux-20.6:/slides-cpp aspose-slides-ubuntu-16.04 ``` You will see the build and execution of the sample project: ``` -- The CXX compiler identification is Clang 3.9.1 -- Check for working CXX compiler: /usr/bin/clang++ -- Check for working CXX compiler: /usr/bin/clang++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Configuring done -- Generating done -- Build files have been written to: /slides-cpp/sample/build Scanning dependencies of target Aspose.Slides.Cpp.Examples [ 14%] Building CXX object CMakeFiles/Aspose.Slides.Cpp.Examples.dir/sources/chart.cpp.o [ 42%] Building CXX object CMakeFiles/Aspose.Slides.Cpp.Examples.dir/sources/main.cpp.o [ 42%] Building CXX object CMakeFiles/Aspose.Slides.Cpp.Examples.dir/sources/presentation_export.cpp.o [ 57%] Building CXX object CMakeFiles/Aspose.Slides.Cpp.Examples.dir/sources/smart_art.cpp.o [ 71%] Building CXX object CMakeFiles/Aspose.Slides.Cpp.Examples.dir/sources/text.cpp.o [ 85%] Building CXX object CMakeFiles/Aspose.Slides.Cpp.Examples.dir/sources/thumbnail.cpp.o [100%] Linking CXX executable Aspose.Slides.Cpp.Examples [100%] Built target Aspose.Slides.Cpp.Examples Running examples... Running Chart::SampleChart... Running Thumbnail::SampleThumbnail... Running Text::SampleAddText... Running SmartArt::SampleCreation... Running SmartArt::SampleCloning... Running SmartArt::SampleNodesTextEditing... Running SmartArt::SampleNodeAdd... Running SmartArt::SampleColorStyleEditing... Running SmartArt::SampleQuickStyleEditing... Running SmartArt::SampleNodeRemove... Running SmartArt::SampleRemoveSmartArt... Running PresentationExport::Export... Saving presentation as PDF...OK Saving presentation as XPS...OK Saving presentation as SWF...OK Saving presentation as HTML...OK Saving presentation as PDF...OK Saving presentation as XPS...OK Saving presentation as SWF...OK Saving presentation as HTML...OK ``` # How to Run Examples > Run Aspose.Slides for C++ examples fast: clone the repo, restore packages, then build and test features for PPT, PPTX and ODP. Source: https://docs.aspose.com/slides/cpp/how-to-run-examples/ Updated: 2025-12-10 ## **Software Requirements** Please make sure you meet the following requirements before downloading and running the examples. 1. Visual Studio 2015 or higher. ## **Download Aspose.Slides from GitHub** All examples of Aspose.Slides for C++ are hosted on [GitHub](https://github.com/aspose-slides/Aspose.Slides-for-C). - You can either clone the repository using your favorite GitHub client or download the ZIP file from [here](https://github.com/aspose-slides/Aspose.Slides-for-.NET/archive/refs/heads/master.zip). - Extract the contents of ZIP file to any folder on your computer. All the examples are located in the **Examples** folder. - There is a C++ Visual Studio solution file. - The projects are created in Visual Studio 2015, but the solution files are compatible with Visual Studio 2015 and higher. - Open the solution file in Visual Studio and build the project. - Download Aspose.Slides for C++ latest release from [Download Section](https://downloads.aspose.com/slides/cpp). - Extract the release and copy the **Include** and **Bin** directories inside **Examples** folder - Open **main.cpp** file, all the examples are called from here. - Uncomment the examples you want to run from within the project. - Build and compile the solution Please feel free to reach out using our Forums if you have any issues setting up or running the examples. ## **Contribute** If you like to add or improve an example, we encourage you to contribute to the project. All examples and showcase projects in this repository are open source and can be freely used in your own applications. To contribute, you can fork the repository, edit the source code and create a pull request. We will review the changes and include it in the repository if found helpful. # Manage Image Transform Effects in Presentations with C++ > Apply, chain, inspect, remove, and verify image transform effects for picture frames with Aspose.Slides for C++. Source: https://docs.aspose.com/slides/cpp/image-transform-effects/ Updated: 2026-11-17 ## **Overview** Aspose.Slides represents picture adjustments as an ordered collection of image transform operations. For a picture frame, start with the frame's [ISlidesPicture](https://reference.aspose.com/slides/cpp/aspose.slides/islidespicture/) and access [ISlidesPicture::get_ImageTransform](https://reference.aspose.com/slides/cpp/aspose.slides/islidespicture/get_imagetransform/). The returned [IImageTransformOperationCollection](https://reference.aspose.com/slides/cpp/aspose.slides.effects/iimagetransformoperationcollection/) lets you append, enumerate, inspect, remove, and clear effects without rewriting the original image bytes. This article demonstrates a complete workflow for brightness and contrast, color transformations, blur, transparency, ordered effect chains, effective values, removal, and PPTX round-trip verification. ## **Understand Effect Ownership and Image Reuse** An image resource and the picture that displays it are different objects: - [IPPImage](https://reference.aspose.com/slides/cpp/aspose.slides/ippimage/) stores or references the source image data owned by the presentation. - [ISlidesPicture](https://reference.aspose.com/slides/cpp/aspose.slides/islidespicture/) belongs to a picture fill and refers to an image resource while storing the image transform collection. - [IPictureFrame](https://reference.aspose.com/slides/cpp/aspose.slides/ipictureframe/) is the slide shape that owns the relevant picture fill, geometry, crop settings, and other frame-level formatting. Therefore, image transform operations do not modify the bytes in [IPPImage](https://reference.aspose.com/slides/cpp/aspose.slides/ippimage/). When the same `IPPImage` is passed to [IShapeCollection::AddPictureFrame](https://reference.aspose.com/slides/cpp/aspose.slides/ishapecollection/addpictureframe/) more than once, each new picture frame receives its own `ISlidesPicture` and its own transform collection. Applying grayscale to one frame does not make the other frames grayscale, even though all of them reuse the same embedded image resource. The same `ISlidesPicture::get_ImageTransform` model is also used by other picture fills, such as a shape or slide background. The examples below focus on picture frames. ## **Use Valid Parameter Ranges and Units** The demonstrated methods use the following semantic ranges and units. Keep values in these ranges even if a particular library version does not reject every out-of-range value immediately; the target presentation format may normalize, omit, or reject invalid data during save or when PowerPoint opens the file. | Operation | Parameters | Valid range and unit | |---|---|---| | [AddBrightnessContrastEffect](https://reference.aspose.com/slides/cpp/aspose.slides.effects/iimagetransformoperationcollection/addbrightnesscontrasteffect/) | `brightness`, `contrast` | `-100` through `100`, percent; `0` leaves the component unchanged. | | [AddGrayScaleEffect](https://reference.aspose.com/slides/cpp/aspose.slides.effects/iimagetransformoperationcollection/addgrayscaleeffect/) | None | No numeric parameters. Alpha is unchanged. | | [AddDuotoneEffect](https://reference.aspose.com/slides/cpp/aspose.slides.effects/iimagetransformoperationcollection/addduotoneeffect/) | `Color1`, `Color2` | Two colors for dark and light pixels. RGB and alpha channels in `System::Drawing::Color` use `0` through `255`. | | [AddTintEffect](https://reference.aspose.com/slides/cpp/aspose.slides.effects/iimagetransformoperationcollection/addtinteffect/) | `hue`, `amount` | Hue is `0` inclusive through `360` exclusive, in degrees; amount is `-100` through `100`, percent. | | [AddHSLEffect](https://reference.aspose.com/slides/cpp/aspose.slides.effects/iimagetransformoperationcollection/addhsleffect/) | `hue`, `saturation`, `luminance` | Hue is `0` inclusive through `360` exclusive, in degrees; saturation and luminance are `-100` through `100`, percent. | | [AddColorReplaceEffect](https://reference.aspose.com/slides/cpp/aspose.slides.effects/iimagetransformoperationcollection/addcolorreplaceeffect/) | `Color` | The replacement color uses channel values from `0` through `255`. Existing alpha values are unchanged. | | [AddBlurEffect](https://reference.aspose.com/slides/cpp/aspose.slides.effects/iimagetransformoperationcollection/addblureffect/) | `radius`, `grow` | Radius is nonnegative and is measured in points; `grow` controls whether blurred content may extend outside the original bounds. | | [AddAlphaModulateFixedEffect](https://reference.aspose.com/slides/cpp/aspose.slides.effects/iimagetransformoperationcollection/addalphamodulatefixedeffect/) | `amount` | Nonnegative percent. Use `0` through `100` for ordinary opacity scaling: `0` is fully transparent and `100` preserves the existing alpha. | | [AddAlphaReplaceEffect](https://reference.aspose.com/slides/cpp/aspose.slides.effects/iimagetransformoperationcollection/addalphareplaceeffect/) | `alpha` | `0` through `100`, percent opacity. | | [AddAlphaBiLevelEffect](https://reference.aspose.com/slides/cpp/aspose.slides.effects/iimagetransformoperationcollection/addalphabileveleffect/) | `threshold` | `0` through `100`, percent alpha threshold. Values below it become transparent; values at or above it become opaque. | For fixed alpha modulation, transparency and opacity are complementary. For example, 35% transparency corresponds to an alpha modulation amount of 65%. ## **Apply Brightness and Contrast** [IImageTransformOperationCollection::AddBrightnessContrastEffect](https://reference.aspose.com/slides/cpp/aspose.slides.effects/iimagetransformoperationcollection/addbrightnesscontrasteffect/) returns an [IBrightnessContrast](https://reference.aspose.com/slides/cpp/aspose.slides.effects/ibrightnesscontrast/) operation. Its scalar settings are supplied when the operation is created. The `IBrightnessContrast::GetEffective` method returns calculated read-only values that can be inspected or logged. The following example increases brightness by 15% and contrast by 20%, then renders a preview without modifying the embedded image: ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Effects; using namespace System; using namespace System::IO; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto imageData = File::ReadAllBytes(u"photo.png"); auto image = presentation->get_Images()->AddImage(imageData); auto pictureFrame = slide->get_Shapes()->AddPictureFrame(ShapeType::Rectangle, 50.0f, 50.0f, 400.0f, 260.0f, image); auto imageTransform = pictureFrame->get_PictureFormat()->get_Picture()->get_ImageTransform(); auto brightnessContrast = imageTransform->AddBrightnessContrastEffect(15.0f, 20.0f); auto effectiveValues = brightnessContrast->GetEffective(); Console::WriteLine(u"Brightness: {0}%", effectiveValues->get_Brightness()); Console::WriteLine(u"Contrast: {0}%", effectiveValues->get_Contrast()); auto preview = slide->GetImage(); preview->Save(u"brightness-contrast-preview.png", ImageFormat::Png); presentation->Dispose(); ``` [BrightnessContrast](https://reference.aspose.com/slides/cpp/aspose.slides.effects/brightnesscontrast/) is an Office 2010 picture-effect extension and is less portable than the standard DrawingML luminance effect. When brightness and contrast must remain editable after a PPTX round trip, use [IImageTransformOperationCollection::AddLuminanceEffect](https://reference.aspose.com/slides/cpp/aspose.slides.effects/iimagetransformoperationcollection/addluminanceeffect/) and verify the result after reopening the file. The format limitations section explains this distinction in more detail. ## **Apply Color Transformations** Color effects can be applied independently to different picture frames that reuse one image resource. The following example creates five frames and applies grayscale, duotone, tint, HSL adjustment, and color replacement. [IDuotone](https://reference.aspose.com/slides/cpp/aspose.slides.effects/iduotone/) contains two independently editable color parameters: `get_Color1` maps dark pixels, while `get_Color2` maps light pixels. This makes it a useful example of an effect whose settings are more complex than a single scalar value. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::Drawing; using namespace System::IO; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto imageData = File::ReadAllBytes(u"photo.png"); auto image = presentation->get_Images()->AddImage(imageData); auto grayFrame = slide->get_Shapes()->AddPictureFrame(ShapeType::Rectangle, 20.0f, 20.0f, 180.0f, 120.0f, image); grayFrame->get_PictureFormat()->get_Picture()->get_ImageTransform()->AddGrayScaleEffect(); auto duotoneFrame = slide->get_Shapes()->AddPictureFrame(ShapeType::Rectangle, 220.0f, 20.0f, 180.0f, 120.0f, image); auto duotone = duotoneFrame->get_PictureFormat()->get_Picture()->get_ImageTransform()->AddDuotoneEffect(); duotone->get_Color1()->set_Color(Color::get_Navy()); duotone->get_Color2()->set_Color(Color::get_Gold()); auto tintFrame = slide->get_Shapes()->AddPictureFrame(ShapeType::Rectangle, 420.0f, 20.0f, 180.0f, 120.0f, image); tintFrame->get_PictureFormat()->get_Picture()->get_ImageTransform()->AddTintEffect(210.0f, 35.0f); auto hslFrame = slide->get_Shapes()->AddPictureFrame(ShapeType::Rectangle, 120.0f, 170.0f, 180.0f, 120.0f, image); hslFrame->get_PictureFormat()->get_Picture()->get_ImageTransform()->AddHSLEffect(30.0f, 20.0f, -10.0f); auto replacementFrame = slide->get_Shapes()->AddPictureFrame(ShapeType::Rectangle, 320.0f, 170.0f, 180.0f, 120.0f, image); auto colorReplacement = replacementFrame->get_PictureFormat()->get_Picture()->get_ImageTransform()->AddColorReplaceEffect(); colorReplacement->get_Color()->set_Color(Color::get_CornflowerBlue()); presentation->Save(u"color-transformations.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` [AddColorReplaceEffect](https://reference.aspose.com/slides/cpp/aspose.slides.effects/iimagetransformoperationcollection/addcolorreplaceeffect/) replaces every pixel's color with one fixed color while preserving alpha. It is different from [AddColorChangeEffect](https://reference.aspose.com/slides/cpp/aspose.slides.effects/iimagetransformoperationcollection/addcolorchangeeffect/), which maps one source color to another and exposes both source and target color formats. ### **Apply a Luminance Threshold** A luminance threshold can make faint marks on a scanned page easier to distinguish from the background. [AddGrayScaleEffect](https://reference.aspose.com/slides/cpp/aspose.slides.effects/iimagetransformoperationcollection/addgrayscaleeffect/) preserves intermediate shades of gray. [AddBiLevelEffect](https://reference.aspose.com/slides/cpp/aspose.slides.effects/iimagetransformoperationcollection/addbileveleffect/) maps luminance to black or white, while [AddAlphaBiLevelEffect](https://reference.aspose.com/slides/cpp/aspose.slides.effects/iimagetransformoperationcollection/addalphabileveleffect/) applies a threshold to opacity. The luminance threshold ranges from 0% to 100%, inclusive. Pixels below the threshold become black. Pixels at or above it become white. Raising the threshold turns more shades black because more of them fall below the cutoff. Download [grayscale-swatches.png](https://docs.aspose.com/slides/cpp/image-transform-effects/grayscale-swatches.png) to the working directory. Each label gives the original gray level on a scale from 0 to 255. The example places the original beside two copies and saves each copy's threshold in the presentation. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::IO; auto presentation = MakeObject(); presentation->get_SlideSize()->SetSize(720, 150, SlideSizeScaleType::DoNotScale); auto shapes = presentation->get_Slide(0)->get_Shapes(); auto imageData = File::ReadAllBytes(u"grayscale-swatches.png"); auto image = presentation->get_Images()->AddImage(imageData); auto addFrame = [&](float x, const String& caption) { auto label = shapes->AddAutoShape(ShapeType::Rectangle, x, 12, 216, 36); label->get_TextFrame()->set_Text(caption); return shapes->AddPictureFrame(ShapeType::Rectangle, x, 60, 216, 72, image); }; addFrame(12, u"Original"); auto lowThreshold = addFrame(252, u"Threshold 20%"); lowThreshold->get_PictureFormat()->get_Picture()->get_ImageTransform()->AddBiLevelEffect(20.0f); auto highThreshold = addFrame(492, u"Threshold 60%"); highThreshold->get_PictureFormat()->get_Picture()->get_ImageTransform()->AddBiLevelEffect(60.0f); presentation->Save(u"luminance-threshold.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` Open the output presentation in PowerPoint to compare the three frames. The swatch labeled 96 has about 38% luminance (96 out of 255). It turns white at the 20% threshold and black at the 60% threshold. ![Original grayscale swatches beside the black-and-white results at luminance thresholds of 20% and 60%](https://docs.aspose.com/slides/cpp/image-transform-effects/luminance-threshold.png) ## **Add Blur, Transparency, and Alpha Effects** [AddBlurEffect](https://reference.aspose.com/slides/cpp/aspose.slides.effects/iimagetransformoperationcollection/addblureffect/) affects all color channels, including alpha. Set `grow` to `true` when the blurred edge may extend beyond the original picture bounds. For uniform transparency, use [AddAlphaModulateFixedEffect](https://reference.aspose.com/slides/cpp/aspose.slides.effects/iimagetransformoperationcollection/addalphamodulatefixedeffect/). It multiplies every existing alpha value, so partially transparent pixels remain proportionally different. [AddAlphaReplaceEffect](https://reference.aspose.com/slides/cpp/aspose.slides.effects/iimagetransformoperationcollection/addalphareplaceeffect/) instead assigns one alpha value to all pixels. [AddAlphaBiLevelEffect](https://reference.aspose.com/slides/cpp/aspose.slides.effects/iimagetransformoperationcollection/addalphabileveleffect/) converts alpha to two levels based on a threshold. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::IO; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto imageData = File::ReadAllBytes(u"photo.png"); auto image = presentation->get_Images()->AddImage(imageData); auto blurredFrame = slide->get_Shapes()->AddPictureFrame(ShapeType::Rectangle, 20.0f, 20.0f, 200.0f, 140.0f, image); auto blur = blurredFrame->get_PictureFormat()->get_Picture()->get_ImageTransform()->AddBlurEffect(4.5, true); blur->set_Radius(5.0); auto transparentFrame = slide->get_Shapes()->AddPictureFrame(ShapeType::Rectangle, 240.0f, 20.0f, 200.0f, 140.0f, image); auto alphaModulate = transparentFrame->get_PictureFormat()->get_Picture()->get_ImageTransform()->AddAlphaModulateFixedEffect(65.0f); alphaModulate->set_Amount(60.0f); auto uniformAlphaFrame = slide->get_Shapes()->AddPictureFrame(ShapeType::Rectangle, 20.0f, 180.0f, 200.0f, 140.0f, image); uniformAlphaFrame->get_PictureFormat()->get_Picture()->get_ImageTransform()->AddAlphaReplaceEffect(55.0f); auto binaryAlphaFrame = slide->get_Shapes()->AddPictureFrame(ShapeType::Rectangle, 240.0f, 180.0f, 200.0f, 140.0f, image); auto binaryAlphaTransform = binaryAlphaFrame->get_PictureFormat()->get_Picture()->get_ImageTransform(); auto alphaBiLevel = binaryAlphaTransform->AddAlphaBiLevelEffect(50.0f); alphaBiLevel->set_Threshold(45.0f); binaryAlphaTransform->AddAlphaInverseEffect(); presentation->Save(u"blur-and-alpha-effects.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` Other parameter-free alpha operations include [AddAlphaCeilingEffect](https://reference.aspose.com/slides/cpp/aspose.slides.effects/iimagetransformoperationcollection/addalphaceilingeffect/), which makes every nonzero alpha fully opaque; [AddAlphaFloorEffect](https://reference.aspose.com/slides/cpp/aspose.slides.effects/iimagetransformoperationcollection/addalphaflooreffect/), which makes every alpha below 100% fully transparent; and [AddAlphaInverseEffect](https://reference.aspose.com/slides/cpp/aspose.slides.effects/iimagetransformoperationcollection/addalphainverseeffect/), which changes alpha to `100% - alpha`. ## **Build an Ordered Effect Chain** Every `Add...Effect` method appends a new operation to the end of the collection. The renderer uses the collection as an ordered pipeline: the output of operation 0 becomes the input of operation 1, and so on. Consequently, the same operations in a different order can produce a different image. For example, grayscale followed by tint first removes chromatic information and then recolors the luminance result. Tint followed by grayscale removes the tint again. Similarly, alpha replacement can override alpha values calculated by earlier operations, while alpha modulation preserves their relative differences. The following example builds a four-operation chain, saves it as PPTX, reopens the presentation, checks both the operation types and their order, and renders the reopened result: ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Effects; using namespace Aspose::Slides::Export; using namespace System; using namespace System::IO; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto imageData = File::ReadAllBytes(u"photo.png"); auto image = presentation->get_Images()->AddImage(imageData); auto pictureFrame = slide->get_Shapes()->AddPictureFrame(ShapeType::Rectangle, 50.0f, 50.0f, 400.0f, 260.0f, image); auto imageTransform = pictureFrame->get_PictureFormat()->get_Picture()->get_ImageTransform(); imageTransform->AddGrayScaleEffect(); imageTransform->AddTintEffect(220.0f, 25.0f); imageTransform->AddBlurEffect(2.5, false); imageTransform->AddAlphaModulateFixedEffect(80.0f); presentation->Save(u"image-transform-chain.pptx", SaveFormat::Pptx); presentation->Dispose(); auto reopenedPresentation = MakeObject(u"image-transform-chain.pptx"); auto reopenedShape = reopenedPresentation->get_Slide(0)->get_Shape(0); if (ObjectExt::Is(reopenedShape)) { auto reopenedFrame = ExplicitCast(reopenedShape); auto reopenedTransform = reopenedFrame->get_PictureFormat()->get_Picture()->get_ImageTransform(); auto orderIsPreserved = reopenedTransform->get_Count() == 4 && ObjectExt::Is(reopenedTransform->idx_get(0)) && ObjectExt::Is(reopenedTransform->idx_get(1)) && ObjectExt::Is(reopenedTransform->idx_get(2)) && ObjectExt::Is(reopenedTransform->idx_get(3)); Console::WriteLine(orderIsPreserved ? u"The effect chain was preserved." : u"The effect chain changed during the round trip."); auto renderedSlide = reopenedPresentation->get_Slide(0)->GetImage(); renderedSlide->Save(u"reopened-effect-chain.png", ImageFormat::Png); } else { Console::WriteLine(u"The reopened shape is not a picture frame."); } reopenedPresentation->Dispose(); ``` The collection does not impose a compatibility matrix that restricts color, alpha, and blur operations to separate chains. They can be combined, but combinations are not always useful. A fixed color replacement removes RGB variation produced by earlier color effects; grayscale after duotone removes the two selected colors; and alpha ceiling, floor, replacement, or bi-level operations can discard alpha detail created earlier. Build the chain according to the desired pixel-processing sequence rather than treating its items as unordered formatting flags. [![The same image passes through grayscale then tint, and tint then grayscale. The two final grayscale images have different tones.](https://docs.aspose.com/slides/cpp/image-transform-effects/visual-image-transform-effects-49aa72211f3a.svg)](https://docs.aspose.com/slides/cpp/image-transform-effects/visual-image-transform-effects-49aa72211f3a.svg) *In this illustrative Aspose.Slides for .NET 26.11 render, a 220° tint at 25% leaves the grayscale image unchanged. Applying the same tint before grayscale produces different tones.* ## **Inspect Editable and Effective Values** An editable operation is the object stored in `ISlidesPicture::get_ImageTransform`. Depending on the effect, it may expose writable members directly. For example, [IBlur](https://reference.aspose.com/slides/cpp/aspose.slides.effects/iblur/) exposes `set_Radius` and `set_Grow`, [IAlphaModulateFixed](https://reference.aspose.com/slides/cpp/aspose.slides.effects/ialphamodulatefixed/) exposes `set_Amount`, and [IAlphaBiLevel](https://reference.aspose.com/slides/cpp/aspose.slides.effects/ialphabilevel/) exposes `set_Threshold`. Color effects such as [IDuotone](https://reference.aspose.com/slides/cpp/aspose.slides.effects/iduotone/) expose mutable [IColorFormat](https://reference.aspose.com/slides/cpp/aspose.slides/icolorformat/) objects. Some operation interfaces, including [IBrightnessContrast](https://reference.aspose.com/slides/cpp/aspose.slides.effects/ibrightnesscontrast/), [IHSL](https://reference.aspose.com/slides/cpp/aspose.slides.effects/ihsl/), [ITint](https://reference.aspose.com/slides/cpp/aspose.slides.effects/itint/), and [IAlphaReplace](https://reference.aspose.com/slides/cpp/aspose.slides.effects/ialphareplace/), do not expose their creation scalars as writable properties. To change those settings, remove the operation and add a replacement at the required position. Effective data returned by `GetEffective()` is calculated and read-only. It is useful for resolving theme-dependent colors and reading the normalized values that the renderer uses, but it is not another editing surface. The following example enumerates the chain and inspects effective values for several common operations: ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Effects; using namespace System; auto presentation = MakeObject(u"image-transform-chain.pptx"); auto slide = presentation->get_Slide(0); SharedPtr pictureFrame; for (auto&& shape : slide->get_Shapes()) { if (ObjectExt::Is(shape)) { pictureFrame = ExplicitCast(shape); break; } } if (pictureFrame != nullptr) { auto imageTransform = pictureFrame->get_PictureFormat()->get_Picture()->get_ImageTransform(); for (auto&& operation : imageTransform) { if (ObjectExt::Is(operation)) { auto brightnessContrast = ExplicitCast(operation); auto data = brightnessContrast->GetEffective(); Console::WriteLine(u"Brightness: {0}; contrast: {1}", data->get_Brightness(), data->get_Contrast()); } else if (ObjectExt::Is(operation)) { auto luminance = ExplicitCast(operation); auto data = luminance->GetEffective(); Console::WriteLine(u"Brightness: {0}; contrast: {1}", data->get_Brightness(), data->get_Contrast()); } else if (ObjectExt::Is(operation)) { auto duotone = ExplicitCast(operation); auto data = duotone->GetEffective(); Console::WriteLine(u"Dark color: {0}; light color: {1}", data->get_Color1(), data->get_Color2()); } else if (ObjectExt::Is(operation)) { auto blur = ExplicitCast(operation); auto data = blur->GetEffective(); Console::WriteLine(u"Blur radius: {0} pt", data->get_Radius()); } else if (ObjectExt::Is(operation)) { auto alphaModulate = ExplicitCast(operation); auto data = alphaModulate->GetEffective(); Console::WriteLine(u"Alpha amount: {0}%", data->get_Amount()); } } } presentation->Dispose(); ``` Parameter-free effects such as grayscale, alpha ceiling, and alpha inverse still have an effective-data object, but there are no scalar settings to print. Their presence and position in the collection are the important information. ## **Remove or Clear Image Transforms** Use [IImageTransformOperationCollection::RemoveAt](https://reference.aspose.com/slides/cpp/aspose.slides.effects/iimagetransformoperationcollection/removeat/) to remove one operation by index. Because indexes shift after removal, search for the target first and remove it after enumeration. Use `Clear()` to remove the entire chain. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Effects; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(u"image-transform-chain.pptx"); auto slide = presentation->get_Slide(0); SharedPtr pictureFrame; for (auto&& shape : slide->get_Shapes()) { if (ObjectExt::Is(shape)) { pictureFrame = ExplicitCast(shape); break; } } if (pictureFrame != nullptr) { auto imageTransform = pictureFrame->get_PictureFormat()->get_Picture()->get_ImageTransform(); auto blurIndex = -1; for (auto index = 0; index < imageTransform->get_Count(); ++index) { if (ObjectExt::Is(imageTransform->idx_get(index))) { blurIndex = index; break; } } if (blurIndex >= 0) { imageTransform->RemoveAt(blurIndex); Console::WriteLine(u"The blur operation was removed."); } imageTransform->Clear(); Console::WriteLine(u"Remaining operations: {0}", imageTransform->get_Count()); presentation->Save(u"image-transforms-cleared.pptx", SaveFormat::Pptx); } presentation->Dispose(); ``` Removing or clearing transforms changes only the picture formatting. It does not delete, recompress, or otherwise alter the reused [IPPImage](https://reference.aspose.com/slides/cpp/aspose.slides/ippimage/) resource. ## **Consider Presentation Formats and Export Targets** Image transforms originate in DrawingML, so PPTX is the preferred editable format for effect chains. Even with PPTX, not every operation has identical portability: - Standard DrawingML operations such as luminance, grayscale, duotone, tint, HSL, blur, and common alpha operations have the best chance of surviving a PPTX round trip. Always reopen the generated file and inspect the collection when preservation is a requirement. - [BrightnessContrast](https://reference.aspose.com/slides/cpp/aspose.slides.effects/brightnesscontrast/) is an Office 2010 extension rather than the standard DrawingML luminance operation. It can be used for in-memory rendering, but it is not guaranteed to remain as an editable [IBrightnessContrast](https://reference.aspose.com/slides/cpp/aspose.slides.effects/ibrightnesscontrast/) after saving and reopening PPTX. Prefer [AddLuminanceEffect](https://reference.aspose.com/slides/cpp/aspose.slides.effects/iimagetransformoperationcollection/addluminanceeffect/) for persistent brightness and contrast adjustments. - The binary PPT format predates the full DrawingML effect model. Saving to PPT can omit unsupported operations, reduce a chain to a supported subset, or approximate the appearance. Do not use PPT as the verification format for a complex editable chain. - Rendering to PNG, JPEG, TIFF, PDF, SVG, HTML, or other visual output applies the supported chain to the rendered appearance. Those outputs do not contain an editable `IImageTransformOperationCollection`; raster formats flatten the result into pixels, and document or vector exports store their own rendering representation. - Effects do not make a linked image self-contained. Rendering a linked picture still depends on the linked resource being available when the presentation is loaded. Different presentation consumers may render edge cases differently, especially when several alpha or color-quantizing operations are combined. For critical output, test both the editable round trip and the final export format with the same Aspose.Slides version used in production. ## **FAQ** **Do image transform effects modify the embedded image data?** No. The operations belong to the `ISlidesPicture` used by the picture fill. The underlying `IPPImage` bytes remain unchanged. **Will two picture frames that reuse the same image share their effects?** No. Reusing an `IPPImage` avoids duplicate image data, but each picture frame normally has a separate `ISlidesPicture` and image transform collection. **Can color, blur, and alpha effects be combined?** Yes. The collection accepts them in one ordered chain. Consider what each operation does to the output of the previous one because replacement and threshold operations may discard earlier color or alpha detail. **Why are effective values read-only?** Effective data represents calculated values used for rendering, including resolved colors. Edit the operation stored in the transform collection where writable members exist; otherwise remove it and add a replacement with new creation parameters. **Which format should I use to preserve a transform chain?** Use PPTX and verify the file by reopening it. Legacy PPT cannot represent the full DrawingML effect model, and rendered export formats preserve appearance rather than editable transform operations. # Optimize Image Management in Presentations Using C++ > Learn how to add, reuse, link, replace, and manage raster and SVG images in PowerPoint and OpenDocument presentations with Aspose.Slides for C++. Source: https://docs.aspose.com/slides/cpp/image/ Updated: 2026-11-08 ## **Introduction** Aspose.Slides for C++ provides several ways to work with images, and each one serves a different purpose. You can store an image in a presentation, display it in a picture frame, use it as a slide background, link to an external image, replace a shared image resource, or convert SVG content into editable shapes. This article focuses on image resources and how they are used across a presentation. For cropping, transparency, effects, stretching, and other formatting applied to an individual picture frame, see [Picture Frame](https://docs.aspose.com/slides/cpp/picture-frame/). ## **Understand the Image Model** The following API concepts are closely related but not interchangeable: - The [presentation image collection](https://reference.aspose.com/slides/cpp/aspose.slides/iimagecollection/) stores image resources used by the presentation. Use [IImageCollection::AddImage](https://reference.aspose.com/slides/cpp/aspose.slides/iimagecollection/addimage/) to add image data and obtain an [IPPImage](https://reference.aspose.com/slides/cpp/aspose.slides/ippimage/) resource. - A [picture frame](https://reference.aspose.com/slides/cpp/aspose.slides/ipictureframe/) is a shape that displays an image on a slide, layout, or master. Use [IShapeCollection::AddPictureFrame](https://reference.aspose.com/slides/cpp/aspose.slides/ishapecollection/addpictureframe/) to place an image resource on a slide. - A slide background uses an image as part of the slide fill rather than as a shape. It therefore does not behave like a picture frame. - [IPPImage::ReplaceImage](https://reference.aspose.com/slides/cpp/aspose.slides/ippimage/replaceimage/) replaces an image resource. If several presentation elements use that resource, they all use the replacement. - Converting an SVG to shapes creates editable slide shapes. After conversion, the content is no longer managed as one picture resource. A typical workflow is therefore: add image data to the image collection, receive an [IPPImage](https://reference.aspose.com/slides/cpp/aspose.slides/ippimage/), and then use that resource in one or more picture frames or fills. [![Two picture frames and a background share one embedded image. A separate SVG conversion creates editable shapes.](https://docs.aspose.com/slides/cpp/image/visual-image-9c661bc60854.svg)](https://docs.aspose.com/slides/cpp/image/visual-image-9c661bc60854.svg) *In this diagram, replacing the shared image updates both picture frames and the background. SVG conversion creates separate slide objects.* ## **Add an Embedded Image** To insert a local image, read the file, add its data to the image collection, and create a picture frame that uses the returned [IPPImage](https://reference.aspose.com/slides/cpp/aspose.slides/ippimage/) resource. ```cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::IO; auto presentation = MakeObject(); auto imageData = File::ReadAllBytes(u"photo.png"); auto image = presentation->get_Images()->AddImage(imageData); auto slide = presentation->get_Slide(0); slide->get_Shapes()->AddPictureFrame(ShapeType::Rectangle, 20.0f, 20.0f, 320.0f, 180.0f, image); presentation->Save(u"presentation.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` The image added this way is embedded in the presentation, so the resulting file does not depend on the original image file remaining available. ### **Add an Image from the Web** When an image is available through HTTP or HTTPS, download its bytes, add them to the presentation image collection, and use the returned image resource in the same way as a local image. ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::Net; auto imageUri = MakeObject(u"https://example.com/image.png"); auto webClient = MakeObject(); auto imageData = webClient->DownloadData(imageUri); auto presentation = MakeObject(); auto image = presentation->get_Images()->AddImage(imageData); auto slide = presentation->get_Slide(0); slide->get_Shapes()->AddPictureFrame(ShapeType::Rectangle, 20.0f, 20.0f, 320.0f, 180.0f, image); presentation->Save(u"presentation-from-web.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` Validate remote URLs, response sizes, and content types when the source is not trusted. In applications that already use another HTTP client, you can download the image with that client and pass the resulting bytes or stream to [IImageCollection::AddImage](https://reference.aspose.com/slides/cpp/aspose.slides/iimagecollection/addimage/). ## **Reuse Images Across Slides** If the same image is needed more than once, add it to the presentation once and reuse the returned [IPPImage](https://reference.aspose.com/slides/cpp/aspose.slides/ippimage/) when creating additional picture frames. This avoids repeatedly loading the same source data and makes the relationship between the shared image resource and its uses explicit. For graphics that should appear automatically on many slides, such as a company logo, consider placing the picture frame on a [slide master](https://docs.aspose.com/slides/cpp/slide-master/) or layout instead of adding an equivalent shape to every slide. ## **Use an Image as a Slide Background** A background image is assigned to the slide fill; it is not added as a picture-frame shape. This is useful when the picture should cover the slide background and should not be manipulated as a normal slide object. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::IO; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto imageData = File::ReadAllBytes(u"background.jpg"); auto image = presentation->get_Images()->AddImage(imageData); slide->get_Background()->set_Type(BackgroundType::OwnBackground); slide->get_Background()->get_FillFormat()->set_FillType(FillType::Picture); slide->get_Background()->get_FillFormat()->get_PictureFillFormat()->set_PictureFillMode(PictureFillMode::Stretch); slide->get_Background()->get_FillFormat()->get_PictureFillFormat()->get_Picture()->set_Image(image); presentation->Save(u"background-image.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` For additional background options, including master and layout backgrounds, see [Presentation Background](https://docs.aspose.com/slides/cpp/presentation-background/). ## **Embedded Images and Linked Images** Embedded and linked images have different portability and file-size tradeoffs: - **Embedded image:** the image data is stored inside the presentation. The presentation is self-contained, but the file size includes the image data. - **Linked image:** the presentation stores a path or URL to an external image. This can reduce the presentation size, but the external resource must remain accessible when the presentation is opened or rendered. A linked picture can be created by assigning the external path or URL through [ISlidesPicture::set_LinkPathLong](https://reference.aspose.com/slides/cpp/aspose.slides/islidespicture/set_linkpathlong/) rather than embedding the image data. ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto pictureFrame = slide->get_Shapes()->AddPictureFrame(ShapeType::Rectangle, 20.0f, 20.0f, 320.0f, 180.0f, nullptr); pictureFrame->get_PictureFormat()->get_Picture()->set_LinkPathLong(u"https://example.com/image.png"); presentation->Save(u"linked-image.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` Use linked images only when the deployment environment can reliably access the external resource. For presentations that must work offline or be moved between systems, embedded images are usually safer. ## **Work with SVG Images** SVG is a vector format, so it can be useful for icons, diagrams, and other graphics that should scale without the same loss of detail as raster images. Aspose.Slides supports SVG both as an image resource and as a source for editable slide shapes. ### **Add an SVG as an Image** Create an [SvgImage](https://reference.aspose.com/slides/cpp/aspose.slides/svgimage/), add it to the image collection, and place the resulting image resource in a picture frame. ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::IO; auto svgContent = File::ReadAllText(u"icon.svg"); auto svgImage = MakeObject(svgContent); auto presentation = MakeObject(); auto image = presentation->get_Images()->AddImage(svgImage); auto slide = presentation->get_Slide(0); slide->get_Shapes()->AddPictureFrame(ShapeType::Rectangle, 20.0f, 20.0f, 200.0f, 200.0f, image); presentation->Save(u"svg-image.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ### **SVG Files with External Resources** An SVG can reference external images, stylesheets, or fonts. For these cases, [SvgImage](https://reference.aspose.com/slides/cpp/aspose.slides/svgimage/) provides constructors that accept an [IExternalResourceResolver](https://reference.aspose.com/slides/cpp/aspose.slides.import/iexternalresourceresolver/) and a base URI. The resolver can map a relative URI to an allowed absolute URI and return a stream for the requested resource. The resolver makes external resources available while Aspose.Slides processes the SVG, but it does not rewrite the SVG into a self-contained document. If the SVG must remain portable, embed its required resources in the SVG itself, for example by using `data:` URIs for linked images. When SVG files come from untrusted sources, restrict the schemes, file locations, and hosts that the resolver can access. Network resolvers should also apply timeouts, response-size limits, and content validation. ### **Convert SVG to Editable Shapes** Aspose.Slides can convert an SVG into a group of editable slide shapes, similar to the corresponding PowerPoint command. ![PowerPoint Popup Menu](https://docs.aspose.com/slides/cpp/image/img_01_01.png) Use the [IShapeCollection::AddGroupShape](https://reference.aspose.com/slides/cpp/aspose.slides/ishapecollection/addgroupshape/) overload that accepts an [ISvgImage](https://reference.aspose.com/slides/cpp/aspose.slides/isvgimage/) to perform the conversion. ```cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::IO; auto svgContent = File::ReadAllText(u"diagram.svg"); auto svgImage = MakeObject(svgContent); auto presentation = MakeObject(); auto slideSize = presentation->get_SlideSize()->get_Size(); auto slide = presentation->get_Slide(0); slide->get_Shapes()->AddGroupShape(svgImage, 0.0f, 0.0f, slideSize.get_Width(), slideSize.get_Height()); presentation->Save(u"editable-svg-shapes.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` Use SVG-to-shapes conversion when individual vector elements need to be edited as PowerPoint shapes. If the SVG only needs to be displayed, keeping it as an image is simpler and avoids creating many separate shapes. ## **Replace an Existing Image Resource** Use [IPPImage::ReplaceImage](https://reference.aspose.com/slides/cpp/aspose.slides/ippimage/replaceimage/) when you want to replace an existing image resource. This is especially useful for shared graphics such as logos. ```cpp #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::IO; auto presentation = MakeObject(u"input.pptx"); auto imageToReplace = presentation->get_Image(0); auto imageData = File::ReadAllBytes(u"new-logo.png"); imageToReplace->ReplaceImage(imageData); presentation->Save(u"output.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` If multiple picture frames, backgrounds, masters, or layouts use the same image resource, replacing that resource updates all of those uses. If only one picture frame should change, assign a different image to that frame instead of replacing the shared resource. [IPPImage::ReplaceImage](https://reference.aspose.com/slides/cpp/aspose.slides/ippimage/replaceimage/) also provides overloads that accept an [IImage](https://reference.aspose.com/slides/cpp/aspose.slides/iimage/) or another [IPPImage](https://reference.aspose.com/slides/cpp/aspose.slides/ippimage/). ## **Practical Image Management Guidance** ### **Control Presentation Size** Large raster images can make a presentation unnecessarily large. Use source images with dimensions appropriate for their intended display size, reuse shared image resources where possible, and avoid embedding repeated copies of the same full-resolution graphic. For raster pictures that have already been placed in picture frames, [IPictureFillFormat::CompressImage](https://reference.aspose.com/slides/cpp/aspose.slides/ipicturefillformat/compressimage/) can reduce image data according to the selected resolution and crop settings. This is picture-frame processing rather than image-collection management, so see [Picture Frame](https://docs.aspose.com/slides/cpp/picture-frame/) for related formatting operations. ### **Choose Between Embedded and Linked Content** Embedding makes the presentation portable because all required image data travels with the file. Linking can reduce file size, but it introduces an external dependency. Use links only when that dependency is acceptable and stable. ### **Reuse Shared Branding** For repeated logos, watermarks, or decorative graphics, use one image resource and reuse it. If the graphic belongs to the presentation design rather than slide content, place it on a master or layout so it is inherited by the appropriate slides. ### **Keep SVG Resources Portable** A self-contained SVG is easier to move and render consistently than an SVG that depends on external files or network resources. When possible, embed required resources before importing the SVG. Convert SVG to shapes only when the individual vector elements need to be edited. ### **Use the Aspose.Slides Image API** For C++ image workflows, use the Aspose.Slides [IImage](https://reference.aspose.com/slides/cpp/aspose.slides/iimage/) and [Images](https://reference.aspose.com/slides/cpp/aspose.slides/images/) APIs when you need an image object, and use [IImageCollection::AddImage](https://reference.aspose.com/slides/cpp/aspose.slides/iimagecollection/addimage/) when you need to register image data as a presentation resource. The collection overloads also support byte arrays and streams, which are useful when image data comes from files, network clients, databases, or other libraries. Generating EMF content from spreadsheets or another product is a separate integration workflow and is outside the scope of this article. If an existing WMF or EMF file only needs to be inserted into a presentation, pass its data to an appropriate [IImageCollection::AddImage](https://reference.aspose.com/slides/cpp/aspose.slides/iimagecollection/addimage/) overload without adding a second product dependency to the image-management workflow. ## **FAQ** **What is the difference between the image collection and a picture frame?** The image collection stores reusable image resources. A picture frame is a slide shape that displays one of those resources and provides picture-specific formatting such as cropping and effects. **What is the best way to replace the same logo everywhere?** If the logo is already shared as one image resource, replace that resource with [IPPImage::ReplaceImage](https://reference.aspose.com/slides/cpp/aspose.slides/ippimage/replaceimage/). For presentation-wide branding, placing the logo on a master or layout can also reduce duplicated slide content. **Why does a linked image disappear on another computer?** A linked picture depends on its external file or URL. If that resource cannot be reached from the other computer, the linked image may be unavailable. Embed the image when the presentation must be self-contained. **Can an inserted SVG be edited as PowerPoint shapes?** Yes. Convert the SVG with [IShapeCollection::AddGroupShape](https://reference.aspose.com/slides/cpp/aspose.slides/ishapecollection/addgroupshape/); the resulting group contains editable slide shapes rather than one SVG picture. **How can I keep presentations with many images smaller?** Reuse shared image resources, avoid unnecessarily large raster sources, compress suitable raster pictures when appropriate, keep repeated branding on masters or layouts, and use linked images only when an external dependency is acceptable. # Import Presentations from PDF or HTML in C++ > Learn how to import PDF and HTML content into PowerPoint presentations in C++ with Aspose.Slides and save the results as PPTX files. Source: https://docs.aspose.com/slides/cpp/import-presentation/ Updated: 2026-11-08 ## **Introduction** Aspose.Slides for C++ can turn PDF pages or HTML content into PowerPoint slides without Microsoft PowerPoint. The [SlideCollection](https://reference.aspose.com/slides/cpp/aspose.slides/slidecollection/) class provides [AddFromPdf](https://reference.aspose.com/slides/cpp/aspose.slides/slidecollection/addfrompdf/) and [AddFromHtml](https://reference.aspose.com/slides/cpp/aspose.slides/slidecollection/addfromhtml/) for appending imported content to a presentation. For more control over HTML placement, [SlideCollection::InsertFromHtml](https://reference.aspose.com/slides/cpp/aspose.slides/slidecollection/insertfromhtml/) can insert generated slides at a collection index or begin filling available space on an existing slide. Long HTML is paginated across additional slides automatically, the source can be supplied as a string, text reader, or stream, and external assets can be loaded through [IExternalResourceResolver](https://reference.aspose.com/slides/cpp/aspose.slides.import/iexternalresourceresolver/) with a base URI. The returned array of [ISlide](https://reference.aspose.com/slides/cpp/aspose.slides/islide/) objects identifies the affected and newly created slides. ## **Import from PDF** To convert a PDF document to a PowerPoint presentation, import its content into the slide collection and save the result as a PPTX file. pdf-to-powerpoint 1. Create a new [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) object. 2. Call [AddFromPdf](https://reference.aspose.com/slides/cpp/aspose.slides/slidecollection/addfrompdf/) with the path to the PDF file. 3. Call [Presentation::Save](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/save/) with [SaveFormat::Pptx](https://reference.aspose.com/slides/cpp/aspose.slides.export/saveformat/) to write the presentation to a PPTX file. The following C++ example imports a PDF document and saves the generated slides as a PowerPoint presentation: ```cpp #include #include #include using namespace System; using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = MakeObject(); presentation->get_Slides()->AddFromPdf(u"document.pdf"); presentation->Save(u"presentation.pptx", SaveFormat::Pptx); ``` The [AddFromPdf](https://reference.aspose.com/slides/cpp/aspose.slides/slidecollection/addfrompdf/) method returns the slides it adds, which is useful when you need to process only the imported slides. Try the free [PDF to PowerPoint](https://products.aspose.app/slides/import/pdf-to-powerpoint) web app to see this conversion workflow in action. ## **Import from HTML** Aspose.Slides can also create slides from an HTML document. The source can be supplied as HTML text, a text reader, or a stream. The following steps use a file stream: 1. Create a new [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) object. 2. Open the HTML file for reading and pass the stream to [AddFromHtml](https://reference.aspose.com/slides/cpp/aspose.slides/slidecollection/addfromhtml/). 3. Call [Presentation::Save](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/save/) with [SaveFormat::Pptx](https://reference.aspose.com/slides/cpp/aspose.slides.export/saveformat/) to write the result to a PPTX file. The following C++ example imports an HTML document and saves the generated slides as a PowerPoint presentation: ```cpp #include #include #include #include using namespace System; using namespace System::IO; using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = MakeObject(); auto htmlStream = File::OpenRead(u"page.html"); presentation->get_Slides()->AddFromHtml(htmlStream); presentation->Save(u"presentation.pptx", SaveFormat::Pptx); ``` ## **Insert HTML Content** Use [SlideCollection::InsertFromHtml](https://reference.aspose.com/slides/cpp/aspose.slides/slidecollection/insertfromhtml/) when HTML-generated slides must be placed at a specific position instead of appended. The index is zero-based and identifies the position at which the import starts. The method is also available through [ISlideCollection](https://reference.aspose.com/slides/cpp/aspose.slides/islidecollection/). The `useSlideWithIndexAsStart` argument controls how the importer uses that position: - When it is `false`, the importer creates new slides at the specified index and shifts the slides that follow them. - When it is `true`, the importer starts placing content in the available space on the existing slide at that index. If the HTML does not fit, Aspose.Slides paginates it automatically and inserts additional slides immediately after the starting slide. [SlideCollection::InsertFromHtml](https://reference.aspose.com/slides/cpp/aspose.slides/slidecollection/insertfromhtml/) returns an array of [ISlide](https://reference.aspose.com/slides/cpp/aspose.slides/islide/) objects. When insertion starts on new slides, every returned item is newly created. When an existing slide is used as the start, the array includes that affected slide followed by any new overflow slides. You can inspect this array instead of calculating the affected range from the presentation's slide count. ### **Insert HTML as New Slides** The following example supplies HTML as a string and inserts the generated slides at collection index `1`. Passing `false` leaves the existing slides unchanged except for shifting them to make room. ```cpp #include #include #include #include #include using namespace System; using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = MakeObject(); auto layoutSlide = presentation->get_LayoutSlide(0); presentation->get_Slides()->AddEmptySlide(layoutSlide); presentation->get_Slides()->AddEmptySlide(layoutSlide); auto insertIndex = 1; String html = u"

Quarterly update

This content is inserted before the slide that was at index 1.

"; auto insertedSlides = presentation->get_Slides()->InsertFromHtml(insertIndex, html, false); for (const auto& slide : insertedSlides) { auto slideIndex = presentation->get_Slides()->IndexOf(slide); Console::WriteLine(String::Format(u"Inserted slide index: {0}", slideIndex)); } presentation->Save(u"presentation-with-inserted-html.pptx", SaveFormat::Pptx); ``` ### **Start on an Existing Slide** The next example supplies the HTML through a stream. It keeps a header shape on the existing template slide, starts importing below the occupied area, and lets the long body continue onto new slides. The HTML also contains a relative image URL. An [IExternalResourceResolver](https://reference.aspose.com/slides/cpp/aspose.slides.import/iexternalresourceresolver/) obtains the resource, while the base URI tells the importer how to resolve `images/logo.png`. In this example, that file is expected at `html-assets/images/logo.png`. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace System; using namespace System::IO; using namespace System::Text; using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace Aspose::Slides::Import; auto presentation = MakeObject(); auto templateSlide = presentation->get_Slide(0); auto header = templateSlide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 20, 20, 680, 60); header->get_TextFrame()->set_Text(u"Product roadmap"); String html = u"

Roadmap details

"; for (auto itemIndex = 1; itemIndex <= 60; itemIndex++) { html += String::Format(u"

Roadmap item {0}: detailed implementation notes.

", itemIndex); } html += u""; auto htmlData = Encoding::get_UTF8()->GetBytes(html); auto htmlStream = MakeObject(htmlData); auto resolver = MakeObject(); String basePath = Path::GetFullPath(u"html-assets") + Path::DirectorySeparatorChar; String baseUri = MakeObject(basePath)->get_AbsoluteUri(); auto affectedSlides = presentation->get_Slides()->InsertFromHtml(0, htmlStream, resolver, baseUri, true); for (const auto& slide : affectedSlides) { auto slideIndex = presentation->get_Slides()->IndexOf(slide); Console::WriteLine(String::Format(u"Affected slide index: {0}", slideIndex)); } presentation->Save(u"presentation-with-html-overflow.pptx", SaveFormat::Pptx); ``` An unrestricted external resource resolver can read local or network resources referenced by the HTML. For untrusted input, implement [IExternalResourceResolver](https://reference.aspose.com/slides/cpp/aspose.slides.import/iexternalresourceresolver/) with an allowlist for permitted schemes, directories, and hosts, and reject all other URIs. [![Crops show Overview, Product roadmap and Summary before import. Slide 2 keeps its Product roadmap header with imported logo and body below. The first continuation starts at item 7 and Summary remains after the imported slides.](https://docs.aspose.com/slides/cpp/import-presentation/visual-import-presentation-2c09b3d2f9f0.svg)](https://docs.aspose.com/slides/cpp/import-presentation/visual-import-presentation-2c09b3d2f9f0.svg) *Crops from one .NET import with an existing target between two neighboring slides. The header survives, the relative logo and body start below it, and overflow creates six continuation slides before Summary.* ## **FAQ** **Can Aspose.Slides detect tables when importing a PDF?** Yes. Create a [PdfImportOptions](https://reference.aspose.com/slides/cpp/aspose.slides.import/pdfimportoptions/) object, call [PdfImportOptions::set_DetectTables](https://reference.aspose.com/slides/cpp/aspose.slides.import/pdfimportoptions/set_detecttables/) with `true`, and pass the options to [AddFromPdf](https://reference.aspose.com/slides/cpp/aspose.slides/slidecollection/addfrompdf/). The quality of table recognition depends on the structure and complexity of the source PDF. You can also use Aspose.Slides to convert HTML content to other formats: - [HTML to image](https://products.aspose.com/slides/cpp/conversion/html-to-image/) - [HTML to JPG](https://products.aspose.com/slides/cpp/conversion/html-to-jpg/) - [HTML to XML](https://products.aspose.com/slides/cpp/conversion/html-to-xml/) - [HTML to TIFF](https://products.aspose.com/slides/cpp/conversion/html-to-tiff/) ## Related articles - [Convert PowerPoint Presentations in C++ | HTML, PNG, PDF, Word, TIFF](https://docs.aspose.com/slides/cpp/convert-powerpoint/) # Installation > Install Aspose.Slides for C++ on Windows from NuGet in Visual Studio, or on Linux from the ZIP package with CMake, and check the installation with a first program. Source: https://docs.aspose.com/slides/cpp/installation/ Updated: 2026-09-27 ## **Overview** Aspose.Slides for C++ is distributed in two forms: | Form | Use it for | Where to get it | |---|---|---| | NuGet packages: [Aspose.Slides.Cpp](https://www.nuget.org/packages/Aspose.Slides.Cpp/) (64-bit) and [Aspose.Slides.Cpp.x86](https://www.nuget.org/packages/Aspose.Slides.Cpp.x86/) (32-bit) | Visual Studio C++ projects on Windows | NuGet | | ZIP packages for Windows, Linux, and macOS | Builds without NuGet, such as CMake projects | The [download page](https://releases.aspose.com/slides/cpp/) | This article shows how to install the NuGet package in Visual Studio on Windows and how to use the ZIP package with CMake on Linux. Both routes end with the same check: build and run the first example in [Create Presentations](https://docs.aspose.com/slides/cpp/create-presentation/). ## **Windows** On Windows, add the NuGet package to a Visual Studio C++ project. The package also installs its dependency, CodePorting.Translator.Cs2Cpp.Framework, and copies the DLLs that your program needs to the build output folder. Choose the package by the platform you build for: **Aspose.Slides.Cpp** for x64, and **Aspose.Slides.Cpp.x86** for Win32 (x86). The Aspose.Slides.Cpp package is not applied to a Win32 build, so the compiler cannot find its headers there. A Windows ZIP package is also available from the [download page](https://releases.aspose.com/slides/cpp/). ### **Method 1: Install or Update Aspose.Slides from the NuGet Package Manager** 1. Open Microsoft Visual Studio. 2. Create a C++ **Console App** project, or open an existing project. 3. In **Solution Explorer**, right-click the project and select **Manage NuGet Packages** (or go to **Project** > **Manage NuGet Packages**). 4. Under **Browse**, search for *Aspose.Slides.Cpp*. ![Searching for Aspose.Slides.Cpp in the NuGet Package Manager](https://docs.aspose.com/slides/cpp/installation/installation_1.png) 5. Click **Aspose.Slides.Cpp** (or **Aspose.Slides.Cpp.x86** for a 32-bit build) and then click **Install**. * If you already installed Aspose.Slides and want to update it, click **Update** instead. The package is downloaded and referenced in your project. ### **Method 2: Install or Update Aspose.Slides Through the Package Manager Console** 1. Open Microsoft Visual Studio. 2. Create a C++ **Console App** project, or open an existing project. 3. Go to **Tools** > **NuGet Package Manager** > **Package Manager Console**. ![Opening the Package Manager Console](https://docs.aspose.com/slides/cpp/installation/installation_2.png) 4. Run this command: ```powershell Install-Package Aspose.Slides.Cpp ``` For a 32-bit (Win32) build, install the x86 package instead: ```powershell Install-Package Aspose.Slides.Cpp.x86 ``` ![Running the Install-Package command](https://docs.aspose.com/slides/cpp/installation/installation_3.png) When the installation completes, confirmation messages appear. The package is distributed under the [Aspose EULA](https://about.aspose.com/legal/eula). ![Installation confirmation messages](https://docs.aspose.com/slides/cpp/installation/installation_4.png) To update the package, run `Update-Package Aspose.Slides.Cpp` (or `Update-Package Aspose.Slides.Cpp.x86`) in the Package Manager Console. ### **Check the Installation** 1. Replace the contents of the project's main *.cpp* file (the file that contains `main`) with the first example in [Create Presentations](https://docs.aspose.com/slides/cpp/create-presentation/). 2. In the toolbar, select the **x64** platform, or **x86** if you installed Aspose.Slides.Cpp.x86. 3. Press **Ctrl+F5** to build and run the program. The program saves *hello.pptx* in the project folder, which is the default working directory when Visual Studio runs a program. ## **Linux** On Linux, use the Linux ZIP package with CMake. It contains the Aspose.Slides library, its dependency CodePorting.Translator.Cs2Cpp.Framework, and a CMake configuration file for each of them. The libraries are built for x86_64 Linux with glibc 2.23 or later. 1. Install a C++ compiler, make, CMake, unzip, and the fontconfig library, which the Aspose.Slides libraries depend on. On Debian and Ubuntu: ```bash sudo apt-get update && sudo apt-get install -y g++ make cmake unzip libfontconfig1 ``` 2. Create a project folder and go to it: ```bash mkdir hello-slides cd hello-slides ``` 3. Download the Linux ZIP (**Aspose.Slides for C++ Linux**) from the [download page](https://releases.aspose.com/slides/cpp/) to the project folder, and unzip it into the *aspose-slides-cpp* subfolder: ```bash unzip aspose-slides-cpp-linux-*.zip -d aspose-slides-cpp ``` 4. Create a file named *CMakeLists.txt* in the project folder with this content: ```cmake cmake_minimum_required(VERSION 3.13) project(HelloSlides CXX) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(ASPOSE_SLIDES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/aspose-slides-cpp") find_package(CodePorting.Translator.Cs2Cpp.Framework REQUIRED CONFIG PATHS "${ASPOSE_SLIDES_DIR}" NO_DEFAULT_PATH) find_package(Aspose.Slides.Cpp REQUIRED CONFIG PATHS "${ASPOSE_SLIDES_DIR}" NO_DEFAULT_PATH) add_executable(hello main.cpp) target_link_libraries(hello PRIVATE Aspose.Slides.Cpp) ``` The two `find_package` calls load the CMake configuration files from the unzipped package. The framework is found first because Aspose.Slides depends on it. Linking the `Aspose.Slides.Cpp` target adds the include folders and both libraries to the build. 5. Save the first example in [Create Presentations](https://docs.aspose.com/slides/cpp/create-presentation/) as *main.cpp* in the project folder. 6. Build and run the program: ```bash cmake -S . -B build -DCMAKE_BUILD_TYPE=Release cmake --build build ./build/hello ``` The program saves *hello.pptx* in the current folder. CMake records the location of the libraries in the program, so you do not need to set `LD_LIBRARY_PATH` while the *aspose-slides-cpp* folder stays in place. The fonts used in your presentations, or suitable substitutes, must be installed on the system for text to render correctly when you convert slides to PDF or images. ## **FAQ** **Is there a free version or trial limitation?** Yes. Without a license, Aspose.Slides runs in evaluation mode: it adds an evaluation watermark to every slide it saves and truncates text read from presentations. To remove these limitations, apply a valid [license](https://docs.aspose.com/slides/cpp/licensing/). **Why does the compiler report that it cannot open *DOM/Presentation.h*?** The installed package does not match the platform you build. Aspose.Slides.Cpp applies only to x64 builds, and Aspose.Slides.Cpp.x86 only to Win32 builds. Select the matching platform in Visual Studio, or install the other package. ## Related features - [Use Slides from C++](https://docs.aspose.com/slides/features/cpp-api/) ## Related articles - [Work with PowerPoint Documents in Qt](https://docs.aspose.com/slides/cpp/work-with-powerpoint-documents-in-qt/) # Known Issues > Stay informed about current limitations and workarounds in Aspose.Slides for C++ to handle PowerPoint and OpenDocument presentations reliably. Source: https://docs.aspose.com/slides/cpp/known-issues/ Updated: 2025-11-19 --- lastmod: 2025-11-19T22:55:59+04:00 title: Known Issues type: docs weight: 330 url: /cpp/known-issues/ keywords: - known issue - PowerPoint - OpenDocument - presentation - C++ - Aspose.Slides description: "Stay informed about current limitations and workarounds in Aspose.Slides for C++ to handle PowerPoint and OpenDocument presentations reliably." --- # Licensing > Apply, manage, and troubleshoot licenses in Aspose.Slides for C++. Ensure uninterrupted access to full features with our step-by-step licensing guide. Source: https://docs.aspose.com/slides/cpp/licensing/ Updated: 2026-09-27 ## **Overview** Aspose.Slides can be used in evaluation mode or with a valid license. The evaluation version provides the same functionality as the licensed version, but it adds an evaluation watermark to every slide of each presentation it saves and truncates text that your code reads from presentations. This article explains how licensing works in Aspose.Slides and how to apply a license before using the library. A license can be loaded from a file or a stream by using the `License` class. The article also shows how to validate whether a license has been applied correctly. ## **Evaluate Aspose.Slides** You can download an evaluation version of **Aspose.Slides for C++** from [its NuGet download page](https://www.nuget.org/packages/Aspose.Slides.Cpp/) or, as a ZIP package, from the [download page](https://releases.aspose.com/slides/cpp/). The evaluation version offers the same functionality as the licensed product. In fact, the evaluation package is identical to the purchased one—it simply becomes licensed once you add a few lines of code to apply the license. Once you're satisfied with your evaluation of **Aspose.Slides**, you can [purchase a license](https://purchase.aspose.com/pricing/slides/cpp/). We recommend reviewing the available subscription types. If you have any questions, feel free to contact the Aspose sales team. Every Aspose license includes a one-year subscription for free upgrades, including new versions and bug fixes released during that period. Whether you're using a licensed or evaluation version, you receive free and unlimited technical support. **Evaluation Version Limitations** * The evaluation version (without a license specified) provides full product functionality, but it adds an evaluation watermark text box to every slide of each presentation it saves. * Text that your code reads from a presentation is truncated to its first few characters, followed by a notice about the evaluation limitation. Text that your code writes is saved in full. To test Aspose.Slides without limitations, you can request a **30-Day Temporary License**. For more information, see the [How to Get a Temporary License](https://purchase.aspose.com/temporary-license) page. ## **Licensing in Aspose.Slides** * An evaluation version becomes licensed after you purchase a license and apply it by adding a couple of lines of code. * The license is a plain-text XML file that contains details such as the product name, the number of developers it is licensed to, the subscription expiry date, and more. * The license file is digitally signed, so it must not be modified. Even an accidental change—such as adding a line break—will invalidate the file. * When you pass a file name without a folder, Aspose.Slides for C++ looks for the license file in the current working directory only. It does not search the folder of your executable or of the Aspose.Slides library, so pass the full path when the license file is stored elsewhere. * To avoid the limitations of the evaluation version, you must set the license before using Aspose.Slides. A license only needs to be set once per application or process. ## **Apply a License** A license can be loaded from a **file** or a **stream**. Aspose.Slides provides the [License](https://reference.aspose.com/slides/cpp/aspose.slides/license/) class for licensing operations. New licenses can activate Aspose.Slides only with version 21.4 or later. Earlier versions use a different licensing system and will not recognize these licenses. ### **File** The easiest way to set a license is to place the license file in the working directory of your program and specify only the file name, without the path. Otherwise, specify the full path to the file. The following C++ code applies the license file *Aspose.Slides.lic* from the working directory of the program: ```c++ #include #include #include using namespace Aspose::Slides; using namespace System; int main() { auto license = MakeObject(); license->SetLicense(u"Aspose.Slides.lic"); return 0; } ``` If the license is valid, [License::SetLicense](https://reference.aspose.com/slides/cpp/aspose.slides/license/setlicense/) returns and the program ends without output; from then on, Aspose.Slides works without the evaluation limitations. If the file is not in the working directory, the method throws a [FileNotFoundException](https://reference.aspose.com/slides/cpp/system.io/filenotfoundexception/) with the message *License "Aspose.Slides.lic" doesn't exist or access is restricted*. The example does not handle the exception, so the program stops. If you place the license file in a different directory, then when calling the [License::SetLicense](https://reference.aspose.com/slides/cpp/aspose.slides/license/setlicense/) method, the file name at the end of the specified explicit path must exactly match the name of your license file. For example, if you rename your license file to *Aspose.Slides.lic.xml*, you must pass the full path ending with *Aspose.Slides.lic.xml* to the [License::SetLicense](https://reference.aspose.com/slides/cpp/aspose.slides/license/setlicense/) method in your code. ### **Stream** Load a license from a stream when your program does not keep the license as a file that it can name, for example, when it reads the license from a database. [License::SetLicense](https://reference.aspose.com/slides/cpp/aspose.slides/license/setlicense/) accepts any [Stream](https://reference.aspose.com/slides/cpp/system.io/stream/) that contains the license. To keep the example short, the following C++ code opens *Aspose.Slides.lic* in the working directory with [File::OpenRead](https://reference.aspose.com/slides/cpp/system.io/file/openread/) and applies the license from that stream: ```c++ #include #include #include using namespace Aspose::Slides; using namespace System; using namespace System::IO; int main() { auto license = MakeObject(); auto stream = File::OpenRead(u"Aspose.Slides.lic"); license->SetLicense(stream); return 0; } ``` A valid license gives the same result as in the file example. If the file does not exist, [File::OpenRead](https://reference.aspose.com/slides/cpp/system.io/file/openread/) throws a [FileNotFoundException](https://reference.aspose.com/slides/cpp/system.io/filenotfoundexception/) before the license is applied, and the program stops. ## **Validate a License** To check whether a license has been set properly, call [License::IsLicensed](https://reference.aspose.com/slides/cpp/aspose.slides/license/islicensed/). It returns `true` only after a valid license has been applied, and `false` before that. The following C++ code applies the license file from the working directory and then checks it: ```c++ #include #include #include using namespace Aspose::Slides; using namespace System; int main() { auto license = MakeObject(); license->SetLicense(u"Aspose.Slides.lic"); if (license->IsLicensed()) { Console::WriteLine(u"License is good!"); } return 0; } ``` With a valid license, the program prints *License is good!*. If the file is missing or is not a license file, [License::SetLicense](https://reference.aspose.com/slides/cpp/aspose.slides/license/setlicense/) throws an exception before the check, and the program stops without printing anything. If the file is a license whose signature does not match, for example because it was edited, SetLicense returns without an error but `IsLicensed` returns `false`, so nothing is printed and Aspose.Slides stays in evaluation mode. ## **Thread Safety** The [License::SetLicense](https://reference.aspose.com/slides/cpp/aspose.slides/license/setlicense/) method is **not thread-safe**. If you need to call this method from multiple threads simultaneously, it's recommended to use synchronization primitives (such as a lock) to prevent potential issues. ## **FAQ** ### Can I apply the license in a completely offline environment (no internet access)? Yes. License validation is performed locally using the license file; no internet connection is required. ### What happens after the one-year subscription expires? Will the library stop working? No. The license is perpetual: you can continue using versions released before your subscription end date; you just won’t be eligible to use newer releases without renewing. ## Related articles - [Evaluate Aspose.Slides](https://docs.aspose.com/slides/cpp/evaluate-aspose-slides/) # Add Line Shapes to Presentations in C++ > Learn to manipulate line formatting in PowerPoint presentations with Aspose.Slides for C++. Discover properties, methods, and examples. Source: https://docs.aspose.com/slides/cpp/line/ Updated: 2026-08-02 ## **Overview** Aspose.Slides allows you to add line shapes to PowerPoint slides programmatically. This article shows how to create a simple line and how to customize a line so it appears as an arrow. You will learn how to add a line shape to a slide, adjust its visual appearance, and save the updated presentation. The examples focus on practical line formatting settings such as style, width, dash pattern, arrowhead options, and fill color. ## **Create a Plain Line** To add a simple plain line to a selected slide of the presentation, please follow the steps below: - Create an instance of [Presentation class](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/). - Obtain the reference of a slide by using its Index. - Add an AutoShape of Line type using [AddAutoShape](https://reference.aspose.com/slides/cpp/aspose.slides/ishapecollection/addautoshape/) method exposed by Shapes object. - Write the modified presentation as a PPTX file. In the example given below, we have added a line to the first slide of the presentation. ```cpp For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C // The path to the documents directory. const String outPath = u"../out/AddPlainLineToSlide_out.pptx"; const String templatePath = u"../templates/AltText.pptx"; // Load the desired the presentation SharedPtr pres = MakeObject(); // Access first slide SharedPtr slide = pres->get_Slides()->idx_get(0); // Add an autoshape of type line SharedPtr shape = slide->get_Shapes()->AddAutoShape(ShapeType::Line, 50, 150, 300, 0); //Write the PPTX to Disk pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx); ``` [Source: Examples-SlidesCPP-AddPlainLineToSlide-AddPlainLineToSlide.cpp](https://gist.githubusercontent.com/aspose-slides/a690df625dc0b1fff869ab198affe7a4/raw/f5e90f2c3a76eafa78b47bc2c4d957aed1441de9/Examples-SlidesCPP-AddPlainLineToSlide-AddPlainLineToSlide.cpp) ## **Create an Arrow-Shaped Line** Aspose.Slides for C++ also allows developers to configure some properties of the line to make it look more appealing. Let's try to configure few properties of a line to make it look like an arrow. Please follow the steps below to do so: - Create an instance of [Presentation class](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/). - Obtain the reference of a slide by using its Index. - Add an AutoShape of Line type using AddAutoShape method exposed by Shapes object. - Set the Line Style to one of the styles as offered by Aspose.Slides for C++. - Set the Width of the line. - Set the [Dash Style](https://reference.aspose.com/slides/cpp/aspose.slides/linedashstyle/) of the line to one of the styles offered by Aspose.Slides for C++. - Set the [Arrow Head Style](https://reference.aspose.com/slides/cpp/aspose.slides/lineformat/) and Length of the start point of the line. - Set the Arrow Head Style and Length of the end point of the line. - Write the modified presentation as a PPTX file. ```cpp For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C // The path to the documents directory. const String outPath = u"../out/AddArrowShapedLineToSlide_out.pptx"; const String templatePath = u"../templates/AltText.pptx"; // Load the desired the presentation SharedPtr pres = MakeObject(); // Access first slide SharedPtr slide = pres->get_Slides()->idx_get(0); // Add an autoshape of type line SharedPtr shape = slide->get_Shapes()->AddAutoShape(ShapeType::Line, 50, 150, 300, 0); // Apply some formatting on the line shape->get_LineFormat()->set_Style(LineStyle::ThickBetweenThin); shape->get_LineFormat()->set_Width(10); shape->get_LineFormat()->set_DashStyle(LineDashStyle::DashDot); shape->get_LineFormat()->set_BeginArrowheadLength(LineArrowheadLength::Short); shape->get_LineFormat()->set_BeginArrowheadStyle(LineArrowheadStyle::Oval); shape->get_LineFormat()->set_EndArrowheadLength(LineArrowheadLength::Long); shape->get_LineFormat()->set_EndArrowheadStyle(LineArrowheadStyle::Triangle); shape->get_LineFormat()->get_FillFormat()->set_FillType(FillType::Solid); shape->get_LineFormat()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Maroon()); //Write the PPTX to Disk pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx); ``` [Source: Examples-SlidesCPP-AddArrowShapedLineToSlide-AddArrowShapedLineToSlide.cpp](https://gist.githubusercontent.com/aspose-slides/a690df625dc0b1fff869ab198affe7a4/raw/bf60fe61fdfe9265fc58848a49176d87742702a3/Examples-SlidesCPP-AddArrowShapedLineToSlide-AddArrowShapedLineToSlide.cpp) ## **FAQ** ### Can I convert a regular line into a connector so it "snaps" to shapes? No. A regular line (an [AutoShape](https://reference.aspose.com/slides/cpp/aspose.slides/autoshape/) of type [Line](https://reference.aspose.com/slides/cpp/aspose.slides/shapetype/)) does not automatically become a connector. To make it snap to shapes, use the dedicated [Connector](https://reference.aspose.com/slides/cpp/aspose.slides/connector/) type and the [corresponding APIs](https://docs.aspose.com/slides/cpp/connector/) for connections. ### What should I do if a line’s properties are inherited from the theme and it’s hard to determine the final values? [Read the effective properties](https://docs.aspose.com/slides/cpp/shape-effective-properties/) through the [ILineFormatEffectiveData](https://reference.aspose.com/slides/cpp/aspose.slides/ilineformateffectivedata/)/[ILineFillFormatEffectiveData](https://reference.aspose.com/slides/cpp/aspose.slides/ilinefillformateffectivedata/) interfaces—these already account for inheritance and theme styles. ### Can I lock a line against editing (moving, resizing)? Yes. Shapes provide [lock objects](https://reference.aspose.com/slides/cpp/aspose.slides/autoshape/get_autoshapelock/) that let you [disallow editing operations](https://docs.aspose.com/slides/cpp/applying-protection-to-presentation/). # Low-Code Presentation Operations in C++ > Use the Aspose.Slides low-code API in C++ to convert and merge presentations, iterate through content, collect shapes, and reduce presentation size. Source: https://docs.aspose.com/slides/cpp/low-code-presentation-operations/ Updated: 2026-08-25 ## **Overview** The [Aspose::Slides::LowCode](https://reference.aspose.com/slides/cpp/aspose.slides.lowcode/) namespace provides static helper classes for common presentation operations. These helpers wrap frequently used object-model workflows in focused methods, so you can convert or merge files, process presentation elements, collect shapes, and remove unused content with less code. Low-code helpers are most useful when the operation applies to an entire file or presentation and the default workflow matches your requirements. Use the full [Aspose.Slides object model](https://reference.aspose.com/slides/cpp/aspose.slides/) when you need fine-grained control over individual slides, masters, layouts, shapes, export settings, or relationships between presentation elements. The following table summarizes the available helpers: | Helper | Use it for | | --- | --- | | [Convert](https://reference.aspose.com/slides/cpp/aspose.slides.lowcode/convert/) | Converting a presentation to another format with a direct file-to-file call. | | [Merger](https://reference.aspose.com/slides/cpp/aspose.slides.lowcode/merger/) | Combining complete presentation files of the same format. | | [ForEach](https://reference.aspose.com/slides/cpp/aspose.slides.lowcode/foreach/) | Running an action for every slide, shape, paragraph, or text portion. | | [Collect](https://reference.aspose.com/slides/cpp/aspose.slides.lowcode/collect/) | Retrieving shapes from the entire presentation for repeated processing or analysis. | | [Compress](https://reference.aspose.com/slides/cpp/aspose.slides.lowcode/compress/) | Removing unused masters and layouts and reducing embedded font data. | ## **Convert a Presentation** Use [Convert::AutoByExtension](https://reference.aspose.com/slides/cpp/aspose.slides.lowcode/convert/autobyextension/) when the output file extension is sufficient to select the export format. The method opens the source presentation, determines the required format from the output path, and writes the result. ```cpp #include using namespace Aspose::Slides::LowCode; Convert::AutoByExtension(u"input.pptx", u"output.pdf"); ``` The [Convert](https://reference.aspose.com/slides/cpp/aspose.slides.lowcode/convert/) class also provides dedicated methods for PDF, SVG, JPEG, PNG, and TIFF output. Use the full object model when you need to inspect or modify the presentation before export or configure an export option that is not exposed by the selected helper. See [Convert Presentation](https://docs.aspose.com/slides/cpp/convert-presentation/) for format-specific workflows and options. ## **Merge Presentations** Use [Merger::Process](https://reference.aspose.com/slides/cpp/aspose.slides.lowcode/merger/process/) to combine complete presentation files with one call. The input presentations must have the same file format. ```cpp #include #include #include using namespace Aspose::Slides::LowCode; auto inputFiles = System::MakeArray({u"part-1.pptx", u"part-2.pptx"}); Merger::Process(inputFiles, u"merged.pptx"); ``` The helper is appropriate when all slides should be appended to one result without selecting or remapping them individually. Use the full object model when you need to merge selected slides, apply a destination master or layout, preserve sections explicitly, or reconcile different slide sizes. See [Merge Presentations](https://docs.aspose.com/slides/cpp/merge-presentation/) for those scenarios. ## **Iterate Through Presentation Elements** The [ForEach](https://reference.aspose.com/slides/cpp/aspose.slides.lowcode/foreach/) class invokes a callback for each requested type of presentation element. It avoids nested collection loops and is convenient for presentation-wide inspection or formatting changes. The following example uses [ForEach::Slide](https://reference.aspose.com/slides/cpp/aspose.slides.lowcode/foreach/slide/), [ForEach::Shape](https://reference.aspose.com/slides/cpp/aspose.slides.lowcode/foreach/shape/), [ForEach::Paragraph](https://reference.aspose.com/slides/cpp/aspose.slides.lowcode/foreach/paragraph/), and [ForEach::Portion](https://reference.aspose.com/slides/cpp/aspose.slides.lowcode/foreach/portion/) to inspect the corresponding elements: ```cpp #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::LowCode; auto presentation = System::MakeObject(u"input.pptx"); auto slideCallback = std::function, int32_t)>([](System::SharedPtr slide, int32_t index) { System::Console::WriteLine(u"Slide {0}: {1} shapes", index, slide->get_Shapes()->get_Count()); }); ForEach::Slide(presentation, slideCallback); auto shapeCallback = std::function, System::SharedPtr, int32_t)>([](System::SharedPtr shape, System::SharedPtr slide, int32_t index) { System::Console::WriteLine(u"Shape {0}: {1}", index, shape->get_Name()); }); ForEach::Shape(presentation, shapeCallback); auto paragraphCallback = std::function, System::SharedPtr, int32_t)>([](System::SharedPtr paragraph, System::SharedPtr slide, int32_t index) { System::Console::WriteLine(u"Paragraph {0}: {1}", index, paragraph->get_Text()); }); ForEach::Paragraph(presentation, paragraphCallback); auto portionCallback = std::function, System::SharedPtr, System::SharedPtr, int32_t)>([](System::SharedPtr portion, System::SharedPtr paragraph, System::SharedPtr slide, int32_t index) { System::Console::WriteLine(u"Portion {0}: {1}", index, portion->get_Text()); }); ForEach::Portion(presentation, portionCallback); ``` By default, presentation-wide shape and text traversal includes normal, master, and layout slides. Overloads with an `includeNotes` parameter can also process notes slides. Use direct collection loops when traversal order, early exit, filtering before callback invocation, or detailed parent-child control is important. ## **Collect Shapes** Use [Collect::Shapes](https://reference.aspose.com/slides/cpp/aspose.slides.lowcode/collect/shapes/) when you need a collection of all shapes in a presentation rather than a callback for each shape. This is useful when the same set will be filtered, counted, or processed more than once. ```cpp #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::LowCode; auto presentation = System::MakeObject(u"input.pptx"); auto shapes = Collect::Shapes(presentation); for (const auto& shape : shapes) { System::Console::WriteLine(shape->get_Name()); } ``` Use [ForEach::Shape](https://reference.aspose.com/slides/cpp/aspose.slides.lowcode/foreach/shape/) instead when each shape can be handled immediately and you do not need to retain the collected result. ## **Compress Presentation Content** The [Compress](https://reference.aspose.com/slides/cpp/aspose.slides.lowcode/compress/) class can remove unused structural elements and reduce embedded font data: - [Compress::RemoveUnusedLayoutSlides](https://reference.aspose.com/slides/cpp/aspose.slides.lowcode/compress/removeunusedlayoutslides/) removes layout slides that no normal slide references. - [Compress::RemoveUnusedMasterSlides](https://reference.aspose.com/slides/cpp/aspose.slides.lowcode/compress/removeunusedmasterslides/) removes master slides that are no longer used. - [Compress::CompressEmbeddedFonts](https://reference.aspose.com/slides/cpp/aspose.slides.lowcode/compress/compressembeddedfonts/) removes unused characters from embedded fonts. ```cpp #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace Aspose::Slides::LowCode; auto presentation = System::MakeObject(u"input.pptx"); Compress::RemoveUnusedLayoutSlides(presentation); Compress::RemoveUnusedMasterSlides(presentation); Compress::CompressEmbeddedFonts(presentation); presentation->Save(u"compressed.pptx", SaveFormat::Pptx); ``` Remove unused layouts before unused masters so a master that becomes unreferenced after layout cleanup can also be removed. Save the optimized presentation to a new file if you may need the original masters, layouts, or complete embedded font data later. For more detail, see [Slide Master](https://docs.aspose.com/slides/cpp/slide-master/) and [Embedded Font](https://docs.aspose.com/slides/cpp/embedded-font/). ## **FAQ** **When should I use the low-code API instead of the full object model?** Use low-code helpers when a standard operation applies to a complete file or presentation and does not require detailed control over individual elements. Use the full object model when you need to select specific slides, control master and layout relationships, inspect intermediate state, or configure behavior that the helper does not expose. **Can Merger combine presentations in different file formats?** No. [Merger::Process](https://reference.aspose.com/slides/cpp/aspose.slides.lowcode/merger/process/) requires input presentations in the same format. Convert the input files to a common format first, for example with [Convert::AutoByExtension](https://reference.aspose.com/slides/cpp/aspose.slides.lowcode/convert/autobyextension/), and then merge the converted files. **Does ForEach process master, layout, and notes slides?** [ForEach::Slide](https://reference.aspose.com/slides/cpp/aspose.slides.lowcode/foreach/slide/) iterates through normal presentation slides. Presentation-wide [ForEach::Shape](https://reference.aspose.com/slides/cpp/aspose.slides.lowcode/foreach/shape/), [ForEach::Paragraph](https://reference.aspose.com/slides/cpp/aspose.slides.lowcode/foreach/paragraph/), and [ForEach::Portion](https://reference.aspose.com/slides/cpp/aspose.slides.lowcode/foreach/portion/) operations include normal, master, and layout slides by default. Use their overloads with `includeNotes` set to `true` to include notes slides. **What is the difference between ForEach::Shape and Collect::Shapes?** Use [ForEach::Shape](https://reference.aspose.com/slides/cpp/aspose.slides.lowcode/foreach/shape/) to process each shape immediately through a callback. Use [Collect::Shapes](https://reference.aspose.com/slides/cpp/aspose.slides.lowcode/collect/shapes/) when you need an enumerable result that can be retained, filtered, counted, or traversed multiple times. **Does Compress always make the presentation file smaller?** Not necessarily. The result depends on whether the presentation contains unused layouts, unused masters, or embedded fonts with unused characters. If none of those are present, the corresponding [Compress](https://reference.aspose.com/slides/cpp/aspose.slides.lowcode/compress/) operations may not reduce the file size. **Are changes made by ForEach or Compress saved automatically?** No. These helpers operate on the loaded [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) object in memory. After changing elements in a [ForEach](https://reference.aspose.com/slides/cpp/aspose.slides.lowcode/foreach/) callback or running [Compress](https://reference.aspose.com/slides/cpp/aspose.slides.lowcode/compress/), call [Presentation::Save](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/save/) to write the result. ## **Related Articles** - [Convert Presentation](https://docs.aspose.com/slides/cpp/convert-presentation/) - [Merge Presentations](https://docs.aspose.com/slides/cpp/merge-presentation/) - [Slide Master](https://docs.aspose.com/slides/cpp/slide-master/) - [Manage Text Box](https://docs.aspose.com/slides/cpp/manage-textbox/) - [Embedded Font](https://docs.aspose.com/slides/cpp/embedded-font/) # Enhance Your Presentations with AutoFit in C++ > Learn how to manage AutoFit settings in Aspose.Slides for C++ to optimize text display in your PowerPoint and OpenDocument presentations and improve content readability. Source: https://docs.aspose.com/slides/cpp/manage-autofit-settings/ Updated: 2026-08-05 ## **Introduction** By default, when you add a textbox, Microsoft PowerPoint uses the **Resize shape to fix text** setting for the textbox—it automatically resizes the textbox to ensure its text always fits into it. ![textbox-in-powerpoint](https://docs.aspose.com/slides/cpp/manage-autofit-settings/textbox-in-powerpoint.png) * When the text in the textbox becomes longer or bigger, PowerPoint automatically enlarges the textbox—increases its height—to allow it to hold more text. * When the text in the textbox becomes shorter or smaller, PowerPoint automatically reduces the textbox—decreases its height—to clear redundant space. In PowerPoint, these are the 4 important parameters or options that control the autofit behavior for a textbox: * **Do not Autofit** * **Shrink text on overflow** * **Resize shape to fit text** * **Wrap text in shape.** ![autofit-options-powerpoint](https://docs.aspose.com/slides/cpp/manage-autofit-settings/autofit-options-powerpoint.png) Aspose.Slides for C++ provides similar options—some methods under the [TextFrameFormat](https://reference.aspose.com/slides/cpp/class/aspose.slides.text_frame_format) class—that allow you to control the autofit behavior for textboxes in presentations. ## **Resize a Shape to Fit Text** If you want the text in a box to always fit into that box after changes are made to the text, you have to use the **Resize shape to fix text** option. To specify this setting, set the [AutofitType](https://reference.aspose.com/slides/cpp/class/aspose.slides.text_frame_format#acc706fb4d991d137831a6d50eea05e73) property (from the [TextFrameFormat](https://reference.aspose.com/slides/cpp/class/aspose.slides.text_frame_format) class) to `Shape`. ![alwaysfit-setting-powerpoint](https://docs.aspose.com/slides/cpp/manage-autofit-settings/alwaysfit-setting-powerpoint.png) This C++ code shows you how to specify that a text must always fit into its box in a PowerPoint presentation: ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System::Drawing; auto pres = System::MakeObject(); auto slide = pres->get_Slides()->idx_get(0); auto autoShape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 30.0f, 30.0f, 350.0f, 100.0f); auto textFrame = autoShape->get_TextFrame(); auto portion = System::MakeObject(u"lorem ipsum..."); auto fillFormat = portion->get_PortionFormat()->get_FillFormat(); fillFormat->get_SolidFillColor()->set_Color(Color::get_Black()); fillFormat->set_FillType(FillType::Solid); textFrame->get_Paragraphs()->idx_get(0)->get_Portions()->Add(portion); auto textFrameFormat = textFrame->get_TextFrameFormat(); textFrameFormat->set_AutofitType(TextAutofitType::Shape); pres->Save(u"Output-presentation.pptx", SaveFormat::Pptx); ``` If the text becomes longer or bigger, the textbox will be automatically resized (increase in height) to ensure all the text fits into it. If the text becomes shorter, the reverse occurs. ## **Do Not Autofit** If you want a textbox or shape to retain its dimensions no matter the changes made to the text it contains, you have to use the **Do not Autofit** option. To specify this setting, set the [AutofitType](https://reference.aspose.com/slides/cpp/class/aspose.slides.text_frame_format#acc706fb4d991d137831a6d50eea05e73) property (from the [TextFrameFormat](https://reference.aspose.com/slides/cpp/class/aspose.slides.text_frame_format) class) to `None`. ![donotautofit-setting-powerpoint](https://docs.aspose.com/slides/cpp/manage-autofit-settings/donotautofit-setting-powerpoint.png) This C++ code shows you how to specify that a textbox must always retain its dimensions in a PowerPoint presentation: ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System::Drawing; auto pres = System::MakeObject(); auto slide = pres->get_Slides()->idx_get(0); auto autoShape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 30.0f, 30.0f, 350.0f, 100.0f); auto textFrame = autoShape->get_TextFrame(); auto portion = System::MakeObject(u"lorem ipsum..."); auto fillFormat = portion->get_PortionFormat()->get_FillFormat(); fillFormat->get_SolidFillColor()->set_Color(Color::get_Black()); fillFormat->set_FillType(FillType::Solid); textFrame->get_Paragraphs()->idx_get(0)->get_Portions()->Add(portion); auto textFrameFormat = textFrame->get_TextFrameFormat(); textFrameFormat->set_AutofitType(TextAutofitType::None); pres->Save(u"Output-presentation.pptx", SaveFormat::Pptx); ``` When the text becomes too long for its box, it spills out. ## **Shrink Text on Overflow** If a text becomes too long for its box, through the **Shrink text on overflow** option, you can specify that the text's size and spacing must be reduced to make it fit into its box. To specify this setting, set the [AutofitType](https://reference.aspose.com/slides/cpp/class/aspose.slides.text_frame_format#acc706fb4d991d137831a6d50eea05e73) property (from the [TextFrameFormat](https://reference.aspose.com/slides/cpp/class/aspose.slides.text_frame_format) class) to `Normal`. ![shrinktextonoverflow-setting-powerpoint](https://docs.aspose.com/slides/cpp/manage-autofit-settings/shrinktextonoverflow-setting-powerpoint.png) This C++ code shows you how to specify that a text must be shrunk on overflow in a PowerPoint presentation: ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System::Drawing; auto pres = System::MakeObject(); auto slide = pres->get_Slides()->idx_get(0); auto autoShape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 30.0f, 30.0f, 350.0f, 100.0f); auto textFrame = autoShape->get_TextFrame(); auto portion = System::MakeObject(u"lorem ipsum..."); auto fillFormat = portion->get_PortionFormat()->get_FillFormat(); fillFormat->get_SolidFillColor()->set_Color(Color::get_Black()); fillFormat->set_FillType(FillType::Solid); textFrame->get_Paragraphs()->idx_get(0)->get_Portions()->Add(portion); auto textFrameFormat = textFrame->get_TextFrameFormat(); textFrameFormat->set_AutofitType(TextAutofitType::Normal); pres->Save(u"Output-presentation.pptx", SaveFormat::Pptx); ``` When the **Shrink text on overflow** option is used, the setting gets applied only when the text becomes too long for its box. ## **Wrap Text** If you want the text in a shape to get wrapped inside that shape when the text goes beyond the shape's border (width only), you have to use the **Wrap text in shape** parameter. To specify this setting, you have to set the [WrapText](https://reference.aspose.com/slides/cpp/class/aspose.slides.text_frame_format#aecc980adb13e3cf7162d09f99b5bbfd1) property (from the [TextFrameFormat](https://reference.aspose.com/slides/cpp/class/aspose.slides.text_frame_format) class) to `true`. This C++ code shows you how to use the Wrap Text setting in a PowerPoint presentation: ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System::Drawing; auto pres = System::MakeObject(); auto slide = pres->get_Slides()->idx_get(0); auto autoShape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 30.0f, 30.0f, 350.0f, 100.0f); auto textFrame = autoShape->get_TextFrame(); auto portion = System::MakeObject(u"lorem ipsum..."); auto fillFormat = portion->get_PortionFormat()->get_FillFormat(); fillFormat->get_SolidFillColor()->set_Color(Color::get_Black()); fillFormat->set_FillType(FillType::Solid); textFrame->get_Paragraphs()->idx_get(0)->get_Portions()->Add(portion); auto textFrameFormat = textFrame->get_TextFrameFormat(); textFrameFormat->set_WrapText(NullableBool::True); pres->Save(u"Output-presentation.pptx", SaveFormat::Pptx); ``` If you set the `WrapText` property to `False` for a shape, when the text inside the shape becomes longer than the shape's width, the text gets extended beyond the shape's borders along a single line. ## **FAQ** ### Do the text frame’s internal margins affect AutoFit? Yes. Padding (internal margins) reduces the usable area for text, so AutoFit will kick in earlier—shrinking the font or resizing the shape sooner. Check and adjust margins before tuning AutoFit. ### How does AutoFit interact with manual and soft line breaks? Forced breaks remain in place, and AutoFit adapts font size and spacing around them. Removing unnecessary breaks often reduces how aggressively AutoFit needs to shrink the text. ### Does changing the theme font or triggering font substitution affect AutoFit results? Yes. Substituting to a font with different glyph metrics changes text width/height, which can alter final font size and line wrapping. After any font change or substitution, re-check the slides. ## Related articles - [Text Box](https://docs.aspose.com/slides/cpp/examples/elements/text-box/) # Manage Presentation BLOBs in C++ for Efficient Memory Use > Manage BLOB data in Aspose.Slides for C++ to streamline PowerPoint and OpenDocument file operations for efficient presentation handling. Source: https://docs.aspose.com/slides/cpp/manage-blob/ Updated: 2026-08-05 ## **Overview** Aspose.Slides provides BLOB-based handling for large binary data in presentations to help reduce memory consumption when working with large images, audio, video, and presentation files. This article shows how to use BLOB-based processing to add large media to a presentation, export large media from a presentation, and load large presentations more efficiently. It also explains how temporary files can be used during processing and how to change the folder used to store them. ## **About BLOB** **BLOB** (**Binary Large Object**) is usually a large item (photo, presentation, document, or media) saved in binary formats. Aspose.Slides for C++ allows you to use BLOBs for objects in a way that reduces memory consumption when large files are involved. ## **Use BLOB to Reduce Memory Consumption** ### **Add a Large File through BLOB to a Presentation** [Aspose.Slides](https://docs.aspose.com/slides/cpp/) for C++ allows you to add large files (in this case, a large video file) through a process involving BLOBs to reduce memory consumption. This C++ code shows you how to add a large video file through the BLOB process to a presentation: ```cpp #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::IO; const String pathToVeryLargeVideo = u"veryLargeVideo.avi"; // Creates a new presentation to which the video will be added auto pres = System::MakeObject(); auto fileStream = System::MakeObject(pathToVeryLargeVideo, FileMode::Open); // Let's add the video to the presentation - we chose the KeepLocked behavior because we do //not intend to access the "veryLargeVideo.avi" file. auto video = pres->get_Videos()->AddVideo(fileStream, LoadingStreamBehavior::KeepLocked); pres->get_Slides()->idx_get(0)->get_Shapes()->AddVideoFrame(0.0f, 0.0f, 480.0f, 270.0f, video); // Saves the presentation. While a large presentation gets outputted, the memory consumption // stays low through the pres object's lifecycle pres->Save(u"presentationWithLargeVideo.pptx", SaveFormat::Pptx); ``` ### **Export a Large File Through BLOB from a Presentation** Aspose.Slides for C++ allows you to export large files (in this case, an audio or video file) through a process involving BLOBs from presentations. For example, you may need to extract a large media file from a presentation but do not want the file to be loaded into your computer's memory. By exporting the file through the BLOB process, you get to keep memory consumption low. This code in C++ demonstrates the described operation: ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; using namespace System::IO; const String hugePresentationWithAudiosAndVideosFile = u"Large Video File Test1.pptx"; auto loadOptions = System::MakeObject(); loadOptions->get_BlobManagementOptions()->set_PresentationLockingBehavior(PresentationLockingBehavior::KeepLocked); // Creates a Presentation's instance, locks the "hugePresentationWithAudiosAndVideos.pptx" file. auto pres = System::MakeObject(hugePresentationWithAudiosAndVideosFile, loadOptions); // Let's save each video to a file. To prevent high memory usage, we need a buffer that will be used // to transfer the data from the presentation's video stream to a stream for a newly created video file. auto buffer = System::MakeArray(8 * 1024, 0); // Iterates through the videos for (int32_t index = 0; index < pres->get_Videos()->get_Count(); ++index) { auto video = pres->get_Videos()->idx_get(index); // Opens the presentation video stream. Please, note that we intentionally avoided accessing methods // like video->get_BinaryData - because this method returns a byte array containing a full video, which then // causes bytes to be loaded into memory. We use video->GetStream, which will return Stream - and does NOT // require us to load the whole video into the memory. auto presVideoStream = video->GetStream(); auto outputFileStream = File::OpenWrite(String::Format(u"video{0}.avi", index)); int32_t bytesRead; while ((bytesRead = presVideoStream->Read(buffer, 0, buffer->get_Length())) > 0) { outputFileStream->Write(buffer, 0, bytesRead); } // Memory consumption will remain low regardless of the size of the video or presentation, } // If necessary, you can apply the same steps for audio files. ``` ### **Add an Image as BLOB to a Presentation** With methods from the [**IImageCollection**](https://reference.aspose.com/slides/cpp/class/aspose.slides.i_image_collection) interface and [**ImageCollection** ](https://reference.aspose.com/slides/cpp/class/aspose.slides.image_collection)class, you can add a large image as a stream to get it treated as a BLOB. This C++ code shows you how to add a large image through the BLOB process: ```cpp #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::IO; const String pathToLargeImage = u"large_image.jpg"; // creates a new presentation to which the image will be added. auto pres = System::MakeObject(); auto fileStream = System::MakeObject(pathToLargeImage, FileMode::Open); // Let's add the image to the presentation - we choose KeepLocked behavior because we do // NOT intend to access the "largeImage.png" file. auto img = pres->get_Images()->AddImage(fileStream, LoadingStreamBehavior::KeepLocked); pres->get_Slides()->idx_get(0)->get_Shapes()->AddPictureFrame(ShapeType::Rectangle, 0.0f, 0.0f, 300.0f, 200.0f, img); // Saves the presentation. While a large presentation gets outputted, the memory consumption // stays low through the pres object's lifecycle pres->Save(u"presentationWithLargeImage.pptx", SaveFormat::Pptx); ``` ## **Memory and Large Presentations** Typically, to load a large presentation, computers require a lot of temporary memory. All the presentation's content is loaded into the memory and the file (from which the presentation was loaded) stops being used. Consider a large PowerPoint presentation (large.pptx) that contains a 1.5 GB video file. The standard method for loading the presentation is described in this C++ code: ```cpp #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto pres = System::MakeObject(u"large.pptx"); pres->Save(u"large.pdf", SaveFormat::Pdf); ``` But this method consumes around 1.6 GB of temporary memory. ### **Load a Large Presentation as BLOB** Through the process involving a BLOB, you can load up a large presentation while using little memory. This C++ code describes the implementation where the BLOB process is used to load up a large presentation file (large.pptx): ```cpp #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto blobManagementOptions = System::MakeObject(); blobManagementOptions->set_PresentationLockingBehavior(PresentationLockingBehavior::KeepLocked); blobManagementOptions->set_IsTemporaryFilesAllowed(true); auto loadOptions = System::MakeObject(); loadOptions->set_BlobManagementOptions(blobManagementOptions); auto pres = System::MakeObject(u"large.pptx", loadOptions); pres->Save(u"large.pdf", SaveFormat::Pdf); ``` #### **Change the Folder for Temporary Files** When the BLOB process is used, your computer creates temporary files in the default folder for temporary files. If you want the temporary files to be kept in a different folder, you can change the settings for storage using `TempFilesRootPath`: ```cpp #include #include #include using namespace Aspose::Slides; auto blobManagementOptions = System::MakeObject(); blobManagementOptions->set_PresentationLockingBehavior(PresentationLockingBehavior::KeepLocked); blobManagementOptions->set_IsTemporaryFilesAllowed(true); blobManagementOptions->set_TempFilesRootPath(u"temp"); auto loadOptions = System::MakeObject(); loadOptions->set_BlobManagementOptions(blobManagementOptions); ``` When you use `TempFilesRootPath`, Aspose.Slides does not automatically create a folder to store temporary files. You have to create the folder manually. ### **Dispose Presentation Objects to Release Memory** When processing large presentations, ensure that the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) instance is properly disposed so that the memory it occupied is released. Call `Dispose()` after you have finished using the presentation to free unmanaged resources. ```cpp #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(u"large.pptx"); // ...process the presentation... presentation->Save(u"large.pdf", SaveFormat::Pdf); // Explicitly release resources. presentation->Dispose(); ``` ## **FAQ** ### What data in an Aspose.Slides presentation is treated as BLOB and controlled by BLOB options? Large binary objects such as images, audio, and video are treated as BLOB. The whole presentation file also involves BLOB handling when it’s loaded or saved. These objects are governed by BLOB policies that let you manage memory usage and spill to temporary files when needed. ### Where do I configure BLOB handling rules during presentation loading? Use [LoadOptions](https://reference.aspose.com/slides/cpp/aspose.slides/loadoptions/) with [BlobManagementOptions](https://reference.aspose.com/slides/cpp/aspose.slides/blobmanagementoptions/). There you set the in-memory limit for BLOB, allow or disallow temporary files, choose the root path for temp files, and select source locking behavior. ### Do BLOB settings affect performance, and how do I balance speed vs memory? Yes. Keeping BLOB in memory maximizes speed but increases RAM consumption; lowering the memory limit shifts more work to temporary files, reducing RAM at the cost of additional I/O. Use the [set_MaxBlobsBytesInMemory](https://reference.aspose.com/slides/cpp/aspose.slides/blobmanagementoptions/set_maxblobsbytesinmemory/) method to reach the right balance for your workload and environment. ### Do BLOB options help when opening extremely large presentations (e.g., gigabytes)? Yes. [BlobManagementOptions](https://reference.aspose.com/slides/cpp/aspose.slides/blobmanagementoptions/) are designed for such scenarios: enabling temporary files and using source locking can significantly reduce peak RAM use and stabilize processing for very large decks. ### Can I use BLOB policies when loading from streams instead of disk files? Yes. The same rules apply to streams: the presentation instance can own and lock the input stream (depending on the chosen locking mode), and temporary files are used when allowed, keeping memory usage predictable during processing. # Manage Table Cells in Presentations Using C++ > Manage PowerPoint table cells in C++: identify merged cells, remove borders, split cells, and set background colors and images with Aspose.Slides for C++. Source: https://docs.aspose.com/slides/cpp/manage-cells/ Updated: 2026-11-17 ## **Overview** Aspose.Slides allows you to access and modify table cells in PowerPoint presentations. This article explains how to identify merged table cells, remove cell borders, work with cell numbering after merging or splitting cells, change a cell’s background color, and add an image inside a table cell. The examples show how to create or open a presentation, get a table from a slide, update cell formatting through cell properties, and save the modified presentation as a PPTX file. Aspose.Slides uses zero-based indices to access table cells in the order `(column, row)`. ## **Identify a Merged Table Cell** The example opens an existing presentation and accesses the first shape on the first slide as a table. It assumes that the slide and shape exist and that the shape is a table. It then iterates through all rows and columns and uses [get_IsMergedCell](https://reference.aspose.com/slides/cpp/aspose.slides/icell/get_ismergedcell/) to identify cells in merged regions. For each match, it prints the cell coordinates in `row;column` order, [get_RowSpan](https://reference.aspose.com/slides/cpp/aspose.slides/icell/get_rowspan/), [get_ColSpan](https://reference.aspose.com/slides/cpp/aspose.slides/icell/get_colspan/), and the region's starting coordinates, [get_FirstRowIndex](https://reference.aspose.com/slides/cpp/aspose.slides/icell/get_firstrowindex/) and [get_FirstColumnIndex](https://reference.aspose.com/slides/cpp/aspose.slides/icell/get_firstcolumnindex/). ```cpp #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto presentation = MakeObject(u"presentation_with_table.pptx"); auto slide = presentation->get_Slide(0); auto table = ExplicitCast(slide->get_Shape(0)); auto rowCount = table->get_Rows()->get_Count(); for (auto rowIndex = 0; rowIndex < rowCount; rowIndex++) { auto columnCount = table->get_Columns()->get_Count(); for (auto columnIndex = 0; columnIndex < columnCount; columnIndex++) { auto cell = table->idx_get(columnIndex, rowIndex); if (cell->get_IsMergedCell()) { Console::WriteLine(u"Cell {0};{1} belongs to a merged region with RowSpan={2} and ColSpan={3} starting at {4};{5}.", rowIndex, columnIndex, cell->get_RowSpan(), cell->get_ColSpan(), cell->get_FirstRowIndex(), cell->get_FirstColumnIndex()); } } } ``` ## **Remove Table Cell Borders** Create a [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) and add a table to its first slide with [AddTable](https://reference.aspose.com/slides/cpp/aspose.slides/ishapecollection/addtable/). Column widths, row heights, and the table position are specified in points. The example sets all four cell borders to [FillType::NoFill](https://reference.aspose.com/slides/cpp/aspose.slides/filltype/), making them invisible. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto columnWidths = MakeArray({50, 50, 50, 50}); auto rowHeights = MakeArray({50, 30, 30, 30, 30}); auto table = slide->get_Shapes()->AddTable(100, 50, columnWidths, rowHeights); for (const auto& row : IterateOver(table->get_Rows())) for (const auto& cell : IterateOver(row)) { cell->get_CellFormat()->get_BorderTop()->get_FillFormat()->set_FillType(FillType::NoFill); cell->get_CellFormat()->get_BorderBottom()->get_FillFormat()->set_FillType(FillType::NoFill); cell->get_CellFormat()->get_BorderLeft()->get_FillFormat()->set_FillType(FillType::NoFill); cell->get_CellFormat()->get_BorderRight()->get_FillFormat()->set_FillType(FillType::NoFill); } presentation->Save(u"table.pptx", SaveFormat::Pptx); ``` ## **Add Diagonal Cell Borders** Use [get_BorderDiagonalDown](https://reference.aspose.com/slides/cpp/aspose.slides/icellformat/get_borderdiagonaldown/) to draw a line from the top-left corner to the bottom-right, and [get_BorderDiagonalUp](https://reference.aspose.com/slides/cpp/aspose.slides/icellformat/get_borderdiagonalup/) to draw a line from the bottom-left corner to the top-right. A diagonal can mark a corner header; both diagonals can form an X to mark a cell as not applicable. Each diagonal is an [ILineFormat](https://reference.aspose.com/slides/cpp/aspose.slides/ilineformat/). Use [get_FillFormat](https://reference.aspose.com/slides/cpp/aspose.slides/ilineformat/get_fillformat/) to access its fill, call [set_FillType](https://reference.aspose.com/slides/cpp/aspose.slides/ilinefillformat/set_filltype/) with [FillType::Solid](https://reference.aspose.com/slides/cpp/aspose.slides/filltype/) and choose a color through [get_SolidFillColor](https://reference.aspose.com/slides/cpp/aspose.slides/ilinefillformat/get_solidfillcolor/). Set the line width with [set_Width](https://reference.aspose.com/slides/cpp/aspose.slides/ilineformat/set_width/) in points. The example creates three cells in one row: a red downward diagonal, a blue upward diagonal, and both diagonals. It leaves the top, bottom, left, and right cell borders unchanged. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::Drawing; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto columnWidths = MakeArray({210, 210, 210}); auto rowHeights = MakeArray({160}); auto table = slide->get_Shapes()->AddTable(45, 130, columnWidths, rowHeights); auto downwardBorder = table->idx_get(0, 0)->get_CellFormat()->get_BorderDiagonalDown(); downwardBorder->get_FillFormat()->set_FillType(FillType::Solid); downwardBorder->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Red()); downwardBorder->set_Width(3); auto upwardBorder = table->idx_get(1, 0)->get_CellFormat()->get_BorderDiagonalUp(); upwardBorder->get_FillFormat()->set_FillType(FillType::Solid); upwardBorder->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Blue()); upwardBorder->set_Width(5); auto crossDownwardBorder = table->idx_get(2, 0)->get_CellFormat()->get_BorderDiagonalDown(); crossDownwardBorder->get_FillFormat()->set_FillType(FillType::Solid); crossDownwardBorder->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Red()); crossDownwardBorder->set_Width(3); auto crossUpwardBorder = table->idx_get(2, 0)->get_CellFormat()->get_BorderDiagonalUp(); crossUpwardBorder->get_FillFormat()->set_FillType(FillType::Solid); crossUpwardBorder->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Blue()); crossUpwardBorder->set_Width(5); presentation->Save(u"diagonal_cell_borders.pptx", SaveFormat::Pptx); ``` A diagonal is a formatting property, not a cell split. Each cell retains a single text frame accessed through [get_TextFrame](https://reference.aspose.com/slides/cpp/aspose.slides/icell/get_textframe/); the regions on either side of a diagonal cannot be edited independently. The saved table, rendered in Microsoft PowerPoint: ![Three table cells showing a red diagonal from top-left to bottom-right, a blue diagonal from bottom-left to top-right, and both diagonals forming an X.](https://docs.aspose.com/slides/cpp/manage-cells/diagonal-cell-borders.png) *Left to right: downward diagonal (red, 3 pt), upward diagonal (blue, 5 pt), and both diagonals.* ## **Merge Table Cells** Use [MergeCells](https://reference.aspose.com/slides/cpp/aspose.slides/itable/mergecells/) to combine a rectangular range of table cells into one cell. Specify the cells at the top-left and bottom-right corners of the range. The final argument controls whether the merge may include cells outside the specified range; `false` keeps the merge within that range. The example creates a 4-by-4 table with 70-point columns and rows, then merges the four central cells from `(1, 1)` through `(2, 2)`. The resulting cell spans two columns and two rows, while the table's underlying grid retains four columns and four rows. To access the merged cell's content or formatting, use its top-left position: `table->idx_get(1, 1)` in this example. The other positions in the merged range remain part of the table grid, so the indices of cells outside the range do not change. ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto columnWidths = MakeArray({70, 70, 70, 70}); auto rowHeights = MakeArray({70, 70, 70, 70}); auto table = slide->get_Shapes()->AddTable(100, 50, columnWidths, rowHeights); table->MergeCells(table->idx_get(1, 1), table->idx_get(2, 2), false); presentation->Save(u"merged_cells.pptx", SaveFormat::Pptx); ``` ## **Split Table Cells** Merging cells in the previous example preserves the table's grid. Splitting a cell can introduce a new grid column and change the column indices of cells to its right. Aspose.Slides follows PowerPoint's table grid model. This example creates a 4-by-4 table with 70-point columns and rows and calls [SplitByWidth](https://reference.aspose.com/slides/cpp/aspose.slides/icell/splitbywidth/) on cell `(1, 1)`. Half of the cell's 70-point width is passed to create two equal-width cells. After this split, the two halves are accessed as `table->idx_get(1, 1)` and `table->idx_get(2, 1)`. The table grid now has five columns: cells originally in columns 2 and 3 move to columns 3 and 4, respectively. Row indices remain unchanged. Use these updated column indices when accessing cells after the split. ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto columnWidths = MakeArray({70, 70, 70, 70}); auto rowHeights = MakeArray({70, 70, 70, 70}); auto table = slide->get_Shapes()->AddTable(100, 50, columnWidths, rowHeights); table->idx_get(1, 1)->SplitByWidth(table->idx_get(1, 1)->get_Width() / 2); presentation->Save(u"split_cells.pptx", SaveFormat::Pptx); ``` [![An unmerged 70-point cell splits into two 35-point cells, adding a fifth grid column and shifting the indices to its right.](https://docs.aspose.com/slides/cpp/manage-cells/visual-manage-cells-04c40789d81c.svg)](https://docs.aspose.com/slides/cpp/manage-cells/visual-manage-cells-04c40789d81c.svg) *The width split affects cell (1, 1), using zero-based (column, row) indices. Other rows keep a cell spanning both new column positions.* ### **Split Merged Cells by Row or Column Span** To prepare merged template cells for data population, use [SplitByRowSpan](https://reference.aspose.com/slides/cpp/aspose.slides/icell/splitbyrowspan/) to split along an existing row boundary, or [SplitByColSpan](https://reference.aspose.com/slides/cpp/aspose.slides/icell/splitbycolspan/) to split along a column boundary. The `index` argument counts rows in the upper part or columns in the left part of the split; it is relative to the merged region: - Row split: `0 < index <` [get_RowSpan](https://reference.aspose.com/slides/cpp/aspose.slides/icell/get_rowspan/). - Column split: `0 < index <` [get_ColSpan](https://reference.aspose.com/slides/cpp/aspose.slides/icell/get_colspan/). The example expects a presentation to have a table as the first shape on the first slide, with `(1, 2)` and `(1, 3)` merged vertically. Starting from the lower position, it uses [get_FirstColumnIndex](https://reference.aspose.com/slides/cpp/aspose.slides/icell/get_firstcolumnindex/) and [get_FirstRowIndex](https://reference.aspose.com/slides/cpp/aspose.slides/icell/get_firstrowindex/) to locate the origin and checks both spans. `SplitByRowSpan(1)` then separates rows 2 and 3 for product names. For a horizontal two-column merge, use `SplitByColSpan(1)` instead. ```cpp #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(u"table_template.pptx"); auto slide = presentation->get_Slide(0); auto table = ExplicitCast(slide->get_Shape(0)); auto selectedCell = table->idx_get(1, 3); auto firstColumnIndex = selectedCell->get_FirstColumnIndex(); auto firstRowIndex = selectedCell->get_FirstRowIndex(); auto mergedCell = table->idx_get(firstColumnIndex, firstRowIndex); if (mergedCell->get_IsMergedCell() && mergedCell->get_RowSpan() == 2 && mergedCell->get_ColSpan() == 1) { mergedCell->SplitByRowSpan(1); // Retrieve the resulting cells from the table after splitting. auto upperCell = table->idx_get(firstColumnIndex, firstRowIndex); auto lowerCell = table->idx_get(firstColumnIndex, firstRowIndex + 1); Console::WriteLine(u"Upper cell merged: {0}", upperCell->get_IsMergedCell()); Console::WriteLine(u"Lower cell merged: {0}", lowerCell->get_IsMergedCell()); upperCell->get_TextFrame()->set_Text(u"Product A"); lowerCell->get_TextFrame()->set_Text(u"Product B"); presentation->Save(u"split_template.pptx", SaveFormat::Pptx); } else { Console::WriteLine(u"Select a merged region spanning exactly two rows and one column."); } ``` The table grid and surrounding cell indices stay unchanged. Retrieve the resulting cells by their coordinates; here, both have spans of 1 and [get_IsMergedCell](https://reference.aspose.com/slides/cpp/aspose.slides/icell/get_ismergedcell/) prints `False`. Larger regions can remain partly merged after one split. The original text and its formatting remain in the upper (or left) cell; the new cell is empty but inherits cell formatting such as fill, borders, and margins. Populate the cells after splitting and set any required text formatting explicitly. The saved presentation contains separate "Product A" and "Product B" cells with the template's cell formatting retained. See the [Cell API Reference](https://reference.aspose.com/slides/cpp/aspose.slides/cell/) for details. ### **Split a Cell at a Specific Height** [SplitByHeight](https://reference.aspose.com/slides/cpp/aspose.slides/icell/splitbyheight/) takes the height of the upper part in points. [SplitByRowSpan](https://reference.aspose.com/slides/cpp/aspose.slides/icell/splitbyrowspan/) takes the number of existing grid rows in the upper part. To center a 40-point cell in the right column, subtract 40 from the cell’s actual height and divide the remaining space equally above and below it. ```cpp #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto columnWidths = MakeArray({160, 160}); auto rowHeights = MakeArray({140}); auto table = slide->get_Shapes()->AddTable(50, 50, columnWidths, rowHeights); table->idx_get(0, 0)->get_TextFrame()->set_Text(u"Left"); auto height = table->idx_get(1, 0)->get_Height(); auto margin = (height - 40) / 2; table->idx_get(1, 0)->SplitByHeight(margin); table->idx_get(1, 1)->SplitByHeight(40); table->idx_get(1, 1)->get_TextFrame()->set_Text(u"Middle"); presentation->Save(u"split_by_height.pptx", SaveFormat::Pptx); ``` The first split adds a grid row, leaving the lower 90 points at `(1, 1)`. The second split targets that cell and adds another row below it. The right column now contains `(1, 0)` at 50 points (`margin`), `(1, 1)` at 40 points, and `(1, 2)` at 50 points (`margin`). The left cell spans all three rows at its original height of 140 points. ![The left cell spans the full table height beside three cells with Middle in the center.](https://docs.aspose.com/slides/cpp/manage-cells/split-by-height.png) ## **Change the Table Cell Background Color** This example creates a table with 150-point columns and 50-point rows. It uses [set_FillType](https://reference.aspose.com/slides/cpp/aspose.slides/ifillformat/set_filltype/) to select a solid fill and [get_SolidFillColor](https://reference.aspose.com/slides/cpp/aspose.slides/ifillformat/get_solidfillcolor/) to access the fill color and set it to red for cell `(2, 3)`, in the third column and fourth row. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace System::Drawing; using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto columnWidths = MakeArray({150, 150, 150, 150}); auto rowHeights = MakeArray({50, 50, 50, 50, 50}); auto table = slide->get_Shapes()->AddTable(50, 50, columnWidths, rowHeights); auto cell = table->idx_get(2, 3); cell->get_CellFormat()->get_FillFormat()->set_FillType(FillType::Solid); cell->get_CellFormat()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Red()); presentation->Save(u"cell_background_color.pptx", SaveFormat::Pptx); ``` ## **Add an Image Inside a Table Cell** Place the input image in the working directory before running this example. It loads the image with [Images::FromFile](https://reference.aspose.com/slides/cpp/aspose.slides/images/fromfile/) and adds it to the presentation's image collection with [AddImage](https://reference.aspose.com/slides/cpp/aspose.slides/iimagecollection/addimage/). It then assigns the image to the picture fill of cell `(0, 0)`, the first cell in the table. [PictureFillMode::Stretch](https://reference.aspose.com/slides/cpp/aspose.slides/picturefillmode/) stretches the image to fill the cell, which may change its aspect ratio. Column widths and row heights are in points. The loaded image is disposed after it has been added to the presentation. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto columnWidths = MakeArray({150, 150, 150, 150}); auto rowHeights = MakeArray({100, 100, 100, 100, 90}); auto table = slide->get_Shapes()->AddTable(50, 50, columnWidths, rowHeights); auto image = Images::FromFile(u"aspose_logo.jpg"); auto ppImage = presentation->get_Images()->AddImage(image); image->Dispose(); table->idx_get(0, 0)->get_CellFormat()->get_FillFormat()->set_FillType(FillType::Picture); table->idx_get(0, 0)->get_CellFormat()->get_FillFormat()->get_PictureFillFormat()->set_PictureFillMode(PictureFillMode::Stretch); table->idx_get(0, 0)->get_CellFormat()->get_FillFormat()->get_PictureFillFormat()->get_Picture()->set_Image(ppImage); presentation->Save(u"table_cell_with_image.pptx", SaveFormat::Pptx); ``` ## **FAQ** **Can I set different line thicknesses and styles for different sides of a single cell?** Yes. The [top](https://reference.aspose.com/slides/cpp/aspose.slides/cellformat/get_bordertop/)/[bottom](https://reference.aspose.com/slides/cpp/aspose.slides/cellformat/get_borderbottom/)/[left](https://reference.aspose.com/slides/cpp/aspose.slides/cellformat/get_borderleft/)/[right](https://reference.aspose.com/slides/cpp/aspose.slides/cellformat/get_borderright/) borders have separate properties, so the thickness and style of each side can differ. **What happens to the image if I change the column/row size after setting a picture as the cell’s background?** The behavior depends on the [fill mode](https://reference.aspose.com/slides/cpp/aspose.slides/picturefillmode/) (stretch/tile). With stretching, the image adjusts to the new cell; with tiling, the tiles are recalculated. **Can I assign a hyperlink to all the content of a cell?** [Hyperlinks](https://docs.aspose.com/slides/cpp/manage-hyperlinks/) are set at the text (portion) level inside the cell’s text frame or at the level of the entire table/shape. In practice, you assign the link to a portion or to all the text in the cell. **Can I set different fonts within a single cell?** Yes. A cell’s text frame supports [portions](https://reference.aspose.com/slides/cpp/aspose.slides/portion/) (runs) with independent formatting—font family, style, size, and color. ## Related articles - [Create and Customize PowerPoint Tables in C++](https://docs.aspose.com/slides/cpp/powerpoint-table/) - [Manage Presentation Tables in C++](https://docs.aspose.com/slides/cpp/manage-table/) - [Table](https://docs.aspose.com/slides/cpp/examples/elements/table/) # Manage Presentation Hyperlinks in C++ > Add, format, update, and remove hyperlinks in PowerPoint and OpenDocument presentations with Aspose.Slides for C++, using C++ examples. Source: https://docs.aspose.com/slides/cpp/manage-hyperlinks/ Updated: 2026-11-02 ## **Introduction** A hyperlink connects presentation content to a website or a location within the presentation. In PowerPoint, hyperlinks commonly serve two purposes: * Open a website from text, a shape, or a media frame. * Navigate to another slide, for example, from a table of contents. Aspose.Slides for C++ lets you add these links, control their appearance and sound, update their settings, and remove them. The examples below show how to work with hyperlinks on individual elements and how to access hyperlinks at the presentation, slide, or text-frame level. You can also edit presentations with the [free online Aspose PowerPoint editor](https://products.aspose.app/slides/editor). ## **Add URL Hyperlinks** You can assign a website URL to text, a shape, or a media frame. The element to which you assign the hyperlink determines the clickable area: a text portion links the selected text, while a shape or frame links the slide object. For presentations containing relative hyperlinks, see [Manage the Hyperlink Base](https://docs.aspose.com/slides/cpp/presentation-properties/#manage-the-hyperlink-base) to read, change, or clear the document-level base. ### **Add URL Hyperlinks to Text** To link text to a website, create a [Hyperlink](https://reference.aspose.com/slides/cpp/aspose.slides/hyperlink/) and assign it with the text portion's [set_HyperlinkClick](https://reference.aspose.com/slides/cpp/aspose.slides/portionformat/set_hyperlinkclick/) method, as shown below. Only that portion of text becomes clickable. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(); auto textShape = presentation->get_Slide(0)->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 100, 100, 600, 50, false); textShape->AddTextFrame(u"Aspose: File Format APIs"); auto portionFormat = textShape->get_TextFrame()->get_Paragraph(0)->get_Portion(0)->get_PortionFormat(); portionFormat->set_HyperlinkClick(System::MakeObject(u"https://www.aspose.com/")); portionFormat->get_HyperlinkClick()->set_Tooltip(u"Explore Aspose file format APIs"); portionFormat->set_FontHeight(32); presentation->Save(u"presentation-out.pptx", SaveFormat::Pptx); ``` ### **Add URL Hyperlinks to Shapes and Media Frames** To make a shape or frame clickable, use its [set_HyperlinkClick](https://reference.aspose.com/slides/cpp/aspose.slides/shape/set_hyperlinkclick/) method. The hyperlink belongs to the object itself rather than to a text portion inside it. The same approach applies to picture, audio, and video frames: assign the hyperlink to the frame and use [set_Tooltip](https://reference.aspose.com/slides/cpp/aspose.slides/ihyperlink/set_tooltip/) to add a hint if needed. The following example makes a rectangle clickable: ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(); auto shape = presentation->get_Slide(0)->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 100, 100, 600, 50); shape->set_HyperlinkClick(System::MakeObject(u"https://www.aspose.com/")); shape->get_HyperlinkClick()->set_Tooltip(u"Explore Aspose file format APIs"); presentation->Save(u"presentation-out.pptx", SaveFormat::Pptx); ``` ## **Use Hyperlinks to Create a Table of Contents** Internal hyperlinks let readers jump from a table of contents to a specific slide. The following example uses [SetInternalHyperlinkClick](https://reference.aspose.com/slides/cpp/aspose.slides/ihyperlinkmanager/setinternalhyperlinkclick/) to link the “Page 2” text on the first slide to the second slide. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(); auto firstSlide = presentation->get_Slide(0); auto secondSlide = presentation->get_Slides()->AddEmptySlide(firstSlide->get_LayoutSlide()); auto tableOfContents = firstSlide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 40, 40, 300, 100); tableOfContents->get_FillFormat()->set_FillType(FillType::NoFill); tableOfContents->get_LineFormat()->get_FillFormat()->set_FillType(FillType::NoFill); tableOfContents->get_TextFrame()->get_Paragraphs()->Clear(); auto paragraph = System::MakeObject(); paragraph->get_ParagraphFormat()->get_DefaultPortionFormat()->get_FillFormat()->set_FillType(FillType::Solid); paragraph->get_ParagraphFormat()->get_DefaultPortionFormat()->get_FillFormat()->get_SolidFillColor()->set_Color(System::Drawing::Color::get_Black()); paragraph->set_Text(u"Title of slide 2 .......... "); auto linkPortion = System::MakeObject(); linkPortion->set_Text(u"Page 2"); linkPortion->get_PortionFormat()->get_HyperlinkManager()->SetInternalHyperlinkClick(secondSlide); paragraph->get_Portions()->Add(linkPortion); tableOfContents->get_TextFrame()->get_Paragraphs()->Add(paragraph); presentation->Save(u"link_to_slide.pptx", SaveFormat::Pptx); ``` ## **Format Hyperlinks** ### **Color** The [set_ColorSource](https://reference.aspose.com/slides/cpp/aspose.slides/ihyperlink/set_colorsource/) method of [IHyperlink](https://reference.aspose.com/slides/cpp/aspose.slides/ihyperlink/) determines whether a hyperlink uses the presentation's hyperlink color or the text portion's formatting. To apply a custom text color, select [HyperlinkColorSource::PortionFormat](https://reference.aspose.com/slides/cpp/aspose.slides/hyperlinkcolorsource/) and set the portion's fill color. This feature was introduced in PowerPoint 2019; older versions do not apply this setting. The following example adds two text hyperlinks to the same slide. The first uses a red text fill, while the second retains the default hyperlink color. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(); auto coloredShape = presentation->get_Slide(0)->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 100, 100, 450, 50, false); coloredShape->AddTextFrame(u"This hyperlink uses a custom color."); auto coloredPortionFormat = coloredShape->get_TextFrame()->get_Paragraph(0)->get_Portion(0)->get_PortionFormat(); coloredPortionFormat->set_HyperlinkClick(System::MakeObject(u"https://www.aspose.com/")); coloredPortionFormat->get_HyperlinkClick()->set_ColorSource(HyperlinkColorSource::PortionFormat); coloredPortionFormat->get_FillFormat()->set_FillType(FillType::Solid); coloredPortionFormat->get_FillFormat()->get_SolidFillColor()->set_Color(System::Drawing::Color::get_Red()); auto defaultShape = presentation->get_Slide(0)->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 100, 200, 450, 50, false); defaultShape->AddTextFrame(u"This hyperlink uses the default color."); defaultShape->get_TextFrame()->get_Paragraph(0)->get_Portion(0)->get_PortionFormat()->set_HyperlinkClick(System::MakeObject(u"https://www.aspose.com/")); presentation->Save(u"presentation-out-hyperlink.pptx", SaveFormat::Pptx); ``` ### **Sound** A hyperlink can play a sound when activated or stop a sound that is already playing. Use the following methods to configure these behaviors: - [IHyperlink::set_Sound](https://reference.aspose.com/slides/cpp/aspose.slides/ihyperlink/set_sound/) specifies the audio associated with the hyperlink. - [IHyperlink::set_StopSoundOnClick](https://reference.aspose.com/slides/cpp/aspose.slides/ihyperlink/set_stopsoundonclick/) controls whether activating the hyperlink stops the previous sound. #### **Add a Hyperlink Sound** The following example loads `sampleaudio.wav` and associates it with a button on the first slide. Clicking the button plays the sound and navigates to the next slide. A second shape on that slide stops the previous sound when clicked, without performing a navigation action. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(); auto audioData = System::IO::File::ReadAllBytes(u"sampleaudio.wav"); auto hyperlinkSound = presentation->get_Audios()->AddAudio(audioData); auto firstSlide = presentation->get_Slide(0); auto playButton = firstSlide->get_Shapes()->AddAutoShape(ShapeType::SoundButton, 100, 100, 100, 50); playButton->set_HyperlinkClick(Hyperlink::get_NextSlide()); if (!playButton->get_HyperlinkClick()->get_StopSoundOnClick() && playButton->get_HyperlinkClick()->get_Sound() == nullptr) { playButton->get_HyperlinkClick()->set_Sound(hyperlinkSound); } auto secondSlide = presentation->get_Slides()->AddEmptySlide(firstSlide->get_LayoutSlide()); auto stopButton = secondSlide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 100, 100, 100, 50); stopButton->set_HyperlinkClick(Hyperlink::get_NoAction()); stopButton->get_HyperlinkClick()->set_StopSoundOnClick(true); presentation->Save(u"hyperlink-sound.pptx", SaveFormat::Pptx); ``` #### **Extract a Hyperlink Sound** The following example opens the presentation created above and reads the first shape's hyperlink audio into memory through [get_Sound](https://reference.aspose.com/slides/cpp/aspose.slides/ihyperlink/get_sound/) and [get_BinaryData](https://reference.aspose.com/slides/cpp/aspose.slides/iaudio/get_binarydata/). ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; auto presentation = System::MakeObject(u"hyperlink-sound.pptx"); if (presentation->get_Slides()->get_Count() > 0 && presentation->get_Slide(0)->get_Shapes()->get_Count() > 0) { auto hyperlink = presentation->get_Slide(0)->get_Shape(0)->get_HyperlinkClick(); auto sound = hyperlink != nullptr ? hyperlink->get_Sound() : nullptr; if (sound != nullptr) { auto audioData = sound->get_BinaryData(); System::Console::WriteLine(u"Extracted {0} bytes of hyperlink audio.", audioData->get_Length()); } else { System::Console::WriteLine(u"The first shape has no hyperlink sound."); } } else { System::Console::WriteLine(u"The presentation has no first slide or shape to inspect."); } ``` ### **Tooltip and Interaction Settings** You can update the following [IHyperlink](https://reference.aspose.com/slides/cpp/aspose.slides/ihyperlink/) settings through these methods after assigning a hyperlink to text or a shape: - [set_Tooltip](https://reference.aspose.com/slides/cpp/aspose.slides/ihyperlink/set_tooltip/) sets the text that a viewer can display as a hint for the link. - [set_TargetFrame](https://reference.aspose.com/slides/cpp/aspose.slides/ihyperlink/set_targetframe/) specifies the target frame within a parent HTML frameset, when applicable. - [set_History](https://reference.aspose.com/slides/cpp/aspose.slides/ihyperlink/set_history/) controls whether activating the link adds its destination to the list of viewed hyperlinks. - [set_HighlightClick](https://reference.aspose.com/slides/cpp/aspose.slides/ihyperlink/set_highlightclick/) controls whether the hyperlink is highlighted when clicked. ## **Remove Hyperlinks from Presentations** Use [GetAnyHyperlinks](https://reference.aspose.com/slides/cpp/aspose.slides/ihyperlinkqueries/getanyhyperlinks/) to collect hyperlink containers, including text-portion links, before changing them. The following example removes both activation types from the first slide. To remove only one type, call only [RemoveHyperlinkClick](https://reference.aspose.com/slides/cpp/aspose.slides/ihyperlinkmanager/removehyperlinkclick/) or [RemoveHyperlinkMouseOver](https://reference.aspose.com/slides/cpp/aspose.slides/ihyperlinkmanager/removehyperlinkmouseover/); removing a click action does not remove its mouse-over counterpart. ```cpp #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(u"pres.pptx"); if (presentation->get_Slides()->get_Count() > 0) { auto containers = presentation->get_Slide(0)->get_HyperlinkQueries()->GetAnyHyperlinks(); for (const auto& container : containers) { container->get_HyperlinkManager()->RemoveHyperlinkClick(); container->get_HyperlinkManager()->RemoveHyperlinkMouseOver(); } presentation->Save(u"pres-removed-hyperlinks.pptx", SaveFormat::Pptx); } else { System::Console::WriteLine(u"The presentation has no slides to process."); } ``` For unconditional removal, [RemoveAllHyperlinks](https://reference.aspose.com/slides/cpp/aspose.slides/ihyperlinkqueries/removeallhyperlinks/) removes both activation types in the selected scope in one call. For selective cleanup and coverage of masters, layouts, and notes, see [Report, Sanitize, and Verify Hyperlinks](https://docs.aspose.com/slides/cpp/manage-hyperlinks/#report-sanitize-and-verify-hyperlinks). ## **Build a Complete Hyperlink Inventory** Before distributing a presentation, inventory its interactive actions as well as its web links. [GetAnyHyperlinks](https://reference.aspose.com/slides/cpp/aspose.slides/ihyperlinkqueries/getanyhyperlinks/) returns [IHyperlinkContainer](https://reference.aspose.com/slides/cpp/aspose.slides/ihyperlinkcontainer/) objects, not a flat list of URL strings. Inspect both [get_HyperlinkClick](https://reference.aspose.com/slides/cpp/aspose.slides/ihyperlinkcontainer/get_hyperlinkclick/) and [get_HyperlinkMouseOver](https://reference.aspose.com/slides/cpp/aspose.slides/ihyperlinkcontainer/get_hyperlinkmouseover/) on each container. They are independent: the same container can expose both actions, so a complete report needs up to two rows per container. Scanning only shape-level hyperlinks can miss links attached to text portions. Query the appropriate scope instead, and retain the returned containers so that you can later update or remove their actions. ### **Query Presentation, Slide, and Text-Frame Scopes** The [IHyperlinkQueries](https://reference.aspose.com/slides/cpp/aspose.slides/ihyperlinkqueries/) interface is available through [IPresentation::get_HyperlinkQueries](https://reference.aspose.com/slides/cpp/aspose.slides/ipresentation/get_hyperlinkqueries/), [IBaseSlide::get_HyperlinkQueries](https://reference.aspose.com/slides/cpp/aspose.slides/ibaseslide/get_hyperlinkqueries/), and [ITextFrame::get_HyperlinkQueries](https://reference.aspose.com/slides/cpp/aspose.slides/itextframe/get_hyperlinkqueries/). Each scope supports the same queries: - [GetHyperlinkClicks](https://reference.aspose.com/slides/cpp/aspose.slides/ihyperlinkqueries/gethyperlinkclicks/) returns containers with a click action. - [GetHyperlinkMouseOvers](https://reference.aspose.com/slides/cpp/aspose.slides/ihyperlinkqueries/gethyperlinkmouseovers/) returns containers with a mouse-over action. - [GetAnyHyperlinks](https://reference.aspose.com/slides/cpp/aspose.slides/ihyperlinkqueries/getanyhyperlinks/) returns containers with either or both actions. The following example creates `hyperlink-audit-input.pptx` with an external click link, a file mouse-over link, internal slide navigation, a text mouse-over link, and a macro action. It does not execute any of these actions. The same three queries work at every scope; the counts describe containers, not action totals. The text-frame scope excludes the enclosing shape's own links. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto printCounts = [](System::String scope, System::SharedPtr queries) { auto clickContainers = queries->GetHyperlinkClicks(); auto mouseOverContainers = queries->GetHyperlinkMouseOvers(); auto allContainers = queries->GetAnyHyperlinks(); System::Console::WriteLine(u"{0}: click={1}, mouse-over={2}, any={3}", scope, clickContainers->get_Count(), mouseOverContainers->get_Count(), allContainers->get_Count()); }; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto destination = presentation->get_Slides()->AddEmptySlide(slide->get_LayoutSlide()); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 20, 20, 400, 60); shape->get_TextFrame()->set_Text(u"Click the text to go to slide 2"); shape->get_HyperlinkManager()->SetExternalHyperlinkClick(u"https://example.com/"); shape->get_HyperlinkClick()->set_Tooltip(u"Public website"); shape->get_HyperlinkManager()->SetExternalHyperlinkMouseOver(u"file:///C:/private/report.xlsx"); auto portionFormat = shape->get_TextFrame()->get_Paragraph(0)->get_Portion(0)->get_PortionFormat(); portionFormat->get_HyperlinkManager()->SetInternalHyperlinkClick(destination); portionFormat->get_HyperlinkManager()->SetExternalHyperlinkMouseOver(u"https://example.com/help"); auto macroButton = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 20, 120, 200, 60); macroButton->get_HyperlinkManager()->SetMacroHyperlinkClick(u"ReviewPresentation"); printCounts(u"Presentation", presentation->get_HyperlinkQueries()); printCounts(u"Slide 1", slide->get_HyperlinkQueries()); printCounts(u"Text frame", shape->get_TextFrame()->get_HyperlinkQueries()); presentation->Save(u"hyperlink-audit-input.pptx", SaveFormat::Pptx); ``` For this example, presentation and slide queries each report three click containers, two mouse-over containers, and three containers with either action. The text-frame query reports one container in each category. ### **Classify Actions and Destinations** Use [IHyperlink::get_ActionType](https://reference.aspose.com/slides/cpp/aspose.slides/ihyperlink/get_actiontype/) to interpret an action before interpreting its destination. The [HyperlinkActionType](https://reference.aspose.com/slides/cpp/aspose.slides/hyperlinkactiontype/) values cover more than web navigation: | Values | Meaning for an audit | | --- | --- | | `Hyperlink` | External hyperlink; inspect the URL and its scheme. | | `JumpSpecificSlide` | Internal navigation to a particular slide. | | `JumpFirstSlide`, `JumpPreviousSlide`, `JumpNextSlide`, `JumpLastSlide`, `JumpLastViewedSlide` | Built-in slideshow navigation, resolved in slideshow context. | | `JumpEndShow`, `StartCustomSlideShow` | End the current show or start a custom show. | | `StartMacro` | Execute a macro. | | `StartProgram` | Launch a program. | | `OpenFile`, `OpenPresentation` | Open a file or another presentation; review separately from web URLs. | | `StartStopMedia` | Start or stop media playback. | | `NoAction`, `Unknown` | No navigation action, or an unrecognized action requiring review. | Read external destinations from [get_ExternalUrl](https://reference.aspose.com/slides/cpp/aspose.slides/ihyperlink/get_externalurl/) and specific internal destinations from [get_TargetSlide](https://reference.aspose.com/slides/cpp/aspose.slides/ihyperlink/get_targetslide/). Internal actions and built-in commands may have no external URL; an empty URL does not mean that the container has no action. Preserve [get_ExternalUrlOriginal](https://reference.aspose.com/slides/cpp/aspose.slides/ihyperlink/get_externalurloriginal/) when it differs from the normalized URL, and include the tooltip returned by [get_Tooltip](https://reference.aspose.com/slides/cpp/aspose.slides/ihyperlink/get_tooltip/) when available. ### **Report, Sanitize, and Verify Hyperlinks** The following C++ example reads an existing presentation (use the file created above), writes `hyperlink-audit.json`, applies a policy, saves `hyperlink-sanitized.pptx`, and reopens it to check both activation types again. It collects containers before changing them and uses pointer identity to avoid processing the same container twice. Presentation queries cover ordinary slides; for a package-wide inventory, it also explicitly queries masters, layouts, notes, and the notes and handout masters when present. The report records a one-based slide index and [get_SlideId](https://reference.aspose.com/slides/cpp/aspose.slides/ibaseslide/get_slideid/) where available. [ISlideComponent::get_Slide](https://reference.aspose.com/slides/cpp/aspose.slides/islidecomponent/get_slide/) supplies the owning slide for supported containers. Masters, layouts, and notes have no ordinary slide index and are identified by their scope. Shape containers and text-portion formatting containers are labeled separately; other container types retain their runtime type name. Each container gets a report-local ID so its two actions can be correlated. This deliberately restrictive application policy allows only absolute HTTPS URLs and valid internal slide targets. It rejects macros, programs, file actions, other slideshow actions, unknown actions, and other URL schemes. These rejections are policy decisions, not an Aspose.Slides safety verdict. HTTPS alone does not establish trust: add host allowlists and other checks for your application. Both original and normalized external URLs are checked. The example audits metadata without following links or running actions. For remediation, the container's [get_HyperlinkManager](https://reference.aspose.com/slides/cpp/aspose.slides/ihyperlinkcontainer/get_hyperlinkmanager/) supports [SetExternalHyperlinkClick](https://reference.aspose.com/slides/cpp/aspose.slides/ihyperlinkmanager/setexternalhyperlinkclick/), [RemoveHyperlinkClick](https://reference.aspose.com/slides/cpp/aspose.slides/ihyperlinkmanager/removehyperlinkclick/), and [RemoveHyperlinkMouseOver](https://reference.aspose.com/slides/cpp/aspose.slides/ihyperlinkmanager/removehyperlinkmouseover/). Here, prohibited external click links are replaced with a fixed HTTPS landing page; other prohibited clicks and prohibited mouse-over actions are removed independently. Set `replaceExternalClicks` to `false` to remove all policy violations instead. Choose an application-owned replacement page before deployment. The report's export flag uses a conservative PDF review policy: flag mouse-over actions and anything other than an external link or specific slide jump as potentially unsupported. It is a review hint, not a capability test or a guarantee that unflagged links will survive export. Supported [PDF](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-pdf/) and [HTML](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-html/) exports may preserve hyperlinks, depending on the action, export options, and viewer. Raster [images](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-png/) and [video](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/) cannot preserve interactive hyperlinks; flag every action when auditing for those outputs. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; const auto replaceExternalClicks = true; const System::String replacementUrl = u"https://example.com/blocked-link"; auto presentation = System::MakeObject(u"hyperlink-audit-input.pptx"); auto collectContainers = [](System::SharedPtr source) { std::vector> found; std::unordered_set seen; auto addQueries = [&](System::SharedPtr queries) { auto containers = queries->GetAnyHyperlinks(); for (const auto& container : containers) { if (seen.insert(container.get()).second) found.push_back(container); } }; auto addScope = [&](System::SharedPtr slide) { if (slide != nullptr) addQueries(slide->get_HyperlinkQueries()); }; addQueries(source->get_HyperlinkQueries()); for (const auto& master : source->get_Masters()) addScope(master); for (const auto& layout : source->get_LayoutSlides()) addScope(layout); for (const auto& slide : source->get_Slides()) addScope(slide->get_NotesSlideManager()->get_NotesSlide()); addScope(source->get_MasterNotesSlideManager()->get_MasterNotesSlide()); addScope(source->get_MasterHandoutSlideManager()->get_MasterHandoutSlide()); return found; }; auto isHttps = [](System::String value) { System::SharedPtr uri; return System::Uri::TryCreate(value, System::UriKind::Absolute, uri) && uri->get_Scheme() == System::Uri::UriSchemeHttps; }; auto policyViolation = [&](System::SharedPtr link) -> System::String { if (link == nullptr) return u""; if (link->get_ActionType() == HyperlinkActionType::JumpSpecificSlide) { return link->get_TargetSlide() == nullptr ? u"Missing target slide" : u""; } if (link->get_ActionType() != HyperlinkActionType::Hyperlink) return u"Action is not allowed"; if (!isHttps(link->get_ExternalUrl())) return u"Normalized URL is not absolute HTTPS"; auto original = link->get_ExternalUrlOriginal(); if (!original.IsNullOrEmpty() && !isHttps(original)) return u"Original URL is not absolute HTTPS"; return u""; }; auto slideIndex = [&](System::SharedPtr slide) { for (auto index = 0; index < presentation->get_Slides()->get_Count(); index++) { if (presentation->get_Slide(index) == slide) return index + 1; } return 0; }; auto jsonString = [](System::String value) { std::ostringstream escaped; escaped << '"'; for (unsigned char character : value.ToUtf8String()) { if (character == '"' || character == '\\') escaped << '\\' << character; else if (character < 0x20) escaped << "\\u" << std::hex << std::setw(4) << std::setfill('0') << static_cast(character); else escaped << character; } escaped << '"'; return escaped.str(); }; auto containers = collectContainers(presentation); std::ofstream report("hyperlink-audit.json", std::ios::binary); if (!report) { System::Console::WriteLine(u"Cannot open the audit report for writing."); System::Environment::set_ExitCode(1); return; } auto rowCount = 0; report << "[\n"; auto addRow = [&](System::SharedPtr link, System::String activation, System::SharedPtr container, size_t containerId) { if (link == nullptr) return; auto component = System::AsCast(container); auto ownerSlide = component != nullptr ? component->get_Slide() : nullptr; auto targetSlide = link->get_TargetSlide(); auto violation = policyViolation(link); auto shape = System::AsCast(container); auto portionFormat = System::AsCast(container); auto ownerType = shape != nullptr ? System::String(u"Shape") : portionFormat != nullptr ? System::String(u"Text portion") : container->GetType().get_Name(); auto ordinaryAction = link->get_ActionType() == HyperlinkActionType::Hyperlink || link->get_ActionType() == HyperlinkActionType::JumpSpecificSlide; auto ownerIndex = slideIndex(ownerSlide); auto targetIndex = slideIndex(targetSlide); if (rowCount++ != 0) report << ",\n"; report << " {\"ContainerId\":" << containerId; report << ",\"SlideIndex\":" << (ownerIndex != 0 ? std::to_string(ownerIndex) : "null"); report << ",\"SlideId\":" << (ownerSlide != nullptr ? std::to_string(ownerSlide->get_SlideId()) : "null"); report << ",\"Scope\":" << (ownerSlide != nullptr ? jsonString(ownerSlide->GetType().get_Name()) : "null"); report << ",\"OwnerType\":" << jsonString(ownerType); report << ",\"Activation\":" << jsonString(activation); report << ",\"ActionType\":" << jsonString(System::ObjectExt::ToString(link->get_ActionType())); report << ",\"ExternalUrl\":" << jsonString(link->get_ExternalUrl()); report << ",\"TargetSlideIndex\":" << (targetIndex != 0 ? std::to_string(targetIndex) : "null"); report << ",\"TargetSlideId\":" << (targetSlide != nullptr ? std::to_string(targetSlide->get_SlideId()) : "null"); report << ",\"Tooltip\":" << jsonString(link->get_Tooltip()); report << ",\"OriginalExternalUrl\":" << (link->get_ExternalUrlOriginal() != link->get_ExternalUrl() ? jsonString(link->get_ExternalUrlOriginal()) : "null"); report << ",\"PotentiallyUnsafe\":" << (!violation.IsNullOrEmpty() ? "true" : "false"); report << ",\"PolicyViolation\":" << (!violation.IsNullOrEmpty() ? jsonString(violation) : "null"); report << ",\"TargetExport\":\"PDF\",\"PotentiallyUnsupportedByExport\":" << (activation == u"mouse-over" || !ordinaryAction ? "true" : "false") << "}"; }; for (auto index = size_t{0}; index < containers.size(); index++) { auto container = containers[index]; addRow(container->get_HyperlinkClick(), u"click", container, index + 1); addRow(container->get_HyperlinkMouseOver(), u"mouse-over", container, index + 1); } report << "\n]\n"; report.close(); if (!report) { System::Console::WriteLine(u"The audit report could not be written completely."); System::Environment::set_ExitCode(1); return; } for (const auto& container : containers) { auto click = container->get_HyperlinkClick(); if (!policyViolation(click).IsNullOrEmpty()) { if (replaceExternalClicks && click->get_ActionType() == HyperlinkActionType::Hyperlink) { container->get_HyperlinkManager()->SetExternalHyperlinkClick(replacementUrl); } else { container->get_HyperlinkManager()->RemoveHyperlinkClick(); } } if (!policyViolation(container->get_HyperlinkMouseOver()).IsNullOrEmpty()) { container->get_HyperlinkManager()->RemoveHyperlinkMouseOver(); } } presentation->Save(u"hyperlink-sanitized.pptx", SaveFormat::Pptx); auto reopened = System::MakeObject(u"hyperlink-sanitized.pptx"); auto remainingContainers = collectContainers(reopened); auto violations = 0; for (const auto& container : remainingContainers) { if (!policyViolation(container->get_HyperlinkClick()).IsNullOrEmpty()) violations++; if (!policyViolation(container->get_HyperlinkMouseOver()).IsNullOrEmpty()) violations++; } System::Console::WriteLine(u"Audit rows: {0}; prohibited actions after reopening: {1}", rowCount, violations); if (violations != 0) { System::Console::WriteLine(u"Verification failed: do not distribute the saved presentation."); System::Environment::set_ExitCode(1); } ``` With the input created above, the report contains five action rows. The file mouse-over link and macro click are removed, while the HTTPS links and internal slide navigation remain. The verification prints zero prohibited actions. An input containing a prohibited external click URL also exercises the replacement branch. A container with an allowed click and a prohibited mouse-over keeps its click action. This selective cleanup differs from [RemoveAllHyperlinks](https://reference.aspose.com/slides/cpp/aspose.slides/ihyperlinkqueries/removeallhyperlinks/), which removes both activation types throughout the selected scope regardless of policy. Verification here checks hyperlink actions only; it does not remove embedded VBA projects, OLE objects, or other active content, and it does not validate an exported PDF or HTML file. ## **FAQ** **How can I link to a section or its first slide?** Sections in PowerPoint group slides, but an internal hyperlink targets an individual slide. To create navigation to a section, link to the first slide in that section. **Can I attach a hyperlink to master slide elements so it works on all slides?** Yes. Master slide and layout elements support hyperlinks. Links on these elements are available during the slide show on slides that use the corresponding master or layout. **Will hyperlinks be preserved when exporting to PDF, HTML, images, or video?** Supported PDF and HTML exports may preserve hyperlinks; raster images and video cannot. See the export considerations in [Report, Sanitize, and Verify Hyperlinks](https://docs.aspose.com/slides/cpp/manage-hyperlinks/#report-sanitize-and-verify-hyperlinks). ## Related articles - [Hyperlink](https://docs.aspose.com/slides/cpp/examples/elements/hyperlink/) # Manage Presentation Ink Objects in C++ > Manage PowerPoint ink objects, edit traces and brush properties, and control ink appearance during PDF, HTML, SVG, TIFF, and image export with Aspose.Slides for C++. Source: https://docs.aspose.com/slides/cpp/manage-ink/ Updated: 2026-08-10 ## **Introduction** PowerPoint provides an ink feature that allows you to draw freeform strokes. Ink can be used to highlight other objects, show connections and processes, and draw attention to specific items on a slide. The [Aspose.Slides.Ink](https://reference.aspose.com/slides/cpp/aspose.slides.ink/) namespace contains the classes and interfaces needed to work with ink objects. For example, the [IInk](https://reference.aspose.com/slides/cpp/aspose.slides.ink/iink/) interface represents an ink object on a slide. ## **Differences between Regular Objects and Ink Objects** Objects on a PowerPoint slide are typically represented by shape objects. In its simplest form, a shape is a container that defines the area of the object itself (its frame) along with properties such as the container size, shape, and background. For more information, see [Shape Layout Format](https://docs.aspose.com/slides/cpp/shape-manipulations/#access-layout-formats-for-shape). However, when PowerPoint handles an ink object, it ignores all properties of the object frame (container) except its size. The size of the container area is determined by the standard [IShape::get_Width](https://reference.aspose.com/slides/cpp/aspose.slides/ishape/get_width/) and [IShape::get_Height](https://reference.aspose.com/slides/cpp/aspose.slides/ishape/get_height/) methods: ![ink_powerpoint1](https://docs.aspose.com/slides/cpp/manage-ink/ink_powerpoint1.png) ## **Ink Traces** An ink trace is a basic element used to record the trajectory of a pen as a user writes digital ink. A trace stores a sequence of connected points. The simplest form of encoding specifies the X and Y coordinates of each sample point. When all connected points are rendered, they produce an image like this: ![ink_powerpoint2](https://docs.aspose.com/slides/cpp/manage-ink/ink_powerpoint2.png) ## **Brush Properties for Drawing** A brush is used to draw lines that connect the points of an ink trace. The brush has its own color and size, represented by the [IInkBrush::get_Color](https://reference.aspose.com/slides/cpp/aspose.slides.ink/iinkbrush/get_color/) and [IInkBrush::get_Size](https://reference.aspose.com/slides/cpp/aspose.slides.ink/iinkbrush/get_size/) methods. ### **Set Ink Brush Color** This C++ code shows how to set the color of an ink brush: ```cpp #include #include #include #include #include #include using Aspose::Slides::Ink::IInk; using Aspose::Slides::Presentation; using System::ExplicitCast; using System::MakeObject; auto presentation = MakeObject(u"pres.pptx"); auto ink = ExplicitCast(presentation->get_Slide(0)->get_Shape(0)); auto inkTrace = ink->get_Traces()[0]; auto brush = inkTrace->get_Brush(); brush->set_Color(System::Drawing::Color::get_Red()); presentation->Dispose(); ``` ### **Set Ink Brush Size** This C++ code shows how to set the size of an ink brush: ```cpp #include #include #include #include #include #include using Aspose::Slides::Ink::IInk; using Aspose::Slides::Presentation; using System::ExplicitCast; using System::MakeObject; auto presentation = MakeObject(u"pres.pptx"); auto ink = ExplicitCast(presentation->get_Slide(0)->get_Shape(0)); auto inkTrace = ink->get_Traces()[0]; auto brush = inkTrace->get_Brush(); brush->set_Size(System::Drawing::SizeF(5.0f, 10.0f)); presentation->Dispose(); ``` Generally, a brush's width and height do not match, so PowerPoint does not display the brush size (the corresponding data section is grayed out). When the brush width and height match, PowerPoint displays its size this way: ![ink_powerpoint3](https://docs.aspose.com/slides/cpp/manage-ink/ink_powerpoint3.png) For clarity, let's increase the height of the ink object and review the important dimensions: ![ink_powerpoint4](https://docs.aspose.com/slides/cpp/manage-ink/ink_powerpoint4.png) The container (frame) does not account for the size of the brushes—it always assumes that the line thickness is zero (see the previous image). Therefore, to determine the visible area of the entire ink object, the brush size of its traces must be taken into account. Here, the target object (the handwritten text trace) has been scaled to the size of the container (frame). When the size of the container changes, the brush size remains constant, and vice versa. ![ink_powerpoint5](https://docs.aspose.com/slides/cpp/manage-ink/ink_powerpoint5.png) PowerPoint uses similar behavior for text objects: ![ink_powerpoint6](https://docs.aspose.com/slides/cpp/manage-ink/ink_powerpoint6.png) ## **Control Ink Appearance During Export and Rendering** Aspose.Slides provides the [IInkOptions](https://reference.aspose.com/slides/cpp/aspose.slides.export/iinkoptions/) interface to control how ink objects appear in exported or rendered output. You can use its methods to hide ink completely or change how ink brush mask operations are interpreted. Ink options are available through the export or rendering options for several output types: | Output | Ink options method | | --- | --- | | PDF | [PdfOptions::get_InkOptions](https://reference.aspose.com/slides/cpp/aspose.slides.export/pdfoptions/get_inkoptions/) | | HTML | [HtmlOptions::get_InkOptions](https://reference.aspose.com/slides/cpp/aspose.slides.export/htmloptions/get_inkoptions/) | | SVG | [SVGOptions::get_InkOptions](https://reference.aspose.com/slides/cpp/aspose.slides.export/svgoptions/get_inkoptions/) | | TIFF | [TiffOptions::get_InkOptions](https://reference.aspose.com/slides/cpp/aspose.slides.export/tiffoptions/get_inkoptions/) | | Slide image | [RenderingOptions::get_InkOptions](https://reference.aspose.com/slides/cpp/aspose.slides.export/renderingoptions/get_inkoptions/) | The same two settings are available through these methods: - [IInkOptions::set_HideInk](https://reference.aspose.com/slides/cpp/aspose.slides.export/iinkoptions/set_hideink/) determines whether ink objects are included in the output. Its default value is `false`. - [IInkOptions::set_InterpretMaskOpAsOpacity](https://reference.aspose.com/slides/cpp/aspose.slides.export/iinkoptions/set_interpretmaskopasopacity/) determines whether a mask operation is interpreted as opacity when rendering an ink brush. Its default value is `true`; set it to `false` to use the ROP operation instead. ### **Hide Ink Objects in PDF Output** By default, ink objects remain visible during export. Call [IInkOptions::set_HideInk](https://reference.aspose.com/slides/cpp/aspose.slides.export/iinkoptions/set_hideink/) with `true` when you need a clean output without handwritten annotations or other ink content. The following C++ example exports a presentation to PDF while hiding all ink objects: ```cpp #include #include #include #include #include using Aspose::Slides::Presentation; using Aspose::Slides::Export::PdfOptions; using Aspose::Slides::Export::SaveFormat; using System::MakeObject; auto presentation = MakeObject(u"presentation.pptx"); auto pdfOptions = MakeObject(); pdfOptions->get_InkOptions()->set_HideInk(true); presentation->Save(u"presentation_without_ink.pdf", SaveFormat::Pdf, pdfOptions); presentation->Dispose(); ``` ### **Hide Ink Objects When Rendering a Slide as an Image** To hide ink objects when rendering slides as bitmap images, configure [RenderingOptions::get_InkOptions](https://reference.aspose.com/slides/cpp/aspose.slides.export/renderingoptions/get_inkoptions/) and pass the rendering options to the [ISlide::GetImage](https://reference.aspose.com/slides/cpp/aspose.slides/islide/getimage/) method. The following C++ example renders the first slide as a PNG image without ink objects: ```cpp #include #include #include #include #include #include #include using Aspose::Slides::ImageFormat; using Aspose::Slides::Presentation; using Aspose::Slides::Export::RenderingOptions; using System::MakeObject; auto presentation = MakeObject(u"presentation.pptx"); auto renderingOptions = MakeObject(); renderingOptions->get_InkOptions()->set_HideInk(true); auto image = presentation->get_Slide(0)->GetImage(renderingOptions); image->Save(u"slide_without_ink.png", ImageFormat::Png); image->Dispose(); presentation->Dispose(); ``` ### **Control Ink Mask Rendering** The [IInkOptions::set_InterpretMaskOpAsOpacity](https://reference.aspose.com/slides/cpp/aspose.slides.export/iinkoptions/set_interpretmaskopasopacity/) method controls how mask operations are interpreted when rendering ink brushes. The default value is `true`, which uses opacity. Call the method with `false` to use the ROP operation instead. The following C++ example exports a slide to SVG and uses ROP-based rendering for ink mask operations: ```cpp #include #include #include #include #include #include using Aspose::Slides::Presentation; using Aspose::Slides::Export::SVGOptions; using System::MakeObject; using System::IO::File; auto presentation = MakeObject(u"presentation.pptx"); auto svgOptions = MakeObject(); svgOptions->get_InkOptions()->set_InterpretMaskOpAsOpacity(false); auto stream = File::Create(u"slide.svg"); presentation->get_Slide(0)->WriteAsSvg(stream, svgOptions); stream->Dispose(); presentation->Dispose(); ``` The same setting can be applied through [TiffOptions::get_InkOptions](https://reference.aspose.com/slides/cpp/aspose.slides.export/tiffoptions/get_inkoptions/) when exporting a presentation or rendering a slide to TIFF. ### **Choose Whether to Hide or Preserve Ink** Use [IInkOptions::set_HideInk](https://reference.aspose.com/slides/cpp/aspose.slides.export/iinkoptions/set_hideink/) with `true` when the exported file should be a clean version of an annotated presentation, for example, a final copy intended for distribution without review marks. Leave ink visible (the default `false` setting) when ink annotations are part of the intended content, such as review comments, handwritten notes, highlights, or drawings that should remain visible in the exported result. This allows applications to generate separate review and final outputs from the same presentation without modifying the source ink objects. ## **FAQ** **Can I change the color or size of an existing ink stroke?** Yes. Get the trace from [IInk::get_Traces](https://reference.aspose.com/slides/cpp/aspose.slides.ink/iink/get_traces/), then change its [IInkTrace::get_Brush](https://reference.aspose.com/slides/cpp/aspose.slides.ink/iinktrace/get_brush/). You can call [IInkBrush::set_Color](https://reference.aspose.com/slides/cpp/aspose.slides.ink/iinkbrush/set_color/) and [IInkBrush::set_Size](https://reference.aspose.com/slides/cpp/aspose.slides.ink/iinkbrush/set_size/) on the brush. **Does hiding ink change the source presentation?** No. [IInkOptions::set_HideInk](https://reference.aspose.com/slides/cpp/aspose.slides.export/iinkoptions/set_hideink/) affects only the rendered or exported result; it does not remove or modify ink objects in the source presentation. **Which export formats support ink options?** You can configure ink options for PDF, HTML, SVG, TIFF, and bitmap slide images through the corresponding export or rendering options shown above. **Further reading** * To read about shapes in general, see the [PowerPoint Shapes](https://docs.aspose.com/slides/cpp/powerpoint-shapes/) section. * For more information on effective values, see [Shape Effective Properties](https://docs.aspose.com/slides/cpp/shape-effective-properties/#get-effective-font-height-value). * For details on PDF export, see [Convert PPT and PPTX to PDF](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-pdf/). * For details on HTML export, see [Convert PowerPoint Presentations to HTML](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-html/). * For details on SVG export, see [Render Presentation Slides as SVG Images](https://docs.aspose.com/slides/cpp/render-a-slide-as-an-svg-image/). * For details on TIFF export, see [Convert PowerPoint Presentations to TIFF](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-tiff/). * For details on slide-to-image rendering, see [Convert Presentation Slides to Images](https://docs.aspose.com/slides/cpp/convert-slide/). ## Related articles - [Ink](https://docs.aspose.com/slides/cpp/examples/elements/ink/) # Manage Bulleted and Numbered Lists in Presentations in C++ > Learn how to create and format bulleted, picture, multilevel, and numbered lists in PowerPoint and OpenDocument presentations using Aspose.Slides for C++. Source: https://docs.aspose.com/slides/cpp/manage-lists/ Updated: 2026-11-02 ## **Overview** Aspose.Slides for C++ lets you create and format bulleted and numbered lists in PowerPoint and OpenDocument presentations. A list item is a paragraph whose bullet settings are controlled through its paragraph format. Use the [IParagraph::get_ParagraphFormat](https://reference.aspose.com/slides/cpp/aspose.slides/iparagraph/get_paragraphformat/) method to access paragraph-level list settings. The main entry point is [IParagraphFormat::get_Bullet](https://reference.aspose.com/slides/cpp/aspose.slides/iparagraphformat/get_bullet/), which returns an [IBulletFormat](https://reference.aspose.com/slides/cpp/aspose.slides/ibulletformat/) object. With this object, you can set the bullet type, symbol, picture, color, size, numbering style, and starting number. This article shows how to: - create a bulleted list with a custom symbol - create a picture bullet - create a multilevel list by setting paragraph depth - create a numbered list - inspect and change list formatting in an existing presentation - read actual list markers and numbers alongside paragraph text ## **Create a Bulleted List** To create a bulleted list, add [Paragraph](https://reference.aspose.com/slides/cpp/aspose.slides/paragraph/) objects to an [ITextFrame](https://reference.aspose.com/slides/cpp/aspose.slides/itextframe/) and set [IBulletFormat::set_Type](https://reference.aspose.com/slides/cpp/aspose.slides/ibulletformat/set_type/) to [BulletType::Symbol](https://reference.aspose.com/slides/cpp/aspose.slides/bullettype/). You can then set [IBulletFormat::set_Char](https://reference.aspose.com/slides/cpp/aspose.slides/ibulletformat/set_char/), [IBulletFormat::get_Color](https://reference.aspose.com/slides/cpp/aspose.slides/ibulletformat/get_color/), and [IBulletFormat::set_Height](https://reference.aspose.com/slides/cpp/aspose.slides/ibulletformat/set_height/) to control the bullet appearance. The following C++ code demonstrates how to create a bulleted list in a slide: ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System::Drawing; auto createParagraph = [](System::String text) { auto paragraph = System::MakeObject(); auto paragraphFormat = paragraph->get_ParagraphFormat(); auto bulletFormat = paragraphFormat->get_Bullet(); bulletFormat->set_Type(BulletType::Symbol); bulletFormat->set_Char(u'*'); paragraphFormat->set_Indent(15); bulletFormat->set_IsBulletHardColor(NullableBool::True); bulletFormat->get_Color()->set_Color(System::Drawing::Color::get_IndianRed()); bulletFormat->set_Height(100); paragraph->set_Text(text); return paragraph; }; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto autoShape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 20, 20, 200, 50); auto textFrame = autoShape->get_TextFrame(); textFrame->get_Paragraphs()->Clear(); auto paragraph1 = createParagraph(u"The first paragraph"); textFrame->get_Paragraphs()->Add(paragraph1); auto paragraph2 = createParagraph(u"The second paragraph"); textFrame->get_Paragraphs()->Add(paragraph2); presentation->Save(u"symbol_bullets.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` The result: ![The symbol bullets](https://docs.aspose.com/slides/cpp/manage-lists/symbol_bullets.png) ## **Create a Numbered List** Use numbered lists when the order of items matters. Set [IBulletFormat::set_Type](https://reference.aspose.com/slides/cpp/aspose.slides/ibulletformat/set_type/) to [BulletType::Numbered](https://reference.aspose.com/slides/cpp/aspose.slides/bullettype/). You can also choose a numbering format with [IBulletFormat::set_NumberedBulletStyle](https://reference.aspose.com/slides/cpp/aspose.slides/ibulletformat/set_numberedbulletstyle/) or set [IBulletFormat::set_NumberedBulletStartWith](https://reference.aspose.com/slides/cpp/aspose.slides/ibulletformat/set_numberedbulletstartwith/) when the list should start from a value other than 1. The following C++ code shows how to create a numbered list in a slide: ```cpp #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto autoShape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 20, 20, 90, 80); auto textFrame = autoShape->get_TextFrame(); textFrame->get_Paragraphs()->Clear(); auto paragraph1 = System::MakeObject(); paragraph1->get_ParagraphFormat()->get_Bullet()->set_Type(BulletType::Numbered); paragraph1->set_Text(u"Apple"); textFrame->get_Paragraphs()->Add(paragraph1); auto paragraph2 = System::MakeObject(); paragraph2->get_ParagraphFormat()->get_Bullet()->set_Type(BulletType::Numbered); paragraph2->set_Text(u"Orange"); textFrame->get_Paragraphs()->Add(paragraph2); auto paragraph3 = System::MakeObject(); paragraph3->get_ParagraphFormat()->get_Bullet()->set_Type(BulletType::Numbered); paragraph3->set_Text(u"Banana"); textFrame->get_Paragraphs()->Add(paragraph3); presentation->Save(u"numbered_bullets.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` The result: ![The numbered bullets](https://docs.aspose.com/slides/cpp/manage-lists/numbered_bullets.png) ## **Create a Picture Bullet** Aspose.Slides allows you to replace a regular bullet symbol with an image. Picture bullets work best with simple images that remain readable at a small size, such as icons or small transparent PNG files. Ideally, if you plan to replace the regular bullet symbol with an image, it's best to choose a simple graphic with a transparent background. Such images work well as custom bullet symbols. Keep in mind that the image will be scaled down to a very small size. For that reason, we strongly recommend selecting an image that remains clear and visually effective when used as a bullet in a list. To create a picture bullet, add an image to [IPresentation::get_Images](https://reference.aspose.com/slides/cpp/aspose.slides/ipresentation/get_images/) and assign the returned [IPPImage](https://reference.aspose.com/slides/cpp/aspose.slides/ippimage/) object to [IBulletFormat::get_Picture](https://reference.aspose.com/slides/cpp/aspose.slides/ibulletformat/get_picture/). Set [IBulletFormat::set_Type](https://reference.aspose.com/slides/cpp/aspose.slides/ibulletformat/set_type/) to [BulletType::Picture](https://reference.aspose.com/slides/cpp/aspose.slides/bullettype/) before assigning the image. Let's say we have an "image.png": ![A picture for the bullets](https://docs.aspose.com/slides/cpp/manage-lists/picture_for_bullets.png) The following C++ code shows how to create picture bullets in a slide: ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto createParagraph = [](System::String text, System::SharedPtr image) { auto paragraph = System::MakeObject(); auto paragraphFormat = paragraph->get_ParagraphFormat(); auto bulletFormat = paragraphFormat->get_Bullet(); bulletFormat->set_Type(BulletType::Picture); bulletFormat->get_Picture()->set_Image(image); paragraphFormat->set_Indent(15); bulletFormat->set_Height(100); paragraph->set_Text(text); return paragraph; }; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto autoShape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 20, 20, 200, 50); auto textFrame = autoShape->get_TextFrame(); textFrame->get_Paragraphs()->Clear(); auto sourceImage = Images::FromFile(u"image.png"); auto bulletImage = presentation->get_Images()->AddImage(sourceImage); sourceImage->Dispose(); auto paragraph1 = createParagraph(u"The first paragraph", bulletImage); textFrame->get_Paragraphs()->Add(paragraph1); auto paragraph2 = createParagraph(u"The second paragraph", bulletImage); textFrame->get_Paragraphs()->Add(paragraph2); presentation->Save(u"picture_bullets.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` The result: ![The picture bullets](https://docs.aspose.com/slides/cpp/manage-lists/picture_bullets.png) ## **Create a Multilevel List** Use [IParagraphFormat::set_Depth](https://reference.aspose.com/slides/cpp/aspose.slides/iparagraphformat/set_depth/) to place list items on different levels. Level 0 is the top level, level 1 is nested below it, and so on. The following C++ code shows how to create a multilevel bulleted list: ```cpp #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto autoShape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 20, 20, 260, 110); auto textFrame = autoShape->get_TextFrame(); textFrame->get_Paragraphs()->Clear(); auto paragraph1 = System::MakeObject(); paragraph1->get_ParagraphFormat()->set_Depth(0); paragraph1->set_Text(u"My text - Depth 0"); textFrame->get_Paragraphs()->Add(paragraph1); auto paragraph2 = System::MakeObject(); paragraph2->get_ParagraphFormat()->set_Depth(1); paragraph2->set_Text(u"My text - Depth 1"); textFrame->get_Paragraphs()->Add(paragraph2); auto paragraph3 = System::MakeObject(); paragraph3->get_ParagraphFormat()->set_Depth(2); paragraph3->set_Text(u"My text - Depth 2"); textFrame->get_Paragraphs()->Add(paragraph3); auto paragraph4 = System::MakeObject(); paragraph4->get_ParagraphFormat()->set_Depth(3); paragraph4->set_Text(u"My text - Depth 3"); textFrame->get_Paragraphs()->Add(paragraph4); presentation->Save(u"multilevel_bullets.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` The result: ![The multilevel list](https://docs.aspose.com/slides/cpp/manage-lists/multilevel_list.png) ## **Change an Existing List** To change list formatting in an existing presentation, access the target paragraph and update its [IParagraphFormat::get_Bullet](https://reference.aspose.com/slides/cpp/aspose.slides/iparagraphformat/get_bullet/) settings. The same properties used to create lists can be used to inspect or modify lists loaded from a PPT, PPTX, or ODP file. The following C++ code changes the first paragraph in a text frame to use a numbered list style: ```cpp #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(u"input.pptx"); auto slide = presentation->get_Slide(0); auto autoShape = System::ExplicitCast(slide->get_Shape(0)); auto paragraph = autoShape->get_TextFrame()->get_Paragraph(0); auto paragraphFormat = paragraph->get_ParagraphFormat(); auto bulletFormat = paragraphFormat->get_Bullet(); bulletFormat->set_Type(BulletType::Numbered); bulletFormat->set_NumberedBulletStyle(NumberedBulletStyle::BulletRomanUCPeriod); bulletFormat->set_NumberedBulletStartWith(1); paragraphFormat->set_MarginLeft(30); paragraphFormat->set_Indent(-20); presentation->Save(u"updated_list.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ## **Read Actual Bullet Values** When extracting presentation content, keep list markers alongside paragraph text. Call [IParagraphFormat::GetEffective](https://reference.aspose.com/slides/cpp/aspose.slides/iparagraphformat/geteffective/) and access [IParagraphFormatEffectiveData::get_Bullet](https://reference.aspose.com/slides/cpp/aspose.slides/iparagraphformateffectivedata/get_bullet/) to obtain the effective bullet format. Check its [get_Type](https://reference.aspose.com/slides/cpp/aspose.slides/ibulletformateffectivedata/get_type/) before reading [get_ActualBulletValue](https://reference.aspose.com/slides/cpp/aspose.slides/ibulletformateffectivedata/get_actualbulletvalue/). For numbered lists, distinguish these three values: - [get_NumberedBulletStyle](https://reference.aspose.com/slides/cpp/aspose.slides/ibulletformateffectivedata/get_numberedbulletstyle/) determines the format, such as Arabic numbers followed by a period or lowercase letters followed by a period. - [get_NumberedBulletStartWith](https://reference.aspose.com/slides/cpp/aspose.slides/ibulletformateffectivedata/get_numberedbulletstartwith/) specifies the starting number for a group of numbered paragraphs. - [get_ActualBulletValue](https://reference.aspose.com/slides/cpp/aspose.slides/ibulletformateffectivedata/get_actualbulletvalue/) returns the formatted marker for a particular paragraph. For example, the second item in a list starting at 5 returns `6.`. Preserve [IParagraphFormat::get_Depth](https://reference.aspose.com/slides/cpp/aspose.slides/iparagraphformat/get_depth/) with each paragraph to retain its nesting level. The actual marker does not encode the full hierarchy: a nested item can return `c.` rather than a combined label such as `6.c.`. The following self-contained example creates lists, saves them to a presentation, and reloads the presentation to report each paragraph's text, depth, bullet type, and actual value. The small blue picture marker is created from inline SVG. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System::Drawing; { auto presentation = System::MakeObject(); presentation->get_SlideSize()->SetSize(720, 440, SlideSizeScaleType::DoNotScale); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 30, 20, 660, 400); shape->get_FillFormat()->set_FillType(FillType::NoFill); shape->get_LineFormat()->get_FillFormat()->set_FillType(FillType::NoFill); auto textFrame = shape->get_TextFrame(); textFrame->get_Paragraphs()->Clear(); // Create a picture marker without an external image file. auto svg = System::MakeObject(u""); auto bulletImage = presentation->get_Images()->AddImage(svg); auto addParagraph = [&](System::String text, int16_t depth, BulletType type, int16_t start = 1, NumberedBulletStyle style = NumberedBulletStyle::BulletArabicPeriod) { auto paragraph = System::MakeObject(); paragraph->set_Text(text); auto format = paragraph->get_ParagraphFormat(); format->set_Depth(depth); format->set_MarginLeft(30 + depth * 40); format->set_Indent(-28); format->set_SpaceAfter(8); format->get_DefaultPortionFormat()->set_FontHeight(22); format->get_DefaultPortionFormat()->get_FillFormat()->set_FillType(FillType::Solid); format->get_DefaultPortionFormat()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Black()); auto bullet = format->get_Bullet(); bullet->set_Type(type); bullet->set_IsBulletHardColor(NullableBool::True); bullet->get_Color()->set_Color(Color::get_Black()); if (type == BulletType::Numbered) { bullet->set_NumberedBulletStyle(style); bullet->set_NumberedBulletStartWith(start); } else if (type == BulletType::Symbol) { bullet->set_Char(u'\u2022'); } else if (type == BulletType::Picture) { bullet->get_Picture()->set_Image(bulletImage); } textFrame->get_Paragraphs()->Add(paragraph); }; addParagraph(u"First item", 0, BulletType::Numbered, 5); addParagraph(u"Second item", 0, BulletType::Numbered, 5); addParagraph(u"Nested item", 1, BulletType::Numbered, 3, NumberedBulletStyle::BulletAlphaLCPeriod); addParagraph(u"Next nested item", 1, BulletType::Numbered, 3, NumberedBulletStyle::BulletAlphaLCPeriod); addParagraph(u"Deep item", 2, BulletType::Numbered, 4, NumberedBulletStyle::BulletRomanLCPeriod); addParagraph(u"Back to top level", 0, BulletType::Numbered, 5); addParagraph(u"Symbol marker", 0, BulletType::Symbol); addParagraph(u"No bullet", 0, BulletType::None); addParagraph(u"Picture marker", 0, BulletType::Picture); presentation->Save(u"actual_bullet_values.pptx", SaveFormat::Pptx); presentation->Dispose(); } auto loadedPresentation = System::MakeObject(u"actual_bullet_values.pptx"); auto loadedShape = System::ExplicitCast(loadedPresentation->get_Slide(0)->get_Shape(0)); System::Console::WriteLine(u"Text | Depth | Type | Actual value"); for (auto paragraph : loadedShape->get_TextFrame()->get_Paragraphs()) { auto bullet = paragraph->get_ParagraphFormat()->GetEffective()->get_Bullet(); auto actualValue = bullet->get_ActualBulletValue(); System::String marker; switch (bullet->get_Type()) { case BulletType::Numbered: case BulletType::Symbol: marker = actualValue; break; case BulletType::None: marker = (actualValue.IsNull() ? System::String(u"null") : actualValue) + u" (no bullet)"; break; case BulletType::Picture: marker = (actualValue.IsNull() ? System::String(u"null") : actualValue) + u" (image required)"; break; default: marker = u"unsupported bullet type"; break; } System::Console::WriteLine(u"{0} | {1} | {2} | {3}", paragraph->get_Text(), paragraph->get_ParagraphFormat()->get_Depth(), bullet->get_Type(), marker); } loadedPresentation->Dispose(); ``` The source lists are shown below. ![Lists starting at 5, nested letter and Roman-number items, a symbol marker, a paragraph without a bullet, and a blue picture marker](https://docs.aspose.com/slides/cpp/manage-lists/actual_bullet_values.png) The report matches the markers displayed in PowerPoint: ```text Text | Depth | Type | Actual value First item | 0 | Numbered | 5. Second item | 0 | Numbered | 6. Nested item | 1 | Numbered | c. Next nested item | 1 | Numbered | d. Deep item | 2 | Numbered | iv. Back to top level | 0 | Numbered | 7. Symbol marker | 0 | Symbol | • No bullet | 0 | None | null (no bullet) Picture marker | 0 | Picture | null (image required) ``` For [BulletType::None and BulletType::Picture](https://reference.aspose.com/slides/cpp/aspose.slides/bullettype/), [get_ActualBulletValue](https://reference.aspose.com/slides/cpp/aspose.slides/ibulletformateffectivedata/get_actualbulletvalue/) returns a null `System::String`, not an empty string. Use `IsNull` to check for this value. Handle these types separately: the former has no marker, while the latter requires extracting the bullet image separately. A picture bullet cannot be reproduced solely by extracting a text marker. ## **FAQ** **Can bulleted and numbered lists be exported to PDF or images?** Yes. Aspose.Slides preserves list formatting when the target format supports the corresponding text layout and bullet features. **Can I edit lists in existing presentations?** Yes. Load the presentation, access the target paragraph, inspect or update its [IParagraphFormat::get_Bullet](https://reference.aspose.com/slides/cpp/aspose.slides/iparagraphformat/get_bullet/) settings, and save the presentation. **Can lists contain non-Latin text?** Yes. List item text can contain Unicode characters, so you can create lists in multilingual presentations. Make sure the fonts used in the presentation support the characters you need. ## Related articles - [Manage PowerPoint Text Paragraphs in C++](https://docs.aspose.com/slides/cpp/manage-paragraph/) - [Manage Presentation Text in C++](https://docs.aspose.com/slides/cpp/manage-text/) # Manage Media Files in C++ > Manage audio and video in Aspose.Slides for C++: add, extract, replace, and optimize media in PPT, PPTX and ODP files. Step-by-step guides and C++ code. Source: https://docs.aspose.com/slides/cpp/manage-media-files/ Updated: 2025-11-19 --- lastmod: 2025-11-19T22:55:59+04:00 title: Manage Media Files in C++ linktitle: Media Files type: docs weight: 30 url: /cpp/manage-media-files/ keywords: - media file - manage media - embed audio - extract flash - manage image - add picture - add video - PowerPoint - OpenDocument - presentation - C++ - Aspose.Slides description: "Manage audio and video in Aspose.Slides for C++: add, extract, replace, and optimize media in PPT, PPTX and ODP files. Step-by-step guides and C++ code." --- ## Related articles - [Audio](https://docs.aspose.com/slides/cpp/examples/elements/audio/) - [Extract Flash Objects from Presentations in C++](https://docs.aspose.com/slides/cpp/flash/) - [Customize Presentation Charts in C++](https://docs.aspose.com/slides/cpp/chart-types/) # Manage OLE in Presentations Using C++ > Optimize OLE object management in PowerPoint and OpenDocument files with Aspose.Slides for C++. Embed, update, and export OLE content seamlessly. Source: https://docs.aspose.com/slides/cpp/manage-ole/ Updated: 2026-11-08 ## **Introduction** OLE (Object Linking & Embedding) is a Microsoft technology that allows data and objects created in one application to be placed in another application through linking or embedding. Consider a chart created in MS Excel. The chart is then placed inside a PowerPoint slide. That Excel chart is considered an OLE object. - An OLE object may appear as an icon. In this case, when you double-click the icon, the chart gets opened in its associated application (Excel), or you are asked to select an application for object opening or editing. - An OLE object may display its actual contents, such as the contents of a chart. In this case, the chart is activated in PowerPoint, the chart interface loads, and you get to modify the chart's data within PowerPoint. [Aspose.Slides for C++](https://products.aspose.com/slides/cpp/) allows you to insert OLE Objects into slides as OLE object frames ([OleObjectFrame](https://reference.aspose.com/slides/cpp/aspose.slides/oleobjectframe/)). ## **Add OLE Object Frames to Slides** Assuming you have already created a chart in Microsoft Excel and want to embed it in a slide as an OLE object frame using Aspose.Slides for C++, you can do it this way: 1. Create an instance of the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) class. 2. Get a slide's reference through its index. 3. Read the Excel file as a byte array. 4. Add the [OleObjectFrame](https://reference.aspose.com/slides/cpp/aspose.slides/oleobjectframe/) to the slide containing the byte array and other information about the OLE object. 5. Write the modified presentation as a PPTX file. In the example below, we added a chart from an Excel file to a slide as an [OleObjectFrame](https://reference.aspose.com/slides/cpp/aspose.slides/oleobjectframe/) using Aspose.Slides for C++. **Note** that the [OleEmbeddedDataInfo](https://reference.aspose.com/slides/cpp/aspose.slides.dom.ole/oleembeddeddatainfo/) constructor takes an embeddable object extension as a second parameter. This extension allows PowerPoint to correctly interpret the file type and choose the right application to open this OLE object. ``` cpp #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::DOM::Ole; using namespace Aspose::Slides::Export; using namespace System; using namespace System::IO; auto presentation = MakeObject(); auto slideSize = presentation->get_SlideSize()->get_Size(); auto slide = presentation->get_Slide(0); // Prepare data for the OLE object. auto fileData = File::ReadAllBytes(u"book.xlsx"); auto dataInfo = MakeObject(fileData, u"xlsx"); // Add the OLE object frame to the slide. slide->get_Shapes()->AddOleObjectFrame(0, 0, slideSize.get_Width(), slideSize.get_Height(), dataInfo); presentation->Save(u"output.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ### **Add Linked OLE Object Frames** Aspose.Slides for C++ allows you to add an [OleObjectFrame](https://reference.aspose.com/slides/cpp/aspose.slides/oleobjectframe/) without embedding data but only with a link to the file. This C++ code shows you how to add an [OleObjectFrame](https://reference.aspose.com/slides/cpp/aspose.slides/oleobjectframe/) with a linked Excel file to a slide: ```cpp #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); // Add an OLE object frame with a linked Excel file. slide->get_Shapes()->AddOleObjectFrame(20, 20, 200, 150, u"Excel.Sheet.12", u"book.xlsx"); presentation->Save(u"output.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` [![OLE preview and workbook payload are distinct, and activation requires a supporting host.](https://docs.aspose.com/slides/cpp/manage-ole/visual-ole-preview-and-payload-f38773947dd8.svg)](https://docs.aspose.com/slides/cpp/manage-ole/visual-ole-preview-and-payload-f38773947dd8.svg) *An embedded object keeps workbook bytes in the PPTX; a linked object keeps a path to an external workbook. The slide preview, when present, is separate. Opening a linked workbook requires the file and a supporting OLE host.* ## **Access OLE Object Frames** If an OLE object is already embedded in a slide, you can easily find or access it this way: 1. Load a presentation with the embedded OLE object by creating an instance of the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) class. 2. Get the reference of the slide by using its index. 3. Access the [OleObjectFrame](https://reference.aspose.com/slides/cpp/aspose.slides/oleobjectframe/) shape. In our example, we used the previously created PPTX that has only one shape on the first slide. We then *cast* that object as an [IOleObjectFrame](https://reference.aspose.com/slides/cpp/aspose.slides/ioleobjectframe/). This was the desired OLE object frame to be accessed. 4. Once the OLE object frame is accessed, you can perform any operation on it. In the example below, an OLE object frame (an Excel chart object embedded in a slide) and its file data are accessed. ``` cpp #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto presentation = MakeObject(u"sample.pptx"); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shape(0); if (ObjectExt::Is(shape)) { auto oleFrame = ExplicitCast(shape); // Get the embedded file data. auto fileData = oleFrame->get_EmbeddedData()->get_EmbeddedFileData(); // Get the extension of the embedded file. auto fileExtension = oleFrame->get_EmbeddedData()->get_EmbeddedFileExtension(); // ... } ``` ### **Access Linked OLE Object Frame Properties** Aspose.Slides allows you to access linked OLE object frame properties. This C++ code shows you how to check if an OLE object is linked and then obtain the path to the linked file: ```cpp #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto presentation = MakeObject(u"sample.ppt"); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shape(0); if (ObjectExt::Is(shape)) { auto oleFrame = ExplicitCast(shape); // Check if the OLE object is linked. if (oleFrame->get_IsObjectLink()) { // Print the full path to the linked file. std::wcout << L"OLE object frame is linked to: " << oleFrame->get_LinkPathLong() << std::endl; // Print the relative path to the linked file if present. // Only the PPT presentations can contain the relative path. if (!String::IsNullOrEmpty(oleFrame->get_LinkPathRelative())) { std::wcout << L"OLE object frame relative path: " << oleFrame->get_LinkPathRelative() << std::endl; } } } ``` ## **Change OLE Object Data** In this section, the code example below uses [Aspose.Cells for C++](https://docs.aspose.com/cells/cpp/). If an OLE object is already embedded in a slide, you can easily access that object and modify its data this way: 1. Load a presentation with the embedded OLE object by creating an instance of the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) class. 2. Get the slide's reference through its index. 3. Access the [OLEObjectFrame](https://reference.aspose.com/slides/cpp/aspose.slides/oleobjectframe/) shape. In our example, we used the previously created PPTX that has one shape on the first slide. We then *cast* that object as an [IOleObjectFrame](https://reference.aspose.com/slides/cpp/aspose.slides/ioleobjectframe/). This was the desired OLE object frame to be accessed. 4. Once the OLE object frame is accessed, you can perform any operation on it. 5. Create a `Workbook` object and access the OLE data. 6. Access the desired `Worksheet` and amend the data. 7. Save the updated `Workbook` in a stream. 8. Change the OLE object data from the stream. In the example below, an OLE object frame (an Excel chart object embedded in a slide) is accessed, and its file data is modified to update the chart data. ``` cpp #include #include #include #include #include #include #include #include "Aspose.Cells/Cell.h" #include "Aspose.Cells/Cells.h" #include "Aspose.Cells/Initializer.h" #include "Aspose.Cells/OoxmlSaveOptions.h" #include "Aspose.Cells/SaveFormat.h" #include "Aspose.Cells/U16String.h" #include "Aspose.Cells/Vector.h" #include "Aspose.Cells/Workbook.h" #include "Aspose.Cells/Worksheet.h" #include "Aspose.Cells/WorksheetCollection.h" using namespace Aspose::Slides; using namespace Aspose::Slides::DOM::Ole; using namespace Aspose::Slides::Export; using namespace System; using namespace System::IO; // Aspose.Cells for C++ must be started before any of its types are used. Aspose::Cells::Startup(); auto presentation = MakeObject(u"sample.pptx"); auto slide = presentation->get_Slide(0); // Get the first shape as an OLE object frame. auto oleFrame = AsCast(slide->get_Shape(0)); if (oleFrame != nullptr) { auto oleStream = MakeObject(oleFrame->get_EmbeddedData()->get_EmbeddedFileData()); // Read the OLE object data as a Workbook object. auto oleArray = oleStream->ToArray(); std::vector workbookData(oleArray->data().begin(), oleArray->data().end()); Aspose::Cells::Workbook workbook(Aspose::Cells::Vector(workbookData.data(), workbookData.size())); // Modify the workbook data. auto worksheet = workbook.GetWorksheets().Get(0); worksheet.GetCells().Get(0, 4).PutValue(Aspose::Cells::U16String("E")); worksheet.GetCells().Get(1, 4).PutValue(12); worksheet.GetCells().Get(2, 4).PutValue(14); worksheet.GetCells().Get(3, 4).PutValue(15); Aspose::Cells::OoxmlSaveOptions fileOptions(Aspose::Cells::SaveFormat::Xlsx); auto newWorkbookData = workbook.Save(fileOptions); auto newOleStream = MakeObject(); newOleStream->Write( MakeArray(std::vector(newWorkbookData.GetData(), newWorkbookData.GetData() + newWorkbookData.GetLength())), 0, newWorkbookData.GetLength()); // Change the OLE frame object data. auto newData = MakeObject(newOleStream->ToArray(), oleFrame->get_EmbeddedData()->get_EmbeddedFileExtension()); oleFrame->SetEmbeddedData(newData); } presentation->Save(u"output.pptx", SaveFormat::Pptx); Aspose::Cells::Cleanup(); ``` ## **Embed Other File Types in Slides** Besides Excel charts, Aspose.Slides for C++ allows you to embed other types of files into slides. For example, you can insert HTML, PDF, and ZIP files as objects. When a user double-clicks the inserted object, it automatically opens in the relevant program, or the user is prompted to select an appropriate program to open it. This C++ code shows you how to embed HTML and ZIP into a slide: ``` cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::DOM::Ole; using namespace Aspose::Slides::Export; using namespace System; using namespace System::IO; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto htmlData = File::ReadAllBytes(u"sample.html"); auto htmlDataInfo = MakeObject(htmlData, u"html"); auto htmlOleFrame = slide->get_Shapes()->AddOleObjectFrame(150, 120, 50, 50, htmlDataInfo); htmlOleFrame->set_IsObjectIcon(true); auto zipData = File::ReadAllBytes(u"sample.zip"); auto zipDataInfo = MakeObject(zipData, u"zip"); auto zipOleFrame = slide->get_Shapes()->AddOleObjectFrame(150, 220, 50, 50, zipDataInfo); zipOleFrame->set_IsObjectIcon(true); presentation->Save(u"output.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ## **Set File Types for Embedded Objects** When working with presentations, you may need to replace old OLE objects with new ones or replace an unsupported OLE object with a supported one. Aspose.Slides for C++ allows you to set the file type for an embedded object, enabling you to update the OLE frame data or its extension. This C++ code shows you how to set the file type for an embedded OLE object to `zip`: ``` cpp #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::DOM::Ole; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(u"sample.pptx"); auto slide = presentation->get_Slide(0); auto oleFrame = ExplicitCast(slide->get_Shape(0)); auto fileExtension = oleFrame->get_EmbeddedData()->get_EmbeddedFileExtension(); auto fileData = oleFrame->get_EmbeddedData()->get_EmbeddedFileData(); std::wcout << L"Current embedded file extension is: " << fileExtension << std::endl; // Change the file type to ZIP. oleFrame->SetEmbeddedData(MakeObject(fileData, u"zip")); presentation->Save(u"output.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ## **Set Icon Images and Titles for Embedded Objects** After embedding an OLE object, a preview consisting of an icon image is added automatically. This preview is what users see before accessing or opening the OLE object. If you want to use a specific image and text as elements in the preview, you can set the icon image and title using Aspose.Slides for C++. This C++ code shows you how to set the icon image and title for an embedded object: ``` cpp #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::IO; auto presentation = MakeObject(u"sample.pptx"); auto slide = presentation->get_Slide(0); auto oleFrame = ExplicitCast(slide->get_Shape(0)); // Add an image to the presentation resources. auto imageData = File::ReadAllBytes(u"image.png"); auto oleImage = presentation->get_Images()->AddImage(imageData); // Set a title and the image for the OLE preview. oleFrame->set_SubstitutePictureTitle(u"My title"); oleFrame->get_SubstitutePictureFormat()->get_Picture()->set_Image(oleImage); oleFrame->set_IsObjectIcon(true); presentation->Save(u"output.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ## **Prevent an OLE Object Frame from Being Resized and Repositioned** After you add a linked OLE object to a presentation slide, when you open the presentation in PowerPoint, you might see a message asking you to update the links. Clicking the "Update Links" button may change the size and position of the OLE object frame because PowerPoint updates the data from the linked OLE object and refreshes the object preview. To prevent PowerPoint from prompting to update the object's data, call the [set_UpdateAutomatic](https://reference.aspose.com/slides/cpp/aspose.slides/ioleobjectframe/set_updateautomatic/) method of the [IOleObjectFrame](https://reference.aspose.com/slides/cpp/aspose.slides/ioleobjectframe/) interface with `false`: ```cpp #include #include #include #include using namespace Aspose::Slides; using namespace System; auto presentation = MakeObject(u"sample.pptx"); auto slide = presentation->get_Slide(0); auto oleFrame = ExplicitCast(slide->get_Shape(0)); oleFrame->set_UpdateAutomatic(false); ``` ## **Extract Embedded Files** Aspose.Slides for C++ allows you to extract the files embedded in slides as OLE objects this way: 1. Create an instance of the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) class containing the OLE objects you intend to extract. 2. Loop through all the shapes in the presentation and access the [OLEObjectFrame](https://reference.aspose.com/slides/cpp/aspose.slides/oleobjectframe/) shapes. 3. Access the data of embedded files from OLE object frames and write it to disk. This C++ code shows you how to extract files embedded in a slide as OLE objects: ``` cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; using namespace System::IO; auto presentation = MakeObject(u"sample.pptx"); auto slide = presentation->get_Slide(0); for (int index = 0; index < slide->get_Shapes()->get_Count(); index++) { auto shape = slide->get_Shape(index); if (ObjectExt::Is(shape)) { auto oleFrame = ExplicitCast(shape); auto fileData = oleFrame->get_EmbeddedData()->get_EmbeddedFileData(); auto fileExtension = oleFrame->get_EmbeddedData()->get_EmbeddedFileExtension(); auto fileName = String::Format(u"OLE_object_{0}{1}", index, fileExtension); File::WriteAllBytes(fileName, fileData); } } presentation->Dispose(); ``` ## **FAQ** **Will the OLE content be rendered when exporting slides to PDF/images?** What is visible on the slide is rendered—the icon/substitute image (preview). The "live" OLE content is not executed during rendering. If needed, set your own preview image to ensure the expected appearance in the exported PDF. To also preserve the embedded file as a PDF attachment, call [PdfOptions::set_IncludeOleData](https://reference.aspose.com/slides/cpp/aspose.slides.export/pdfoptions/set_includeoledata/) with `true`. This option is disabled by default. For an example and instructions for checking the attachment, see [Preserve Embedded OLE Files as PDF Attachments](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-pdf/#preserve-embedded-ole-files-as-pdf-attachments). **How can I lock an OLE object on a slide so users cannot move/edit it in PowerPoint?** Lock the shape: Aspose.Slides provides [shape-level locks](https://docs.aspose.com/slides/cpp/applying-protection-to-presentation/). This is not encryption, but it effectively prevents accidental edits and movement. **Why does a linked Excel object "jump" or change size when I open the presentation?** PowerPoint may refresh the preview of the linked OLE. For a stable appearance, follow the [Working Solution for Worksheet Resizing](https://docs.aspose.com/slides/cpp/working-solution-for-worksheet-resizing/) practices—either fit the frame to the range, or scale the range to a fixed frame and set an appropriate substitute image. **Will relative paths for linked OLE objects be preserved in the PPTX format?** In PPTX, "relative path" information is not available—only the full path. Relative paths are found in the older PPT format. For portability, prefer reliable absolute paths/accessible URIs or embedding. ## Related articles - [OLE Object](https://docs.aspose.com/slides/cpp/examples/elements/ole-object/) - [Create Excel Charts and Embed Them in Presentations as OLE Objects](https://docs.aspose.com/slides/cpp/creating-excel-chart-and-embedding-it-in-presentation-as-ole-object/) - [Object Preview Issue When Adding OleObjectFrame](https://docs.aspose.com/slides/cpp/object-preview-issue-when-adding-oleobjectframe/) # Manage PowerPoint Text Paragraphs in C++ > Learn how to create and format paragraphs, portions, bullets, numbered lists, indents, HTML content, and paragraph images with Aspose.Slides for C++. Source: https://docs.aspose.com/slides/cpp/manage-paragraph/ Updated: 2026-11-11 ## **Overview** Aspose.Slides for C++ represents text as a hierarchy of text frames, paragraphs, and portions: * [ITextFrame](https://reference.aspose.com/slides/cpp/aspose.slides/itextframe/) represents the text container in a shape and provides access to its paragraph collection. * [IParagraph](https://reference.aspose.com/slides/cpp/aspose.slides/iparagraph/) represents one paragraph in a text frame and provides access to its portions and paragraph-level formatting. * [IPortion](https://reference.aspose.com/slides/cpp/aspose.slides/iportion/) represents a text run within a paragraph. Each portion can have its own text and character-level formatting. A paragraph can therefore contain text with different fonts, colors, sizes, and other formatting by using multiple portions. ## **Create and Format Paragraphs** Create paragraphs in a shape's text frame and use portions to format individual text runs. This section shows how to combine multiple portions within each paragraph and apply different colors, font sizes, and styles. ### **Create Paragraphs with Multiple Portions** The following C++ example creates three paragraphs, each containing three text runs in its [IParagraph::get_Portions](https://reference.aspose.com/slides/cpp/aspose.slides/iparagraph/get_portions/) collection. It reuses the default paragraph and its empty portion, then adds the remaining paragraphs and portions. Formatting is applied through [IPortion::get_PortionFormat](https://reference.aspose.com/slides/cpp/aspose.slides/iportion/get_portionformat/): the first portion in each paragraph is red, bold, and 15 points; the second is blue, italic, and 18 points. The third portion retains its default formatting: ```cpp #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::Drawing; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 50, 150, 300, 150); auto textFrame = shape->get_TextFrame(); auto firstParagraph = textFrame->get_Paragraph(0); firstParagraph->get_Portions()->Add(MakeObject()); firstParagraph->get_Portions()->Add(MakeObject()); auto secondParagraph = MakeObject(); secondParagraph->get_Portions()->Add(MakeObject()); secondParagraph->get_Portions()->Add(MakeObject()); secondParagraph->get_Portions()->Add(MakeObject()); textFrame->get_Paragraphs()->Add(secondParagraph); auto thirdParagraph = MakeObject(); thirdParagraph->get_Portions()->Add(MakeObject()); thirdParagraph->get_Portions()->Add(MakeObject()); thirdParagraph->get_Portions()->Add(MakeObject()); textFrame->get_Paragraphs()->Add(thirdParagraph); auto paragraphCount = textFrame->get_Paragraphs()->get_Count(); for (auto paragraphIndex = 0; paragraphIndex < paragraphCount; paragraphIndex++) { auto paragraph = textFrame->get_Paragraph(paragraphIndex); auto portionCount = paragraph->get_Portions()->get_Count(); for (auto portionIndex = 0; portionIndex < portionCount; portionIndex++) { auto portion = paragraph->get_Portion(portionIndex); portion->set_Text(String::Format(u"Portion {0}.{1}", paragraphIndex + 1, portionIndex + 1)); auto portionFormat = portion->get_PortionFormat(); if (portionIndex == 0) { portionFormat->get_FillFormat()->set_FillType(FillType::Solid); portionFormat->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Red()); portionFormat->set_FontBold(NullableBool::True); portionFormat->set_FontHeight(15); } else if (portionIndex == 1) { portionFormat->get_FillFormat()->set_FillType(FillType::Solid); portionFormat->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Blue()); portionFormat->set_FontItalic(NullableBool::True); portionFormat->set_FontHeight(18); } } } presentation->Save(u"paragraphs_with_portions.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ## **Create Bulleted and Numbered Lists** Organize paragraph text into lists with symbols, numbers, or custom images. The examples in this section cover bullet formatting, multilevel lists, and custom starting numbers. ### **Create a Bulleted or Numbered List** Bullets and numbering make related items easier to scan. In Aspose.Slides, list settings are defined through [IBulletFormat](https://reference.aspose.com/slides/cpp/aspose.slides/ibulletformat/). This C++ example adds a symbol bullet and a numbered item to the same text frame. [IBulletFormat::set_Type](https://reference.aspose.com/slides/cpp/aspose.slides/ibulletformat/set_type/) selects the bullet type, while [IBulletFormat::set_Char](https://reference.aspose.com/slides/cpp/aspose.slides/ibulletformat/set_char/) supplies the symbol and [IBulletFormat::set_NumberedBulletStyle](https://reference.aspose.com/slides/cpp/aspose.slides/ibulletformat/set_numberedbulletstyle/) selects the numbering style. Both items use black bullets with a height of 100 percent and a paragraph indent of 25 points: ```cpp #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::Drawing; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 200, 200, 400, 200); auto textFrame = shape->get_TextFrame(); textFrame->get_Paragraphs()->Clear(); auto symbolParagraph = MakeObject(); symbolParagraph->set_Text(u"Welcome to Aspose.Slides"); symbolParagraph->get_ParagraphFormat()->get_Bullet()->set_Type(BulletType::Symbol); symbolParagraph->get_ParagraphFormat()->get_Bullet()->set_Char(Convert::ToChar(0x2022)); symbolParagraph->get_ParagraphFormat()->set_Indent(25); symbolParagraph->get_ParagraphFormat()->get_Bullet()->get_Color()->set_ColorType(ColorType::RGB); symbolParagraph->get_ParagraphFormat()->get_Bullet()->get_Color()->set_Color(Color::get_Black()); symbolParagraph->get_ParagraphFormat()->get_Bullet()->set_IsBulletHardColor(NullableBool::True); symbolParagraph->get_ParagraphFormat()->get_Bullet()->set_Height(100); textFrame->get_Paragraphs()->Add(symbolParagraph); auto numberedParagraph = MakeObject(); numberedParagraph->set_Text(u"This is a numbered item"); numberedParagraph->get_ParagraphFormat()->get_Bullet()->set_Type(BulletType::Numbered); numberedParagraph->get_ParagraphFormat()->get_Bullet()->set_NumberedBulletStyle(NumberedBulletStyle::BulletCircleNumWDBlackPlain); numberedParagraph->get_ParagraphFormat()->set_Indent(25); numberedParagraph->get_ParagraphFormat()->get_Bullet()->get_Color()->set_ColorType(ColorType::RGB); numberedParagraph->get_ParagraphFormat()->get_Bullet()->get_Color()->set_Color(Color::get_Black()); numberedParagraph->get_ParagraphFormat()->get_Bullet()->set_IsBulletHardColor(NullableBool::True); numberedParagraph->get_ParagraphFormat()->get_Bullet()->set_Height(100); textFrame->get_Paragraphs()->Add(numberedParagraph); presentation->Save(u"bulleted_and_numbered_list.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ### **Use Picture Bullets** Picture bullets let you use a custom image instead of a symbol or number. The example requires `bullets.png` in the working directory. This C++ example adds an image to the presentation's image collection as an [IPPImage](https://reference.aspose.com/slides/cpp/aspose.slides/ippimage/) and uses it as a paragraph bullet. It sets [IBulletFormat::set_Type](https://reference.aspose.com/slides/cpp/aspose.slides/ibulletformat/set_type/) to use a picture bullet and assigns the image through [IBulletFormat::get_Picture](https://reference.aspose.com/slides/cpp/aspose.slides/ibulletformat/get_picture/). [IBulletFormat::set_Height](https://reference.aspose.com/slides/cpp/aspose.slides/ibulletformat/set_height/) is set to 100 percent to size the bullet relative to the paragraph text: ```cpp #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto bulletImage = Images::FromFile(u"bullets.png"); auto presentationImage = presentation->get_Images()->AddImage(bulletImage); bulletImage->Dispose(); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 200, 200, 400, 200); auto textFrame = shape->get_TextFrame(); textFrame->get_Paragraphs()->Clear(); auto paragraph = MakeObject(); paragraph->set_Text(u"Welcome to Aspose.Slides"); paragraph->get_ParagraphFormat()->get_Bullet()->set_Type(BulletType::Picture); paragraph->get_ParagraphFormat()->get_Bullet()->get_Picture()->set_Image(presentationImage); paragraph->get_ParagraphFormat()->get_Bullet()->set_Height(100); textFrame->get_Paragraphs()->Add(paragraph); presentation->Save(u"picture_bullet.pptx", SaveFormat::Pptx); presentation->Save(u"picture_bullet.ppt", SaveFormat::Ppt); presentation->Dispose(); ``` ### **Create a Multilevel List** Set [IParagraphFormat::set_Depth](https://reference.aspose.com/slides/cpp/aspose.slides/iparagraphformat/set_depth/) to place paragraphs at different levels of a list. The top level has a depth of `0`. This C++ example assigns [IParagraphFormat::set_Depth](https://reference.aspose.com/slides/cpp/aspose.slides/iparagraphformat/set_depth/) values from 0 to 3 to four paragraphs, creating a hierarchy within one text frame. Each paragraph uses a symbol bullet, with [IBulletFormat::set_Char](https://reference.aspose.com/slides/cpp/aspose.slides/ibulletformat/set_char/) alternating between a round bullet and a hyphen to distinguish adjacent levels: ```cpp #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::Drawing; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 200, 200, 400, 200); auto textFrame = shape->get_TextFrame(); textFrame->get_Paragraphs()->Clear(); auto firstParagraph = MakeObject(); firstParagraph->set_Text(u"Content"); firstParagraph->get_ParagraphFormat()->get_Bullet()->set_Type(BulletType::Symbol); firstParagraph->get_ParagraphFormat()->get_Bullet()->set_Char(Convert::ToChar(0x2022)); firstParagraph->get_ParagraphFormat()->get_DefaultPortionFormat()->get_FillFormat()->set_FillType(FillType::Solid); firstParagraph->get_ParagraphFormat()->get_DefaultPortionFormat()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Black()); firstParagraph->get_ParagraphFormat()->set_Depth(0); auto secondParagraph = MakeObject(); secondParagraph->set_Text(u"Second level"); secondParagraph->get_ParagraphFormat()->get_Bullet()->set_Type(BulletType::Symbol); secondParagraph->get_ParagraphFormat()->get_Bullet()->set_Char(u'-'); secondParagraph->get_ParagraphFormat()->get_DefaultPortionFormat()->get_FillFormat()->set_FillType(FillType::Solid); secondParagraph->get_ParagraphFormat()->get_DefaultPortionFormat()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Black()); secondParagraph->get_ParagraphFormat()->set_Depth(1); auto thirdParagraph = MakeObject(); thirdParagraph->set_Text(u"Third level"); thirdParagraph->get_ParagraphFormat()->get_Bullet()->set_Type(BulletType::Symbol); thirdParagraph->get_ParagraphFormat()->get_Bullet()->set_Char(Convert::ToChar(0x2022)); thirdParagraph->get_ParagraphFormat()->get_DefaultPortionFormat()->get_FillFormat()->set_FillType(FillType::Solid); thirdParagraph->get_ParagraphFormat()->get_DefaultPortionFormat()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Black()); thirdParagraph->get_ParagraphFormat()->set_Depth(2); auto fourthParagraph = MakeObject(); fourthParagraph->set_Text(u"Fourth level"); fourthParagraph->get_ParagraphFormat()->get_Bullet()->set_Type(BulletType::Symbol); fourthParagraph->get_ParagraphFormat()->get_Bullet()->set_Char(u'-'); fourthParagraph->get_ParagraphFormat()->get_DefaultPortionFormat()->get_FillFormat()->set_FillType(FillType::Solid); fourthParagraph->get_ParagraphFormat()->get_DefaultPortionFormat()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Black()); fourthParagraph->get_ParagraphFormat()->set_Depth(3); textFrame->get_Paragraphs()->Add(firstParagraph); textFrame->get_Paragraphs()->Add(secondParagraph); textFrame->get_Paragraphs()->Add(thirdParagraph); textFrame->get_Paragraphs()->Add(fourthParagraph); presentation->Save(u"multilevel_list.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ### **Start Numbered List Items at Custom Values** Use [IBulletFormat::set_NumberedBulletStartWith](https://reference.aspose.com/slides/cpp/aspose.slides/ibulletformat/set_numberedbulletstartwith/) to set the initial number displayed for a numbered paragraph. This C++ example sets [IBulletFormat::set_Type](https://reference.aspose.com/slides/cpp/aspose.slides/ibulletformat/set_type/) to use numbering for three paragraphs and assigns [IBulletFormat::set_NumberedBulletStartWith](https://reference.aspose.com/slides/cpp/aspose.slides/ibulletformat/set_numberedbulletstartwith/) values of 2, 3, and 7. The starting value is configured separately for each paragraph, allowing the displayed numbers to skip values: ```cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 200, 200, 400, 200); auto textFrame = shape->get_TextFrame(); textFrame->get_Paragraphs()->Clear(); auto firstParagraph = MakeObject(); firstParagraph->set_Text(u"Start at 2"); firstParagraph->get_ParagraphFormat()->get_Bullet()->set_Type(BulletType::Numbered); firstParagraph->get_ParagraphFormat()->get_Bullet()->set_NumberedBulletStartWith(2); textFrame->get_Paragraphs()->Add(firstParagraph); auto secondParagraph = MakeObject(); secondParagraph->set_Text(u"Start at 3"); secondParagraph->get_ParagraphFormat()->get_Bullet()->set_Type(BulletType::Numbered); secondParagraph->get_ParagraphFormat()->get_Bullet()->set_NumberedBulletStartWith(3); textFrame->get_Paragraphs()->Add(secondParagraph); auto thirdParagraph = MakeObject(); thirdParagraph->set_Text(u"Start at 7"); thirdParagraph->get_ParagraphFormat()->get_Bullet()->set_Type(BulletType::Numbered); thirdParagraph->get_ParagraphFormat()->get_Bullet()->set_NumberedBulletStartWith(7); textFrame->get_Paragraphs()->Add(thirdParagraph); presentation->Save(u"custom_numbered_list.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ## **Control Paragraph Layout and End Properties** Adjust paragraph margins and indents to control the position of the first line and wrapped lines. You can also format the paragraph end mark separately from the visible text portions. ### **Set a First-Line Indent** Use the [IParagraphFormat::set_Indent](https://reference.aspose.com/slides/cpp/aspose.slides/iparagraphformat/set_indent/) method to control the first-line indent of a paragraph. This method moves only the first line relative to the paragraph's left margin. A positive value shifts the first line to the right, while the remaining lines stay aligned to the paragraph body. Use [IParagraphFormat::set_MarginLeft](https://reference.aspose.com/slides/cpp/aspose.slides/iparagraphformat/set_marginleft/) when you need to move the whole paragraph. Use [IParagraphFormat::set_Indent](https://reference.aspose.com/slides/cpp/aspose.slides/iparagraphformat/set_indent/) when you need to move only the first line. The following example gives three paragraphs the same [IParagraphFormat::set_MarginLeft](https://reference.aspose.com/slides/cpp/aspose.slides/iparagraphformat/set_marginleft/) of 20 points and [IParagraphFormat::set_Indent](https://reference.aspose.com/slides/cpp/aspose.slides/iparagraphformat/set_indent/) values of 0, 20, and 40 points. The first lines start at progressively larger offsets, while wrapped lines retain the same left margin: ```cpp #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::Drawing; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 50, 50, 420, 220); shape->get_FillFormat()->set_FillType(FillType::NoFill); shape->get_LineFormat()->get_FillFormat()->set_FillType(FillType::Solid); shape->get_LineFormat()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Gray()); auto textFrame = shape->get_TextFrame(); textFrame->get_TextFrameFormat()->set_AutofitType(TextAutofitType::Shape); textFrame->get_Paragraphs()->Clear(); auto firstParagraph = MakeObject(); firstParagraph->set_Text(u"No first-line indent. Wrapped lines start at the same position as the first line."); firstParagraph->get_ParagraphFormat()->get_DefaultPortionFormat()->get_FillFormat()->set_FillType(FillType::Solid); firstParagraph->get_ParagraphFormat()->get_DefaultPortionFormat()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Black()); firstParagraph->get_ParagraphFormat()->set_MarginLeft(20); firstParagraph->get_ParagraphFormat()->set_Indent(0); auto secondParagraph = MakeObject(); secondParagraph->set_Text(u"First-line indent of 20 points. The first line moves to the right, while wrapped lines remain aligned to the paragraph body."); secondParagraph->get_ParagraphFormat()->get_DefaultPortionFormat()->get_FillFormat()->set_FillType(FillType::Solid); secondParagraph->get_ParagraphFormat()->get_DefaultPortionFormat()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Black()); secondParagraph->get_ParagraphFormat()->set_MarginLeft(20); secondParagraph->get_ParagraphFormat()->set_Indent(20); auto thirdParagraph = MakeObject(); thirdParagraph->set_Text(u"First-line indent of 40 points. This paragraph shows a larger first-line offset to make the effect easier to see."); thirdParagraph->get_ParagraphFormat()->get_DefaultPortionFormat()->get_FillFormat()->set_FillType(FillType::Solid); thirdParagraph->get_ParagraphFormat()->get_DefaultPortionFormat()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Black()); thirdParagraph->get_ParagraphFormat()->set_MarginLeft(20); thirdParagraph->get_ParagraphFormat()->set_Indent(40); textFrame->get_Paragraphs()->Add(firstParagraph); textFrame->get_Paragraphs()->Add(secondParagraph); textFrame->get_Paragraphs()->Add(thirdParagraph); presentation->Save(u"paragraph_indent.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` The result: ![The first-line indent of the paragraphs](https://docs.aspose.com/slides/cpp/manage-paragraph/first_line_indent.png) ### **Set a Hanging Indent** A hanging indent is a paragraph layout in which the first line starts to the left of the remaining lines. In Aspose.Slides, you create this effect with the [IParagraphFormat::set_Indent](https://reference.aspose.com/slides/cpp/aspose.slides/iparagraphformat/set_indent/) method. Pass a negative value to move the first line to the left relative to the paragraph body. In practice, [IParagraphFormat::set_MarginLeft](https://reference.aspose.com/slides/cpp/aspose.slides/iparagraphformat/set_marginleft/) defines the left position of the paragraph body, and [IParagraphFormat::set_Indent](https://reference.aspose.com/slides/cpp/aspose.slides/iparagraphformat/set_indent/) defines the position of the first line relative to that margin. To create a hanging indent, set a positive `MarginLeft` value and a negative `Indent` value. This formatting is useful for bibliographies, references, glossary entries, and other paragraphs where wrapped lines must align under the paragraph body rather than under the first character of the first line. The following C++ example pairs [IParagraphFormat::set_MarginLeft](https://reference.aspose.com/slides/cpp/aspose.slides/iparagraphformat/set_marginleft/) values of 40 and 60 points with [IParagraphFormat::set_Indent](https://reference.aspose.com/slides/cpp/aspose.slides/iparagraphformat/set_indent/) values of -20 and -30 points. In each paragraph, the first line starts to the left of the wrapped lines; the second paragraph has a deeper hanging indent: ```cpp #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::Drawing; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 50, 50, 420, 220); shape->get_FillFormat()->set_FillType(FillType::NoFill); shape->get_LineFormat()->get_FillFormat()->set_FillType(FillType::Solid); shape->get_LineFormat()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Gray()); auto textFrame = shape->get_TextFrame(); textFrame->get_TextFrameFormat()->set_AutofitType(TextAutofitType::Shape); textFrame->get_Paragraphs()->Clear(); auto firstParagraph = MakeObject(); firstParagraph->set_Text(u"A hanging indent is created by combining a positive left margin with a negative indent. The first line starts to the left, while wrapped lines align with the paragraph body."); firstParagraph->get_ParagraphFormat()->get_DefaultPortionFormat()->get_FillFormat()->set_FillType(FillType::Solid); firstParagraph->get_ParagraphFormat()->get_DefaultPortionFormat()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Black()); firstParagraph->get_ParagraphFormat()->set_MarginLeft(40); firstParagraph->get_ParagraphFormat()->set_Indent(-20); auto secondParagraph = MakeObject(); secondParagraph->set_Text(u"This second example uses a deeper hanging indent so the difference between the first line and the wrapped lines is easier to compare."); secondParagraph->get_ParagraphFormat()->get_DefaultPortionFormat()->get_FillFormat()->set_FillType(FillType::Solid); secondParagraph->get_ParagraphFormat()->get_DefaultPortionFormat()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Black()); secondParagraph->get_ParagraphFormat()->set_MarginLeft(60); secondParagraph->get_ParagraphFormat()->set_Indent(-30); textFrame->get_Paragraphs()->Add(firstParagraph); textFrame->get_Paragraphs()->Add(secondParagraph); presentation->Save(u"hanging_indent.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` The result: ![The hanging indent of the paragraphs](https://docs.aspose.com/slides/cpp/manage-paragraph/hanging_indent.png) ### **Set End Paragraph Run Properties** The [IParagraph::set_EndParagraphPortionFormat](https://reference.aspose.com/slides/cpp/aspose.slides/iparagraph/set_endparagraphportionformat/) method controls the formatting of the paragraph end mark. The example loads `Test.pptx`, which must contain at least one slide. The following example creates a [PortionFormat](https://reference.aspose.com/slides/cpp/aspose.slides/portionformat/) with [IBasePortionFormat::set_FontHeight](https://reference.aspose.com/slides/cpp/aspose.slides/ibaseportionformat/set_fontheight/) set to 48 points and [IBasePortionFormat::set_LatinFont](https://reference.aspose.com/slides/cpp/aspose.slides/ibaseportionformat/set_latinfont/) set to Times New Roman. It assigns this format to the second paragraph's end mark, leaving the visible text portions unchanged: ```cpp #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(u"Test.pptx"); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 10, 10, 200, 250); auto textFrame = shape->get_TextFrame(); textFrame->get_Paragraphs()->Clear(); auto firstParagraph = MakeObject(); firstParagraph->get_Portions()->Add(MakeObject(u"Sample text")); auto secondParagraph = MakeObject(); secondParagraph->get_Portions()->Add(MakeObject(u"Sample text 2")); auto endParagraphFormat = MakeObject(); endParagraphFormat->set_FontHeight(48); endParagraphFormat->set_LatinFont(MakeObject(u"Times New Roman")); secondParagraph->set_EndParagraphPortionFormat(endParagraphFormat); textFrame->get_Paragraphs()->Add(firstParagraph); textFrame->get_Paragraphs()->Add(secondParagraph); presentation->Save(u"end_paragraph_format.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ## **Count Rendered Lines** For paragraph rules that affect automatic wrapping and punctuation at line endings, see [Control Line Breaking](https://docs.aspose.com/slides/cpp/text-formatting/#control-line-breaking) and [Control Hanging Punctuation](https://docs.aspose.com/slides/cpp/text-formatting/#control-hanging-punctuation). Use [IParagraph::GetLinesCount](https://reference.aspose.com/slides/cpp/aspose.slides/iparagraph/getlinescount/) to count the lines occupied by a paragraph after text layout, including automatic wrapping. This is useful when checking text length and layout in presentation templates. A paragraph is one item in [ITextFrame::get_Paragraphs](https://reference.aspose.com/slides/cpp/aspose.slides/itextframe/get_paragraphs/), and it can occupy several rendered lines. An explicit line break within a paragraph forces a new line without creating another paragraph. Automatic wrapping creates lines based on the available width without inserting explicit line breaks into the text. Counting paragraphs or line-break characters therefore does not give the rendered line count. The following example creates a text shape, counts its lines, narrows the shape, and then replaces the text with a shorter string. The example enables [ITextFrameFormat::set_WrapText](https://reference.aspose.com/slides/cpp/aspose.slides/itextframeformat/set_wraptext/) and disables [ITextFrameFormat::set_AutofitType](https://reference.aspose.com/slides/cpp/aspose.slides/itextframeformat/set_autofittype/) so that the shape width controls wrapping without automatically shrinking the text or resizing the shape. Each measurement uses [IParagraph::GetLinesCount](https://reference.aspose.com/slides/cpp/aspose.slides/iparagraph/getlinescount/). Shape dimensions are in points. Finally, the example adds another paragraph and sums the line counts across the text frame. ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 50, 50, 400, 200); auto textFrame = shape->get_TextFrame(); textFrame->get_TextFrameFormat()->set_WrapText(NullableBool::True); textFrame->get_TextFrameFormat()->set_AutofitType(TextAutofitType::None); auto paragraph = textFrame->get_Paragraph(0); paragraph->get_ParagraphFormat()->get_DefaultPortionFormat()->set_FontHeight(20); paragraph->set_Text(u"This text demonstrates how automatic wrapping changes the number of rendered lines."); Console::WriteLine(u"Original width: {0}", paragraph->GetLinesCount()); shape->set_Width(150); Console::WriteLine(u"Narrower shape: {0}", paragraph->GetLinesCount()); paragraph->set_Text(u"Short text."); Console::WriteLine(u"Shorter text: {0}", paragraph->GetLinesCount()); auto secondParagraph = MakeObject(); secondParagraph->set_Text(u"Another paragraph."); secondParagraph->get_ParagraphFormat()->get_DefaultPortionFormat()->set_FontHeight(20); textFrame->get_Paragraphs()->Add(secondParagraph); auto totalLineCount = 0; for (auto currentParagraph : textFrame->get_Paragraphs()) { totalLineCount += currentParagraph->GetLinesCount(); } Console::WriteLine(u"Total lines in the text frame: {0}", totalLineCount); presentation->Dispose(); ``` With this text and these dimensions, narrowing the shape increases the line count, while replacing the text with the short string reduces it. Exact counts can vary with font availability and substitution, font size, margins, indentation, wrapping, and autofit settings. Use the fonts and layout settings intended for the target environment when checking a template. The line count alone does not determine whether text overflows its container. The available height, line heights, paragraph and line spacing, and autofit behavior also matter; even a single line can exceed the available width when wrapping is disabled. ## **Import and Export Paragraph Content** Use HTML to bring text into a presentation or export existing paragraphs for use outside it. This section also shows how to render individual paragraphs as images, including paragraphs in table cells. ### **Import HTML Text into Paragraphs** Use [ParagraphCollection::AddFromHtml](https://reference.aspose.com/slides/cpp/aspose.slides/paragraphcollection/addfromhtml/) to convert HTML markup into paragraphs and portions in a text frame. This C++ example reads HTML from a file and passes the markup to [ParagraphCollection::AddFromHtml](https://reference.aspose.com/slides/cpp/aspose.slides/paragraphcollection/addfromhtml/). It clears the text frame's default paragraph so that the frame contains only the imported content. The rectangular shape leaves a 10-point margin on each side of the slide: ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::IO; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto slideSize = presentation->get_SlideSize()->get_Size(); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 10, 10, slideSize.get_Width() - 20, slideSize.get_Height() - 20); shape->get_FillFormat()->set_FillType(FillType::NoFill); shape->get_TextFrame()->get_Paragraphs()->Clear(); auto reader = MakeObject(u"file.html"); auto html = reader->ReadToEnd(); reader->Close(); shape->get_TextFrame()->get_Paragraphs()->AddFromHtml(html); presentation->Save(u"html_text.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ### **Export Paragraph Text to HTML** Use [ParagraphCollection::ExportToHtml](https://reference.aspose.com/slides/cpp/aspose.slides/paragraphcollection/exporttohtml/) to export a selected range of paragraphs as HTML. When reusing presentation text on a website, you may want to preserve local emphasis without carrying over the presentation's font, size, or text box styles. Set [TextToHtmlConversionOptions::set_TextInheritanceLimit](https://reference.aspose.com/slides/cpp/aspose.slides.export/texttohtmlconversionoptions/set_textinheritancelimit/) to control how far the exporter follows formatting inheritance. Download [the sample presentation](https://docs.aspose.com/slides/cpp/manage-paragraph/text-inheritance.pptx) and place it in the application's working directory. Its first slide contains one text shape with the text "Inherited text; explicit red 18pt". The input deliberately uses several formatting levels: - The presentation's default text style supplies Calibri and a size of 28 pt. - The text frame's first-level text style supplies blue text and italics. - The paragraph explicitly sets bold text. - The second portion, "explicit red 18pt", explicitly sets red text and a size of 18 pt. The following example exports the same paragraphs three times. It passes [TextToHtmlConversionOptions](https://reference.aspose.com/slides/cpp/aspose.slides.export/texttohtmlconversionoptions/) to the export method and writes each result as a separate UTF-8 HTML file: ```cpp #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::IO; using namespace System::Text; auto presentation = MakeObject(u"text-inheritance.pptx"); auto shape = presentation->get_Slide(0)->get_Shape(0); auto textShape = AsCast(shape); if (textShape != nullptr && textShape->get_TextFrame() != nullptr) { auto paragraphs = textShape->get_TextFrame()->get_Paragraphs(); auto modes = MakeArray({TextInheritanceLimit::All, TextInheritanceLimit::TextBox, TextInheritanceLimit::ParagraphOnly}); auto fileNames = MakeArray({u"All.html", u"TextBox.html", u"ParagraphOnly.html"}); for (auto i = 0; i < modes->get_Length(); i++) { auto options = MakeObject(); options->set_TextInheritanceLimit(modes[i]); auto html = paragraphs->ExportToHtml(0, paragraphs->get_Count(), options); File::WriteAllText(fileNames[i], html, Encoding::get_UTF8()); } } else { Console::WriteLine(u"The first shape is not a text shape."); } presentation->Dispose(); ``` The generated HTML contains the following CSS for the first portion, "Inherited text; ". The table lists the relevant declarations; other generated properties are omitted for clarity. | Output | Relevant CSS for the first portion | Appearance | | --- | --- | --- | | `All.html` | `font-family:'Calibri'; font-size:28pt; color:#0000ff; font-style:italic; font-weight:bold` | Blue, bold, italic text at 28 pt in Calibri, if that font is available. | | `TextBox.html` | `color:#0000ff; font-style:italic; font-weight:bold` | Blue, bold, italic text; the surrounding page or browser supplies the font family and size. | | `ParagraphOnly.html` | `font-weight:bold` | Bold text; the surrounding page or browser supplies the font family, size, color, and italic style. | The second portion retains `color:#ff0000`, `font-size:18pt`, and `font-weight:bold` in all three outputs. It also retains italics with `All` and `TextBox`, but not with `ParagraphOnly`. Restricting inheritance therefore does not remove formatting explicitly assigned to a paragraph or portion. Open the files in the same browser to compare them. In the two restricted modes, omitted CSS properties are resolved by the destination page's styles or browser defaults, so the resulting appearance depends on where the HTML is used. ### **Generate an HTML Clipboard Fragment** Set [TextToHtmlConversionOptions::set_AddClipboardFragmentHeader](https://reference.aspose.com/slides/cpp/aspose.slides.export/texttohtmlconversionoptions/set_addclipboardfragmentheader/) to `false` for ordinary HTML or `true` to include a clipboard header. The header gives the UTF-8 byte offsets of the surrounding HTML (`StartHTML` and `EndHTML`) and the fragment to paste (`StartFragment` and `EndFragment`). This example exports two formatted paragraphs as ordinary HTML (`html`) and as an HTML clipboard fragment (`clipboardHtml`). Writing the fragment to the system clipboard is a separate application step. A clipboard API that accepts raw HTML clipboard bytes requires UTF-8 without a BOM. ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 0, 0, 400, 100); auto paragraphs = shape->get_TextFrame()->get_Paragraphs(); paragraphs->Clear(); paragraphs->AddFromHtml(u"

Status: Ready

Next steps

"); auto options = MakeObject(); options->set_AddClipboardFragmentHeader(false); auto html = paragraphs->ExportToHtml(0, paragraphs->get_Count(), options); options->set_AddClipboardFragmentHeader(true); auto clipboardHtml = paragraphs->ExportToHtml(0, paragraphs->get_Count(), options); presentation->Dispose(); ``` ### **Render a Paragraph as an Image** [IParagraph::GetImage](https://reference.aspose.com/slides/cpp/aspose.slides/iparagraph/getimage/) renders an individual paragraph directly and returns an [IImage](https://reference.aspose.com/slides/cpp/aspose.slides/iimage/). Save the result to a file or stream with [IImage::Save](https://reference.aspose.com/slides/cpp/aspose.slides/iimage/save/). You do not need to render the containing shape or crop a bitmap manually. [IParagraph::GetImage](https://reference.aspose.com/slides/cpp/aspose.slides/iparagraph/getimage/) can return `nullptr` if the paragraph cannot be found in its parent collection, has no valid rendering bounds, or cannot be rendered. Check the result before saving it and dispose of the returned image after use. #### **Render a Paragraph at the Default Scale** The example uses `sample.pptx`, a presentation with one slide whose first shape is a text box containing three paragraphs. ![The text box with three paragraphs](https://docs.aspose.com/slides/cpp/manage-paragraph/paragraph_to_image_input.png) The following example selects the second paragraph at index 1 and calls [IParagraph::GetImage](https://reference.aspose.com/slides/cpp/aspose.slides/iparagraph/getimage/) without scale parameters. It checks that the shape contains the required paragraph and that rendering returns an image before calling [IImage::Save](https://reference.aspose.com/slides/cpp/aspose.slides/iimage/save/) to save it in PNG format. The example disposes of the image after saving it. ```cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto presentation = MakeObject(u"sample.pptx"); auto shape = presentation->get_Slide(0)->get_Shape(0); auto textShape = AsCast(shape); if (textShape != nullptr && textShape->get_TextFrame() != nullptr && textShape->get_TextFrame()->get_Paragraphs()->get_Count() > 1) { auto paragraph = textShape->get_TextFrame()->get_Paragraph(1); auto paragraphImage = paragraph->GetImage(); if (paragraphImage != nullptr) { paragraphImage->Save(u"paragraph.png", ImageFormat::Png); paragraphImage->Dispose(); } else { Console::WriteLine(u"The paragraph could not be rendered."); } } else { Console::WriteLine(u"The expected text shape or paragraph was not found."); } presentation->Dispose(); ``` The result: ![The paragraph image](https://docs.aspose.com/slides/cpp/manage-paragraph/paragraph_to_image_output.png) #### **Render a Paragraph in a Table Cell with Scaling** Use the [IParagraph::GetImage](https://reference.aspose.com/slides/cpp/aspose.slides/iparagraph/getimage/) overload that accepts `float scaleX` and `float scaleY` parameters to set the horizontal and vertical scale factors. The following example creates a table, renders the paragraph in its first cell at twice its default width and height, and saves the result as a PNG image. ```cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto scaleX = 2.0f; auto scaleY = 2.0f; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto table = slide->get_Shapes()->AddTable(50, 50, MakeArray({300}), MakeArray({80})); auto paragraph = table->idx_get(0, 0)->get_TextFrame()->get_Paragraph(0); paragraph->set_Text(u"Text in a table cell"); auto paragraphImage = paragraph->GetImage(scaleX, scaleY); if (paragraphImage != nullptr) { paragraphImage->Save(u"table_paragraph.png", ImageFormat::Png); paragraphImage->Dispose(); } else { Console::WriteLine(u"The paragraph could not be rendered."); } presentation->Dispose(); ``` A scale factor of `1` keeps that axis at its default pixel size. For example, `2` for both factors produces an image whose width and height are approximately twice the default dimensions, resulting in four times as many pixels. Larger factors generally produce sharper text for zooming or high-resolution output, but they also increase memory use and file size. Factors below `1` produce smaller images with less detail. Use equal factors to preserve the paragraph's aspect ratio; different horizontal and vertical factors stretch the output independently. Rendering a whole shape with [IShape::GetImage](https://reference.aspose.com/slides/cpp/aspose.slides/ishape/getimage/) remains useful when the output must include the shape's fill, border, or other visual context. For a paragraph-only image, use [IParagraph::GetImage](https://reference.aspose.com/slides/cpp/aspose.slides/iparagraph/getimage/). ## **FAQ** **Can I completely disable line wrapping inside a text frame?** Yes. Use [ITextFrameFormat::set_WrapText](https://reference.aspose.com/slides/cpp/aspose.slides/itextframeformat/set_wraptext/) to disable wrapping so lines do not break at the text frame's edges. **How can I get the exact on-slide bounds of a specific paragraph?** Use [IParagraph::GetRect](https://reference.aspose.com/slides/cpp/aspose.slides/iparagraph/getrect/) to retrieve the paragraph's bounding rectangle. [IPortion::GetRect](https://reference.aspose.com/slides/cpp/aspose.slides/iportion/getrect/) provides the bounds of an individual portion. **Where is paragraph alignment (left, right, center, or justify) controlled?** [IParagraphFormat::set_Alignment](https://reference.aspose.com/slides/cpp/aspose.slides/iparagraphformat/set_alignment/) is a paragraph-level setting and applies to the whole paragraph regardless of individual portion formatting. To vertically align portions of different font sizes within each line, see [Align Fonts Within a Line](https://docs.aspose.com/slides/cpp/text-formatting/#align-fonts-within-a-line). **Can I set the proofing language for part of a paragraph?** Yes. Use [IBasePortionFormat::set_LanguageId](https://reference.aspose.com/slides/cpp/aspose.slides/ibaseportionformat/set_languageid/) for individual portions, so one paragraph can contain text in multiple languages. ## Related articles - [Manage Bulleted and Numbered Lists in Presentations in C++](https://docs.aspose.com/slides/cpp/manage-lists/) # Manage Presentation Placeholders in C++ > Learn how to inspect and edit text, picture, chart, and content placeholders and understand placeholder inheritance with Aspose.Slides for C++. Source: https://docs.aspose.com/slides/cpp/manage-placeholder/ Updated: 2026-11-08 ## **Overview** A placeholder is a shape that reserves a position for a particular kind of content in a presentation template. Common examples are title, body, picture, chart, and general-purpose content placeholders. Unlike an ordinary shape, a placeholder can inherit its position, size, formatting, and other settings from a layout slide or master slide. Aspose.Slides exposes placeholder information through the [IShape::get_Placeholder](https://reference.aspose.com/slides/cpp/aspose.slides/ishape/get_placeholder/) method. The method returns an [IPlaceholder](https://reference.aspose.com/slides/cpp/aspose.slides/iplaceholder/) object or `nullptr` for a normal shape. Use [IPlaceholder::get_Type](https://reference.aspose.com/slides/cpp/aspose.slides/iplaceholder/get_type/) to determine what the placeholder is intended to contain. The shape interface still matters after you know the placeholder type: - An empty text, picture, chart, or content placeholder is commonly represented by an [IAutoShape](https://reference.aspose.com/slides/cpp/aspose.slides/iautoshape/). - A populated picture placeholder can be represented by an [IPictureFrame](https://reference.aspose.com/slides/cpp/aspose.slides/ipictureframe/). - A populated chart placeholder can be represented by an [IChart](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichart/). - A content placeholder can contain several kinds of content. Check both [IPlaceholder::get_Type](https://reference.aspose.com/slides/cpp/aspose.slides/iplaceholder/get_type/) and the runtime shape interface instead of assuming that every placeholder is an [IAutoShape](https://reference.aspose.com/slides/cpp/aspose.slides/iautoshape/). [IPlaceholder::get_Type](https://reference.aspose.com/slides/cpp/aspose.slides/iplaceholder/get_type/) describes a placeholder's role; it does not guarantee the shape's runtime type. Always use a type check before accessing text, picture, chart, table, or media-specific members. ## **Understand Placeholder Inheritance** Placeholders form a hierarchy: 1. A master slide defines reusable styles and, in some cases, master-level placeholders. 2. A layout slide defines the arrangement used by one or more normal slides and can inherit from the master. 3. A normal slide contains the placeholders for that slide and can inherit from its layout. Call [IShape::GetBasePlaceholder](https://reference.aspose.com/slides/cpp/aspose.slides/ishape/getbaseplaceholder/) to move one level up this hierarchy. A slide placeholder normally returns its layout placeholder; a layout placeholder can return its master placeholder. The method returns `nullptr` when the shape has no base placeholder. The following example lists placeholders on the first slide and reports their base placeholders: ```c++ #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto presentation = MakeObject(u"template.pptx"); auto slide = presentation->get_Slide(0); for (auto&& shape : slide->get_Shapes()) { auto placeholder = shape->get_Placeholder(); if (placeholder == nullptr) { continue; } auto placeholderType = placeholder->get_Type(); auto typeName = shape->GetType().get_Name(); Console::WriteLine(u"Slide placeholder: {0}; shape interface: {1}", placeholderType, typeName); auto layoutPlaceholder = shape->GetBasePlaceholder(); if (layoutPlaceholder != nullptr) { auto layoutPlaceholderInfo = layoutPlaceholder->get_Placeholder(); if (layoutPlaceholderInfo != nullptr) { auto layoutPlaceholderType = layoutPlaceholderInfo->get_Type(); Console::WriteLine(u" Layout placeholder: {0}", layoutPlaceholderType); } auto masterPlaceholder = layoutPlaceholder->GetBasePlaceholder(); if (masterPlaceholder != nullptr) { auto masterPlaceholderInfo = masterPlaceholder->get_Placeholder(); if (masterPlaceholderInfo != nullptr) { auto masterPlaceholderType = masterPlaceholderInfo->get_Type(); Console::WriteLine(u" Master placeholder: {0}", masterPlaceholderType); } } } } ``` Editing a placeholder on a normal slide creates or changes a local override for that slide. Editing the related layout or master can affect all slides that still inherit that setting. A local ordinary shape has no base placeholder and does not begin inheriting merely because it occupies the same coordinates. ## **Remove Placeholder Status** When adapting a template, use [IShape::RemovePlaceholder](https://reference.aspose.com/slides/cpp/aspose.slides/ishape/removeplaceholder/) to keep an existing object as an ordinary shape. Its [IShape::get_Placeholder](https://reference.aspose.com/slides/cpp/aspose.slides/ishape/get_placeholder/) method returns `nullptr`, but the shape remains in the slide's collection. In contrast, [IShapeCollection::Remove](https://reference.aspose.com/slides/cpp/aspose.slides/ishapecollection/remove/) deletes the shape from that collection. The following example requires `template.pptx` with at least one slide and a nonempty text placeholder on the first slide. Use a placeholder with formatting inherited from its layout or master to see the effect of removing that relationship. The example checks that the same shape remains, calls the method again on the now ordinary shape, and saves the result. Removing placeholder status does not automatically preserve inherited appearance settings. The example below deliberately leaves those settings unchanged, so the output may look different. A shape whose position and size are entirely inherited can have zero coordinates and dimensions after the call and become invisible even though it remains in the collection. ```c++ #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(u"template.pptx"); auto slide = presentation->get_Slide(0); auto found = false; for (auto index = 0; index < slide->get_Shapes()->get_Count(); index++) { auto currentShape = slide->get_Shape(index); if (!ObjectExt::Is(currentShape)) { continue; } auto shape = ExplicitCast(currentShape); auto textFrame = shape->get_TextFrame(); if (shape->get_Placeholder() == nullptr || textFrame == nullptr || String::IsNullOrEmpty(textFrame->get_Text())) { continue; } auto shapeCount = slide->get_Shapes()->get_Count(); shape->RemovePlaceholder(); Console::WriteLine(u"Placeholder removed: {0}", shape->get_Placeholder() == nullptr); Console::WriteLine(u"Same shape retained: {0}", slide->get_Shape(index) == currentShape); Console::WriteLine(u"Shape count unchanged: {0}", slide->get_Shapes()->get_Count() == shapeCount); // Calling the method on an ordinary shape has no effect. shape->RemovePlaceholder(); found = true; break; } if (found) { presentation->Save(u"placeholder-status-removed.pptx", SaveFormat::Pptx); } else { Console::WriteLine(u"No nonempty text placeholder was found on the first slide."); } ``` For a matching placeholder, all three checks print `True`. The text remains, but inherited position, size, rotation, font, paragraph alignment, text-frame margins, vertical anchoring, fill, and line settings can change when the placeholder relationship is removed. For example, inherited title formatting can fall back to ordinary text formatting. See [Slide Layout](https://docs.aspose.com/slides/cpp/slide-layout/) for more about layouts. To preserve the intended appearance, capture the resolved position, size, and rotation before the call, and copy the required effective formatting values into separate variables. Retrieve those values through [IPortionFormat::GetEffective](https://reference.aspose.com/slides/cpp/aspose.slides/iportionformat/geteffective/), [IParagraphFormat::GetEffective](https://reference.aspose.com/slides/cpp/aspose.slides/iparagraphformat/geteffective/), [ITextFrameFormat::GetEffective](https://reference.aspose.com/slides/cpp/aspose.slides/itextframeformat/geteffective/), [IFillFormat::GetEffective](https://reference.aspose.com/slides/cpp/aspose.slides/ifillformat/geteffective/), and [ILineFormat::GetEffective](https://reference.aspose.com/slides/cpp/aspose.slides/ilineformat/geteffective/). Do not rely on retaining only the effective-format objects, because their text-formatting values can change after the relationship is removed. Explicitly apply the captured values to the ordinary shape afterward, including the font family, size, style, color, paragraph settings, text-frame settings, fill, and line used by your template. Inherited shape geometry may also need to be assigned explicitly through [IGeometryShape::set_ShapeType](https://reference.aspose.com/slides/cpp/aspose.slides/igeometryshape/set_shapetype/). For a rectangular text placeholder, this means assigning [ShapeType::Rectangle](https://reference.aspose.com/slides/cpp/aspose.slides/shapetype/); restoring only the fill and line may not restore the visible rectangle. Templates with additional effects or more complex formatting require those settings to be handled as well. [![An inherited Project update title becomes almost invisible after placeholder removal; stored text and shape count remain while its resolved frame becomes zero-sized.](https://docs.aspose.com/slides/cpp/manage-placeholder/visual-placeholder-inheritance-e07f1411f7f8.svg)](https://docs.aspose.com/slides/cpp/manage-placeholder/visual-placeholder-inheritance-e07f1411f7f8.svg) *Controlled .NET 26.11 fixture: removing placeholder status keeps the object and text but removes the base link; the inherited 648 × 90-point frame becomes zero-sized. This is not shape deletion. Capture resolved values before removal and explicitly reapply the geometry and formatting needed to preserve appearance.* ## **Change Text in a Placeholder** Title, centered-title, subtitle, body, and text placeholders normally support text. Check for [IAutoShape](https://reference.aspose.com/slides/cpp/aspose.slides/iautoshape/) before using its [get_TextFrame](https://reference.aspose.com/slides/cpp/aspose.slides/iautoshape/get_textframe/) method. This example updates the first title placeholder on the first slide and saves the result: ```c++ #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(u"template.pptx"); auto slide = presentation->get_Slide(0); SharedPtr titleShape; for (auto&& shape : slide->get_Shapes()) { if (!ObjectExt::Is(shape)) { continue; } auto autoShape = ExplicitCast(shape); auto placeholder = autoShape->get_Placeholder(); if (placeholder == nullptr) { continue; } auto placeholderType = placeholder->get_Type(); if (placeholderType == PlaceholderType::Title || placeholderType == PlaceholderType::CenteredTitle) { titleShape = autoShape; break; } } if (titleShape == nullptr) { throw InvalidOperationException(u"The first slide does not contain a title placeholder."); } titleShape->get_TextFrame()->set_Text(u"Quarterly Business Review"); presentation->Save(u"title-placeholder-updated.pptx", SaveFormat::Pptx); ``` This pattern avoids casting picture, chart, table, or media placeholders to [IAutoShape](https://reference.aspose.com/slides/cpp/aspose.slides/iautoshape/). It also identifies the placeholder by purpose instead of relying on a fragile shape index. ## **Set Prompt Text on a Layout** Prompt text is the design-time instruction displayed in an empty placeholder, such as *Click to add title*. Set custom prompt text on the layout placeholder rather than trying to reach it through a normal slide's shape collection. Access the layout through [ISlide::get_LayoutSlide](https://reference.aspose.com/slides/cpp/aspose.slides/islide/get_layoutslide/) and iterate over [IBaseSlide::get_Shapes](https://reference.aspose.com/slides/cpp/aspose.slides/ibaseslide/get_shapes/). The following example changes the title and subtitle prompts on the layout used by the first slide: ```c++ #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(u"template.pptx"); auto layoutSlide = presentation->get_Slide(0)->get_LayoutSlide(); for (auto&& shape : layoutSlide->get_Shapes()) { if (!ObjectExt::Is(shape)) { continue; } auto autoShape = ExplicitCast(shape); auto placeholder = autoShape->get_Placeholder(); if (placeholder == nullptr) { continue; } switch (placeholder->get_Type()) { case PlaceholderType::Title: case PlaceholderType::CenteredTitle: autoShape->get_TextFrame()->set_Text(u"Enter a concise slide title"); break; case PlaceholderType::Subtitle: autoShape->get_TextFrame()->set_Text(u"Enter a subtitle or reporting period"); break; default: break; } } presentation->Save(u"custom-placeholder-prompts.pptx", SaveFormat::Pptx); ``` Prompt text is not normal slide content. It is intended for empty placeholders in editing applications such as PowerPoint. Once a user or program supplies real content, the prompt is no longer displayed. Changing a prompt also does not replace existing text on slides that use the layout. ## **Update a Picture Placeholder** There are two cases to handle: - If the picture placeholder is already populated and represented by an [IPictureFrame](https://reference.aspose.com/slides/cpp/aspose.slides/ipictureframe/), replace the image through [IPictureFillFormat::get_Picture](https://reference.aspose.com/slides/cpp/aspose.slides/ipicturefillformat/get_picture/) and [ISlidesPicture::set_Image](https://reference.aspose.com/slides/cpp/aspose.slides/islidespicture/set_image/). - If it is still an empty placeholder, add a picture frame at the placeholder's coordinates with [IShapeCollection::AddPictureFrame](https://reference.aspose.com/slides/cpp/aspose.slides/ishapecollection/addpictureframe/) and remove the empty placeholder. The next example supports both cases and saves the presentation: ```c++ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::IO; auto presentation = MakeObject(u"picture-template.pptx"); auto slide = presentation->get_Slide(0); SharedPtr picturePlaceholder; for (auto&& shape : slide->get_Shapes()) { auto placeholder = shape->get_Placeholder(); if (placeholder != nullptr && placeholder->get_Type() == PlaceholderType::Picture) { picturePlaceholder = shape; break; } } if (picturePlaceholder == nullptr) { throw InvalidOperationException(u"The first slide does not contain a picture placeholder."); } auto imageBytes = File::ReadAllBytes(u"replacement.png"); auto image = presentation->get_Images()->AddImage(imageBytes); if (ObjectExt::Is(picturePlaceholder)) { auto pictureFrame = ExplicitCast(picturePlaceholder); pictureFrame->get_PictureFormat()->get_Picture()->set_Image(image); } else { auto x = picturePlaceholder->get_X(); auto y = picturePlaceholder->get_Y(); auto width = picturePlaceholder->get_Width(); auto height = picturePlaceholder->get_Height(); auto shapes = slide->get_Shapes(); shapes->AddPictureFrame(ShapeType::Rectangle, x, y, width, height, image); shapes->Remove(picturePlaceholder); } presentation->Save(u"picture-placeholder-updated.pptx", SaveFormat::Pptx); ``` The replacement created for an empty placeholder is a local picture frame, not a new placeholder, because [IShape::get_Placeholder](https://reference.aspose.com/slides/cpp/aspose.slides/ishape/get_placeholder/) is read-only. It keeps the reserved position but no longer inherits placeholder-specific behavior. If retaining the placeholder relationship is essential, prepare and populate the placeholder in PowerPoint first, then update the resulting [IPictureFrame](https://reference.aspose.com/slides/cpp/aspose.slides/ipictureframe/) with Aspose.Slides. For image transparency, cropping, and other picture-specific effects, see [Manage Picture Frames](https://docs.aspose.com/slides/cpp/picture-frame/). Those operations belong to the picture frame or picture fill, not to placeholder metadata. ## **Work with Chart and Content Placeholders** A populated chart placeholder can be represented by an [IChart](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichart/). This example finds such a chart by both placeholder type and runtime interface, changes its title, and saves the file: ```c++ #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(u"chart-template.pptx"); auto slide = presentation->get_Slide(0); SharedPtr placeholderChart; for (auto&& shape : slide->get_Shapes()) { if (!ObjectExt::Is(shape)) { continue; } auto chart = ExplicitCast(shape); auto placeholder = chart->get_Placeholder(); if (placeholder != nullptr && placeholder->get_Type() == PlaceholderType::Chart) { placeholderChart = chart; break; } } if (placeholderChart == nullptr) { throw InvalidOperationException(u"The first slide does not contain a populated chart placeholder."); } placeholderChart->set_HasTitle(true); placeholderChart->get_ChartTitle()->AddTextFrameForOverriding(u"Quarterly Revenue"); presentation->Save(u"chart-placeholder-updated.pptx", SaveFormat::Pptx); ``` A general content placeholder usually has [PlaceholderType::Object](https://reference.aspose.com/slides/cpp/aspose.slides/placeholdertype/). In PowerPoint it acts as a launcher for several content types, including charts, tables, diagrams, pictures, and media. After it has been populated, inspect the actual shape interface to learn what it contains. Specialized layouts can also expose [PlaceholderType::Chart](https://reference.aspose.com/slides/cpp/aspose.slides/placeholdertype/), [PlaceholderType::Table](https://reference.aspose.com/slides/cpp/aspose.slides/placeholdertype/), [PlaceholderType::Picture](https://reference.aspose.com/slides/cpp/aspose.slides/placeholdertype/), [PlaceholderType::Media](https://reference.aspose.com/slides/cpp/aspose.slides/placeholdertype/), or [PlaceholderType::Diagram](https://reference.aspose.com/slides/cpp/aspose.slides/placeholdertype/). Aspose.Slides does not convert an empty [IAutoShape](https://reference.aspose.com/slides/cpp/aspose.slides/iautoshape/) placeholder into an [IChart](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichart/) merely by changing [IPlaceholder::get_Type](https://reference.aspose.com/slides/cpp/aspose.slides/iplaceholder/get_type/); the type is read-only. To fill an empty chart or content area programmatically, add the required object at the placeholder's coordinates and then remove the empty placeholder. The following example does that for a chart: ```c++ #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(u"content-template.pptx"); auto slide = presentation->get_Slide(0); SharedPtr targetPlaceholder; for (auto&& shape : slide->get_Shapes()) { auto placeholder = shape->get_Placeholder(); if (placeholder == nullptr) { continue; } auto placeholderType = placeholder->get_Type(); if (placeholderType == PlaceholderType::Chart || placeholderType == PlaceholderType::Object) { targetPlaceholder = shape; break; } } if (targetPlaceholder == nullptr) { throw InvalidOperationException(u"The first slide does not contain a chart or content placeholder."); } auto x = targetPlaceholder->get_X(); auto y = targetPlaceholder->get_Y(); auto width = targetPlaceholder->get_Width(); auto height = targetPlaceholder->get_Height(); auto shapes = slide->get_Shapes(); auto chart = shapes->AddChart(ChartType::ClusteredColumn, x, y, width, height); chart->set_HasTitle(true); chart->get_ChartTitle()->AddTextFrameForOverriding(u"Quarterly Revenue"); shapes->Remove(targetPlaceholder); presentation->Save(u"content-placeholder-replaced-with-chart.pptx", SaveFormat::Pptx); ``` The added chart is an ordinary local chart. It occupies the placeholder's area but does not inherit from the layout placeholder. Use the dedicated [chart management articles](https://docs.aspose.com/slides/cpp/powerpoint-charts/) when you need to replace its categories, series, or workbook data. ## **Complete Example: Update Text or Image Content** The following end-to-end example opens a template, searches the first slide for either a title or picture placeholder, checks the placeholder and shape types, updates the appropriate content, and saves the output. The example deliberately avoids assuming a shape index or casting every placeholder to the same interface. ```c++ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::IO; auto presentation = MakeObject(u"template.pptx"); auto slide = presentation->get_Slide(0); auto updated = false; for (auto&& shape : slide->get_Shapes()) { auto placeholder = shape->get_Placeholder(); if (placeholder == nullptr) { continue; } auto placeholderType = placeholder->get_Type(); if ((placeholderType == PlaceholderType::Title || placeholderType == PlaceholderType::CenteredTitle) && ObjectExt::Is(shape)) { auto titleShape = ExplicitCast(shape); titleShape->get_TextFrame()->set_Text(u"Quarterly Business Review"); updated = true; break; } if (placeholderType == PlaceholderType::Picture) { auto imageBytes = File::ReadAllBytes(u"replacement.png"); auto image = presentation->get_Images()->AddImage(imageBytes); if (ObjectExt::Is(shape)) { auto pictureFrame = ExplicitCast(shape); pictureFrame->get_PictureFormat()->get_Picture()->set_Image(image); } else { auto x = shape->get_X(); auto y = shape->get_Y(); auto width = shape->get_Width(); auto height = shape->get_Height(); auto shapes = slide->get_Shapes(); shapes->AddPictureFrame(ShapeType::Rectangle, x, y, width, height, image); shapes->Remove(shape); } updated = true; break; } } if (!updated) { throw InvalidOperationException(u"No supported title or picture placeholder was found on the first slide."); } presentation->Save(u"placeholder-content-updated.pptx", SaveFormat::Pptx); ``` ## **FAQ** **What is a base placeholder?** A base placeholder is the corresponding shape on the layout or master from which another placeholder inherits. Use [IShape::GetBasePlaceholder](https://reference.aspose.com/slides/cpp/aspose.slides/ishape/getbaseplaceholder/) to retrieve it. An ordinary local shape returns `nullptr` because it is not part of the placeholder hierarchy. **Can I change all slide titles by editing a layout placeholder?** You can change inherited formatting or prompt text through a layout, but existing title content is stored on the normal slides. To replace actual title text across a presentation, iterate over the slides and update each title placeholder. **How do I manage date, slide-number, header, and footer placeholders?** Use the header and footer managers at the appropriate slide, layout, master, notes, or handout scope. See [Manage Presentation Header and Footer](https://docs.aspose.com/slides/cpp/presentation-header-and-footer/) for complete examples. ## Related articles - [Manage Presentation Headers and Footers in C++](https://docs.aspose.com/slides/cpp/presentation-header-and-footer/) # Manage Presentations in C++ > Manage PowerPoint PPT, PPTX and ODP presentations in C++ with Aspose.Slides: create, load, edit, clone slides and control content programmatically. Source: https://docs.aspose.com/slides/cpp/manage-presentation/ Updated: 2025-11-19 --- lastmod: 2025-11-19T22:55:59+04:00 title: Manage Presentations in C++ linktitle: Manage Presentation type: docs weight: 10 url: /cpp/manage-presentation/ keywords: - manage presentation - manage PPT - manage PPTX - manage ODP - create presentation - open presentation - examine presentation - merge presentations - convert presentation - save presentation - manage slide show - PowerPoint - OpenDocument - C++ - Aspose.Slides description: "Manage PowerPoint PPT, PPTX and ODP presentations in C++ with Aspose.Slides: create, load, edit, clone slides and control content programmatically." --- # Manage Rows and Columns in PowerPoint Tables Using C++ > Manage table rows and columns in PowerPoint with Aspose.Slides for C++ and speed up presentation editing and data updates. Source: https://docs.aspose.com/slides/cpp/manage-rows-and-columns/ Updated: 2026-11-16 ## **Introduction** Aspose.Slides for C++ lets you manage table structure and formatting in PowerPoint presentations through the [Table](https://reference.aspose.com/slides/cpp/aspose.slides/table/) class and [ITable](https://reference.aspose.com/slides/cpp/aspose.slides/itable/) interface. You can designate a header row, clone or remove rows and columns, and apply text formatting to an entire row or column. This article explains these operations with C++ examples. It also shows how to retrieve a table's style preset so you can reuse it. Table row and column indices are zero-based. ## **Control Row Height** Use [IRow::set_MinimalHeight](https://reference.aspose.com/slides/cpp/aspose.slides/irow/set_minimalheight/) to set a row's minimum height in points. It is a lower bound, not a fixed height. [IRow::get_Height](https://reference.aspose.com/slides/cpp/aspose.slides/irow/get_height/) returns the actual height; this value cannot be set directly. Access the row through [ITable::get_Rows](https://reference.aspose.com/slides/cpp/aspose.slides/itable/get_rows/). The example loads [row-height-input.pptx](https://docs.aspose.com/slides/cpp/manage-rows-and-columns/row-height-input.pptx), which has a table as the first shape on the first slide. Its first row starts at 70 points. The cells use 18-point Arial text, wrapping, and 6-point top and bottom margins; the longer text in the second column wraps onto multiple lines. The example increases the minimum to 100 points, then decreases it to 20 points, prints the actual height after each change, and saves both results. ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(u"row-height-input.pptx"); auto slide = presentation->get_Slide(0); auto table = ExplicitCast(slide->get_Shape(0)); auto row = table->get_Rows()->idx_get(0); row->set_MinimalHeight(100); Console::WriteLine(u"Increased: minimum = {0:F1}, actual = {1:F1} pt", row->get_MinimalHeight(), row->get_Height()); presentation->Save(u"row-height-increased.pptx", SaveFormat::Pptx); row->set_MinimalHeight(20); Console::WriteLine(u"Decreased: minimum = {0:F1}, actual = {1:F1} pt", row->get_MinimalHeight(), row->get_Height()); presentation->Save(u"row-height-decreased.pptx", SaveFormat::Pptx); ``` With the supplied presentation, increasing the minimum adds space to the row. Decreasing it removes that extra space, but the actual height remains greater than 20 points because the text and cell margins need more room. Reducing the minimum alone cannot force the row below the space required by its content. Several factors affect the actual height: - **Text and font size:** longer text, explicit line breaks, or a larger font can require more vertical space. - **Wrapping and column width:** with wrapping enabled, reducing the column width with [IColumn::set_Width](https://reference.aspose.com/slides/cpp/aspose.slides/icolumn/set_width/) can produce more lines. A wider column can reduce the space required vertically. - **Cell margins:** [ICell::set_MarginTop](https://reference.aspose.com/slides/cpp/aspose.slides/icell/set_margintop/) and [ICell::set_MarginBottom](https://reference.aspose.com/slides/cpp/aspose.slides/icell/set_marginbottom/) control the margins that add vertical space. [ICell::set_MarginLeft](https://reference.aspose.com/slides/cpp/aspose.slides/icell/set_marginleft/) and [ICell::set_MarginRight](https://reference.aspose.com/slides/cpp/aspose.slides/icell/set_marginright/) control the margins that reduce the width available for text and can cause additional wrapping. For this table without merged cells, the cell that needs the most vertical space determines the content-driven lower limit for the entire row. To make the row shorter, you may also need to shorten the text, reduce the font size or margins, or widen a column. The images below show the same table at the same scale. In the reference .NET run shown here, the actual heights were 70, 100, and 55.2 points: the final row remained taller than its 20-point minimum. Exact text measurements can vary with the fonts available in your environment. Download the saved results: [increased minimum](https://docs.aspose.com/slides/cpp/manage-rows-and-columns/row-height-increased.pptx) and [decreased minimum](https://docs.aspose.com/slides/cpp/manage-rows-and-columns/row-height-decreased.pptx). | Original: minimum 70 pt, actual 70 pt | Increased: minimum 100 pt, actual 100 pt | Decreased: minimum 20 pt, actual 55.2 pt | | --- | --- | --- | | ![Original table with a 70-point first row.](https://docs.aspose.com/slides/cpp/manage-rows-and-columns/row-height-before.png) | ![Table after increasing the first row minimum to 100 points.](https://docs.aspose.com/slides/cpp/manage-rows-and-columns/row-height-increased.png) | ![Table after decreasing the first row minimum to 20 points; wrapped text keeps the row taller than the minimum.](https://docs.aspose.com/slides/cpp/manage-rows-and-columns/row-height-decreased.png) | ## **Set the First Row as a Header** Use the [set_FirstRow](https://reference.aspose.com/slides/cpp/aspose.slides/itable/set_firstrow/) method to mark the first row for header formatting. Its appearance depends on the table style applied to the table. 1. Load the presentation with the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) class. 2. Access the first slide. 3. Access the table stored as the first shape on the slide. 4. Enable header formatting for its first row. 5. Save the modified presentation. The example requires `table.pptx` with a table as the first shape on the first slide. It enables header formatting for the first row and saves `First_row_header.pptx`. ```cpp #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(u"table.pptx"); auto slide = presentation->get_Slide(0); auto table = ExplicitCast(slide->get_Shape(0)); table->set_FirstRow(true); presentation->Save(u"First_row_header.pptx", SaveFormat::Pptx); ``` ## **Clone a Table Row or Column** Clone rows or columns to reuse their content and formatting. You can append a copy to the end of the table or insert it at a specific position. 1. Load the presentation with the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) class. 2. Access the first slide. 3. Define the column widths and row heights. 4. Add a table with the [AddTable](https://reference.aspose.com/slides/cpp/aspose.slides/ishapecollection/addtable/) method. 5. Clone the required rows. 6. Clone the required columns. 7. Save the modified presentation. The example requires `Test.pptx` with at least one slide. It creates a table with three columns and five rows, with dimensions specified in points. It appends copies of the first row and column, then inserts copies of the second row and column at index 3 (the fourth position). The resulting table has seven rows and five columns. The `false` argument disables cloning into adjacent merged rows or columns; this table has no merged cells. ```cpp #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(u"Test.pptx"); auto slide = presentation->get_Slide(0); auto columnWidths = MakeArray({ 50, 50, 50 }); auto rowHeights = MakeArray({ 50, 30, 30, 30, 30 }); auto table = slide->get_Shapes()->AddTable(100, 50, columnWidths, rowHeights); table->idx_get(0, 0)->get_TextFrame()->set_Text(u"Row 1 Cell 1"); table->idx_get(1, 0)->get_TextFrame()->set_Text(u"Row 1 Cell 2"); table->get_Rows()->AddClone(table->get_Rows()->idx_get(0), false); table->idx_get(0, 1)->get_TextFrame()->set_Text(u"Row 2 Cell 1"); table->idx_get(1, 1)->get_TextFrame()->set_Text(u"Row 2 Cell 2"); table->get_Rows()->InsertClone(3, table->get_Rows()->idx_get(1), false); table->get_Columns()->AddClone(table->get_Columns()->idx_get(0), false); table->get_Columns()->InsertClone(3, table->get_Columns()->idx_get(1), false); presentation->Save(u"table_out.pptx", SaveFormat::Pptx); ``` ## **Remove a Row or Column from a Table** Remove rows or columns that are no longer needed in a table. Removing an item shifts the indices of the rows or columns that follow it. 1. Create a presentation with the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) class. 2. Access the first slide. 3. Define the column widths and row heights. 4. Add a table with the [AddTable](https://reference.aspose.com/slides/cpp/aspose.slides/ishapecollection/addtable/) method. 5. Remove the second row and second column. 6. Save the modified presentation. This example creates a three-by-three table and removes the row and column at index 1, leaving a two-by-two table in `TestTable_out.pptx`. The dimensions are in points. The `false` argument disables removal of adjacent merged rows or columns; this table has no merged cells. ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto columnWidths = MakeArray({ 100, 50, 30 }); auto rowHeights = MakeArray({ 30, 50, 30 }); auto table = slide->get_Shapes()->AddTable(100, 100, columnWidths, rowHeights); table->get_Rows()->RemoveAt(1, false); table->get_Columns()->RemoveAt(1, false); presentation->Save(u"TestTable_out.pptx", SaveFormat::Pptx); ``` ## **Set Text Formatting on the Table Row Level** Apply text formatting to an entire row to keep its cells consistent. You can set font properties, paragraph formatting, and text direction without formatting each cell individually. 1. Load the presentation with the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) class. 2. Access the table on the first slide. 3. Set the font height with [set_FontHeight](https://reference.aspose.com/slides/cpp/aspose.slides/baseportionformat/set_fontheight/) for the first row. 4. Set the alignment and right paragraph margin with [set_Alignment](https://reference.aspose.com/slides/cpp/aspose.slides/iparagraphformat/set_alignment/) and [set_MarginRight](https://reference.aspose.com/slides/cpp/aspose.slides/iparagraphformat/set_marginright/) for the first row. 5. Set the text direction with [set_TextVerticalType](https://reference.aspose.com/slides/cpp/aspose.slides/textframeformat/set_textverticaltype/) for the second row. 6. Save the modified presentation. The example requires `table.pptx` with a table as the first shape on the first slide and at least two rows. It applies 25-point text, right alignment, and a 20-point right paragraph margin to the first row, then sets vertical text in the second row. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(u"table.pptx"); auto slide = presentation->get_Slide(0); auto table = ExplicitCast(slide->get_Shape(0)); auto portionFormat = MakeObject(); portionFormat->set_FontHeight(25); table->get_Rows()->idx_get(0)->SetTextFormat(portionFormat); auto paragraphFormat = MakeObject(); paragraphFormat->set_Alignment(TextAlignment::Right); paragraphFormat->set_MarginRight(20); table->get_Rows()->idx_get(0)->SetTextFormat(paragraphFormat); auto textFrameFormat = MakeObject(); textFrameFormat->set_TextVerticalType(TextVerticalType::Vertical); table->get_Rows()->idx_get(1)->SetTextFormat(textFrameFormat); presentation->Save(u"row_formatting.pptx", SaveFormat::Pptx); ``` ## **Set Text Formatting on the Table Column Level** Apply text formatting to an entire column to keep its cells consistent. You can set font properties, paragraph formatting, and text direction without formatting each cell individually. 1. Load the presentation with the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) class. 2. Access the table on the first slide. 3. Set the font height with [set_FontHeight](https://reference.aspose.com/slides/cpp/aspose.slides/baseportionformat/set_fontheight/) for the first column. 4. Set the alignment and right paragraph margin with [set_Alignment](https://reference.aspose.com/slides/cpp/aspose.slides/iparagraphformat/set_alignment/) and [set_MarginRight](https://reference.aspose.com/slides/cpp/aspose.slides/iparagraphformat/set_marginright/) for the first column. 5. Set the text direction with [set_TextVerticalType](https://reference.aspose.com/slides/cpp/aspose.slides/textframeformat/set_textverticaltype/) for the second column. 6. Save the modified presentation. The example requires `table.pptx` with a table as the first shape on the first slide and at least two columns. It applies 25-point text, right alignment, and a 20-point right paragraph margin to the first column, then sets vertical text in the second column. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(u"table.pptx"); auto slide = presentation->get_Slide(0); auto table = ExplicitCast(slide->get_Shape(0)); auto portionFormat = MakeObject(); portionFormat->set_FontHeight(25); table->get_Columns()->idx_get(0)->SetTextFormat(portionFormat); auto paragraphFormat = MakeObject(); paragraphFormat->set_Alignment(TextAlignment::Right); paragraphFormat->set_MarginRight(20); table->get_Columns()->idx_get(0)->SetTextFormat(paragraphFormat); auto textFrameFormat = MakeObject(); textFrameFormat->set_TextVerticalType(TextVerticalType::Vertical); table->get_Columns()->idx_get(1)->SetTextFormat(textFrameFormat); presentation->Save(u"column_formatting.pptx", SaveFormat::Pptx); ``` ## **Get Table Style Properties** Use the [get_StylePreset](https://reference.aspose.com/slides/cpp/aspose.slides/itable/get_stylepreset/) method to retrieve the preset applied to a table and reuse it on another table. This identifies the preset rather than individual cell formatting overrides. The example creates a table, applies [TableStylePreset::DarkStyle1](https://reference.aspose.com/slides/cpp/aspose.slides/tablestylepreset/), and reads the preset back. It prints `DarkStyle1` and saves the table in `table.pptx`. ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto columnWidths = MakeArray({ 100, 150 }); auto rowHeights = MakeArray({ 5, 5, 5 }); auto table = slide->get_Shapes()->AddTable(10, 10, columnWidths, rowHeights); table->set_StylePreset(TableStylePreset::DarkStyle1); Console::WriteLine(u"{0}", table->get_StylePreset()); presentation->Save(u"table.pptx", SaveFormat::Pptx); ``` ## **Apply Row or Column Banding** Set [set_HorizontalBanding](https://reference.aspose.com/slides/cpp/aspose.slides/itable/set_horizontalbanding/) to alternate row fills or [set_VerticalBanding](https://reference.aspose.com/slides/cpp/aspose.slides/itable/set_verticalbanding/) to alternate column fills. The table style supplies the band colors. To keep a particular cell the same color in every configuration, set its [get_FillFormat](https://reference.aspose.com/slides/cpp/aspose.slides/icellformat/get_fillformat/) to a solid fill. The example saves three versions of the same table. Only the two banding flags change between saves. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::Drawing; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto widths = MakeArray({ 100, 100, 100, 100 }); auto heights = MakeArray({ 50, 50, 50, 50 }); auto table = slide->get_Shapes()->AddTable(40, 40, widths, heights); table->set_StylePreset(TableStylePreset::MediumStyle2Accent1); table->set_FirstRow(false); table->set_FirstCol(false); table->set_LastRow(false); table->set_LastCol(false); for (auto row = 0; row < heights->get_Length(); ++row) { for (auto column = 0; column < widths->get_Length(); ++column) { auto label = String::Format(u"{0},{1}", row + 1, column + 1); table->idx_get(column, row)->get_TextFrame()->set_Text(label); } } auto fill = table->idx_get(1, 1)->get_CellFormat()->get_FillFormat(); fill->set_FillType(FillType::Solid); fill->get_SolidFillColor()->set_Color(Color::get_Orange()); table->set_HorizontalBanding(true); table->set_VerticalBanding(false); presentation->Save(u"rows.pptx", SaveFormat::Pptx); table->set_HorizontalBanding(false); table->set_VerticalBanding(true); presentation->Save(u"columns.pptx", SaveFormat::Pptx); table->set_VerticalBanding(false); presentation->Save(u"off.pptx", SaveFormat::Pptx); ``` In PowerPoint, cell `2,2` stays orange in all three versions. Its neighbors alternate in color by row or by column and share a single fill when both flags are off. | Row banding | Column banding | Both off | | --- | --- | --- | | ![Alternating row fills with cell 2,2 in orange.](https://docs.aspose.com/slides/cpp/manage-rows-and-columns/row-banding.png) | ![Alternating column fills with cell 2,2 in orange.](https://docs.aspose.com/slides/cpp/manage-rows-and-columns/column-banding.png) | ![Uniform fill except for the orange cell.](https://docs.aspose.com/slides/cpp/manage-rows-and-columns/banding-off.png) | ## **FAQ** **Can I apply PowerPoint themes/styles to a table that's already created?** Yes. The table inherits the slide/layout/master theme, and you can still override fills, borders, and text colors on top of that theme. **Can I sort table rows like in Excel?** No, Aspose.Slides tables don't have built-in sorting or filters. Sort your data in memory first, then repopulate the table rows in that order. **Can I have banded (striped) columns while keeping custom colors on specific cells?** Yes. Enable banded columns and apply a local fill to the cells you want to highlight. See [Apply Row or Column Banding](https://docs.aspose.com/slides/cpp/manage-rows-and-columns/#apply-row-or-column-banding). ## Related articles - [Manage Presentation Tables in C++](https://docs.aspose.com/slides/cpp/manage-table/) - [Create and Customize PowerPoint Tables in C++](https://docs.aspose.com/slides/cpp/powerpoint-table/) # Manage Slide Show in C++ > Learn how to manage slide shows in Aspose.Slides for C++. Control slide transitions, timings and more across PPT, PPTX and ODP formats with ease. Source: https://docs.aspose.com/slides/cpp/manage-slide-show/ Updated: 2026-08-05 ## **Introduction** In Microsoft PowerPoint, the **Slide Show** settings are a key tool for preparing and delivering professional presentations. One of the most important features in this section is **Set Up Show**, which allows you to tailor your presentation to specific conditions and audiences, ensuring flexibility and convenience. With this feature, you can select the show type (e.g., presented by a speaker, browsed by an individual, or browsed at a kiosk), enable or disable looping, choose specific slides to display, and use timings. This step in preparation is crucial for making your presentation more effective and professional. `get_SlideShowSettings` is a method of the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) class that returns an object of type [SlideShowSettings](https://reference.aspose.com/slides/cpp/aspose.slides/slideshowsettings/), which allows you to manage the slide show settings in a PowerPoint presentation. In this article, we will explore how to use this method to configure and control various aspects of slide show settings. ## **Select Show Type** `SlideShowSettings.set_SlideShowType` defines the type of slide show, which can be an instance of the following classes: [PresentedBySpeaker](https://reference.aspose.com/slides/cpp/aspose.slides/presentedbyspeaker/), [BrowsedByIndividual](https://reference.aspose.com/slides/cpp/aspose.slides/browsedbyindividual/), or [BrowsedAtKiosk](https://reference.aspose.com/slides/cpp/aspose.slides/browsedatkiosk/). Using this method allows you to adapt the presentation for different usage scenarios, such as automated kiosks or manual presentations. The code example below creates a new presentation and sets the show type to "Browsed by an individual" without displaying the scrollbar. ```cpp #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(); auto showType = MakeObject(); showType->set_ShowScrollbar(false); presentation->get_SlideShowSettings()->set_SlideShowType(showType); presentation->Save(u"output.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ## **Enable Show Options** `SlideShowSettings.set_Loop` determines whether the slide show should repeat in a loop until manually stopped. This is useful for automated presentations that need to run continuously. `SlideShowSettings.set_ShowNarration` determines whether voice narrations should be played during the slide show. It is useful for automated presentations that contain voice guidance for the audience. `SlideShowSettings.set_ShowAnimation` determines whether animations added to slide objects should be played. This is useful for providing the full visual effect of the presentation. The following code example creates a new presentation and loops the slide show. ```cpp #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(); presentation->get_SlideShowSettings()->set_Loop(true); presentation->Save(u"output.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ## **Select Slides to Show** `SlideShowSettings.set_Slides` method allows you to select a range of slides to be shown during the presentation. This is useful when you need to show only part of the presentation rather than all slides. The following code example creates a new presentation and sets the slide range to display from slides `2` to `9`. ```cpp #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(); auto slideRange = MakeObject(); slideRange->set_Start(2); slideRange->set_End(9); presentation->get_SlideShowSettings()->set_Slides(slideRange); presentation->Save(u"output.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ## **Use Advance Slides** `SlideShowSettings.set_UseTimings` method allows you to enable or disable the use of preset timings for each slide. This is useful for automatically showing slides with pre-defined display durations. The code example below creates a new presentation and disables the use of timings. ```cpp #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(); presentation->get_SlideShowSettings()->set_UseTimings(false); presentation->Save(u"output.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ## **Show Media Controls** `SlideShowSettings.set_ShowMediaControls` method determines whether media controls (such as play, pause, and stop) should be displayed during the slide show when multimedia content (e.g., video or audio) is played. This is useful when you want to give the presenter control over media playback during the presentation. The following code example creates a new presentation and enables media controls to be displayed. ```cpp #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(); presentation->get_SlideShowSettings()->set_ShowMediaControls(true); presentation->Save(u"output.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ## **FAQ** ### Can I save a presentation so it opens directly in slide show mode? Yes. Save the file as PPSX or PPSM; these formats launch directly in slide show when opened in PowerPoint. In Aspose.Slides, choose the corresponding save format [during export](https://docs.aspose.com/slides/cpp/save-presentation/). ### Can I exclude individual slides from the show without deleting them from the file? Yes. Mark a slide as [hidden](https://reference.aspose.com/slides/cpp/aspose.slides/slide/set_hidden/). Hidden slides remain in the presentation but are not displayed during the slide show. ### Can Aspose.Slides play a slide show or control a live presentation on screen? No. Aspose.Slides edits, analyzes, and converts presentation files; the actual playback is handled by a viewer application such as PowerPoint. # Manage SmartArt Shape Nodes in Presentations Using C++ > Manage SmartArt shape nodes in PPT and PPTX with Aspose.Slides for C++. Get clear code samples and tips to streamline your presentations. Source: https://docs.aspose.com/slides/cpp/manage-smartart-shape-node/ Updated: 2026-08-05 ## **Overview** SmartArt graphics in PowerPoint presentations are organized through nodes that contain text and define the structure of the diagram. Aspose.Slides allows you to work with these SmartArt nodes programmatically: add new nodes and child nodes, insert child nodes at a specific position, access existing nodes, and read their text, level, and position. This article explains how to manage SmartArt shape nodes. It shows how to remove nodes, work with child nodes by index or position, change an assistant node to a normal node, adjust the position, size, and rotation of SmartArt node shapes, set node fill formats, and generate a thumbnail image for a SmartArt child node. ## **Add a SmartArt Node** Aspose.Slides for C++ has provided the simplest API to manage the SmartArt shapes in an easiest way. The following sample code will help to add node and child node inside SmartArt shape. - Create an instance of [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) class and load the presentation with SmartArt Shape. - Obtain the reference of first slide by using its Index. - Traverse through every shape inside first slide. - Check if shape is of SmartArt type and Typecast selected shape to SmartArt if it is SmartArt. - Add a new Node in SmartArt shape NodeCollection and set the text in TextFrame. - Now, Add a Child Node in newly added SmartArt Node and set the text in TextFrame. - Save the Presentation. ```cpp For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C // The path to the documents directory. const String outPath = u"../out/AddNodes_out.pptx"; // Load the desired the presentation SharedPtr pres = MakeObject(); // Add SmartArt BasicProcess System::SharedPtr smart = pres->get_Slides()->idx_get(0)->get_Shapes()->AddSmartArt(10, 10, 400, 300, SmartArtLayoutType::StackedList); if (smart->get_AllNodes()->get_Count() > 0) { // Accessing SmartArt node at index 0 System::SharedPtr node = smart->get_AllNodes()->AddNode(); // Add Text node->get_TextFrame()->set_Text(u"Test"); // SharedPtr nodeCollection = System::DynamicCast_noexcept(node->get_ChildNodes()); ; auto nodeCollection = node->get_ChildNodes() ; // Adding new child node at end of parent node SharedPtr chNode = nodeCollection->AddNode(); // Add Text chNode->get_TextFrame()->set_Text(u"Sample Text Added"); } // Save Presentation pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx); ``` [Source: Examples-SlidesCPP-AddNodes-AddNodes.cpp](https://gist.githubusercontent.com/aspose-slides/a690df625dc0b1fff869ab198affe7a4/raw/b7b865ccde21f4b2337ccb5bc0c4305fca9ebfe8/Examples-SlidesCPP-AddNodes-AddNodes.cpp) ## **Add a SmartArt Node at a Specific Position** In the following sample code we have explained how to add the child nodes belonging to respective nodes of SmartArt shape at particular position. - Create an instance of `Presentation` class. - Obtain the reference of first slide by using its Index. - Add a StackedList type SmartArt shape in accessed slide. - Access the first node in added SmartArt shape. - Now, add the Child Node for selected Node at position 2 and set its text. - Save the Presentation. ```cpp For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C // The path to the documents directory. const String outPath = u"../out/AddNodesSpecificPosition_out.pptx"; // Load the desired the presentation SharedPtr pres = MakeObject(); // Add SmartArt BasicProcess System::SharedPtr smart = pres->get_Slides()->idx_get(0)->get_Shapes()->AddSmartArt(10, 10, 400, 300, SmartArtLayoutType::StackedList); if (smart->get_AllNodes()->get_Count() > 0) { // Accessing SmartArt node at index 0 System::SharedPtr node0 = System::DynamicCast_noexcept(smart->get_AllNodes()->idx_get(0)); // SharedPtr node0Collection = System::DynamicCast_noexcept(node0->get_ChildNodes()); ; SharedPtr node0Collection = node0->get_ChildNodes() ; // Adding new child node at position 2 in parent node SharedPtr chNode = node0Collection->AddNodeByPosition(2); // Add Text chNode->get_TextFrame()->set_Text(u"Sample Text Added"); } // Save Presentation pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx); ``` [Source: Examples-SlidesCPP-AddNodesSpecificPosition-AddNodesSpecificPosition.cpp](https://gist.githubusercontent.com/aspose-slides/a690df625dc0b1fff869ab198affe7a4/raw/6f5a6e816869af4da2c032952f0f7368d4620b82/Examples-SlidesCPP-AddNodesSpecificPosition-AddNodesSpecificPosition.cpp) ## **Access a SmartArt Node** The following sample code will help to access nodes inside SmartArt shape. Please note that you cannot change the LayoutType of the SmartArt as it is read only and is set only when the SmartArt shape is added. - Create an instance of `Presentation` class and load the presentation with SmartArt Shape. - Obtain the reference of first slide by using its Index. - Traverse through every shape inside first slide. - Check if shape is of SmartArt type and Typecast selected shape to SmartArt if it is SmartArt. - Traverse through all Nodes inside SmartArt Shape. - Access and display information like SmartArt Node position, level and Text. ```cpp For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C // The path to the documents directory. const String templatePath = u"../templates/SmartArt.pptx"; // Load the desired the presentation SharedPtr pres = MakeObject(templatePath); // Traverse through every shape inside first slide //foreach(IShape shape in pres.Slides[0].Shapes) for (int x = 0; xget_Slides()->idx_get(0)->get_Shapes()->get_Count(); x++) { SharedPtr shape = pres->get_Slides()->idx_get(0)->get_Shapes()->idx_get(x); if (System::ObjectExt::Is(shape)) { System::SharedPtr smart = System::DynamicCast_noexcept(shape); // Traverse through all nodes inside SmartArt for (int i = 0; i < smart->get_AllNodes()->get_Count(); i++) { // Accessing SmartArt node at index i System::SharedPtr node = System::DynamicCast_noexcept(smart->get_AllNodes()->idx_get(i)); // Printing the SmartArt node parameters System::Console::WriteLine(u"j = " + node->get_TextFrame()->get_Text() + u", Text = " + node->get_Level() + u", Position = " + node->get_Position()); } } } ``` [Source: Examples-SlidesCPP-AccessSmartArt-AccessSmartArt.cpp](https://gist.githubusercontent.com/aspose-slides/a690df625dc0b1fff869ab198affe7a4/raw/b53743e683f9e785a913ac4742addd224b498b2c/Examples-SlidesCPP-AccessSmartArt-AccessSmartArt.cpp) ## **Access a SmartArt Child Node** The following sample code will help to access the child nodes belonging to respective nodes of SmartArt shape. - Create an instance of PresentationEx class and load the presentation with SmartArt Shape. - Obtain the reference of first slide by using its Index. - Traverse through every shape inside first slide. - Check if shape is of SmartArt type and Typecast selected shape to SmartArtEx if it is SmartArt. - Traverse through all Nodes inside SmartArt Shape. - For every selected SmartArt shape Node, traverse through all Child Nodes inside particular node. - Access and display information like Child Node position, level and Text. ```cpp For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C // The path to the documents directory. const String templatePath = u"../templates/SmartArt.pptx"; // Load the desired the presentation SharedPtr pres = MakeObject(templatePath); // Traverse through every shape inside first slide for(int x=0;xget_Slides()->idx_get(0)->get_Shapes()->get_Count();x++) { SharedPtr shape = pres->get_Slides()->idx_get(0)->get_Shapes()->idx_get(x); if (System::ObjectExt::Is(shape)) { System::SharedPtr smart = System::DynamicCast_noexcept(shape); // Traverse through all nodes inside SmartArt for (int i = 0; i < smart->get_AllNodes()->get_Count(); i++) { // Accessing SmartArt node at index i System::SharedPtr node0 = System::DynamicCast_noexcept(smart->get_AllNodes()->idx_get(i)); // Traversing through the child nodes in SmartArt node at index i for (int j = 0; j < node0->get_ChildNodes()->get_Count(); j++) { // Accessing the child node in SmartArt node System::SharedPtr node = System::DynamicCast_noexcept(node0->get_ChildNodes()->idx_get(j)); // Printing the SmartArt child node parameters System::Console::WriteLine(u"j = " + node->get_TextFrame()->get_Text()+u", Text = "+ node->get_Level()+u", Position = "+ node->get_Position()); } } } } ``` [Source: Examples-SlidesCPP-AccessChildNodes-AccessChildNodes.cpp](https://gist.githubusercontent.com/aspose-slides/a690df625dc0b1fff869ab198affe7a4/raw/da74681619d0676e505dddcfc3a7312ad1ac8489/Examples-SlidesCPP-AccessChildNodes-AccessChildNodes.cpp) ## **Access a SmartArt Child Node at a Specific Position** In this example, we will learn to access the child nodes at some particular position belonging to respective nodes of SmartArt shape. - Create an instance of `Presentation` class. - Obtain the reference of first slide by using its Index. - Add a StackedList type SmartArt shape. - Access the added SmartArt shape. - Access the node at index 0 for accessed SmartArt shape. - Now, access the Child Node at position 1 for accessed SmartArt node using GetNodeByPosition() method. - Access and display information like Child Node position, level and Text. ```cpp For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C // The path to the documents directory. const String outPath = u"../out/AccessChildNodeSpecificPosition_out.pptx"; // Load the desired the presentation SharedPtr pres = MakeObject(); // Add SmartArt BasicProcess System::SharedPtr smart = pres->get_Slides()->idx_get(0)->get_Shapes()->AddSmartArt(10, 10, 400, 300, SmartArtLayoutType::StackedList); if (smart->get_AllNodes()->get_Count() > 0) { // Accessing SmartArt node at index 0 SharedPtr node0 = smart->get_AllNodes()->idx_get(0); //Accessing child node collection auto nodeCollection =node0->get_ChildNodes(); SharedPtr foundChild; int position = 1; System::SharedPtr node = node0->get_ChildNodes()->idx_get(position); // Printing the SmartArt child node parameters System::Console::WriteLine(u"j = " + node->get_TextFrame()->get_Text() + u", Text = " + node->get_Level() + u", Position = " + node->get_Position()); } ``` [Source: Examples-SlidesCPP-AccessChildNodeSpecificPosition-AccessChildNodeSpecificPosition.cpp](https://gist.githubusercontent.com/aspose-slides/a690df625dc0b1fff869ab198affe7a4/raw/7cdb4944bdfd5f663b282199e9fef8a70804b97b/Examples-SlidesCPP-AccessChildNodeSpecificPosition-AccessChildNodeSpecificPosition.cpp) ## **Remove a SmartArt Node** In this example, we will learn to remove the nodes inside SmartArt shape. - Create an instance of `Presentation` class and load the presentation with SmartArt Shape. - Obtain the reference of first slide by using its Index. - Traverse through every shape inside first slide. - Check if shape is of SmartArt type and Typecast selected shape to SmartArt if it is SmartArt. - Check if the SmartArt has more than 0 nodes. - Select the SmartArt node to be deleted. - Now, remove the selected node using RemoveNode() method* Save the Presentation. ```cpp For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C // The path to the documents directory. const String templatePath = u"../templates/SmartArt.pptx"; const String outPath = u"../out/RemoveNode_out.pptx"; // Load the desired the presentation SharedPtr pres = MakeObject(templatePath); // Traverse through every shape inside first slide for (int x = 0; x < pres->get_Slides()->idx_get(0)->get_Shapes()->get_Count(); x++) { SharedPtr shape = pres->get_Slides()->idx_get(0)->get_Shapes()->idx_get(x); if (System::ObjectExt::Is(shape)) { System::SharedPtr smart = System::DynamicCast_noexcept(shape); if (smart->get_AllNodes()->get_Count() > 0) { // Accessing SmartArt node at index 0 System::SharedPtr node0 = System::DynamicCast_noexcept(smart->get_AllNodes()->idx_get(0)); // Removing the selected node smart->get_AllNodes()->RemoveNode(node0); } } } // Save Presentation pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx); ``` [Source: Examples-SlidesCPP-RemoveNode-RemoveNode.cpp](https://gist.githubusercontent.com/aspose-slides/a690df625dc0b1fff869ab198affe7a4/raw/f61b3077f4c7eb595445895ed8bd18bd35e58a47/Examples-SlidesCPP-RemoveNode-RemoveNode.cpp) ## **Remove a SmartArt Node at a Specific Position** In this example, we will learn to remove the nodes inside SmartArt shape at particular position. - Create an instance of `Presentation` class and load the presentation with SmartArt Shape. - Obtain the reference of first slide by using its Index. - Traverse through every shape inside first slide. - Check if shape is of SmartArt type and Typecast selected shape to SmartArt if it is SmartArt. - Select the SmartArt shape node at index 0. - Now, check if the selected SmartArt node has more than 2 child nodes. - Now, remove the node at Position 1 using RemoveNodeByPosition() method. - Save the Presentation. ```cpp For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C // The path to the documents directory. const String templatePath = u"../templates/SmartArt.pptx"; const String outPath = u"../out/RemoveSmartArtNodeByPosition_out.pptx"; // Load the desired the presentation SharedPtr pres = MakeObject(templatePath); // Traverse through every shape inside first slide for (int x = 0; x < pres->get_Slides()->idx_get(0)->get_Shapes()->get_Count(); x++) { SharedPtr shape = pres->get_Slides()->idx_get(0)->get_Shapes()->idx_get(x); if (System::ObjectExt::Is(shape)) { System::SharedPtr smart = System::DynamicCast_noexcept(shape); if (smart->get_AllNodes()->get_Count() > 0) { // Accessing SmartArt node at index 0 System::SharedPtr node0 = System::DynamicCast_noexcept(smart->get_AllNodes()->idx_get(0)); if (node0->get_ChildNodes()->get_Count() >= 2) { // Removing the child node at position 1 node0->get_ChildNodes()->RemoveNode(1); } } } } // Save Presentation pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx); ``` [Source: Examples-SlidesCPP-RemoveNodeSpecificPosition-RemoveNodeSpecificPosition.cpp](https://gist.githubusercontent.com/aspose-slides/a690df625dc0b1fff869ab198affe7a4/raw/014e3b0aabba2d3c38c4df378792f5efc2d8108b/Examples-SlidesCPP-RemoveNodeSpecificPosition-RemoveNodeSpecificPosition.cpp) ## **Set a Custom Position for a SmartArt Child Node** Now Aspose.Slides support for setting SmartArtShape X and Y properties. The code snippet below shows how to set custom SmartArtShape position, size and rotation also please note that adding new nodes causes a recalculation of the positions and sizes of all nodes. ```cpp For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C // Load the desired the presentation SharedPtr pres = MakeObject(); System::SharedPtr smart = pres->get_Slides()->idx_get(0)->get_Shapes()->AddSmartArt(20, 20, 600, 500, Aspose::Slides::SmartArt::SmartArtLayoutType::OrganizationChart); // Move SmartArt shape to new position System::SharedPtr node = smart->get_AllNodes()->idx_get(1); System::SharedPtr shape = node->get_Shapes()->idx_get(1); shape->set_X((float)(shape->get_X() + (shape->get_Width() * 2))); shape->set_Y((float)(shape->get_Y() - (shape->get_Height() / 2))); // Change SmartArt shape's widths node = smart->get_AllNodes()->idx_get(2); shape = node->get_Shapes()->idx_get(1); shape->set_Width(shape->get_Width() + (shape->get_Width() / 2)); // Change SmartArt shape's height node = smart->get_AllNodes()->idx_get(3); shape = node->get_Shapes()->idx_get(1); shape->set_Height(shape->get_Height() + (shape->get_Height() / 2)); // Change SmartArt shape's rotation node = smart->get_AllNodes()->idx_get(4); shape = node->get_Shapes()->idx_get(1); shape->set_Rotation(90); // Save Presentation pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx); ``` [Source: Examples-SlidesCPP-CustomChildNodesInSmartArt-CustomChildNodesInSmartArt.cpp](https://gist.githubusercontent.com/aspose-slides/a690df625dc0b1fff869ab198affe7a4/raw/2bb97037d8145c12a801c2baa44ab85f14bea168/Examples-SlidesCPP-CustomChildNodesInSmartArt-CustomChildNodesInSmartArt.cpp) ## **Check an Assistant Node** In the following sample code we will investigate how to identify Assistant Nodes in the SmartArt nodes collection and changing them. - Create an instance of PresentationEx class and load the presentation with SmartArt Shape. - Obtain the reference of second slide by using its Index. - Traverse through every shape inside first slide. - Check if shape is of SmartArt type and Typecast selected shape to SmartArtEx if it is SmartArt. - Traverse through all nodes inside SmartArt shape and check if they are Assistant Nodes. - Change the status of Assistant Node to normal node. - Save the Presentation. ```cpp For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C // The path to the documents directory. const String templatePath = u"../templates/AssistantNode.pptx"; const String outPath = u"../out/ChangeAssitantNode_out.pptx"; // Load the desired the presentation SharedPtr pres = MakeObject(templatePath); // Traverse through every shape inside first slide for (int x = 0; x < pres->get_Slides()->idx_get(0)->get_Shapes()->get_Count(); x++) { SharedPtr shape = pres->get_Slides()->idx_get(0)->get_Shapes()->idx_get(x); if (System::ObjectExt::Is(shape)) { System::SharedPtr smart = System::DynamicCast_noexcept(shape); for (int i = 0; i < smart->get_AllNodes()->get_Count(); i++) { // Accessing SmartArt node at index i System::SharedPtr node = smart->get_AllNodes()->idx_get(i); if (node->get_IsAssistant()) { // Setting Assitant node to false and making it normal node node->set_IsAssistant(false); } } } } // Save Presentation pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx); ``` [Source: Examples-SlidesCPP-AssistantNode-AssistantNode.cpp](https://gist.githubusercontent.com/aspose-slides/a690df625dc0b1fff869ab198affe7a4/raw/cc85c3ca0fd04427cfa71235aefe5812a1eb4248/Examples-SlidesCPP-AssistantNode-AssistantNode.cpp) ## **Set a Node's Fill Format** Aspose.Slides for C++ makes it possible to add custom SmartArt shapes and set their fill formats. This article explains how to create and access SmartArt shapes and set their fill format using Aspose.Slides for C++. Please follow the steps below: - Create an instance of the `Presentation` class. - Obtain the reference of a slide using its index. - Add a SmartArt shape by setting its LayoutType. - Set the FillFormat for the SmartArt shape nodes. - Write the modified presentation as a PPTX file. ```cpp For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C // The path to the documents directory. const String outPath = u"../out/FillFormat_SmartArt_ShapeNode_out.pptx"; // Load the desired the presentation SharedPtr pres = MakeObject(); // Add SmartArt BasicProcess System::SharedPtr smart = pres->get_Slides()->idx_get(0)->get_Shapes()->AddSmartArt(10, 10, 400, 300, SmartArtLayoutType::ClosedChevronProcess); // Adding SmartArt node System::SharedPtr NewNode = smart->get_AllNodes()->AddNode(); //Adding text to added node NewNode->get_TextFrame()->set_Text( u"Some text"); // Save Presentation pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx); ``` [Source: Examples-SlidesCPP-FillFormatSmartArtShapeNode-FillFormatSmartArtShapeNode.cpp](https://gist.githubusercontent.com/aspose-slides/a690df625dc0b1fff869ab198affe7a4/raw/b9294a39681a239dcd5fcaf5a51b13bc8cedb07f/Examples-SlidesCPP-FillFormatSmartArtShapeNode-FillFormatSmartArtShapeNode.cpp) ## **Generate a Thumbnail of a SmartArt Child Node** Developers can generate a thumbnail of Child node of a SmartArt by following the steps below: 1. Instantiate `Presentation` class that represents the PPTX file. 1. Add SmartArt. 1. Obtain the reference of a node by using its Index 1. Get the thumbnail image. 1. Save the thumbnail image in any desired image format. The example below generating a thumbnail of SmartArt child node ```cpp #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::SmartArt; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto smartArt = slide->get_Shapes()->AddSmartArt(10, 10, 400, 300, SmartArtLayoutType::BasicCycle); auto node = smartArt->get_Node(1); auto image = node->get_Shape(0)->GetImage(); image->Save(u"SmartArt_ChildNote_Thumbnail_out.jpeg", ImageFormat::Png); image->Dispose(); presentation->Dispose(); ``` ## **FAQ** ### Is SmartArt animation supported? Yes. SmartArt is treated as a regular shape, so you can [apply standard animations](https://docs.aspose.com/slides/cpp/shape-animation/) (entrance, exit, emphasis, motion paths) and adjust timing. You can also animate shapes inside SmartArt nodes when needed. ### How can I reliably locate a specific SmartArt on a slide if its internal ID is unknown? Assign and search by [alternative text](https://reference.aspose.com/slides/cpp/aspose.slides/shape/set_alternativetext/). Setting a distinctive AltText on the SmartArt lets you find it programmatically without relying on internal identifiers. ### Will the SmartArt appearance be preserved when converting the presentation to PDF? Yes. Aspose.Slides renders SmartArt with high visual fidelity during [PDF export](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-pdf/), preserving layout, colors, and effects. ### Can I extract an image of the entire SmartArt (for previews or reports)? Yes. You can render a SmartArt shape to [raster formats](https://reference.aspose.com/slides/cpp/aspose.slides/shape/getimage/) or to [SVG](https://reference.aspose.com/slides/cpp/aspose.slides/shape/writeassvg/) for scalable vector output, making it suitable for thumbnails, reports, or web use. ## Related articles - [Manage SmartArt Graphics in Presentations Using C++](https://docs.aspose.com/slides/cpp/manage-smartart-shape/) - [Create and Customize PowerPoint SmartArt in C++](https://docs.aspose.com/slides/cpp/powerpoint-smartart/) - [Manage SmartArt in PowerPoint Presentations Using C++](https://docs.aspose.com/slides/cpp/manage-smartart/) # Manage SmartArt Graphics in Presentations Using C++ > Automate PowerPoint SmartArt creation, editing, and styling in C++ using Aspose.Slides, featuring concise code examples and performance-focused guidance. Source: https://docs.aspose.com/slides/cpp/manage-smartart-shape/ Updated: 2026-08-02 ## **Overview** Aspose.Slides allows you to create and manage SmartArt graphics in PowerPoint presentations programmatically. This article explains how to add a SmartArt shape to a slide, access existing SmartArt shapes, find SmartArt by a specific layout type, and update its visual appearance by changing the SmartArt style or color style. The examples show how to work with SmartArt shapes through the presentation slide’s shape collection, check whether a shape is SmartArt and then modify or inspect its properties. ## **Create a SmartArt Shape** Aspose.Slides for C++ now facilitates to add custom SmartArt shapes in their slides from scratch. Aspose.Slides for C++ has provided the simplest API to create SmartArt shapes in an easiest way. To create a SmartArt shape in a slide, please follow the steps below: - Create an instance of [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) class. - Obtain the reference of a slide by using its Index. - Add a SmartArt shape by setting it LayoutType. - Write the modified presentation as a PPTX file. ```cpp For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C // The path to the documents directory. const String outPath = u"../out/SimpleSmartArt_out.pptx"; // Load the desired the presentation SharedPtr pres = MakeObject(); // Add SmartArt BasicProcess System::SharedPtr smart = pres->get_Slides()->idx_get(0)->get_Shapes()->AddSmartArt(10, 10, 400, 300, SmartArtLayoutType::BasicBlockList); // Save Presentation pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx); ``` [Source: Examples-SlidesCPP-CreateSmartArtShape-CreateSmartArtShape.cpp](https://gist.githubusercontent.com/aspose-slides/a690df625dc0b1fff869ab198affe7a4/raw/1112f4ed6bfe64ef1f98ef984229334b45632df3/Examples-SlidesCPP-CreateSmartArtShape-CreateSmartArtShape.cpp) ## **Access a SmartArt Shape on a Slide** The following code will be used to access the SmartArt shapes added in presentation slide. In sample code we will traverse through every shape inside the slide and check if it is a SmartArt shape. If shape is of SmartArt type then we will typecast that to SmartArt instance. ```cpp For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C // The path to the documents directory. const String templatePath = u"../templates/SmartArt.pptx"; // Load the desired the presentation SharedPtr pres = MakeObject(templatePath); // Traverse through every shape inside first slide for (int x = 0; x < pres->get_Slides()->idx_get(0)->get_Shapes()->get_Count(); x++) { SharedPtr shape = pres->get_Slides()->idx_get(0)->get_Shapes()->idx_get(x); if (System::ObjectExt::Is(shape)) { System::SharedPtr smart = System::DynamicCast_noexcept(shape); System::Console::WriteLine(u"Smart Art Name = " + smart->get_Name()); } } ``` [Source: Examples-SlidesCPP-AccessSmartArtShape-AccessSmartArtShape.cpp](https://gist.githubusercontent.com/aspose-slides/a690df625dc0b1fff869ab198affe7a4/raw/d0429e6ef3c0c6b09f13d26fb2d10f179d8db887/Examples-SlidesCPP-AccessSmartArtShape-AccessSmartArtShape.cpp) ## **Access a SmartArt Shape with a Particular Layout Type** The following sample code will help to access the SmartArt shape with particular LayoutType. Please note that you cannot change the LayoutType of the SmartArt as it is read only and is set only when the SmartArt shape is added. - Create an instance of `Presentation` class and load the presentation with SmartArt Shape. - Obtain the reference of first slide by using its Index. - Traverse through every shape inside first slide. - Check if shape is of SmartArt type and Typecast selected shape to SmartArt if it is SmartArt. - Check the SmartArt shape with particular LayoutType and perform what is required to be done afterwards. ```cpp For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C // The path to the documents directory. const String templatePath = u"../templates/SmartArt.pptx"; // Load the desired the presentation SharedPtr pres = MakeObject(templatePath); // Traverse through every shape inside first slide for (int x = 0; x < pres->get_Slides()->idx_get(0)->get_Shapes()->get_Count(); x++) { SharedPtr shape = pres->get_Slides()->idx_get(0)->get_Shapes()->idx_get(x); if (System::ObjectExt::Is(shape)) { System::SharedPtr smart = System::DynamicCast_noexcept(shape); System::Console::WriteLine(u"Smart Art Name = " + smart->get_Name()); // Checking SmartArt Layout if (smart->get_Layout() == SmartArtLayoutType::BasicBlockList) { System::Console::WriteLine(u"Do some thing here...."); } } } ``` [Source: Examples-SlidesCPP-AccessSmartArtParticularLayout-AccessSmartArtParticularLayout.cpp](https://gist.githubusercontent.com/aspose-slides/a690df625dc0b1fff869ab198affe7a4/raw/d9a627a389fcd7c28088dfc2ec9396f3a287410a/Examples-SlidesCPP-AccessSmartArtParticularLayout-AccessSmartArtParticularLayout.cpp) ## **Change a SmartArt Shape Style** The following sample code will help to access the SmartArt shape with particular LayoutType. - Create an instance of `Presentation` class and load the presentation with SmartArt Shape. - Obtain the reference of first slide by using its Index. - Traverse through every shape inside first slide. - Check if shape is of SmartArt type and Typecast selected shape to SmartArt if it is SmartArt. - Find the SmartArt shape with particular Style. - Set the new Style for the SmartArt shape. - Save the Presentation. ```cpp For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C // The path to the documents directory. const String templatePath = u"../templates/SmartArt.pptx"; const String outPath = u"../out/ChangeSmartArtStyle_out.pptx"; // Load the desired the presentation SharedPtr pres = MakeObject(templatePath); // Traverse through every shape inside first slide for (int x = 0; x < pres->get_Slides()->idx_get(0)->get_Shapes()->get_Count(); x++) { SharedPtr shape = pres->get_Slides()->idx_get(0)->get_Shapes()->idx_get(x); if (System::ObjectExt::Is(shape)) { System::SharedPtr smart = System::DynamicCast_noexcept(shape); // Checking SmartArt style if (smart->get_QuickStyle() == SmartArtQuickStyleType::SimpleFill) { // Changing SmartArt Style smart->set_QuickStyle(SmartArtQuickStyleType::Cartoon); } } } // Save Presentation pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx); ``` [Source: Examples-SlidesCPP-ChangSmartArtShapeStyle-ChangSmartArtShapeStyle.cpp](https://gist.githubusercontent.com/aspose-slides/a690df625dc0b1fff869ab198affe7a4/raw/110bd2dcec6a9157c46ca06196832230d6b6de1d/Examples-SlidesCPP-ChangSmartArtShapeStyle-ChangSmartArtShapeStyle.cpp) ## **Change a SmartArt Shape Color Style** In this example, we will learn to change the color style for any SmartArt shape. In the following sample code will access the SmartArt shape with particular color style and will change its style. - Create an instance of `Presentation` class and load the presentation with SmartArt Shape. - Obtain the reference of first slide by using its Index. - Traverse through every shape inside first slide. - Check if shape is of SmartArt type and Typecast selected shape to SmartArt if it is SmartArt. - Find the SmartArt shape with particular Color Style. - Set the new Color Style for the SmartArt shape. - Save the Presentation. ```cpp For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C // The path to the documents directory. const String templatePath = u"../templates/SmartArt.pptx"; const String outPath = u"../out/ChangeSmartArtShapeColorStyle.pptx"; // Load the desired the presentation SharedPtr pres = MakeObject(templatePath); // Traverse through every shape inside first slide for (int x = 0; x < pres->get_Slides()->idx_get(0)->get_Shapes()->get_Count(); x++) { SharedPtr shape = pres->get_Slides()->idx_get(0)->get_Shapes()->idx_get(x); if (System::ObjectExt::Is(shape)) { System::SharedPtr smart = System::DynamicCast_noexcept(shape); if (smart->get_ColorStyle() == SmartArtColorType::ColoredFillAccent1) { // Changing SmartArt color type smart->set_ColorStyle(SmartArtColorType::ColorfulAccentColors); } } } // Save Presentation pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx); ``` [Source: Examples-SlidesCPP-ChangeSmartArtShapeColorStyle-ChangeSmartArtShapeColorStyle.cpp](https://gist.githubusercontent.com/aspose-slides/a690df625dc0b1fff869ab198affe7a4/raw/2cc15a94a70b49b7661ac331856fa19fffc21f84/Examples-SlidesCPP-ChangeSmartArtShapeColorStyle-ChangeSmartArtShapeColorStyle.cpp) ## **FAQ** ### Can I animate SmartArt as a single object? Yes. SmartArt is a shape, so you can apply [standard animations](https://docs.aspose.com/slides/cpp/powerpoint-animation/) via the animations API (entrance, exit, emphasis, motion paths) just like for other shapes. ### How can I find a specific SmartArt on a slide if I don’t know its internal ID? Set and use the Alternative Text (AltText) and search for the shape by that value—this is a recommended way to locate the target shape. ### Can I group SmartArt with other shapes? Yes. You can group SmartArt with other shapes (pictures, tables, etc.) and then [manipulate the group](https://docs.aspose.com/slides/cpp/group/). ### How do I get an image of a specific SmartArt (e.g., for a preview or report)? Export a thumbnail/image of the shape; the library can [render individual shapes](https://docs.aspose.com/slides/cpp/create-shape-thumbnails/) to raster files (PNG/JPG/TIFF). ### Will the SmartArt appearance be preserved when converting the whole presentation to PDF? Yes. The rendering engine targets high fidelity for [PDF export](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-pdf/), with a range of quality and compatibility options. ## Related articles - [Manage SmartArt Shape Nodes in Presentations Using C++](https://docs.aspose.com/slides/cpp/manage-smartart-shape-node/) - [SmartArt](https://docs.aspose.com/slides/cpp/examples/elements/smart-art/) # Manage SmartArt in PowerPoint Presentations Using C++ > Learn to build and edit PowerPoint SmartArt with Aspose.Slides for C++ using clear code samples that speed up slide design and automation. Source: https://docs.aspose.com/slides/cpp/manage-smartart/ Updated: 2026-11-08 ## **Overview** SmartArt is a PowerPoint diagram made from nodes, node shapes, and a layout. With Aspose.Slides for C++, you can create SmartArt, read text from its nodes, change its layout, inspect hidden nodes, configure organization chart layouts, and create picture organization charts. ## **Get Text from a SmartArt Object** A SmartArt node can contain one or more shapes. To read text from the node shapes, iterate through [ISmartArt::get_AllNodes](https://reference.aspose.com/slides/cpp/aspose.slides.smartart/ismartart/get_allnodes/), then read the [ITextFrame](https://reference.aspose.com/slides/cpp/aspose.slides/itextframe/) returned by [ISmartArtShape::get_TextFrame](https://reference.aspose.com/slides/cpp/aspose.slides.smartart/ismartartshape/get_textframe/). The example requires a presentation with at least one slide and a SmartArt object as the first shape on that slide. It prints each available text frame to the console. ```cpp #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::SmartArt; using namespace System; auto presentation = MakeObject(u"sample.pptx"); auto slide = presentation->get_Slide(0); auto smartArt = ExplicitCast(slide->get_Shape(0)); for (auto nodeIndex = 0; nodeIndex < smartArt->get_AllNodes()->get_Count(); nodeIndex++) { auto node = smartArt->get_AllNodes()->idx_get(nodeIndex); for (auto shapeIndex = 0; shapeIndex < node->get_Shapes()->get_Count(); shapeIndex++) { auto nodeShape = node->get_Shape(shapeIndex); if (nodeShape->get_TextFrame() != nullptr) { Console::WriteLine(nodeShape->get_TextFrame()->get_Text()); } } } presentation->Dispose(); ``` ## **Change the Layout Type of a SmartArt Object** The SmartArt layout controls how nodes are arranged and connected. The following example creates a SmartArt object with the [SmartArtLayoutType](https://reference.aspose.com/slides/cpp/aspose.slides.smartart/smartartlayouttype/) `BasicBlockList` value, changes it to the `BasicProcess` value, and saves the presentation. The position and size passed to [IShapeCollection::AddSmartArt](https://reference.aspose.com/slides/cpp/aspose.slides/ishapecollection/addsmartart/) are measured in points. Use [ISmartArt::set_Layout](https://reference.aspose.com/slides/cpp/aspose.slides.smartart/ismartart/set_layout/) to change the layout. ```cpp #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace Aspose::Slides::SmartArt; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto smartArt = slide->get_Shapes()->AddSmartArt(10.0f, 10.0f, 400.0f, 300.0f, SmartArtLayoutType::BasicBlockList); smartArt->set_Layout(SmartArtLayoutType::BasicProcess); presentation->Save(u"ChangeSmartArtLayout.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ## **Check Whether a SmartArt Node Is Hidden** [ISmartArtNode::get_IsHidden](https://reference.aspose.com/slides/cpp/aspose.slides.smartart/ismartartnode/get_ishidden/) indicates whether the node is hidden in the SmartArt data model. Hidden nodes can exist in the structure even when the selected layout does not display them as visible diagram elements. The following example adds a node to a SmartArt object that uses the [SmartArtLayoutType](https://reference.aspose.com/slides/cpp/aspose.slides.smartart/smartartlayouttype/) `RadialCycle` value and checks the added node's hidden state. It prints a message if the node is hidden and saves the diagram. ```cpp #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace Aspose::Slides::SmartArt; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto smartArt = slide->get_Shapes()->AddSmartArt(10.0f, 10.0f, 400.0f, 300.0f, SmartArtLayoutType::RadialCycle); auto node = smartArt->get_AllNodes()->AddNode(); auto isHidden = node->get_IsHidden(); if (isHidden) { Console::WriteLine(u"The node is hidden in the SmartArt data model."); } presentation->Save(u"CheckSmartArtHiddenProperty.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ## **Get or Set the Organization Chart Layout** For SmartArt diagrams that use an organization chart layout, [ISmartArtNode::get_OrganizationChartLayout](https://reference.aspose.com/slides/cpp/aspose.slides.smartart/ismartartnode/get_organizationchartlayout/) and [ISmartArtNode::set_OrganizationChartLayout](https://reference.aspose.com/slides/cpp/aspose.slides.smartart/ismartartnode/set_organizationchartlayout/) define how child nodes are arranged under a parent node. For example, you can set child nodes to hang from the left, right, or both sides, depending on the selected [OrganizationChartLayoutType](https://reference.aspose.com/slides/cpp/aspose.slides.smartart/organizationchartlayouttype/). The following example creates an organization chart and sets the layout for the first node to the [OrganizationChartLayoutType](https://reference.aspose.com/slides/cpp/aspose.slides.smartart/organizationchartlayouttype/) `LeftHanging` value. The zero-based index `0` selects the first top-level node; its child nodes use the selected arrangement. The modified presentation is then saved. ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace Aspose::Slides::SmartArt; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto smartArt = slide->get_Shapes()->AddSmartArt(10.0f, 10.0f, 400.0f, 300.0f, SmartArtLayoutType::OrganizationChart); auto rootNode = smartArt->get_Node(0); rootNode->set_OrganizationChartLayout(OrganizationChartLayoutType::LeftHanging); presentation->Save(u"OrganizationChartLayout.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` [![The same labelled organization-chart nodes change from the default arrangement to left-hanging children under parent A.](https://docs.aspose.com/slides/cpp/manage-smartart/visual-smartart-layouts-3487c8138eeb.svg)](https://docs.aspose.com/slides/cpp/manage-smartart/visual-smartart-layouts-3487c8138eeb.svg) *Illustrative .NET 26.11 fixture with labels added for identification. LeftHanging changes the child arrangement of the selected top-level parent; it is distinct from changing the whole SmartArt layout type.* ## **Create a Picture Organization Chart** A picture organization chart is a SmartArt layout designed for hierarchy diagrams that include image placeholders. Use the [SmartArtLayoutType](https://reference.aspose.com/slides/cpp/aspose.slides.smartart/smartartlayouttype/) `PictureOrganizationChart` value when adding the SmartArt object to a slide. This example saves a diagram with image placeholders; it does not populate the placeholders with images. ```cpp #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace Aspose::Slides::SmartArt; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto smartArt = slide->get_Shapes()->AddSmartArt(0.0f, 0.0f, 400.0f, 400.0f, SmartArtLayoutType::PictureOrganizationChart); presentation->Save(u"PictureOrganizationChart.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ## **Convert Legacy Diagrams to Groups of Shapes** When modernizing an existing presentation, you may need to update an organization chart originally created in PowerPoint 97–2003. Aspose.Slides represents these legacy diagrams as [ILegacyDiagram](https://reference.aspose.com/slides/cpp/aspose.slides/ilegacydiagram/) objects. Use [ILegacyDiagram::ConvertToGroupShape](https://reference.aspose.com/slides/cpp/aspose.slides/ilegacydiagram/converttogroupshape/) to convert a diagram into a group of shapes so that you can edit individual visual elements. See the [LegacyDiagram API Reference](https://reference.aspose.com/slides/cpp/aspose.slides/legacydiagram/) for details. Conversion adds a new group to the shape collection without removing the original diagram. After successful conversion, remove the original with [IShapeCollection::Remove](https://reference.aspose.com/slides/cpp/aspose.slides/ishapecollection/remove/) to avoid duplicate content. Collect the legacy diagrams into a vector before converting them so that adding and removing shapes does not disrupt iteration. The following example opens a presentation, searches every slide, converts the diagrams to groups of shapes, and saves the updated presentation as PPTX. ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(u"legacy-diagrams.ppt"); for (auto slideIndex = 0; slideIndex < presentation->get_Slides()->get_Count(); slideIndex++) { auto slide = presentation->get_Slide(slideIndex); std::vector> legacyDiagrams; for (auto shapeIndex = 0; shapeIndex < slide->get_Shapes()->get_Count(); shapeIndex++) { auto shape = slide->get_Shape(shapeIndex); if (ObjectExt::Is(shape)) { auto legacyDiagram = ExplicitCast(shape); legacyDiagrams.push_back(legacyDiagram); } } for (auto legacyDiagram : legacyDiagrams) { auto groupShape = legacyDiagram->ConvertToGroupShape(); if (groupShape != nullptr) { slide->get_Shapes()->Remove(legacyDiagram); } } } presentation->Save(u"modernized.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` The saved presentation contains editable groups of shapes in place of the converted legacy diagrams, with no original diagrams left alongside them. Open the PPTX in PowerPoint to edit individual elements within each group, such as their text, fill, or position. ## **FAQ** **Does SmartArt support mirroring or reversing for RTL languages?** Yes. The [SmartArt::set_IsReversed](https://reference.aspose.com/slides/cpp/aspose.slides.smartart/smartart/set_isreversed/) method switches the diagram direction from left-to-right to right-to-left, or back, when the selected SmartArt layout supports reversal. **How can I copy SmartArt to the same slide or to another presentation while preserving formatting?** You can [clone the SmartArt shape](https://docs.aspose.com/slides/cpp/shape-manipulations/) with [ShapeCollection::AddClone](https://reference.aspose.com/slides/cpp/aspose.slides/shapecollection/addclone/) or [clone the whole slide](https://docs.aspose.com/slides/cpp/clone-slides/) that contains the SmartArt. Both approaches preserve size, position, and formatting. **How do I render SmartArt to a raster image for preview or web export?** [Render the slide](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-png/) or the whole presentation to PNG or JPEG. SmartArt is rendered as part of the slide. **How can I find a specific SmartArt object on a slide if there are several?** Set a distinctive [Shape::set_AlternativeText](https://reference.aspose.com/slides/cpp/aspose.slides/shape/set_alternativetext/) or [Shape::set_Name](https://reference.aspose.com/slides/cpp/aspose.slides/shape/set_name/) value on the SmartArt shape, search for that value in [BaseSlide::get_Shapes](https://reference.aspose.com/slides/cpp/aspose.slides/baseslide/get_shapes/), and then check that the matching shape is an [ISmartArt](https://reference.aspose.com/slides/cpp/aspose.slides.smartart/ismartart/). ## Related articles - [Create and Customize PowerPoint SmartArt in C++](https://docs.aspose.com/slides/cpp/powerpoint-smartart/) - [Manage SmartArt Shape Nodes in Presentations Using C++](https://docs.aspose.com/slides/cpp/manage-smartart-shape-node/) - [SmartArt](https://docs.aspose.com/slides/cpp/examples/elements/smart-art/) # Manage Presentation Tables in C++ > Create & edit tables in PowerPoint slides with Aspose.Slides for C++. Discover simple code examples to streamline your table workflows. Source: https://docs.aspose.com/slides/cpp/manage-table/ Updated: 2026-10-26 ## **Introduction** Tables in PowerPoint organize information into rows and columns, making it easier to read and compare values. Aspose.Slides provides the [Table](https://reference.aspose.com/slides/cpp/aspose.slides/table/) class, [ITable](https://reference.aspose.com/slides/cpp/aspose.slides/itable/) interface, [Cell](https://reference.aspose.com/slides/cpp/aspose.slides/cell/) class, [ICell](https://reference.aspose.com/slides/cpp/aspose.slides/icell/) interface, and other types to allow you to create, update, and manage tables in presentations. ## **Create a Table from Scratch** Create a table by specifying its position, column widths, and row heights. After adding it to a slide, you can format cell borders, merge cells, and insert text. 1. Create an instance of the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) class. 2. Get a reference to the slide by its index. 3. Define an array of column widths in points. 4. Define an array of row heights in points. 5. Add an [ITable](https://reference.aspose.com/slides/cpp/aspose.slides/itable/) object to the slide through the [AddTable](https://reference.aspose.com/slides/cpp/aspose.slides/ishapecollection/addtable/) method. 6. Iterate through each [ICell](https://reference.aspose.com/slides/cpp/aspose.slides/icell/) to apply formatting to the top, bottom, right, and left borders. 7. Merge the first two cells of the table's first row. 8. Access the merged cell through its [get_TextFrame](https://reference.aspose.com/slides/cpp/aspose.slides/icell/get_textframe/) method. 9. Set the text in the merged cell. 10. Save the modified presentation. The example below creates a table with three columns and five rows at (100, 50) points. It applies red borders with a width of 5 points, merges the first two cells in the first row, and saves the result as `table.pptx`. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System::Drawing; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto columnWidths = System::MakeArray({ 50, 50, 50 }); auto rowHeights = System::MakeArray({ 50, 30, 30, 30, 30 }); auto table = slide->get_Shapes()->AddTable(100.0f, 50.0f, columnWidths, rowHeights); for (const auto& row : table->get_Rows()) { for (const auto& cell : row) { auto cellFormat = cell->get_CellFormat(); cellFormat->get_BorderTop()->get_FillFormat()->set_FillType(FillType::Solid); cellFormat->get_BorderTop()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Red()); cellFormat->get_BorderTop()->set_Width(5); cellFormat->get_BorderBottom()->get_FillFormat()->set_FillType(FillType::Solid); cellFormat->get_BorderBottom()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Red()); cellFormat->get_BorderBottom()->set_Width(5); cellFormat->get_BorderLeft()->get_FillFormat()->set_FillType(FillType::Solid); cellFormat->get_BorderLeft()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Red()); cellFormat->get_BorderLeft()->set_Width(5); cellFormat->get_BorderRight()->get_FillFormat()->set_FillType(FillType::Solid); cellFormat->get_BorderRight()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Red()); cellFormat->get_BorderRight()->set_Width(5); } } table->MergeCells(table->idx_get(0, 0), table->idx_get(1, 0), false); table->idx_get(0, 0)->get_TextFrame()->set_Text(u"Merged Cells"); presentation->Save(u"table.pptx", SaveFormat::Pptx); ``` ## **Numbering in a Standard Table** In a standard table, cell indices are zero-based and use the order (column, row). The first cell is indexed as (0, 0). For example, the cells in a table with 4 columns and 4 rows are numbered this way: | (0, 0) | (1, 0) | (2, 0) | (3, 0) | | :----- | :----- | :----- | :----- | | (0, 1) | (1, 1) | (2, 1) | (3, 1) | | (0, 2) | (1, 2) | (2, 2) | (3, 2) | | (0, 3) | (1, 3) | (2, 3) | (3, 3) | This example creates the 4 × 4 table illustrated above, with column widths and row heights of 70 points and red cell borders with a width of 5 points. The coordinates illustrate cell indices; the example leaves the cells empty and saves the table as `StandardTables_out.pptx`. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System::Drawing; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto columnWidths = System::MakeArray({ 70, 70, 70, 70 }); auto rowHeights = System::MakeArray({ 70, 70, 70, 70 }); auto table = slide->get_Shapes()->AddTable(100.0f, 50.0f, columnWidths, rowHeights); for (const auto& row : table->get_Rows()) { for (const auto& cell : row) { auto cellFormat = cell->get_CellFormat(); cellFormat->get_BorderTop()->get_FillFormat()->set_FillType(FillType::Solid); cellFormat->get_BorderTop()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Red()); cellFormat->get_BorderTop()->set_Width(5); cellFormat->get_BorderBottom()->get_FillFormat()->set_FillType(FillType::Solid); cellFormat->get_BorderBottom()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Red()); cellFormat->get_BorderBottom()->set_Width(5); cellFormat->get_BorderLeft()->get_FillFormat()->set_FillType(FillType::Solid); cellFormat->get_BorderLeft()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Red()); cellFormat->get_BorderLeft()->set_Width(5); cellFormat->get_BorderRight()->get_FillFormat()->set_FillType(FillType::Solid); cellFormat->get_BorderRight()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Red()); cellFormat->get_BorderRight()->set_Width(5); } } presentation->Save(u"StandardTables_out.pptx", SaveFormat::Pptx); ``` ## **Access an Existing Table** Tables are stored in a slide's shape collection. Iterate through the shapes to locate a table, then use the [ITable](https://reference.aspose.com/slides/cpp/aspose.slides/itable/) interface to read or update its cells. 1. Load the presentation using the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) class. 2. Get a reference to the slide containing the table by its index. 3. Iterate through the [IShape](https://reference.aspose.com/slides/cpp/aspose.slides/ishape/) objects and stop when a table is found. If the slide contains several tables, use [get_AlternativeText](https://reference.aspose.com/slides/cpp/aspose.slides/ishape/get_alternativetext/) to identify the one you need. 4. Update the text in the target cell. 5. Save the modified presentation. The example below opens `UpdateExistingTable.pptx` and finds the first table on the first slide. It sets the cell at column 0, row 1 to `New` and saves the result as `table1_out.pptx`. The input must contain at least one slide, and the first table on that slide must have at least one column and two rows. ```cpp #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(u"UpdateExistingTable.pptx"); auto slide = presentation->get_Slide(0); System::SharedPtr table; for (const auto& shape : System::IterateOver(slide->get_Shapes())) { if (System::ObjectExt::Is(shape)) { table = System::ExplicitCast(shape); break; } } if (table != nullptr) { table->idx_get(0, 1)->get_TextFrame()->set_Text(u"New"); presentation->Save(u"table1_out.pptx", SaveFormat::Pptx); } ``` To resize a row in an existing table and understand why its actual height can exceed the requested minimum, see [Control Row Height](https://docs.aspose.com/slides/cpp/manage-rows-and-columns/#control-row-height). ## **Find the Cell That Owns a Text Frame** When generic text-processing code receives an [ITextFrame](https://reference.aspose.com/slides/cpp/aspose.slides/itextframe/) from a table, use [ITextFrame::get_ParentCell](https://reference.aspose.com/slides/cpp/aspose.slides/itextframe/get_parentcell/) to retrieve the owning [ICell](https://reference.aspose.com/slides/cpp/aspose.slides/icell/). For a table-cell text frame, [ITextFrame::get_ParentCell](https://reference.aspose.com/slides/cpp/aspose.slides/itextframe/get_parentcell/) returns the owner and [ITextFrame::get_ParentShape](https://reference.aspose.com/slides/cpp/aspose.slides/itextframe/get_parentshape/) returns `nullptr`, even though the table itself is a shape. The cell coordinates are available through the read-only [ICell::get_FirstColumnIndex](https://reference.aspose.com/slides/cpp/aspose.slides/icell/get_firstcolumnindex/) and [ICell::get_FirstRowIndex](https://reference.aspose.com/slides/cpp/aspose.slides/icell/get_firstrowindex/) methods. [ITextFrame::get_ParentCell](https://reference.aspose.com/slides/cpp/aspose.slides/itextframe/get_parentcell/) also provides read-only navigation: it returns the owner but does not change ownership. Always check the returned cell for `nullptr` before using it. For a complete example that identifies table-cell and shape owners, including shapes associated with SmartArt nodes, see [Search and Replace Text](https://docs.aspose.com/slides/cpp/search-and-replace-text/). ## **Align Text in a Table** You can control the vertical anchoring and text direction of individual table cells. The example in this section centers text within the first cell and rotates it by 270 degrees. 1. Create an instance of the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) class. 2. Get a reference to the slide by its index. 3. Add an [ITable](https://reference.aspose.com/slides/cpp/aspose.slides/itable/) object to the slide. 4. Access an [ITextFrame](https://reference.aspose.com/slides/cpp/aspose.slides/itextframe/) object from the table. 5. Access the first [IParagraph](https://reference.aspose.com/slides/cpp/aspose.slides/iparagraph/) and set its text and color. 6. Set the cell's vertical anchoring and text direction using [set_TextAnchorType](https://reference.aspose.com/slides/cpp/aspose.slides/icell/set_textanchortype/) and [set_TextVerticalType](https://reference.aspose.com/slides/cpp/aspose.slides/icell/set_textverticaltype/). 7. Save the modified presentation. This example creates a 4 × 4 table with column widths of 120 points and row heights of 100 points. It formats the text in cell (0, 0), adds values to the remaining cells in the first row, and saves the result as `Vertical_Align_Text_out.pptx`. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System::Drawing; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto columnWidths = System::MakeArray({ 120, 120, 120, 120 }); auto rowHeights = System::MakeArray({ 100, 100, 100, 100 }); auto table = slide->get_Shapes()->AddTable(100.0f, 50.0f, columnWidths, rowHeights); table->idx_get(1, 0)->get_TextFrame()->set_Text(u"10"); table->idx_get(2, 0)->get_TextFrame()->set_Text(u"20"); table->idx_get(3, 0)->get_TextFrame()->set_Text(u"30"); auto cell = table->idx_get(0, 0); auto paragraph = cell->get_TextFrame()->get_Paragraphs()->idx_get(0); auto portion = paragraph->get_Portions()->idx_get(0); portion->set_Text(u"Text here"); portion->get_PortionFormat()->get_FillFormat()->set_FillType(FillType::Solid); portion->get_PortionFormat()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Black()); cell->set_TextAnchorType(TextAnchorType::Center); cell->set_TextVerticalType(TextVerticalType::Vertical270); presentation->Save(u"Vertical_Align_Text_out.pptx", SaveFormat::Pptx); ``` ## **Set Text Formatting on the Table Level** Use [SetTextFormat](https://reference.aspose.com/slides/cpp/aspose.slides/ibulktextformattable/settextformat/) to apply text formatting to all cells in a table. Its overloads accept portion, paragraph, and text frame formatting, so you can set these properties without iterating through individual cells. 1. Load the presentation using the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) class. 2. Get a reference to the slide by its index. 3. Access an [ITable](https://reference.aspose.com/slides/cpp/aspose.slides/itable/) object from the slide. 4. Set the font size using [set_FontHeight](https://reference.aspose.com/slides/cpp/aspose.slides/baseportionformat/set_fontheight/) for the text. 5. Set the paragraph alignment and right margin using [set_Alignment](https://reference.aspose.com/slides/cpp/aspose.slides/iparagraphformat/set_alignment/) and [set_MarginRight](https://reference.aspose.com/slides/cpp/aspose.slides/iparagraphformat/set_marginright/). 6. Set the text direction using [set_TextVerticalType](https://reference.aspose.com/slides/cpp/aspose.slides/textframeformat/set_textverticaltype/). 7. Save the modified presentation. The example below opens `table.pptx`, which must contain at least one slide with a table as its first shape. It sets the font size to 25 points, right-aligns paragraphs with a right margin of 20 points, and makes the text vertical. The formatted presentation is saved as `result.pptx`. ```cpp #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(u"table.pptx"); auto slide = presentation->get_Slide(0); auto table = System::ExplicitCast(slide->get_Shape(0)); auto portionFormat = System::MakeObject(); portionFormat->set_FontHeight(25.0f); table->SetTextFormat(portionFormat); auto paragraphFormat = System::MakeObject(); paragraphFormat->set_Alignment(TextAlignment::Right); paragraphFormat->set_MarginRight(20.0f); table->SetTextFormat(paragraphFormat); auto textFrameFormat = System::MakeObject(); textFrameFormat->set_TextVerticalType(TextVerticalType::Vertical); table->SetTextFormat(textFrameFormat); presentation->Save(u"result.pptx", SaveFormat::Pptx); ``` ## **Get Table Style Properties** Use [get_StylePreset](https://reference.aspose.com/slides/cpp/aspose.slides/itable/get_stylepreset/) to read a table's preset style and [set_StylePreset](https://reference.aspose.com/slides/cpp/aspose.slides/itable/set_stylepreset/) to assign it. This example applies [TableStylePreset::DarkStyle1](https://reference.aspose.com/slides/cpp/aspose.slides/tablestylepreset/) to one table, prints the preset name, and assigns the same preset to a second table. Both tables are saved in `table-style.pptx`. ```cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto columnWidths = System::MakeArray({ 100, 150 }); auto rowHeights = System::MakeArray({ 5, 5, 5 }); auto table = slide->get_Shapes()->AddTable(10, 10, columnWidths, rowHeights); table->set_StylePreset(TableStylePreset::DarkStyle1); auto stylePreset = table->get_StylePreset(); System::Console::WriteLine(u"Table style preset: {0}", stylePreset); auto anotherTable = slide->get_Shapes()->AddTable(10, 100, columnWidths, rowHeights); anotherTable->set_StylePreset(stylePreset); presentation->Save(u"table-style.pptx", SaveFormat::Pptx); ``` ## **Lock Aspect Ratio of a Table** A table's aspect ratio is the ratio of its width to its height. Use [set_AspectRatioLocked](https://reference.aspose.com/slides/cpp/aspose.slides/igraphicalobjectlock/set_aspectratiolocked/) to lock this ratio for a table. The example below opens `pres.pptx`, which must contain at least one slide with a table as its first shape. It prints the current lock state, enables the aspect ratio lock, prints the updated state (`True`), and saves the result as `pres-out.pptx`. ```cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = System::MakeObject(u"pres.pptx"); auto slide = presentation->get_Slide(0); auto table = System::ExplicitCast(slide->get_Shape(0)); Console::WriteLine(u"Lock aspect ratio set: {0}", table->get_GraphicalObjectLock()->get_AspectRatioLocked()); table->get_GraphicalObjectLock()->set_AspectRatioLocked(true); Console::WriteLine(u"Lock aspect ratio set: {0}", table->get_GraphicalObjectLock()->get_AspectRatioLocked()); presentation->Save(u"pres-out.pptx", SaveFormat::Pptx); ``` ## **FAQ** **Can I enable right-to-left (RTL) reading direction for an entire table and the text in its cells?** Yes. The table exposes a [set_RightToLeft](https://reference.aspose.com/slides/cpp/aspose.slides/table/set_righttoleft/) method, and paragraphs have [ParagraphFormat::set_RightToLeft](https://reference.aspose.com/slides/cpp/aspose.slides/paragraphformat/set_righttoleft/). Using both ensures the correct RTL order and rendering inside cells. **How can I prevent users from moving or resizing a table in the final file?** Use [shape locks](https://docs.aspose.com/slides/cpp/applying-protection-to-presentation/) to disable moving, resizing, selection, etc. These locks apply to tables as well. **Is inserting an image inside a cell as a background supported?** Yes. You can set a [picture fill](https://reference.aspose.com/slides/cpp/aspose.slides/picturefillformat/) for a cell; the image will cover the cell area according to the chosen mode (stretch or tile). Related feature: [Create tables on slides](https://docs.aspose.com/slides/features/create-tables/). ## Related articles - [Manage Rows and Columns in PowerPoint Tables Using C++](https://docs.aspose.com/slides/cpp/manage-rows-and-columns/) - [Manage Table Cells in Presentations Using C++](https://docs.aspose.com/slides/cpp/manage-cells/) - [Create and Customize PowerPoint Tables in C++](https://docs.aspose.com/slides/cpp/powerpoint-table/) # Manage Presentation Text in C++ > Learn to manage text in Aspose.Slides for C++: edit placeholders, fonts, paragraphs, bullets, and more with clear C++ code examples for PPT, PPTX, and ODP. Source: https://docs.aspose.com/slides/cpp/manage-text/ Updated: 2025-11-19 --- lastmod: 2025-11-19T22:55:59+04:00 title: Manage Presentation Text in C++ linktitle: Manage Text type: docs weight: 50 url: /cpp/manage-text/ keywords: - text - placeholder - text box - autofit - paragraph - format text - animate text - bulleted list - numbered list - superscript - subscript - text extration - localization - WordArt - PowerPoint - OpenDocument - presentation - C++ - Aspose.Slides description: "Learn to manage text in Aspose.Slides for C++: edit placeholders, fonts, paragraphs, bullets, and more with clear C++ code examples for PPT, PPTX, and ODP." --- ## Related articles - [Manage Bulleted and Numbered Lists in Presentations in C++](https://docs.aspose.com/slides/cpp/manage-lists/) # Manage Text Boxes in Presentations Using C++ > Create, identify, format, and update text boxes in PowerPoint and OpenDocument presentations using Aspose.Slides for C++. Source: https://docs.aspose.com/slides/cpp/manage-textbox/ Updated: 2026-09-03 ## **Introduction** In Aspose.Slides for C++, slide text is stored in text frames that belong to shapes. The [IAutoShape](https://reference.aspose.com/slides/cpp/aspose.slides/iautoshape/) interface represents the most common text-bearing shape and exposes its text through the [IAutoShape::get_TextFrame](https://reference.aspose.com/slides/cpp/aspose.slides/iautoshape/get_textframe/) method. Every auto shape implements [IShape](https://reference.aspose.com/slides/cpp/aspose.slides/ishape/), but not every shape is an auto shape or supports a text frame. When processing an existing presentation, check that a shape implements [IAutoShape](https://reference.aspose.com/slides/cpp/aspose.slides/iautoshape/) before accessing its text. ## **Create a Text Box on a Slide** To create a text box, add an auto shape to a slide, add text to its text frame, and save the presentation. The following example creates a rectangular text box: ```cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto textBox = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 150, 75, 300, 50); textBox->AddTextFrame(u"Aspose TextBox"); presentation->Save(u"TextBox.pptx", SaveFormat::Pptx); ``` The coordinates and dimensions passed to [IShapeCollection::AddAutoShape](https://reference.aspose.com/slides/cpp/aspose.slides/ishapecollection/addautoshape/) are measured in points. [IAutoShape::AddTextFrame](https://reference.aspose.com/slides/cpp/aspose.slides/iautoshape/addtextframe/) initializes the text frame with the supplied text. ## **Check for a Text Box Shape** Use the [IAutoShape::get_IsTextBox](https://reference.aspose.com/slides/cpp/aspose.slides/iautoshape/get_istextbox/) method to determine whether an auto shape is treated as a text box. This is useful when a presentation contains both text-bearing and purely graphical auto shapes. ![A text box and a shape](https://docs.aspose.com/slides/cpp/manage-textbox/istextbox.png) The following example inspects every auto shape in a presentation: ```cpp #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto textBox = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 10, 10, 120, 40); textBox->AddTextFrame(u"Text box"); slide->get_Shapes()->AddAutoShape(ShapeType::Ellipse, 150, 10, 40, 40); for (const auto& currentSlide : IterateOver(presentation->get_Slides())) { for (const auto& shape : IterateOver(currentSlide->get_Shapes())) { auto autoShape = AsCast(shape); if (autoShape != nullptr) { Console::WriteLine(autoShape->get_IsTextBox() ? u"The shape is a text box." : u"The shape is not a text box."); } } } ``` A newly added auto shape is not considered a text box until it contains non-empty text. You can supply that text through [IAutoShape::AddTextFrame](https://reference.aspose.com/slides/cpp/aspose.slides/iautoshape/addtextframe/) or [ITextFrame::set_Text](https://reference.aspose.com/slides/cpp/aspose.slides/itextframe/set_text/). Adding or assigning an empty string makes [IAutoShape::get_IsTextBox](https://reference.aspose.com/slides/cpp/aspose.slides/iautoshape/get_istextbox/) return `false`: ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto shape1 = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 10, 10, 100, 40); shape1->AddTextFrame(u"Shape 1"); Console::WriteLine(shape1->get_IsTextBox()); auto shape2 = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 10, 70, 100, 40); shape2->get_TextFrame()->set_Text(u"Shape 2"); Console::WriteLine(shape2->get_IsTextBox()); auto shape3 = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 10, 130, 100, 40); shape3->AddTextFrame(u""); Console::WriteLine(shape3->get_IsTextBox()); auto shape4 = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 10, 190, 100, 40); shape4->get_TextFrame()->set_Text(u""); Console::WriteLine(shape4->get_IsTextBox()); ``` The first two checks return `true`; the last two return `false`. ## **Find the Shape That Owns a Text Frame** Generic text-processing code may receive an [ITextFrame](https://reference.aspose.com/slides/cpp/aspose.slides/itextframe/) without knowing which presentation object contains it. Use the [ITextFrame::get_ParentShape](https://reference.aspose.com/slides/cpp/aspose.slides/itextframe/get_parentshape/) method to navigate back to its owning [IShape](https://reference.aspose.com/slides/cpp/aspose.slides/ishape/). For a text frame owned by an auto shape or another text-bearing shape, [ITextFrame::get_ParentShape](https://reference.aspose.com/slides/cpp/aspose.slides/itextframe/get_parentshape/) returns the owner and [ITextFrame::get_ParentCell](https://reference.aspose.com/slides/cpp/aspose.slides/itextframe/get_parentcell/) returns `nullptr`. Both methods provide read-only navigation. Check the returned value for `nullptr` before accessing it. To identify both shape and table-cell owners, including shapes associated with SmartArt nodes, see [Search and Replace Text](https://docs.aspose.com/slides/cpp/search-and-replace-text/). ## **Add Columns to a Text Box** The [ITextFrameFormat::set_ColumnCount](https://reference.aspose.com/slides/cpp/aspose.slides/itextframeformat/set_columncount/) method divides the text frame into columns, while [ITextFrameFormat::set_ColumnSpacing](https://reference.aspose.com/slides/cpp/aspose.slides/itextframeformat/set_columnspacing/) sets the gap between columns in points. Both methods belong to [ITextFrameFormat](https://reference.aspose.com/slides/cpp/aspose.slides/itextframeformat/) and can be called through the text frame of an existing text box. Text reflows between columns inside the same shape; it does not continue into another shape. The following example creates a three-column text box with 10 points between columns, saves the presentation, and reads the stored settings back from the output file: ```cpp #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto textBox = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 100, 100, 300, 200); textBox->AddTextFrame(u"This text is distributed automatically across all columns in the text box."); auto textFrameFormat = textBox->get_TextFrame()->get_TextFrameFormat(); textFrameFormat->set_ColumnCount(3); textFrameFormat->set_ColumnSpacing(10); presentation->Save(u"TextBoxColumns.pptx", SaveFormat::Pptx); auto savedPresentation = MakeObject(u"TextBoxColumns.pptx"); auto savedTextBox = ExplicitCast(savedPresentation->get_Slide(0)->get_Shape(0)); auto savedFormat = savedTextBox->get_TextFrame()->get_TextFrameFormat(); Console::WriteLine(u"Columns: {0}; spacing: {1} points", savedFormat->get_ColumnCount(), savedFormat->get_ColumnSpacing()); ``` ## **Extract Text from Individual Columns** Use [ITextFrame::SplitTextByColumns](https://reference.aspose.com/slides/cpp/aspose.slides/itextframe/splittextbycolumns/) to retrieve the text assigned to each visual column in an existing text frame. The method returns one string for each column, in column-based reading order. A single-column text frame produces an array with one element, and an empty column is represented by an empty string. The strings contain plain text only; portion-level formatting is not preserved. This is useful when you need to: - Extract text while preserving its column-based reading order. - Index or compare the content of multi-column slides. - Export each column to a separate file, database field, or other destination. - Inspect how text is redistributed after setting the column count with [ITextFrameFormat::set_ColumnCount](https://reference.aspose.com/slides/cpp/aspose.slides/itextframeformat/set_columncount/) or the spacing with [ITextFrameFormat::set_ColumnSpacing](https://reference.aspose.com/slides/cpp/aspose.slides/itextframeformat/set_columnspacing/), or changing the font or text-frame size. The method reports the text distributed within the current [ITextFrame](https://reference.aspose.com/slides/cpp/aspose.slides/itextframe/); it does not automatically flow text between separate shapes or text boxes. Column distribution can depend on available fonts and other text-layout settings, so make sure that the required fonts are available when consistent results are important. The following example loads a presentation, finds the first multi-column auto shape with a text frame on the first slide, reads its configured column count, and writes the text from every column to a separate file. Shapes that do not provide a text frame are skipped. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; using namespace System::IO; auto presentation = MakeObject(u"MultiColumnText.pptx"); SharedPtr textBox = nullptr; for (const auto& shape : IterateOver(presentation->get_Slide(0)->get_Shapes())) { auto autoShape = AsCast(shape); if (autoShape != nullptr && autoShape->get_TextFrame() != nullptr) { auto columnCount = autoShape->get_TextFrame()->get_TextFrameFormat()->get_ColumnCount(); if (columnCount > 1) { textBox = autoShape; break; } } } if (textBox == nullptr) { Console::WriteLine(u"No multi-column text frame was found."); } else { auto textFrame = textBox->get_TextFrame(); auto configuredColumnCount = textFrame->get_TextFrameFormat()->get_ColumnCount(); auto columnTexts = textFrame->SplitTextByColumns(); Console::WriteLine(u"Configured columns: {0}", configuredColumnCount); for (auto columnIndex = 0; columnIndex < columnTexts->get_Length(); columnIndex++) { auto columnNumber = columnIndex + 1; auto columnText = columnTexts->idx_get(columnIndex); Console::WriteLine(u"Column {0}: {1}", columnNumber, columnText); auto fileName = String::Format(u"Column-{0}.txt", columnNumber); File::WriteAllText(fileName, columnText); } } ``` ## **Update Text** To update text throughout a presentation, iterate through the slides and shapes, select auto shapes, and then edit their text portions. Working at the portion level lets you change both text and character formatting. The following example replaces every occurrence of `years` with `months` within individual auto-shape text portions and makes each affected portion bold: ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(u"Text.pptx"); for (const auto& slide : IterateOver(presentation->get_Slides())) { for (const auto& shape : IterateOver(slide->get_Shapes())) { auto autoShape = AsCast(shape); if (autoShape == nullptr || autoShape->get_TextFrame() == nullptr) { continue; } for (const auto& paragraph : IterateOver(autoShape->get_TextFrame()->get_Paragraphs())) { for (const auto& portion : IterateOver(paragraph->get_Portions())) { auto text = portion->get_Text(); if (!String::IsNullOrEmpty(text) && text.Contains(u"years")) { portion->set_Text(text.Replace(u"years", u"months")); portion->get_PortionFormat()->set_FontBold(NullableBool::True); } } } } } presentation->Save(u"TextChanged.pptx", SaveFormat::Pptx); ``` This traversal updates text only in auto shapes. Text stored in tables, charts, SmartArt, or grouped shapes requires traversal of those objects' own collections. ## **Add a Text Box with a Hyperlink** A hyperlink can be assigned to a specific text portion, so only that text acts as the clickable link. Use [IHyperlinkManager::SetExternalHyperlinkClick](https://reference.aspose.com/slides/cpp/aspose.slides/ihyperlinkmanager/setexternalhyperlinkclick/) to associate the portion with an external URL. The following example creates linked text and saves it to a presentation: ```cpp #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto textBox = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 150, 150, 200, 50); textBox->AddTextFrame(u"Aspose.Slides"); auto textPortion = textBox->get_TextFrame()->get_Paragraph(0)->get_Portion(0); textPortion->get_PortionFormat()->get_HyperlinkManager()->SetExternalHyperlinkClick(u"https://www.aspose.com/"); presentation->Save(u"Hyperlink.pptx", SaveFormat::Pptx); ``` ## **FAQ** **What is the difference between a text box and a text placeholder on a master or layout slide?** A [placeholder](https://docs.aspose.com/slides/cpp/manage-placeholder/) can inherit its position and formatting from a [master slide](https://reference.aspose.com/slides/cpp/aspose.slides/masterslide/) or [layout slide](https://reference.aspose.com/slides/cpp/aspose.slides/layoutslide/). A regular text box is an independent shape on the slide where it was created and does not acquire placeholder behavior when the layout changes. **How can I replace text without changing text in charts, tables, or SmartArt?** Limit the traversal to shapes that implement [IAutoShape](https://reference.aspose.com/slides/cpp/aspose.slides/iautoshape/), as shown in the Update Text example. Charts, tables, and SmartArt store text in their own object models, so they are not modified by that loop. ## Related articles - [Text Box](https://docs.aspose.com/slides/cpp/examples/elements/text-box/) # Manage Presentation Zoom in C++ > Create and customize Zoom with Aspose.Slides for C++ — jump between sections, add thumbnails and transitions in PowerPoint presentations. Source: https://docs.aspose.com/slides/cpp/manage-zoom/ Updated: 2026-11-09 ## **Introduction** PowerPoint zooms let you navigate between specific slides and sections during a slide show. With Aspose.Slides for C++, you can create slide, section, and summary zooms and customize their previews, borders, and transitions. ![PowerPoint zoom overview](https://docs.aspose.com/slides/cpp/manage-zoom/overview.png) * To summarize an entire presentation on a single slide, use a [Summary Zoom](https://docs.aspose.com/slides/cpp/manage-zoom/#summary-zoom). * To show selected slides only, use a [Slide Zoom](https://docs.aspose.com/slides/cpp/manage-zoom/#slide-zoom). * To show a single section only, use a [Section Zoom](https://docs.aspose.com/slides/cpp/manage-zoom/#section-zoom). ## **Slide Zoom** A slide zoom can make your presentation more dynamic, allowing you to navigate freely between slides in any order you choose without interrupting the flow of your presentation. Slide zooms are great for short presentations without many sections, but you can still use them in different presentation scenarios. Slide zooms let you explore related information from a single overview slide. ![Selecting slides for a slide zoom](https://docs.aspose.com/slides/cpp/manage-zoom/slidezoomsel.png) For slide zoom objects, Aspose.Slides provides the [ZoomImageType](https://reference.aspose.com/slides/cpp/aspose.slides/zoomimagetype/) enumeration, the [IZoomFrame](https://reference.aspose.com/slides/cpp/aspose.slides/izoomframe/) interface, and methods on the [IShapeCollection](https://reference.aspose.com/slides/cpp/aspose.slides/ishapecollection/) interface. ### **Create Zoom Frames** Use [IShapeCollection::AddZoomFrame](https://reference.aspose.com/slides/cpp/aspose.slides/ishapecollection/addzoomframe/) to place links to individual slides on an overview slide. This example creates two target slides with distinct backgrounds and labels, then adds a preview of each to the first slide and saves the presentation as PPTX. Frame positions and dimensions are specified in points. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System::Drawing; auto presentation = System::MakeObject(); auto overviewSlide = presentation->get_Slide(0); auto secondSlide = presentation->get_Slides()->AddEmptySlide(overviewSlide->get_LayoutSlide()); auto thirdSlide = presentation->get_Slides()->AddEmptySlide(overviewSlide->get_LayoutSlide()); secondSlide->get_Background()->set_Type(BackgroundType::OwnBackground); secondSlide->get_Background()->get_FillFormat()->set_FillType(FillType::Solid); secondSlide->get_Background()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Cyan()); auto textBox = secondSlide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 100, 200, 500, 200); textBox->get_TextFrame()->set_Text(u"Second Slide"); thirdSlide->get_Background()->set_Type(BackgroundType::OwnBackground); thirdSlide->get_Background()->get_FillFormat()->set_FillType(FillType::Solid); thirdSlide->get_Background()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_DarkKhaki()); textBox = thirdSlide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 100, 200, 500, 200); textBox->get_TextFrame()->set_Text(u"Third Slide"); overviewSlide->get_Shapes()->AddZoomFrame(20, 20, 250, 200, secondSlide); overviewSlide->get_Shapes()->AddZoomFrame(200, 250, 250, 200, thirdSlide); presentation->Save(u"presentation.pptx", SaveFormat::Pptx); ``` ### **Create Zoom Frames with Custom Images** Pass a custom image to [IShapeCollection::AddZoomFrame](https://reference.aspose.com/slides/cpp/aspose.slides/ishapecollection/addzoomframe/) to replace the target slide's default preview. This example requires a local image, loads it with [Images::FromFile](https://reference.aspose.com/slides/cpp/aspose.slides/images/fromfile/), and adds it to the presentation using [IImageCollection::AddImage](https://reference.aspose.com/slides/cpp/aspose.slides/iimagecollection/addimage/). The resulting frame displays that image while still linking to the second slide. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System::Drawing; auto presentation = System::MakeObject(); auto overviewSlide = presentation->get_Slide(0); auto slide = presentation->get_Slides()->AddEmptySlide(overviewSlide->get_LayoutSlide()); slide->get_Background()->set_Type(BackgroundType::OwnBackground); slide->get_Background()->get_FillFormat()->set_FillType(FillType::Solid); slide->get_Background()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Cyan()); auto textBox = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 100, 200, 500, 200); textBox->get_TextFrame()->set_Text(u"Second Slide"); auto image = Images::FromFile(u"image.png"); auto previewImage = presentation->get_Images()->AddImage(image); image->Dispose(); overviewSlide->get_Shapes()->AddZoomFrame(20, 20, 300, 200, slide, previewImage); presentation->Save(u"presentation.pptx", SaveFormat::Pptx); ``` ### **Format Zoom Frames** This example customizes two slide zoom frames. It assigns a local image to the first frame through [IZoomObject::set_ZoomImage](https://reference.aspose.com/slides/cpp/aspose.slides/izoomobject/set_zoomimage/), and gives the second frame a five-point, dash-dot pink border through [IShape::get_LineFormat](https://reference.aspose.com/slides/cpp/aspose.slides/ishape/get_lineformat/). Setting [IZoomObject::set_ShowBackground](https://reference.aspose.com/slides/cpp/aspose.slides/izoomobject/set_showbackground/) to `false` hides the second frame's background. A local image is required for the custom preview; both frames retain their slide targets in the saved PPTX. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System::Drawing; auto presentation = System::MakeObject(); auto overviewSlide = presentation->get_Slide(0); auto secondSlide = presentation->get_Slides()->AddEmptySlide(overviewSlide->get_LayoutSlide()); auto thirdSlide = presentation->get_Slides()->AddEmptySlide(overviewSlide->get_LayoutSlide()); secondSlide->get_Background()->set_Type(BackgroundType::OwnBackground); secondSlide->get_Background()->get_FillFormat()->set_FillType(FillType::Solid); secondSlide->get_Background()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Cyan()); auto textBox = secondSlide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 100, 200, 500, 200); textBox->get_TextFrame()->set_Text(u"Second Slide"); thirdSlide->get_Background()->set_Type(BackgroundType::OwnBackground); thirdSlide->get_Background()->get_FillFormat()->set_FillType(FillType::Solid); thirdSlide->get_Background()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_DarkKhaki()); textBox = thirdSlide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 100, 200, 500, 200); textBox->get_TextFrame()->set_Text(u"Third Slide"); auto firstZoomFrame = overviewSlide->get_Shapes()->AddZoomFrame(20, 20, 250, 200, secondSlide); auto secondZoomFrame = overviewSlide->get_Shapes()->AddZoomFrame(200, 250, 250, 200, thirdSlide); auto image = Images::FromFile(u"image.png"); auto previewImage = presentation->get_Images()->AddImage(image); image->Dispose(); firstZoomFrame->set_ZoomImage(previewImage); secondZoomFrame->get_LineFormat()->set_Width(5); secondZoomFrame->get_LineFormat()->get_FillFormat()->set_FillType(FillType::Solid); secondZoomFrame->get_LineFormat()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_HotPink()); secondZoomFrame->get_LineFormat()->set_DashStyle(LineDashStyle::DashDot); secondZoomFrame->set_ShowBackground(false); presentation->Save(u"presentation.pptx", SaveFormat::Pptx); ``` ## **Section Zoom** A section zoom links to a section in your presentation. Use it to revisit a topic or show how different parts of the presentation connect. ![Selecting a section for a section zoom](https://docs.aspose.com/slides/cpp/manage-zoom/seczoomsel.png) For section zoom objects, Aspose.Slides provides the [ISectionZoomFrame](https://reference.aspose.com/slides/cpp/aspose.slides/isectionzoomframe/) interface and methods on the [IShapeCollection](https://reference.aspose.com/slides/cpp/aspose.slides/ishapecollection/) interface. ### **Create Section Zoom Frames** Create a section with [ISectionCollection::AddSection](https://reference.aspose.com/slides/cpp/aspose.slides/isectioncollection/addsection/), then pass the returned section to [IShapeCollection::AddSectionZoomFrame](https://reference.aspose.com/slides/cpp/aspose.slides/ishapecollection/addsectionzoomframe/). This example places a section zoom on the first slide and links it to a section beginning with a colored slide. The frame's position and dimensions are specified in points, and the presentation is saved as PPTX. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System::Drawing; auto presentation = System::MakeObject(); auto overviewSlide = presentation->get_Slide(0); auto slide = presentation->get_Slides()->AddEmptySlide(overviewSlide->get_LayoutSlide()); slide->get_Background()->get_FillFormat()->set_FillType(FillType::Solid); slide->get_Background()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_YellowGreen()); slide->get_Background()->set_Type(BackgroundType::OwnBackground); auto section = presentation->get_Sections()->AddSection(u"Section 1", slide); auto sectionZoomFrame = overviewSlide->get_Shapes()->AddSectionZoomFrame(20, 20, 300, 200, section); presentation->Save(u"presentation.pptx", SaveFormat::Pptx); ``` ### **Create Section Zoom Frames with Custom Images** The image overload of [IShapeCollection::AddSectionZoomFrame](https://reference.aspose.com/slides/cpp/aspose.slides/ishapecollection/addsectionzoomframe/) lets you display a custom preview without changing the destination section. This example requires a local image, which is loaded with [Images::FromFile](https://reference.aspose.com/slides/cpp/aspose.slides/images/fromfile/) and added through [IImageCollection::AddImage](https://reference.aspose.com/slides/cpp/aspose.slides/iimagecollection/addimage/). The saved presentation contains a section zoom on the first slide linked to the newly created section. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System::Drawing; auto presentation = System::MakeObject(); auto overviewSlide = presentation->get_Slide(0); auto slide = presentation->get_Slides()->AddEmptySlide(overviewSlide->get_LayoutSlide()); slide->get_Background()->get_FillFormat()->set_FillType(FillType::Solid); slide->get_Background()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_YellowGreen()); slide->get_Background()->set_Type(BackgroundType::OwnBackground); auto image = Images::FromFile(u"image.png"); auto previewImage = presentation->get_Images()->AddImage(image); image->Dispose(); auto section = presentation->get_Sections()->AddSection(u"Section 1", slide); auto sectionZoomFrame = overviewSlide->get_Shapes()->AddSectionZoomFrame(20, 20, 300, 200, section, previewImage); presentation->Save(u"presentation.pptx", SaveFormat::Pptx); ``` ### **Change a Section Zoom's Target Section** Use [ISectionZoomFrame::set_TargetSection](https://reference.aspose.com/slides/cpp/aspose.slides/isectionzoomframe/set_targetsection/) to redirect an existing section zoom without recreating it. Choose a populated section from the same presentation's [get_Sections](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/get_sections/) collection. Assigning an empty section leaves the current target unchanged, so check [ISection::GetSlidesListOfSection](https://reference.aspose.com/slides/cpp/aspose.slides/isection/getslideslistofsection/) before assigning it. See [Manage Slide Sections](https://docs.aspose.com/slides/cpp/slide-section/) for more about sections. The following example loads a presentation file, which must contain multiple populated sections, an existing section zoom named `Section navigation`, and a section with the unique name `Results`. It searches all slides for the zoom and finds the destination by name rather than by a collection index that can change when sections are reordered. If names are not unique, use [ISection::get_SectionId](https://reference.aspose.com/slides/cpp/aspose.slides/isection/get_sectionid/) to identify the destination instead. ```cpp #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(u"section-zoom.pptx"); System::SharedPtr zoom; for (auto slideIndex = 0; slideIndex < presentation->get_Slides()->get_Count() && !zoom; ++slideIndex) { auto slide = presentation->get_Slide(slideIndex); for (auto shapeIndex = 0; shapeIndex < slide->get_Shapes()->get_Count(); ++shapeIndex) { auto candidate = System::DynamicCast(slide->get_Shape(shapeIndex)); if (candidate && candidate->get_Name() == u"Section navigation") { zoom = candidate; break; } } } System::SharedPtr targetSection; for (auto sectionIndex = 0; sectionIndex < presentation->get_Sections()->get_Count(); ++sectionIndex) { auto section = presentation->get_Sections()->idx_get(sectionIndex); if (section->get_Name() == u"Results") { targetSection = section; break; } } if (!zoom || !targetSection) { System::Console::WriteLine(u"The section zoom or destination section was not found."); } else if (targetSection->GetSlidesListOfSection()->get_Count() == 0) { System::Console::WriteLine(u"The destination section is empty."); } else { auto currentSection = zoom->get_TargetSection(); if (currentSection) { System::Console::WriteLine(u"Current section: " + currentSection->get_Name()); } zoom->set_TargetSection(targetSection); presentation->Save(u"section-zoom-updated.pptx", SaveFormat::Pptx); } ``` ### **Format Section Zoom Frames** This example moves and resizes a section zoom to 100 by 75 points, assigns a local image through [IZoomObject::set_ZoomImage](https://reference.aspose.com/slides/cpp/aspose.slides/izoomobject/set_zoomimage/), and applies a 2.5-point, dash-dot brown border. It enables [IZoomObject::set_ReturnToParent](https://reference.aspose.com/slides/cpp/aspose.slides/izoomobject/set_returntoparent/) to return to the originating slide after the section, disables [IZoomObject::set_ShowBackground](https://reference.aspose.com/slides/cpp/aspose.slides/izoomobject/set_showbackground/), and sets [IZoomObject::set_TransitionDuration](https://reference.aspose.com/slides/cpp/aspose.slides/izoomobject/set_transitionduration/) to 1.5 seconds. A local image is required for the custom preview. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System::Drawing; auto presentation = System::MakeObject(); auto overviewSlide = presentation->get_Slide(0); auto slide = presentation->get_Slides()->AddEmptySlide(overviewSlide->get_LayoutSlide()); slide->get_Background()->get_FillFormat()->set_FillType(FillType::Solid); slide->get_Background()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_YellowGreen()); slide->get_Background()->set_Type(BackgroundType::OwnBackground); auto section = presentation->get_Sections()->AddSection(u"Section 1", slide); auto sectionZoomFrame = overviewSlide->get_Shapes()->AddSectionZoomFrame(20, 20, 300, 200, section); sectionZoomFrame->set_X(100); sectionZoomFrame->set_Y(300); sectionZoomFrame->set_Width(100); sectionZoomFrame->set_Height(75); auto image = Images::FromFile(u"image.png"); auto previewImage = presentation->get_Images()->AddImage(image); image->Dispose(); sectionZoomFrame->set_ZoomImage(previewImage); sectionZoomFrame->set_ReturnToParent(true); sectionZoomFrame->set_ShowBackground(false); sectionZoomFrame->get_LineFormat()->get_FillFormat()->set_FillType(FillType::Solid); sectionZoomFrame->get_LineFormat()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Brown()); sectionZoomFrame->get_LineFormat()->set_DashStyle(LineDashStyle::DashDot); sectionZoomFrame->get_LineFormat()->set_Width(2.5f); sectionZoomFrame->set_TransitionDuration(1.5f); presentation->Save(u"presentation.pptx", SaveFormat::Pptx); ``` ## **Summary Zoom** A summary zoom provides an overview of presentation sections. During a slide show, you can use it to jump to a section, skip ahead, or revisit a topic without following the slide order. ![Selecting sections for a summary zoom](https://docs.aspose.com/slides/cpp/manage-zoom/sumzoomsel.png) For summary zoom objects, Aspose.Slides provides the [ISummaryZoomFrame](https://reference.aspose.com/slides/cpp/aspose.slides/isummaryzoomframe/), [ISummaryZoomSection](https://reference.aspose.com/slides/cpp/aspose.slides/isummaryzoomsection/), and [ISummaryZoomSectionCollection](https://reference.aspose.com/slides/cpp/aspose.slides/isummaryzoomsectioncollection/) interfaces and methods on the [IShapeCollection](https://reference.aspose.com/slides/cpp/aspose.slides/ishapecollection/) interface. ### **Create a Summary Zoom** Use [IShapeCollection::AddSummaryZoomFrame](https://reference.aspose.com/slides/cpp/aspose.slides/ishapecollection/addsummaryzoomframe/) to create an overview of the presentation's sections. This example creates four sections with distinct slide backgrounds and adds a summary zoom to the first slide. The frame's position and dimensions are specified in points, and the resulting overview is saved in a PPTX presentation. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System::Drawing; auto presentation = System::MakeObject(); auto overviewSlide = presentation->get_Slide(0); auto slide = presentation->get_Slides()->AddEmptySlide(overviewSlide->get_LayoutSlide()); slide->get_Background()->get_FillFormat()->set_FillType(FillType::Solid); slide->get_Background()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Brown()); slide->get_Background()->set_Type(BackgroundType::OwnBackground); presentation->get_Sections()->AddSection(u"Section 1", slide); slide = presentation->get_Slides()->AddEmptySlide(overviewSlide->get_LayoutSlide()); slide->get_Background()->get_FillFormat()->set_FillType(FillType::Solid); slide->get_Background()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Aqua()); slide->get_Background()->set_Type(BackgroundType::OwnBackground); presentation->get_Sections()->AddSection(u"Section 2", slide); slide = presentation->get_Slides()->AddEmptySlide(overviewSlide->get_LayoutSlide()); slide->get_Background()->get_FillFormat()->set_FillType(FillType::Solid); slide->get_Background()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Chartreuse()); slide->get_Background()->set_Type(BackgroundType::OwnBackground); presentation->get_Sections()->AddSection(u"Section 3", slide); slide = presentation->get_Slides()->AddEmptySlide(overviewSlide->get_LayoutSlide()); slide->get_Background()->get_FillFormat()->set_FillType(FillType::Solid); slide->get_Background()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_DarkGreen()); slide->get_Background()->set_Type(BackgroundType::OwnBackground); presentation->get_Sections()->AddSection(u"Section 4", slide); auto summaryZoomFrame = overviewSlide->get_Shapes()->AddSummaryZoomFrame(150, 50, 300, 200); presentation->Save(u"presentation.pptx", SaveFormat::Pptx); ``` ### **Add and Remove a Summary Zoom Section** A summary zoom stores its [ISummaryZoomSection](https://reference.aspose.com/slides/cpp/aspose.slides/isummaryzoomsection/) objects in [ISummaryZoomFrame::get_SummaryZoomCollection](https://reference.aspose.com/slides/cpp/aspose.slides/isummaryzoomframe/get_summaryzoomcollection/). This example creates an overview of two sections, adds a third section using [ISummaryZoomSectionCollection::AddSummaryZoomSection](https://reference.aspose.com/slides/cpp/aspose.slides/isummaryzoomsectioncollection/addsummaryzoomsection/), and removes the first section's entry using [ISummaryZoomSectionCollection::RemoveSummaryZoomSection](https://reference.aspose.com/slides/cpp/aspose.slides/isummaryzoomsectioncollection/removesummaryzoomsection/). Removing the entry leaves the presentation section and its slides intact. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System::Drawing; auto presentation = System::MakeObject(); auto overviewSlide = presentation->get_Slide(0); auto slide = presentation->get_Slides()->AddEmptySlide(overviewSlide->get_LayoutSlide()); slide->get_Background()->get_FillFormat()->set_FillType(FillType::Solid); slide->get_Background()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Brown()); slide->get_Background()->set_Type(BackgroundType::OwnBackground); auto firstSection = presentation->get_Sections()->AddSection(u"Section 1", slide); slide = presentation->get_Slides()->AddEmptySlide(overviewSlide->get_LayoutSlide()); slide->get_Background()->get_FillFormat()->set_FillType(FillType::Solid); slide->get_Background()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Aqua()); slide->get_Background()->set_Type(BackgroundType::OwnBackground); presentation->get_Sections()->AddSection(u"Section 2", slide); auto summaryZoomFrame = overviewSlide->get_Shapes()->AddSummaryZoomFrame(150, 50, 300, 200); slide = presentation->get_Slides()->AddEmptySlide(overviewSlide->get_LayoutSlide()); slide->get_Background()->get_FillFormat()->set_FillType(FillType::Solid); slide->get_Background()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Chartreuse()); slide->get_Background()->set_Type(BackgroundType::OwnBackground); auto thirdSection = presentation->get_Sections()->AddSection(u"Section 3", slide); summaryZoomFrame->get_SummaryZoomCollection()->AddSummaryZoomSection(thirdSection); summaryZoomFrame->get_SummaryZoomCollection()->RemoveSummaryZoomSection(firstSection); presentation->Save(u"presentation.pptx", SaveFormat::Pptx); ``` ### **Format Summary Zoom Sections** This example formats the first entry in [ISummaryZoomFrame::get_SummaryZoomCollection](https://reference.aspose.com/slides/cpp/aspose.slides/isummaryzoomframe/get_summaryzoomcollection/), using the zero-based index `0`. It requires a local image for [IZoomObject::set_ZoomImage](https://reference.aspose.com/slides/cpp/aspose.slides/izoomobject/set_zoomimage/), applies a 1.5-point, dash-dot black border, and sets [IZoomObject::set_TransitionDuration](https://reference.aspose.com/slides/cpp/aspose.slides/izoomobject/set_transitionduration/) to 1.5 seconds. Setting [IZoomObject::set_ReturnToParent](https://reference.aspose.com/slides/cpp/aspose.slides/izoomobject/set_returntoparent/) to `false` disables the automatic return to the summary slide for this entry. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System::Drawing; auto presentation = System::MakeObject(); auto overviewSlide = presentation->get_Slide(0); auto slide = presentation->get_Slides()->AddEmptySlide(overviewSlide->get_LayoutSlide()); slide->get_Background()->get_FillFormat()->set_FillType(FillType::Solid); slide->get_Background()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Brown()); slide->get_Background()->set_Type(BackgroundType::OwnBackground); presentation->get_Sections()->AddSection(u"Section 1", slide); slide = presentation->get_Slides()->AddEmptySlide(overviewSlide->get_LayoutSlide()); slide->get_Background()->get_FillFormat()->set_FillType(FillType::Solid); slide->get_Background()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Aqua()); slide->get_Background()->set_Type(BackgroundType::OwnBackground); presentation->get_Sections()->AddSection(u"Section 2", slide); auto summaryZoomFrame = overviewSlide->get_Shapes()->AddSummaryZoomFrame(150, 50, 300, 200); auto summarySection = summaryZoomFrame->get_SummaryZoomCollection()->idx_get(0); auto image = Images::FromFile(u"image.png"); auto previewImage = presentation->get_Images()->AddImage(image); image->Dispose(); summarySection->set_ZoomImage(previewImage); summarySection->set_ReturnToParent(false); summarySection->get_LineFormat()->get_FillFormat()->set_FillType(FillType::Solid); summarySection->get_LineFormat()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Black()); summarySection->get_LineFormat()->set_DashStyle(LineDashStyle::DashDot); summarySection->get_LineFormat()->set_Width(1.5f); summarySection->set_TransitionDuration(1.5f); presentation->Save(u"presentation.pptx", SaveFormat::Pptx); ``` ## **FAQ** **Can I control returning to the 'parent' slide after showing the target?** Yes. Set [IZoomObject::set_ReturnToParent](https://reference.aspose.com/slides/cpp/aspose.slides/izoomobject/set_returntoparent/) to `true` to return to the originating slide after the target content is shown. **Can I adjust the 'speed' or duration of the Zoom transition?** Yes. Set [IZoomObject::set_TransitionDuration](https://reference.aspose.com/slides/cpp/aspose.slides/izoomobject/set_transitionduration/) to control the transition duration in seconds. **Are there limits on how many Zoom objects a presentation can contain?** There is no hard API limit documented. Practical limits depend on overall presentation complexity and the viewer's performance. You can add many Zoom frames, but consider file size and rendering time. # Manage Tags and Custom Data in Presentations Using C++ > Learn how to manage tags and custom XML data in PowerPoint presentations with Aspose.Slides for C++, including adding, reading, updating, auditing, and removing custom XML parts. Source: https://docs.aspose.com/slides/cpp/managing-tags-and-custom-data/ Updated: 2026-08-13 ## **Overview** This article explains how Aspose.Slides works with tags and custom data in PowerPoint presentations. Presentation-specific data can be stored as tags or custom XML parts. Tags are simple key-value string pairs, while custom XML parts can store structured metadata and application-specific XML payloads. Aspose.Slides provides APIs for adding, reading, updating, auditing, and removing custom XML parts at the presentation, slide, and shape levels. Custom XML parts are useful for integrations that store information such as document-management identifiers, workflow state, compliance metadata, template-binding data, or other structured application data inside a presentation. ## **Data Storage in Presentation Files** PPTX files—files with the `.pptx` extension—are stored in the PresentationML format, which is part of the Office Open XML specification. Office Open XML defines the package structure and relationships used to store presentation content and related data. A presentation contains multiple parts connected by relationships. For example, a slide part contains the content of a single slide and can have explicit relationships to other parts defined by ISO/IEC 29500. Custom data can be stored as tags ([ITagCollection](https://reference.aspose.com/slides/cpp/aspose.slides/itagcollection/)) or custom XML parts ([ICustomXmlPartCollection](https://reference.aspose.com/slides/cpp/aspose.slides/icustomxmlpartcollection/)). Both are available through the [`ICustomData`](https://reference.aspose.com/slides/cpp/aspose.slides/icustomdata/) interface. Tags store simple string key-value pairs. Custom XML parts store structured XML data and can be associated with a presentation, slide, or shape. ## **Work with Custom XML Parts** The [`ICustomData::get_CustomXmlParts`](https://reference.aspose.com/slides/cpp/aspose.slides/icustomdata/get_customxmlparts/) method returns the collection of custom XML parts associated with a particular presentation object. For example: - `presentation->get_CustomData()->get_CustomXmlParts()` contains custom XML parts associated with the presentation itself. - `slide->get_CustomData()->get_CustomXmlParts()` contains custom XML parts associated with a specific slide. - `shape->get_CustomData()->get_CustomXmlParts()` contains custom XML parts associated with a specific shape. Use [`Presentation::get_AllCustomXmlParts`](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/get_allcustomxmlparts/) when you need to inspect all custom XML parts in the presentation regardless of where they are associated. ### **Add a Custom XML Part to a Presentation** Use [`ICustomXmlPartCollection::Add`](https://reference.aspose.com/slides/cpp/aspose.slides/icustomxmlpartcollection/add/) to add XML data to a custom XML part collection. The XML must be valid and non-empty. The following example adds structured metadata to the presentation-level custom data collection: ```cpp #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; System::String customXmlContent = u"" u"" u"DOC-1001" u"Draft" u""; auto presentation = System::MakeObject(); auto customXmlPart = presentation->get_CustomData()->get_CustomXmlParts()->Add(customXmlContent); // Add assigns an identifier automatically. Set a specific GUID only when required. customXmlPart->set_ItemId(System::Guid::NewGuid()); presentation->Save(u"presentation_with_custom_xml.pptx", SaveFormat::Pptx); ``` The `Add` method can also accept XML as a byte array or stream, which is useful when XML content is already available in binary form. ### **Add a Custom XML Part to a Slide or Shape** Custom XML data can be associated with a specific slide or shape instead of the whole presentation. This is useful when metadata describes only one object, such as a template key, external record identifier, or binding information. The following example adds one custom XML part to a slide and another to a shape: ```cpp #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(); auto slide = presentation->get_Slides()->idx_get(0); slide->get_CustomData()->get_CustomXmlParts()->Add( u"" u"TitleSlide" u""); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 50.0f, 50.0f, 250.0f, 80.0f); shape->get_TextFrame()->set_Text(u"Customer data"); shape->get_CustomData()->get_CustomXmlParts()->Add( u"" u"CRM-4281" u""); presentation->Save(u"object_custom_xml.pptx", SaveFormat::Pptx); ``` The level at which a part is added determines which object's `get_CustomData()->get_CustomXmlParts()` collection contains the relationship to that part. Presentation-level data is appropriate for document-wide metadata, slide-level data for information that belongs to a particular slide, and shape-level data for metadata tied to an individual shape. ### **List and Audit All Custom XML Parts** Use [`Presentation::get_AllCustomXmlParts`](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/get_allcustomxmlparts/) to retrieve all custom XML parts from a presentation. Each [`ICustomXmlPart`](https://reference.aspose.com/slides/cpp/aspose.slides/icustomxmlpart/) exposes its identifier, XML content, and associated namespace schemas. The following example lists all custom XML parts and their namespace schemas: ```cpp #include #include #include using namespace Aspose::Slides; auto presentation = System::MakeObject(u"presentation.pptx"); for (auto customXmlPart : presentation->get_AllCustomXmlParts()) { System::Console::WriteLine(System::String(u"ItemId: ") + customXmlPart->get_ItemId().ToString()); System::Console::WriteLine(u"XML:"); System::Console::WriteLine(customXmlPart->get_XmlAsString()); for (auto namespaceSchema : customXmlPart->get_NamespaceSchemas()) { System::Console::WriteLine(System::String(u"Namespace schema: ") + namespaceSchema); } System::Console::WriteLine(); } ``` [`ICustomXmlPart::get_NamespaceSchemas`](https://reference.aspose.com/slides/cpp/aspose.slides/icustomxmlpart/get_namespaceschemas/) returns the XML schemas associated with the custom XML part. This information can be useful when auditing presentations that contain XML produced by external systems. ### **Read and Update XML Content and ItemId** Use [`ICustomXmlPart::get_XmlAsString`](https://reference.aspose.com/slides/cpp/aspose.slides/icustomxmlpart/get_xmlasstring/) and `set_XmlAsString` to work with XML as a UTF-8 string, or [`ICustomXmlPart::get_XmlData`](https://reference.aspose.com/slides/cpp/aspose.slides/icustomxmlpart/get_xmldata/) and `set_XmlData` to work with the raw XML bytes. Both representations can be read and updated. The [`ICustomXmlPart::get_ItemId`](https://reference.aspose.com/slides/cpp/aspose.slides/icustomxmlpart/get_itemid/) method returns the GUID that identifies the custom XML part in the Office Open XML document. The identifier can also be changed with `set_ItemId` when an integration requires a new identifier. The following example updates the XML content and the identifier: ```cpp #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(u"presentation.pptx"); auto customXmlPart = presentation->get_AllCustomXmlParts()->idx_get(0); // Read the current XML as text. auto currentXmlContent = customXmlPart->get_XmlAsString(); System::Console::WriteLine(currentXmlContent); // Update the XML as a UTF-8 string. customXmlPart->set_XmlAsString( u"" u"DOC-1001" u"Approved" u""); // XmlData provides the same XML content as raw bytes. auto customXmlData = customXmlPart->get_XmlData(); System::Console::WriteLine(System::Text::Encoding::get_UTF8()->GetString(customXmlData)); // Replace the identifier when required by the integration. customXmlPart->set_ItemId(System::Guid::NewGuid()); presentation->Save(u"updated_custom_xml.pptx", SaveFormat::Pptx); ``` When assigning XML with `set_XmlAsString` or `set_XmlData`, provide valid, non-empty XML. Use one representation or the other depending on whether the application works primarily with strings or byte data. ### **Remove a Custom XML Part** Aspose.Slides provides several ways to remove custom XML data: - [`ICustomXmlPart::Remove`](https://reference.aspose.com/slides/cpp/aspose.slides/icustomxmlpart/remove/) removes the custom XML part from the presentation. - [`ICustomXmlPartCollection::Remove`](https://reference.aspose.com/slides/cpp/aspose.slides/icustomxmlpartcollection/remove/) removes a specific part from a custom XML part collection. - [`ICustomXmlPartCollection::RemoveAt`](https://reference.aspose.com/slides/cpp/aspose.slides/icustomxmlpartcollection/removeat/) removes the part at a specified collection index. - [`ICustomXmlPartCollection::Clear`](https://reference.aspose.com/slides/cpp/aspose.slides/icustomxmlpartcollection/clear/) removes all parts from a specific collection. The following example removes one presentation-level custom XML part by reference: ```cpp #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(u"presentation.pptx"); auto customXmlParts = presentation->get_CustomData()->get_CustomXmlParts(); if (customXmlParts->get_Count() > 0) { auto customXmlPart = customXmlParts->idx_get(0); customXmlParts->Remove(customXmlPart); } presentation->Save(u"custom_xml_removed.pptx", SaveFormat::Pptx); ``` If you already have an `ICustomXmlPart` and want to remove that part from the presentation rather than addressing a particular collection, call `customXmlPart->Remove()`. You can also remove an item by index: ```cpp presentation->get_CustomData()->get_CustomXmlParts()->RemoveAt(0); ``` ### **Clear All Custom XML Parts from a Collection** Use `Clear` when all custom XML parts associated with a particular presentation object should be removed. ```cpp #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(u"presentation.pptx"); presentation->get_Slides()->idx_get(0)->get_CustomData()->get_CustomXmlParts()->Clear(); presentation->Save(u"slide_custom_xml_cleared.pptx", SaveFormat::Pptx); ``` `Clear` affects only the selected collection. For example, clearing a slide's collection does not clear the presentation-level or shape-level collections. To remove every custom XML part in the presentation, iterate through `get_AllCustomXmlParts()` and remove each part: ```cpp #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(u"presentation.pptx"); for (auto customXmlPart : presentation->get_AllCustomXmlParts()) { customXmlPart->Remove(); } presentation->Save(u"all_custom_xml_removed.pptx", SaveFormat::Pptx); ``` ### **Handle Linked or Shared Custom XML Parts** In an Office Open XML presentation, the same custom XML part can be referenced from more than one presentation object. For example, an existing file can contain relationships from multiple slides or shapes to the same underlying custom XML part. A shared part should be treated as one data object with multiple references: - Updating it with `set_XmlAsString`, `set_XmlData`, or `set_ItemId` changes the underlying custom XML part, so the change applies wherever that part is referenced. - `get_ItemId()` can be used to identify the same custom XML part while auditing object-level collections. - Removing a part from a specific `get_CustomXmlParts()` collection removes it from that collection. Use `ICustomXmlPart::Remove()` when the part itself should be removed from the presentation. - Before deleting or replacing a shared part, inspect the object-level collections to determine whether other slides or shapes still reference it. The `Add` overloads create a new custom XML part from XML content; they do not accept an existing `ICustomXmlPart`. Therefore, shared relationships are most commonly encountered when loading presentations that already contain them. The following example audits presentation-, slide-, and shape-level collections by `ItemId` and reports parts referenced from more than one place: ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; struct CustomXmlReferenceEntry { System::Guid itemId; std::vector owners; }; auto presentation = System::MakeObject(u"presentation.pptx"); std::vector referencesByItemId; auto registerCustomXmlParts = [&referencesByItemId]( const System::String& ownerName, const System::SharedPtr& customXmlParts) { for (int32_t partIndex = 0; partIndex < customXmlParts->get_Count(); ++partIndex) { auto customXmlPart = customXmlParts->idx_get(partIndex); auto itemId = customXmlPart->get_ItemId(); auto entry = std::find_if( referencesByItemId.begin(), referencesByItemId.end(), [&itemId](const CustomXmlReferenceEntry& referenceEntry) { return referenceEntry.itemId == itemId; }); if (entry == referencesByItemId.end()) { referencesByItemId.push_back({ itemId, { ownerName } }); } else { entry->owners.push_back(ownerName); } } }; registerCustomXmlParts(u"Presentation", presentation->get_CustomData()->get_CustomXmlParts()); for (int32_t slideIndex = 0; slideIndex < presentation->get_Slides()->get_Count(); ++slideIndex) { auto slide = presentation->get_Slides()->idx_get(slideIndex); registerCustomXmlParts( System::String::Format(u"Slide {0}", slideIndex + 1), slide->get_CustomData()->get_CustomXmlParts()); for (int32_t shapeIndex = 0; shapeIndex < slide->get_Shapes()->get_Count(); ++shapeIndex) { auto shape = slide->get_Shapes()->idx_get(shapeIndex); registerCustomXmlParts( System::String::Format(u"Slide {0}, shape {1}", slideIndex + 1, shapeIndex), shape->get_CustomData()->get_CustomXmlParts()); } } for (const auto& referenceEntry : referencesByItemId) { if (referenceEntry.owners.size() > 1) { System::Console::WriteLine( System::String(u"Shared custom XML part: ") + referenceEntry.itemId.ToString()); for (const auto& ownerName : referenceEntry.owners) { System::Console::WriteLine(System::String(u" Referenced by: ") + ownerName); } } } ``` This type of audit is useful before modifying or deleting custom XML data in presentations created by external systems, because the same metadata part may participate in more than one relationship. ## **Get Values of Tags** In slides, a tag corresponds to the `IDocumentProperties::get_Keywords` property. This sample code shows how to get a tag value with Aspose.Slides for C++ for [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/): ```cpp #include #include using namespace Aspose::Slides; auto presentation = System::MakeObject(u"presentation.pptx"); auto keywords = presentation->get_DocumentProperties()->get_Keywords(); ``` ## **Add Tags to Presentations** Aspose.Slides allows you to add tags to presentations. A tag typically consists of two items: - the name of a custom property, for example, `MyTag`; - the value of the custom property, for example, `My Tag Value`. If you need to classify presentations based on a specific rule or property, you can add tags for that purpose. For example, if you want to categorize presentations from North American countries, you can create a North American tag and assign the relevant country as its value. This sample code shows how to add a tag to a [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) using Aspose.Slides for C++: ```cpp #include #include #include using namespace Aspose::Slides; auto presentation = System::MakeObject(u"presentation.pptx"); auto tags = presentation->get_CustomData()->get_Tags(); tags->idx_set(u"MyTag", u"My Tag Value"); ``` Tags can also be set for a [Slide](https://reference.aspose.com/slides/cpp/aspose.slides/slide/): ```cpp #include #include #include #include using namespace Aspose::Slides; auto presentation = System::MakeObject(); auto slide = presentation->get_Slides()->idx_get(0); slide->get_CustomData()->get_Tags()->idx_set(u"tag", u"value"); ``` Or for an individual [Shape](https://reference.aspose.com/slides/cpp/aspose.slides/shape/): ```cpp #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; auto presentation = System::MakeObject(); auto slide = presentation->get_Slides()->idx_get(0); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 10.0f, 10.0f, 100.0f, 50.0f); shape->get_TextFrame()->set_Text(u"My text"); shape->get_CustomData()->get_Tags()->idx_set(u"tag", u"value"); ``` ### **Limitations** Tags added through the `get_CustomData()->get_Tags()` collection are stored only in the PowerPoint file. They are **not** transferred to the PDF tag structure when the presentation is exported to PDF. Consequently, a custom identifier assigned as a tag cannot be retrieved from the tagged PDF. **Workaround**: You can store a custom identifier in the object's **Alt Text** (for example, `shape->set_AlternativeText(u"MyId")`). After exporting to PDF, the Alt Text may appear in the PDF tag structure. ## **FAQ** **Can I remove all tags from a presentation, slide, or shape in one operation?** Yes. The [tag collection](https://reference.aspose.com/slides/cpp/aspose.slides/tagcollection/) supports a [Clear](https://reference.aspose.com/slides/cpp/aspose.slides/tagcollection/clear/) operation that deletes all key-value pairs at once. **How do I delete a single tag by its name without iterating over the whole collection?** Use [Remove(name)](https://reference.aspose.com/slides/cpp/aspose.slides/tagcollection/remove/) on [TagCollection](https://reference.aspose.com/slides/cpp/aspose.slides/tagcollection/) to delete the tag by its key. **How can I retrieve the complete list of tag names for analytics or filtering?** Use [GetNamesOfTags](https://reference.aspose.com/slides/cpp/aspose.slides/tagcollection/getnamesoftags/) on the [tag collection](https://reference.aspose.com/slides/cpp/aspose.slides/tagcollection/); it returns an array of all tag names. **How can I find all custom XML parts regardless of where they are stored?** Use [`Presentation::get_AllCustomXmlParts`](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/get_allcustomxmlparts/) to retrieve all custom XML parts in the presentation. **Should I use `get_XmlAsString`/`set_XmlAsString` or `get_XmlData`/`set_XmlData` to update a custom XML part?** Use `get_XmlAsString` and `set_XmlAsString` when the application works with UTF-8 XML text. Use `get_XmlData` and `set_XmlData` when the XML is already available as a byte array or when binary-oriented processing is more convenient. Both representations refer to the XML content of the same custom XML part. # Efficiently Merge Presentations in C++ > Learn how to merge PowerPoint and OpenDocument presentations in C++ by cloning slides, controlling masters and layouts, resizing slide content, preserving sections, and handling protected or large files. Source: https://docs.aspose.com/slides/cpp/merge-presentation/ Updated: 2026-11-08 ## **Overview** Aspose.Slides for C++ merges presentations by cloning slides from one [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) into another. The main operation is [ISlideCollection::AddClone](https://reference.aspose.com/slides/cpp/aspose.slides/islidecollection/addclone/), which can preserve the source slide's formatting or attach the cloned slide to a master or layout in the destination presentation. This article covers the most common merging workflows: - merge all slides while preserving their source formatting; - merge selected slides; - apply a master from the destination presentation; - apply a specific layout from the destination presentation; - normalize different slide sizes before merging; - add cloned slides to a section; - merge several presentations in one end-to-end workflow; - handle masters, resources, notes, comments, media, fonts, passwords, large files, and multithreading concerns. ## **How Slide Cloning Affects Masters and Layouts** A slide inherits much of its appearance from its layout and master. For that reason, the cloning overload you choose determines how the merged slide is integrated into the destination presentation. Use [ISlideCollection::AddClone](https://reference.aspose.com/slides/cpp/aspose.slides/islidecollection/addclone/) in one of these ways: - `AddClone(sourceSlide)` — preserve the source slide's layout and formatting. When required, the source master can be cloned into the destination presentation automatically. Aspose.Slides tracks automatically cloned masters so repeated slides that use the same source master do not cause that master to be cloned repeatedly. - `AddClone(sourceSlide, destinationMaster, allowCloneMissingLayout)` — attach the cloned slide to a specific destination [IMasterSlide](https://reference.aspose.com/slides/cpp/aspose.slides/imasterslide/). Aspose.Slides looks for a matching layout under that master by layout type or name. - `AddClone(sourceSlide, destinationLayout)` — attach the cloned slide directly to a specific destination [ILayoutSlide](https://reference.aspose.com/slides/cpp/aspose.slides/ilayoutslide/). The master or layout passed to an `AddClone` overload must belong to the **destination** presentation, not the source presentation. [![Three actual renders use the blue source banner, orange destination-master banner, or green destination-layout banner while retaining the content panel.](https://docs.aspose.com/slides/cpp/merge-presentation/visual-merge-presentation-9d5f131d779a.svg)](https://docs.aspose.com/slides/cpp/merge-presentation/visual-merge-presentation-9d5f131d779a.svg) *Illustrative .NET 26.11 fixture comparing source design, a selected destination master with a matching layout, and an explicit destination layout. The panel retains its explicit geometry and looks the same in this fixture. The selected master or layout must belong to the destination; changing inheritance does not redesign every object.* ## **Merge Entire Presentations and Preserve Source Formatting** The simplest merge copies every slide from the source presentation to the destination presentation. This is the appropriate choice when the imported slides should keep their original theme, master, and layout relationships. ```cpp #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto destination = System::MakeObject(u"destination.pptx"); auto source = System::MakeObject(u"source.pptx"); for (const auto& slide : source->get_Slides()) { destination->get_Slides()->AddClone(slide); } destination->Save(u"merged.pptx", SaveFormat::Pptx); ``` The resulting presentation may contain multiple masters when the source and destination use different designs. This is expected when source formatting is intentionally preserved. ## **Merge Selected Slides** You do not have to clone every slide. The following example imports only selected slide indexes from the source presentation. ```cpp #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto destination = System::MakeObject(u"destination.pptx"); auto source = System::MakeObject(u"source.pptx"); int32_t slideIndexes[] = {0, 2, 4}; for (auto index : slideIndexes) { destination->get_Slides()->AddClone(source->get_Slide(index)); } destination->Save(u"merged-selected-slides.pptx", SaveFormat::Pptx); ``` Validate slide indexes before cloning when they come from user input or external configuration. ## **Merge Slides Using a Destination Master** Use the [AddClone(ISlide, IMasterSlide, bool)](https://reference.aspose.com/slides/cpp/aspose.slides/islidecollection/addclone/) overload when imported slides should follow a master that already belongs to the destination presentation. ```cpp #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto destination = System::MakeObject(u"destination.pptx"); auto source = System::MakeObject(u"source.pptx"); auto destinationMaster = destination->get_Master(0); for (const auto& slide : source->get_Slides()) { destination->get_Slides()->AddClone(slide, destinationMaster, true); } destination->Save(u"merged-with-destination-master.pptx", SaveFormat::Pptx); ``` Aspose.Slides selects an appropriate layout under the specified master by matching the source layout's type or name. If no suitable layout exists and `allowCloneMissingLayout` is `true`, the source layout is cloned so the slide can be added. If it is `false`, a [PptxEditException](https://reference.aspose.com/slides/cpp/aspose.slides/details_pptxeditexception/) is thrown. Use `false` when you want the merge to fail instead of introducing an additional layout into the destination master. ## **Merge Slides Using a Specific Destination Layout** Use the [AddClone(ISlide, ILayoutSlide)](https://reference.aspose.com/slides/cpp/aspose.slides/islidecollection/addclone/) overload when you know exactly which destination layout the imported slides should use. ```cpp #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto destination = System::MakeObject(u"destination.pptx"); auto source = System::MakeObject(u"source.pptx"); auto destinationLayout = destination->get_LayoutSlide(0); for (const auto& slide : source->get_Slides()) { destination->get_Slides()->AddClone(slide, destinationLayout); } destination->Save(u"merged-with-destination-layout.pptx", SaveFormat::Pptx); ``` Applying a destination layout changes the inherited layout relationship; it does not redesign the source slide content. If the source and destination layouts have different placeholder structures, inspect the result to confirm that the inherited formatting and placeholder behavior are appropriate. ## **Merge Presentations with Different Slide Sizes** Presentations with different slide dimensions can be merged, but cloning a slide into a presentation with another slide size does not automatically redesign its content for the new canvas. Shapes may therefore appear shifted, scaled unexpectedly, or outside the visible slide area. A practical approach is to resize the source presentation before cloning. The [SlideSize::SetSize](https://reference.aspose.com/slides/cpp/aspose.slides/slidesize/setsize/) method can scale existing content while changing the slide dimensions. [SlideSizeScaleType::EnsureFit](https://reference.aspose.com/slides/cpp/aspose.slides/slidesizescaletype/) scales content to fit within the requested size. ```cpp #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto destination = System::MakeObject(u"destination.pptx"); auto source = System::MakeObject(u"source.pptx"); auto destinationSize = destination->get_SlideSize()->get_Size(); auto sourceSize = source->get_SlideSize()->get_Size(); if (sourceSize.get_Width() != destinationSize.get_Width() || sourceSize.get_Height() != destinationSize.get_Height()) { source->get_SlideSize()->SetSize( destinationSize.get_Width(), destinationSize.get_Height(), SlideSizeScaleType::EnsureFit); } for (const auto& slide : source->get_Slides()) { destination->get_Slides()->AddClone(slide); } destination->Save(u"merged-same-slide-size.pptx", SaveFormat::Pptx); ``` Resizing changes the source presentation object in memory. If you need the original source presentation unchanged for other operations, open a separate instance for the merge. ## **Merge Slides into a Presentation Section** The basic slide-cloning loop does not recreate the source presentation's section hierarchy. If sections matter in the output, create or select sections in the destination presentation and clone slides into them explicitly with [AddClone(ISlide, ISection)](https://reference.aspose.com/slides/cpp/aspose.slides/islidecollection/addclone/). ```cpp #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto destination = System::MakeObject(u"destination.pptx"); auto source = System::MakeObject(u"source.pptx"); auto importedSection = destination->get_Sections()->AppendEmptySection(u"Imported slides"); for (const auto& slide : source->get_Slides()) { destination->get_Slides()->AddClone(slide, importedSection); } destination->Save(u"merged-with-section.pptx", SaveFormat::Pptx); ``` The cloned slides are appended to the specified destination section. To preserve several source sections, enumerate [Presentation::get_Sections](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/get_sections/), retrieve each source section's current slides with [ISection::GetSlidesListOfSection](https://reference.aspose.com/slides/cpp/aspose.slides/isection/getslideslistofsection/), recreate the sections in the destination, and clone each returned slide into its corresponding destination section. See [Manage Slide Sections](https://docs.aspose.com/slides/cpp/slide-section/) for a complete section-enumeration example, including empty sections and structural changes. ## **Merge Multiple Presentations Safely** The following end-to-end example uses the first presentation as the destination, normalizes the slide size of each additional source, keeps each source open only while it is being copied, and saves the final file once. ```cpp #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; System::String inputFiles[] = {u"part1.pptx", u"part2.pptx", u"part3.pptx"}; const int32_t inputFileCount = 3; auto merged = System::MakeObject(inputFiles[0]); auto mergedSize = merged->get_SlideSize()->get_Size(); for (int32_t fileIndex = 1; fileIndex < inputFileCount; fileIndex++) { auto source = System::MakeObject(inputFiles[fileIndex]); auto sourceSize = source->get_SlideSize()->get_Size(); if (sourceSize.get_Width() != mergedSize.get_Width() || sourceSize.get_Height() != mergedSize.get_Height()) { source->get_SlideSize()->SetSize( mergedSize.get_Width(), mergedSize.get_Height(), SlideSizeScaleType::EnsureFit); } for (const auto& slide : source->get_Slides()) { merged->get_Slides()->AddClone(slide); } } merged->Save(u"merged.pptx", SaveFormat::Pptx); ``` This is a useful baseline for preserving the source formatting of imported slides. If your output must use a single destination theme, replace the simple `AddClone(slide)` call with the appropriate destination-master or destination-layout overload shown earlier. ## **Practical Considerations** ### **Masters, Layouts, and Formatting Fidelity** Default slide cloning can automatically bring a required source master into the destination presentation. Aspose.Slides keeps an internal registry for automatically cloned masters to avoid cloning the same master repeatedly. Manually cloned masters are not tracked by that registry, so avoid pre-cloning masters unless you need explicit control over the master structure. Do not assume that two masters or layouts with the same name are visually equivalent. If a corporate template must control the final appearance, choose a destination master or layout explicitly and verify the result after merging. ### **Notes and Comments** Speaker notes and slide comments are associated with slide content and are copied when a slide is cloned. Aspose.Slides also exposes dedicated APIs for [presentation notes](https://docs.aspose.com/slides/cpp/presentation-notes/) and [presentation comments](https://docs.aspose.com/slides/cpp/presentation-comments/). If notes-page formatting is important, verify the merged presentation because notes masters are presentation-level objects and may differ between source files. For review workflows, also verify comment authors and threaded comments after combining files from different authors or templates. ### **Images, Audio, Video, OLE Objects, and External Links** Slides can reference presentation-level resources such as images, embedded audio, embedded video, and OLE data. Clone the slide itself rather than copying only its visible shapes so Aspose.Slides can maintain the slide's relationships to its resources. Embedded and linked resources should be treated differently. A linked audio, video, OLE object, or hyperlink remains dependent on its external target; cloning a slide does not turn an external link into embedded content. Test linked-resource paths and URLs in the environment where the merged presentation will be opened. Aspose.Slides explicitly tracks automatically cloned masters, but this should not be treated as a general guarantee that identical binary resources from unrelated source presentations will always be deduplicated. If output file size is important, inspect the merged package and measure the result instead of relying on implicit deduplication. ### **Embedded Fonts and Font Availability** Fonts are managed at the presentation level. If typography must remain consistent across machines, do not assume that cloning slides alone guarantees that every required font is available in the destination environment. You can inspect embedded fonts with [FontsManager::GetEmbeddedFonts](https://reference.aspose.com/slides/cpp/aspose.slides/fontsmanager/getembeddedfonts/) and manage embedding explicitly as described in [Embed Fonts in Presentations](https://docs.aspose.com/slides/cpp/embedded-font/). Also verify that you are permitted to embed the fonts used by the source files. Font licenses can restrict embedding. ### **Password-Protected Presentations** A password-protected source must be opened successfully before its slides can be cloned. Supply the password through [LoadOptions::set_Password](https://reference.aspose.com/slides/cpp/aspose.slides/loadoptions/set_password/). ```cpp #include #include using namespace Aspose::Slides; auto loadOptions = System::MakeObject(); loadOptions->set_Password(u"YOUR_PASSWORD"); auto source = System::MakeObject(u"protected.pptx", loadOptions); ``` Opening an encrypted source does not automatically apply the same protection to the destination presentation. Configure output protection separately when required. ### **Large Presentations and Memory Use** Large presentations containing high-resolution images, audio, video, or other large binary objects can consume significant memory. [LoadOptions::set_BlobManagementOptions](https://reference.aspose.com/slides/cpp/aspose.slides/loadoptions/set_blobmanagementoptions/) provides controls for BLOB handling and temporary-file usage. See [Manage Presentation BLOBs](https://docs.aspose.com/slides/cpp/manage-blob/) for large-file strategies. For large files, prefer loading from file paths when possible, dispose each source presentation as soon as it has been merged, and avoid repeatedly saving intermediate results unless the workflow requires checkpoints. ### **Thread Safety** Do not load, modify, save, or clone the same [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) instance concurrently from multiple threads. Keep each presentation instance confined to one merge operation. If you parallelize independent jobs, use independent presentation instances and follow the [Aspose.Slides multithreading guidance](https://docs.aspose.com/slides/cpp/multithreading/). ## **FAQ** **How do I keep each source presentation's original design?** Use [AddClone](https://reference.aspose.com/slides/cpp/aspose.slides/islidecollection/addclone/) without supplying a destination master or layout. Aspose.Slides can automatically clone the source master when it is needed by the imported slide. **How do I make imported slides use the destination theme?** Use the overload that accepts a destination master. Pass a master from the destination presentation, not from the source. Aspose.Slides will try to map each source slide to an appropriate layout under that master. **When should I use a specific destination layout instead of a destination master?** Use a specific layout when every imported slide should use one known layout. Use a master when you want Aspose.Slides to select among that master's layouts based on the source layout type or name. **Can presentations with different slide sizes be merged?** Yes, but slide content is not automatically redesigned for the destination dimensions. Resize the source presentation first when you need predictable placement, for example with [SlideSize::SetSize](https://reference.aspose.com/slides/cpp/aspose.slides/slidesize/setsize/) and [SlideSizeScaleType::EnsureFit](https://reference.aspose.com/slides/cpp/aspose.slides/slidesizescaletype/). **Can I merge PPT, PPTX, and ODP presentations into one file?** Yes. Load each source presentation, clone the required slides into one destination, and save the destination in a supported output format. Because presentation formats do not support exactly the same feature set, verify complex content after cross-format merges. See [Supported File Formats](https://docs.aspose.com/slides/cpp/supported-file-formats/). **Are source sections preserved automatically?** Not by a basic loop that only clones slides. Recreate the required sections in the destination and use the section overload of [AddClone](https://reference.aspose.com/slides/cpp/aspose.slides/islidecollection/addclone/) when section structure must be preserved. **Are speaker notes and comments preserved?** They are copied with the cloned slide. For workflows that depend on notes-master styling, comment authors, or threaded review data, verify the merged result because those scenarios involve presentation-level structures as well as slide-level content. **What happens to audio, video, OLE objects, and hyperlinks?** Embedded content is carried as part of the cloned slide's resource relationships. External links remain external, so their target files or URLs must still be available after the merge. **Are embedded fonts from every source guaranteed to be available in the merged presentation?** Do not rely on slide cloning alone for font deployment. Inspect the destination's embedded fonts and explicitly manage font embedding or external font availability when typography is important. **How do I merge a password-protected file?** Open it with the correct [LoadOptions::set_Password](https://reference.aspose.com/slides/cpp/aspose.slides/loadoptions/set_password/), then clone its slides normally. Output protection is configured separately. **How should I handle very large presentations?** Use BLOB management when large binary objects dominate memory usage, prefer file-path loading for very large files, dispose source presentations promptly, and save the final result only when needed. **Can I merge slides from multiple threads?** Do not use one [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) instance concurrently from multiple threads. Keep each merge operation isolated to its own presentation instances. # Microsoft PowerPoint (PPT) > Source: https://docs.aspose.com/slides/cpp/microsoft-powerpoint-ppt/ Updated: 2024-11-01 ## **About PPT** [PPT](https://en.wikipedia.org/wiki/Microsoft_PowerPoint) is the presentation document file format that can be created, read, manipulated and written by different versions of Microsoft PowerPoint. This is the binary format for presentation documents developed by Microsoft. ## **PPT in Aspose.Slides for C++** Aspose.Slides for C++ can read PPT files created by the software listed below. - Microsoft PowerPoint 97 - Microsoft PowerPoint 2000 - Microsoft PowerPoint XP - Microsoft PowerPoint 2003 Similarly, PPT files created by Aspose.Slides for C++ can be read by the above set of software. ## **Comprehensive Support for PPT** Aspose.Slides for C++ provides support for almost all the features related to the PPT document file format. It not only covers the basic/advanced features provided by different Microsoft PowerPoint versions for PPT document manipulations, but also some features that are not even supported by Microsoft PowerPoint. The main advantage of using Aspose.Slides for C++ API library is the ease of use for handling such features. In addition to the basic tasks related to creating, reading and writing PPT document files, there are several features that are provided by Aspose.Slides for C++ like: - Import other MS Office file formats as OLE Objects in PPT documents - Export PPT documents to PDF, TIFF, XPS formats - Export slides in the PPT documents to SVG formats - Render slide to any image format supported by C++ Framework - Set size of slides in the PPT document - Manage animations on shapes - Manage slide shows - Format text on slides - Scan text from the PPT documents - Handle tables on slides - Automatic copying of masters using cloning feature ## Related articles - [Different File Formats and Conversions](https://docs.aspose.com/slides/cpp/different-file-formats-and-conversions/) # Enhance Image Processing with the Modern API > Modernize slide image processing by replacing deprecated imaging APIs with the C++ Modern API for seamless PowerPoint and OpenDocument automation. Source: https://docs.aspose.com/slides/cpp/modern-api/ Updated: 2026-08-05 ## **Introduction** Currently, the Aspose.Slides for C++ library has dependencies in its public API on the following classes from System::Drawing: - [System::Drawing::Graphics](https://reference.aspose.com/slides/cpp/system.drawing/graphics/) - [System::Drawing::Image](https://reference.aspose.com/slides/cpp/system.drawing/image/) - [System::Drawing::Bitmap](https://reference.aspose.com/slides/cpp/system.drawing/bitmap/) As of version 24.4, this public API is declared deprecated. In order to get rid of dependencies on System::Drawing in the public API, we added the so-called "Modern API". Methods with [System::Drawing::Image](https://reference.aspose.com/slides/cpp/system.drawing/image/) and [System::Drawing::Bitmap](https://reference.aspose.com/slides/cpp/system.drawing/bitmap/) are declared deprecated and should be replaced with the corresponding methods from the Modern API. Methods with [System::Drawing::Graphics](https://reference.aspose.com/slides/cpp/system.drawing/graphics/) are declared deprecated and have no direct Modern API replacement. In current versions, treat the public API that depends on System::Drawing types as legacy/deprecated. Use the Modern API for new code and when migrating existing image-processing workflows. ## **Modern API** Added the following classes and enums to the public API: - [Aspose::Slides::IImage](https://reference.aspose.com/slides/cpp/aspose.slides/iimage/) - represents the raster or vector image. - [Aspose::Slides::ImageFormat](https://reference.aspose.com/slides/cpp/aspose.slides/imageformat/) - represents the file format of the image. - [Aspose::Slides::Images](https://reference.aspose.com/slides/cpp/aspose.slides/images/) - methods to instantiate and work with the [IImage](https://reference.aspose.com/slides/cpp/aspose.slides/iimage/) interface. Use `GetImage` to render a single slide or shape. Use `GetImages` to render several presentation slides. Use [Images](https://reference.aspose.com/slides/cpp/aspose.slides/images/) methods to load images, `AddImage` with [IImage](https://reference.aspose.com/slides/cpp/aspose.slides/iimage/) to add them to a presentation, and `ReplaceImage` with [IImage](https://reference.aspose.com/slides/cpp/aspose.slides/iimage/) to update an existing presentation image. A typical scenario of using the new API may look as follows: ``` cpp #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; System::SharedPtr pres = System::MakeObject(); // instantiate a disposable instance of IImage from the file on the disk. System::SharedPtr image = Images::FromFile(u"image.png"); // create a PowerPoint image by adding an instance of IImage to the presentation's images. System::SharedPtr ppImage = pres->get_Images()->AddImage(image); // add a picture shape on the slide #1 pres->get_Slide(0)->get_Shapes()->AddPictureFrame(Aspose::Slides::ShapeType::Rectangle, 10.0f, 10.0f, 100.0f, 100.0f, ppImage); // get an instance of the IImage representing slide #1. auto slideImage = pres->get_Slide(0)->GetImage(System::Drawing::Size(1920, 1080)); // save the image on the disk. slideImage->Save(u"slide1.jpeg", Aspose::Slides::ImageFormat::Jpeg); ``` ## **Replacing Old Code with Modern API** For ease of transition, the interface of the new [IImage](https://reference.aspose.com/slides/cpp/aspose.slides/iimage/) repeats the separate signatures of the [System::Drawing::Image](https://reference.aspose.com/slides/cpp/system.drawing/image/) and [System::Drawing::Bitmap](https://reference.aspose.com/slides/cpp/system.drawing/bitmap/) classes. In general, you will just need to replace the call to the old method using System::Drawing with the new one. ### **Getting a Slide Thumbnail** Legacy/deprecated API: ``` cpp #include #include using namespace Aspose::Slides; System::SharedPtr pres = System::MakeObject(u"pres.pptx"); pres->get_Slide(0)->GetThumbnail()->Save(u"slide1.png"); ``` Modern API: ``` cpp #include #include #include using namespace Aspose::Slides; System::SharedPtr pres = System::MakeObject(u"pres.pptx"); pres->get_Slide(0)->GetImage()->Save(u"slide1.png"); ``` ### **Getting a Shape Thumbnail** Legacy/deprecated API: ``` cpp #include #include #include using namespace Aspose::Slides; System::SharedPtr pres = System::MakeObject(u"pres.pptx"); pres->get_Slide(0)->get_Shape(0)->GetThumbnail()->Save(u"shape.png"); ``` Modern API: ``` cpp #include #include #include #include using namespace Aspose::Slides; System::SharedPtr pres = System::MakeObject(u"pres.pptx"); pres->get_Slide(0)->get_Shape(0)->GetImage()->Save(u"shape.png"); ``` ### **Getting a Presentation Thumbnail** Legacy/deprecated API: ``` cpp #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; System::SharedPtr pres = System::MakeObject(u"pres.pptx"); auto bitmaps = pres->GetThumbnails(System::MakeObject(), System::Drawing::Size(1980, 1028)); for (int32_t index = 0; index < bitmaps->get_Length(); index++) { System::SharedPtr thumbnail = bitmaps[index]; thumbnail->Save(System::String::Format(u"slide_{0}.png", index), System::Drawing::Imaging::ImageFormat::get_Png()); } ``` Modern API: ``` cpp #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; System::SharedPtr pres = System::MakeObject(u"pres.pptx"); auto images = pres->GetImages(System::MakeObject(), System::Drawing::Size(1980, 1028)); for (int32_t index = 0; index < images->get_Length(); index++) { System::SharedPtr thumbnail = images[index]; thumbnail->Save(System::String::Format(u"slide_{0}.png", index), Aspose::Slides::ImageFormat::Png); } ``` ### **Adding a Picture to a Presentation** Legacy/deprecated API: ``` cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; System::SharedPtr pres = System::MakeObject(); System::SharedPtr image = System::Drawing::Image::FromFile(u"image.png"); System::SharedPtr ppImage = pres->get_Images()->AddImage(image); pres->get_Slide(0)->get_Shapes()->AddPictureFrame(Aspose::Slides::ShapeType::Rectangle, 10.0f, 10.0f, 100.0f, 100.0f, ppImage); ``` Modern API: ``` cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; System::SharedPtr pres = System::MakeObject(); System::SharedPtr image = Aspose::Slides::Images::FromFile(u"image.png"); System::SharedPtr ppImage = pres->get_Images()->AddImage(image); pres->get_Slide(0)->get_Shapes()->AddPictureFrame(Aspose::Slides::ShapeType::Rectangle, 10.0f, 10.0f, 100.0f, 100.0f, ppImage); ``` ## **Deprecated Methods/Properties and Their Replacement in Modern API** ### **Presentation Class** |Method Signature|Replacement Method Signature| | :- | :- | |GetThumbnails(System::SharedPtr<Export::IRenderingOptions> options)|GetImages(System::SharedPtr<Export::IRenderingOptions> options)| |GetThumbnails(System::SharedPtr<Export::IRenderingOptions> options, System::ArrayPtr<int32_t> slides)|GetImages(System::SharedPtr<Export::IRenderingOptions> options, System::ArrayPtr<int32_t> slides)| |GetThumbnails(System::SharedPtr<Export::IRenderingOptions> options, float scaleX, float scaleY)|GetImages(System::SharedPtr<Export::IRenderingOptions> options, float scaleX, float scaleY)| |GetThumbnails(System::SharedPtr<Export::IRenderingOptions> options, System::ArrayPtr<int32_t> slides, float scaleX, float scaleY)|GetImages(System::SharedPtr<Export::IRenderingOptions> options, System::ArrayPtr<int32_t> slides, float scaleX, float scaleY)| |GetThumbnails(System::SharedPtr<Export::IRenderingOptions> options, System::Drawing::Size imageSize)|GetImages(System::SharedPtr<Export::IRenderingOptions> options, System::Drawing::Size imageSize)| |GetThumbnails(System::SharedPtr<Export::IRenderingOptions> options, System::ArrayPtr<int32_t> slides, System::Drawing::Size imageSize)|GetImages(System::SharedPtr<Export::IRenderingOptions> options, System::ArrayPtr<int32_t> slides, System::Drawing::Size imageSize)| |Save(System::String fname, System::ArrayPtr<int32_t> slides, Export::SaveFormat format)|No Modern API replacement| |Save(System::String fname, System::ArrayPtr<int32_t> slides, Export::SaveFormat format, System::SharedPtr<Export::ISaveOptions> options)|No Modern API replacement| ### **Slide Class** |Method Signature|Replacement Method Signature| | :- | :- | |GetThumbnail()|GetImage()| |GetThumbnail(float scaleX, float scaleY)|GetImage(float scaleX, float scaleY)| |GetThumbnail(System::Drawing::Size imageSize)|GetImage(System::Drawing::Size imageSize)| |GetThumbnail(System::SharedPtr<Export::ITiffOptions> options)|GetImage(System::SharedPtr<Export::IRenderingOptions> options| |GetThumbnail(System::SharedPtr<Export::IRenderingOptions> options)|GetImage(System::SharedPtr<Export::IRenderingOptions> options)| |GetThumbnail(System::SharedPtr<Export::IRenderingOptions> options, float scaleX, float scaleY)|GetImage(System::SharedPtr<Export::IRenderingOptions> options, float scaleX, float scaleY)| |GetThumbnail(System::SharedPtr<Export::IRenderingOptions> options, System::Drawing::Size imageSize)|GetImage(System::SharedPtr<Export::IRenderingOptions> options, System::Drawing::Size imageSize)| |RenderToGraphics(System::SharedPtr<Export::IRenderingOptions> options, System::SharedPtr<System::Drawing::Graphics> graphics)|No Modern API replacement| |RenderToGraphics(System::SharedPtr<Export::IRenderingOptions> options, System::SharedPtr<System::Drawing::Graphics> graphics, float scaleX, float scaleY)|No Modern API replacement| |RenderToGraphics(System::SharedPtr<Export::IRenderingOptions> options, System::SharedPtr<System::Drawing::Graphics> graphics, System::Drawing::Size renderingSize)|No Modern API replacement| ### **Shape Class** |Method Signature|Replacement Method Signature| | :- | :- | |GetThumbnail()|GetImage()| |GetThumbnail(ShapeThumbnailBounds bounds, float scaleX, float scaleY)|GetImage(ShapeThumbnailBounds bounds, float scaleX, float scaleY)| ### **ImageCollection Class** |Method Signature|Replacement Method Signature| | :- | :- | |AddImage(System::SharedPtr<System::Drawing::Image> image)|AddImage(System::SharedPtr<IImage> image)| ### **PPImage Class** |Method Signature|Replacement Method Signature| | :- | :- | |ReplaceImage(System::SharedPtr<System::Drawing::Image> newImage)|ReplaceImage(System::SharedPtr<Aspose::Slides::IImage> newImage)| |get_SystemImage()|get_Image()| ### **PatternFormat Class** |Method Signature|Replacement Method Signature| | :- | :- | |GetTileImage(System::Drawing::Color background, System::Drawing::Color foreground)|GetTile(System::Drawing::Color background, System::Drawing::Color foreground)| |GetTileImage(System::Drawing::Color styleColor)|GetTile(System::Drawing::Color styleColor)| ### **IPatternFormatEffectiveData Class** |Method Signature|Replacement Method Signature| | :- | :- | |GetTileImage(System::Drawing::Color background, System::Drawing::Color foreground)|GetTileIImage(System::Drawing::Color background, System::Drawing::Color foreground)| ## **API Support for System::Drawing::Graphics** Methods with [System::Drawing::Graphics](https://reference.aspose.com/slides/cpp/system.drawing/graphics/) are declared deprecated and have no direct Modern API replacement. Use the Modern API image-rendering methods instead of the API that renders to [System::Drawing::Graphics](https://reference.aspose.com/slides/cpp/system.drawing/graphics/): - [Slide::RenderToGraphics(System::SharedPtr<Export::IRenderingOptions>, System::SharedPtr<System::Drawing::Graphics>)](https://reference.aspose.com/slides/cpp/aspose.slides/slide/rendertographics/#sliderendertographicssystemsharedptrexportirenderingoptions-systemsharedptrsystemdrawinggraphics-method) - [Slide::RenderToGraphics(System::SharedPtr<Export::IRenderingOptions>, System::SharedPtr<System::Drawing::Graphics>, float, float)](https://reference.aspose.com/slides/cpp/aspose.slides/slide/rendertographics/#sliderendertographicssystemsharedptrexportirenderingoptions-systemsharedptrsystemdrawinggraphics-float-float-method) - [Slide::RenderToGraphics(System::SharedPtr<Export::IRenderingOptions>, System::SharedPtr<System::Drawing::Graphics>, System::Drawing::Size)](https://reference.aspose.com/slides/cpp/aspose.slides/slide/rendertographics/#sliderendertographicssystemsharedptrexportirenderingoptions-systemsharedptrsystemdrawinggraphics-systemdrawingsize-method) ## **FAQ** ### Why was [System::Drawing::Graphics](https://reference.aspose.com/slides/cpp/system.drawing/graphics/) dropped? Support for [System::Drawing::Graphics](https://reference.aspose.com/slides/cpp/system.drawing/graphics/) is deprecated in the public API to unify work with rendering and images, eliminate ties to platform-specific dependencies, and switch to a cross-platform approach with [IImage](https://reference.aspose.com/slides/cpp/aspose.slides/iimage/). Use `GetImage` or `GetImages` instead of rendering to [System::Drawing::Graphics](https://reference.aspose.com/slides/cpp/system.drawing/graphics/). ### What is the practical benefit of [IImage](https://reference.aspose.com/slides/cpp/aspose.slides/iimage/) compared to [System::Drawing::Image](https://reference.aspose.com/slides/cpp/system.drawing/image/)/[System::Drawing::Bitmap](https://reference.aspose.com/slides/cpp/system.drawing/bitmap/)? [IImage](https://reference.aspose.com/slides/cpp/aspose.slides/iimage/) unifies working with both raster and vector images, simplifies saving to various formats via [ImageFormat](https://reference.aspose.com/slides/cpp/aspose.slides/imageformat/), reduces dependence on `System::Drawing`, and makes code more portable across environments. ### Will the Modern API affect the performance of generating thumbnails? Switching from `GetThumbnail` to `GetImage` does not worsen scenarios: the new methods provide the same capabilities for producing images with options and sizes, while retaining support for rendering options. The specific gain or drop depends on the scenario, but functionally the replacements are equivalent. # Multithreading in Aspose.Slides for C++ > Aspose.Slides for C++ multithreading boosts PowerPoint and OpenDocument processing. Discover best practices for efficient presentation workflows. Source: https://docs.aspose.com/slides/cpp/multithreading/ Updated: 2026-08-05 ## **Introduction** While parallel work with presentations is possible (besides parsing/loading/cloning) and everything goes well (most times), there is a small chance you might get incorrect results when you use the library in multiple threads. We strongly recommend that you do **not** use a single [Presentation](https://reference.aspose.com/slides/cpp/class/aspose.slides.presentation) instance in a multi-threading environment because it might result in unpredictable errors or failures that are not easily detected. It is **not** safe to load, save, and/or clone an instance of a [Presentation](https://reference.aspose.com/slides/cpp/class/aspose.slides.presentation) class in multiple threads. Such operations are **not** supported. If you need to perform such tasks, you have to parallel the operations using several single-threaded processes—and each of these processes should use its own presentation instance. ## **Convert Presentation Slides to Images in Parallel** Let's say we want to convert all the slides from a PowerPoint presentation to PNG images in parallel. Since it is unsafe to use a single `Presentation` instance in multiple threads, we split the presentation slides into separate presentations and convert the slides to images in parallel, using each presentation in a separate thread. The following code example shows how to do this. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto inputFilePath = u"sample.pptx"; auto outputFilePathTemplate = u"slide_{0}.png"; auto imageScale = 2; auto presentation = MakeObject(inputFilePath); auto slideCount = presentation->get_Slides()->get_Count(); auto slideSize = presentation->get_SlideSize()->get_Size(); std::vector> conversionTasks; for (auto slideIndex = 0; slideIndex < slideCount; slideIndex++) { // Extract slide i into a separate presentation. auto slidePresentation = MakeObject(); slidePresentation->get_SlideSize()->SetSize(slideSize.get_Width(), slideSize.get_Height(), SlideSizeScaleType::DoNotScale); slidePresentation->get_Slides()->RemoveAt(0); slidePresentation->get_Slides()->AddClone(presentation->get_Slide(slideIndex)); // Convert the slide to an image in a separate task. auto slideNumber = slideIndex + 1; conversionTasks.push_back(std::async(std::launch::async, [slidePresentation = std::move(slidePresentation), slideNumber, outputFilePathTemplate, imageScale]() { SharedPtr image = nullptr; try { auto slide = slidePresentation->get_Slide(0); image = slide->GetImage(imageScale, imageScale); auto imageFilePath = String::Format(outputFilePathTemplate, slideNumber); image->Save(imageFilePath, ImageFormat::Png); } catch (Exception e) { if(image != nullptr) image->Dispose(); slidePresentation->Dispose(); } })); } // Wait for all tasks to complete. for (auto& task : conversionTasks) { task.get(); } presentation->Dispose(); ``` ## **FAQ** ### Do I need to call license setup in every thread? No. It’s enough to do it once per process/app domain before threads start. If [license setup](https://docs.aspose.com/slides/cpp/licensing/) might be invoked concurrently (for example, during lazy initialization), synchronize that call because the license setup method itself is not thread-safe. ### Can I pass `Presentation` or `Slide` objects between threads? Passing "live" presentation objects between threads is not recommended: use independent instances per thread or precreate separate presentations/slide containers for each thread. This approach follows the general recommendation not to share a single presentation instance across threads. ### Is it safe to parallelize export to different formats (PDF, HTML, images) provided each thread has its own `Presentation` instance? Yes. With independent instances and separate output paths, such tasks typically parallelize correctly; avoid any shared presentation objects and shared I/O streams. ### What should I do with global font settings (folders, substitutions) in multithreading? Initialize all global font settings before starting the threads and do not change them during parallel work. This eliminates races when accessing shared font resources. # Change Notes Page Size and Orientation in C++ > Read and change notes page dimensions in Aspose.Slides for C++, switch orientation, verify saved sizes, and export notes or handouts to PDF and images. Source: https://docs.aspose.com/slides/cpp/notes-size/ Updated: 2026-11-08 ## **Overview** Use [Presentation::get_NotesSize](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/get_notessize/) to access the presentation's notes page settings. It returns an [INotesSize](https://reference.aspose.com/slides/cpp/aspose.slides/inotessize/) object whose [set_Size](https://reference.aspose.com/slides/cpp/aspose.slides/inotessize/set_size/) method sets the dimensions. Although the notes settings object cannot be replaced, you can change its size. Width and height are specified in **points**, with 72 points per inch. For example, 900 × 600 points is 12.5 × 8⅓ inches. These settings apply to the presentation, rather than to an individual slide's notes. | Setting | Purpose | | --- | --- | | [Presentation::get_NotesSize](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/get_notessize/) | Controls notes page dimensions and the page dimensions used for handout export. | | [Presentation::get_SlideSize](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/get_slidesize/) | Controls regular presentation slide dimensions through [ISlideSize](https://reference.aspose.com/slides/cpp/aspose.slides/islidesize/). | Changing either setting does not automatically change the other. Changing the notes page orientation also does not rotate the regular slides. See [Slide Size](https://docs.aspose.com/slides/cpp/slide-size/) to resize regular slides. The examples below use an existing `sample.pptx`. For the export examples, use a presentation with at least one slide containing speaker notes. Each example can be run independently. ## **Read the Notes Page Size and Orientation** Read the width and height and compare them to determine the orientation: a wider page is landscape, a taller page is portrait, and equal dimensions describe a square page. This example prints the actual dimensions in points, without assuming a standard paper size. ```cpp #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto presentation = MakeObject(u"sample.pptx"); auto size = presentation->get_NotesSize()->get_Size(); auto orientation = String(u"Square"); if (size.get_Width() > size.get_Height()) orientation = u"Landscape"; else if (size.get_Width() < size.get_Height()) orientation = u"Portrait"; Console::WriteLine(u"Notes page: {0} x {1} points", size.get_Width(), size.get_Height()); Console::WriteLine(u"Orientation: {0}", orientation); ``` ## **Switch to Landscape Without Changing the Paper Size** To change only the orientation, swap the existing width and height. This preserves the lengths of both sides, including those of a custom paper size. The condition below prevents an already-landscape page from being switched back to portrait and leaves a square page unchanged. ```cpp #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::Drawing; auto presentation = MakeObject(u"sample.pptx"); auto size = presentation->get_NotesSize()->get_Size(); if (size.get_Width() < size.get_Height()) presentation->get_NotesSize()->set_Size(SizeF(size.get_Height(), size.get_Width())); presentation->Save(u"landscape-notes.pptx", SaveFormat::Pptx); ``` For portrait orientation, use the same assignment when `size.get_Width() > size.get_Height()`. Do not substitute A4 or Letter dimensions unless you also want to change the paper size. [![A regular 960 by 540-point slide keeps its 16 to 9 ratio. A portrait notes PDF measures 600 by 900 points, and the landscape export measures 900 by 600 points.](https://docs.aspose.com/slides/cpp/notes-size/visual-notes-size-dff02bd439bd.svg)](https://docs.aspose.com/slides/cpp/notes-size/visual-notes-size-dff02bd439bd.svg) *Swapping the stored notes dimensions gives 600 × 900 and 900 × 600-point PDF pages in this example. The regular slide keeps its 16:9 proportions.* ## **Set and Verify a Custom Notes Page Size** Assign both dimensions together, then use [Presentation::Save](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/save/) to write the presentation. This example sets a 900 × 600-point landscape page, saves it as PPTX, and opens the saved file again to check the persisted values. The comparison allows a 0.01-point tolerance for floating-point values; it is not a guarantee of precision for every file format. ```cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::Drawing; auto presentation = MakeObject(u"sample.pptx"); auto expectedSize = SizeF(900, 600); presentation->get_NotesSize()->set_Size(expectedSize); presentation->Save(u"custom-notes.pptx", SaveFormat::Pptx); auto reopened = MakeObject(u"custom-notes.pptx"); auto actualSize = reopened->get_NotesSize()->get_Size(); auto widthMatches = std::abs(actualSize.get_Width() - expectedSize.get_Width()) < 0.01f; auto heightMatches = std::abs(actualSize.get_Height() - expectedSize.get_Height()) < 0.01f; auto preserved = widthMatches && heightMatches; Console::WriteLine(u"Stored notes page: {0} x {1} points", actualSize.get_Width(), actualSize.get_Height()); Console::WriteLine(u"Size preserved: {0}", preserved); ``` The expected result is `900 x 600 points` and `Size preserved: True`. Checking a newly opened presentation verifies the saved file, rather than only the in-memory settings. ## **Export Notes and Handouts** The page dimensions define the available area for notes or handout layouts. They do not enable those layouts by themselves: configure the export options as well. Regular slide export continues to use the slide dimensions. ### **Export Notes to PDF and PNG** Assign [NotesCommentsLayoutingOptions](https://reference.aspose.com/slides/cpp/aspose.slides.export/notescommentslayoutingoptions/) to [PdfOptions::set_SlidesLayoutOptions](https://reference.aspose.com/slides/cpp/aspose.slides.export/pdfoptions/set_slideslayoutoptions/) to include notes in the PDF. This example also renders the first slide with notes to PNG using [Slide::GetImage](https://reference.aspose.com/slides/cpp/aspose.slides/slide/getimage/) and [RenderingOptions](https://reference.aspose.com/slides/cpp/aspose.slides.export/renderingoptions/). The [BottomTruncated](https://reference.aspose.com/slides/cpp/aspose.slides.export/notespositions/) mode keeps the notes on one page; notes that do not fit can be truncated. The PDF uses 900 × 600-point pages. At the image scale of 1 × 1 used below, the PNG is 900 × 600 pixels. Points describe the page geometry; pixels describe the raster output, whose dimensions also depend on the rendering scale. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::Drawing; auto presentation = MakeObject(u"sample.pptx"); presentation->get_NotesSize()->set_Size(SizeF(900, 600)); auto layout = MakeObject(); layout->set_NotesPosition(NotesPositions::BottomTruncated); auto pdfOptions = MakeObject(); pdfOptions->set_SlidesLayoutOptions(layout); presentation->Save(u"notes.pdf", SaveFormat::Pdf, pdfOptions); auto renderingOptions = MakeObject(); renderingOptions->set_SlidesLayoutOptions(layout); auto image = presentation->get_Slide(0)->GetImage(renderingOptions, 1.0f, 1.0f); image->Save(u"first-slide-notes.png", ImageFormat::Png); image->Dispose(); ``` For PDF export with long notes, [BottomFull](https://reference.aspose.com/slides/cpp/aspose.slides.export/notespositions/) allows additional pages as needed. Do not use that mode with the single-slide image call above, which does not support it. After resizing, inspect the output for clipped notes and the placement of existing notes-master objects; changing page dimensions alone should not be treated as a guarantee that all content will fit. See [Convert PowerPoint to PDF with Notes](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-pdf-with-notes/) for more about notes export. ### **Export Handouts to PDF** Use [HandoutLayoutingOptions](https://reference.aspose.com/slides/cpp/aspose.slides.export/handoutlayoutingoptions/) for multiple slide thumbnails on one page. The following example sets a 900 × 600-point page and uses [HandoutType::Handouts4Horizontal](https://reference.aspose.com/slides/cpp/aspose.slides.export/handouttype/) to arrange up to four slides per page. The horizontal preset controls slide ordering; the page orientation comes from its width and height. ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::Drawing; auto presentation = MakeObject(u"sample.pptx"); presentation->get_NotesSize()->set_Size(SizeF(900, 600)); auto layout = MakeObject(); layout->set_Handout(HandoutType::Handouts4Horizontal); auto pdfOptions = MakeObject(); pdfOptions->set_SlidesLayoutOptions(layout); presentation->Save(u"handouts.pdf", SaveFormat::Pdf, pdfOptions); ``` Changing the page size changes the area available for the handout grid without changing the source slides' dimensions. For handout images, use [Presentation::GetImages](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/getimages/) with the handout layout, rather than an individual slide's image method. In Aspose.Slides, presentation-level handout rendering uses the notes page dimensions, while the individual slide image call does not produce the handout page. See [Handout Mode](https://docs.aspose.com/slides/cpp/convert-powerpoint-in-handout-mode/) for layout options. ## **Page Size in Viewers, Export, and Printing** Keep the stored presentation size, the exported page size, and the printed paper size distinct: - **Presentation viewers:** A viewer can display or print notes using its own layout rules. If another application saves the file, reopen it and check the dimensions again; that application's format conversion may normalize them. - **Export formats:** The notes and handout PDF examples above use the configured page dimensions. Raster images use integer pixel dimensions and a rendering scale, so fractional point values can be rounded in the image output. Exporting regular slides does not apply the notes page size. - **Printer drivers:** Paper selection, automatic rotation, and fit-to-page settings can change the physical output without changing the dimensions stored in the presentation or PDF. For a specific paper size, match the printer settings and inspect the print preview. ## **FAQ** **Can I set the notes size for just one slide?** The notes page size is a presentation-level setting. Individual slides can have different notes content, but this property does not provide a separate page size for each slide. **Why did changing notes orientation not change my slides?** Notes pages and regular slides have independent dimensions. Use the regular slide size settings when you want to resize the slides themselves. **Why does my saved or printed result have a different size?** First reopen the saved presentation and compare its notes dimensions. If those changed, check whether saving or converting the file in another application changed the page settings. If they did not, check the export layout, image scale, viewer settings, and printer paper selection. # Object Preview Issue When Adding OleObjectFrame > Learn why EMBEDDED OLE OBJECT appears when adding OleObjectFrame in Aspose.Slides for C++ and how to fix preview issues in PPT, PPTX and ODP presentations. Source: https://docs.aspose.com/slides/cpp/object-preview-issue-when-adding-oleobjectframe/ Updated: 2026-08-05 ## **Introduction** Using Aspose.Slides for C++, when you add [OleObjectFrame](https://reference.aspose.com/slides/cpp/aspose.slides/oleobjectframe/) to a slide, an "EMBEDDED OLE OBJECT" message is shown on the output slide. This message is intentional and NOT a bug. For more information on working with OLE objects, see [Manage OLE](https://docs.aspose.com/slides/cpp/manage-ole/). ## **Explanation and Solution** Aspose.Slides displays the "EMBEDDED OLE OBJECT" message to notify you that the OLE object has been changed and the preview image has to be updated. For example, if you add a Microsoft Excel сhart as an [OleObjectFrame](https://reference.aspose.com/slides/cpp/aspose.slides/oleobjectframe/) to a slide (for more details, see the "Manage OLE" article) and then open the presentation in the Microsoft PowerPoint, you will see this image on the slide: ![OLE object message](https://docs.aspose.com/slides/cpp/object-preview-issue-when-adding-oleobjectframe/OLE_object_message.png) If you want to check and confirm that your OLE object was added to the slide, you have to double-click on the "EMBEDDED OLE OBJECT" message, or you can right-click on it and go through **Object > Edit** option. ![OLE object > Edit](https://docs.aspose.com/slides/cpp/object-preview-issue-when-adding-oleobjectframe/OLE_object_edit.png) PowerPoint then opens the embedded OLE object. ![OLE object data](https://docs.aspose.com/slides/cpp/object-preview-issue-when-adding-oleobjectframe/OLE_object_data.png) The slide may retain the "EMBEDDED OLE OBJECT" message. Once you click the OLE object, the slide preview gets updated and the "EMBEDDED OLE OBJECT" message is replaced by the actual image for the OLE object. ![OLE object preview](https://docs.aspose.com/slides/cpp/object-preview-issue-when-adding-oleobjectframe/OLE_object_preview.png) Now, you may want to save your presentation to ensure the image for the OLE Object gets updated correctly. This way, after saving the presentation, when you open the presentation again, you will NOT see the "EMBEDDED OLE OBJECT" message. ## **Other Solutions** ### **Solution 1: Replace the "Embedded OLE Object" Message with an Image** If you do not want to remove the "EMBEDDED OLE OBJECT" message by opening the presentation in PowerPoint and then saving it, you can replace the message with your preferred preview image. These lines of code demonstrate the process: ```cpp #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::IO; auto presentation = MakeObject(u"embeddedOLE.pptx"); auto slide = presentation->get_Slide(0); auto oleFrame = ExplicitCast(slide->get_Shape(0)); // Add an image to presentation resources. auto imageStream = File::OpenRead(u"myImage.png"); auto oleImage = presentation->get_Images()->AddImage(imageStream); imageStream->Dispose(); // Set a title and the image for the OLE object preview. oleFrame->set_SubstitutePictureTitle(u"My title"); oleFrame->get_SubstitutePictureFormat()->get_Picture()->set_Image(oleImage); oleFrame->set_IsObjectIcon(false); presentation->Save(u"embeddedOLE-newImage.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` The slide containing the `OleObjectFrame` then changes to this: ![New OLE object image](https://docs.aspose.com/slides/cpp/object-preview-issue-when-adding-oleobjectframe/OLE_object_new_image.png) ### **Solution 2: Create an Add-On for PowerPoint** You can also create an add-on for Microsoft PowerPoint that updates all OLE objects when you open presentations in the program. ## Related articles - [Manage OLE in Presentations Using C++](https://docs.aspose.com/slides/cpp/manage-ole/) - [Create Excel Charts and Embed Them in Presentations as OLE Objects](https://docs.aspose.com/slides/cpp/creating-excel-chart-and-embedding-it-in-presentation-as-ole-object/) - [OLE Object](https://docs.aspose.com/slides/cpp/examples/elements/ole-object/) # Open Presentations in C++ > Learn how to open PowerPoint and OpenDocument presentations in C++, supply opening passwords, control resource loading, and reduce memory use with Aspose.Slides for C++. Source: https://docs.aspose.com/slides/cpp/open-presentation/ Updated: 2026-10-27 ## **Introduction** [Aspose.Slides for C++](https://products.aspose.com/slides/cpp/) can load PowerPoint and OpenDocument presentations from files and streams. After a presentation is loaded, you can inspect its structure, edit slides, manage resources, and save it in the original or another supported format. Loading behavior can be customized through the [LoadOptions](https://reference.aspose.com/slides/cpp/aspose.slides/loadoptions/) class. For example, you can supply an opening password, keep large binary objects outside memory, control external resources, or omit embedded binary data. ## **Open Presentations** After loading a file or stream, you can [determine its original presentation format](https://docs.aspose.com/slides/cpp/detect-presentation-source-format/) to choose how your application processes it. To open an existing presentation, pass its file path to the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) constructor. Dispose the presentation after use so that file handles, temporary data, and other resources are released promptly. The following C++ example shows how to open a presentation and get its slide count: ```cpp #include #include #include using namespace Aspose::Slides; using namespace System; auto presentation = MakeObject(u"sample.pptx"); Console::WriteLine(u"Slide count: {0}", presentation->get_Slides()->get_Count()); presentation->Dispose(); ``` ## **Open Password-Protected Presentations** An opening password encrypts presentation content. To load the complete presentation, pass the correct password to [LoadOptions::set_Password](https://reference.aspose.com/slides/cpp/aspose.slides/loadoptions/set_password/) and pass the options to the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) constructor. Loading fails when the password is missing or incorrect. ```cpp #include #include #include #include using namespace Aspose::Slides; using namespace System; auto loadOptions = MakeObject(); loadOptions->set_Password(u"open_password"); auto presentation = MakeObject(u"encrypted-presentation.pptx", loadOptions); Console::WriteLine(u"Slide count: {0}", presentation->get_Slides()->get_Count()); presentation->Dispose(); ``` For password detection, validation, and encryption workflows, see [Password-Protect Presentations](https://docs.aspose.com/slides/cpp/password-protected-presentation/). If an encrypted presentation was deliberately saved with public document properties, those properties can be read without a password; see [Manage Presentation Properties](https://docs.aspose.com/slides/cpp/presentation-properties/). ## **Open Large Presentations** [LoadOptions::get_BlobManagementOptions](https://reference.aspose.com/slides/cpp/aspose.slides/loadoptions/get_blobmanagementoptions/) controls how Aspose.Slides handles binary large objects such as images, audio, and video. You can keep the source file locked, allow temporary files, and limit the amount of BLOB data retained in memory. The following C++ code demonstrates loading a large presentation (for example, 2 GB): ```cpp #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; const String filePath = u"large-presentation.pptx"; auto loadOptions = MakeObject(); auto blobOptions = loadOptions->get_BlobManagementOptions(); blobOptions->set_PresentationLockingBehavior(PresentationLockingBehavior::KeepLocked); blobOptions->set_IsTemporaryFilesAllowed(true); blobOptions->set_MaxBlobsBytesInMemory(10 * 1024 * 1024); auto presentation = MakeObject(filePath, loadOptions); presentation->get_Slide(0)->set_Name(u"Large presentation"); presentation->Save(u"large-presentation-copy.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` With `PresentationLockingBehavior::KeepLocked`, the source file remains locked until the `Presentation` object is disposed. Do not move, overwrite, or delete the source file while that object is alive. Aspose.Slides may copy the contents of an input stream while loading it. For large presentations, a file path is therefore generally more efficient than a stream. See [Manage BLOBs](https://docs.aspose.com/slides/cpp/manage-blob/) for additional storage and memory-management options. ## **Control External Resources** [LoadOptions::set_ResourceLoadingCallback](https://reference.aspose.com/slides/cpp/aspose.slides/loadoptions/set_resourceloadingcallback/) accepts an [IResourceLoadingCallback](https://reference.aspose.com/slides/cpp/aspose.slides/iresourceloadingcallback/) implementation. The callback can supply replacement data, redirect a resource, use the default loader, or skip the resource. This is useful when presentations contain external images that must be resolved according to application-specific security or storage rules. ```cpp #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; using namespace System::IO; class ImageLoadingHandler : public IResourceLoadingCallback { public: ResourceLoadingAction ResourceLoading(SharedPtr args) override { auto isJpeg = args->get_OriginalUri().EndsWith(u".jpg", StringComparison::OrdinalIgnoreCase); if (!isJpeg || !File::Exists(u"approved-image.jpg")) { return ResourceLoadingAction::Skip; } auto imageData = File::ReadAllBytes(u"approved-image.jpg"); args->SetData(imageData); return ResourceLoadingAction::UserProvided; } }; auto loadOptions = MakeObject(); loadOptions->set_ResourceLoadingCallback(MakeObject()); auto presentation = MakeObject(u"presentation-with-external-images.pptx", loadOptions); Console::WriteLine(u"Slide count: {0}", presentation->get_Slides()->get_Count()); presentation->Dispose(); ``` ## **Load Presentations without Embedded Binary Objects** A presentation may contain embedded binary data that an application does not need or does not want to retain. Examples include: - VBA projects, available through [IPresentation::get_VbaProject](https://reference.aspose.com/slides/cpp/aspose.slides/ipresentation/get_vbaproject/); - embedded OLE data, available through [IOleEmbeddedDataInfo::get_EmbeddedFileData](https://reference.aspose.com/slides/cpp/aspose.slides/ioleembeddeddatainfo/get_embeddedfiledata/); - ActiveX control data, available through [IControl::get_ActiveXControlBinary](https://reference.aspose.com/slides/cpp/aspose.slides/icontrol/get_activexcontrolbinary/). Pass `true` to [LoadOptions::set_DeleteEmbeddedBinaryObjects](https://reference.aspose.com/slides/cpp/aspose.slides/loadoptions/set_deleteembeddedbinaryobjects/) to remove this binary data while loading. Save the loaded presentation to persist the sanitized result. This option reduces exposure to unwanted embedded payloads, but it is not a complete malware-detection or content-sanitization system. ```cpp #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto loadOptions = MakeObject(); loadOptions->set_DeleteEmbeddedBinaryObjects(true); auto presentation = MakeObject(u"presentation-with-embedded-data.pptx", loadOptions); presentation->Save(u"presentation-without-embedded-data.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ## **FAQ** **How can I tell that a file is corrupted and cannot be opened?** Aspose.Slides throws a parsing or format exception during loading. Handle that failure separately from an incorrect-password error so that the application can report the cause accurately. **What happens if required fonts are missing?** The presentation can still load, but rendering and export may substitute fonts. You can [configure font substitution](https://docs.aspose.com/slides/cpp/font-substitution/) or [provide custom fonts](https://docs.aspose.com/slides/cpp/custom-font/) to make output more predictable. **Does loading a presentation also load its embedded media?** Embedded audio and video become available through the presentation object model. External resources are resolved according to the configured resource-loading behavior and may be unavailable if their locations cannot be accessed. Related feature: [Read PPTX presentations](https://docs.aspose.com/slides/features/powerpoint-files/). # Get Paragraph Bounds from Presentations in C++ > Learn how to retrieve paragraph bounds in Aspose.Slides for C++ to optimize text positioning in PowerPoint presentations. Source: https://docs.aspose.com/slides/cpp/paragraph-bounds/ Updated: 2026-08-05 ## **Overview** This article explains how to get the bounds, size, and coordinates of paragraphs in Aspose.Slides. It shows how to retrieve a paragraph rectangle from an [ITextFrame](https://reference.aspose.com/slides/cpp/aspose.slides/itextframe/) by using [IParagraph::GetRect](https://reference.aspose.com/slides/cpp/aspose.slides/iparagraph/getrect/), how to get paragraph coordinates inside a table cell text frame, and highlights important details such as measurement units, the effect of text wrapping on bounds, pixel conversion, and effective paragraph formatting values. ## **Get Rectangular Coordinates of a Paragraph** Use [IParagraph::GetRect](https://reference.aspose.com/slides/cpp/aspose.slides/iparagraph/getrect/) to get the bounding rectangle of a paragraph. ```cpp #include #include #include #include #include #include using namespace Aspose::Slides; auto presentation = System::MakeObject(u"Shapes.pptx"); auto slide = presentation->get_Slide(0); auto shape = System::ExplicitCast(slide->get_Shape(0)); auto paragraph = shape->get_TextFrame()->get_Paragraph(0); auto rectangle = paragraph->GetRect(); presentation->Dispose(); ``` ## **Get the Size of a Paragraph Inside a Table Cell TextFrame** To get the size and coordinates of an [IParagraph](https://reference.aspose.com/slides/cpp/aspose.slides/iparagraph/) in a table cell text frame, use [IParagraph::GetRect](https://reference.aspose.com/slides/cpp/aspose.slides/iparagraph/getrect/). The returned rectangle is relative to the table cell text frame, so add the table position and cell offset when you need slide-level coordinates. The following example gets paragraph bounds inside a table cell and draws rectangles on the slide to visualize those bounds: ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System::Drawing; auto presentation = System::MakeObject(u"source.pptx"); auto slide = presentation->get_Slide(0); auto table = System::ExplicitCast(slide->get_Shape(0)); auto cell = table->get_Row(1)->idx_get(1); auto cellX = table->get_X() + cell->get_OffsetX(); auto cellY = table->get_Y() + cell->get_OffsetY(); auto paragraphs = cell->get_TextFrame()->get_Paragraphs(); for (const auto& paragraph : paragraphs) { if (paragraph->get_Text().IsEmpty()) { continue; } auto paragraphRectangle = paragraph->GetRect(); auto paragraphRectangleX = paragraphRectangle.get_X() + cellX; auto paragraphRectangleY = paragraphRectangle.get_Y() + cellY; auto paragraphBoundsShape = slide->get_Shapes()->AddAutoShape( ShapeType::Rectangle, paragraphRectangleX, paragraphRectangleY, paragraphRectangle.get_Width(), paragraphRectangle.get_Height()); paragraphBoundsShape->get_FillFormat()->set_FillType(FillType::NoFill); paragraphBoundsShape->get_LineFormat()->get_FillFormat()->get_SolidFillColor()->set_Color(System::Drawing::Color::get_Yellow()); paragraphBoundsShape->get_LineFormat()->get_FillFormat()->set_FillType(FillType::Solid); } presentation->Save(u"output.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ## **FAQ** ### In what units are paragraph coordinates measured? They are measured in points, where 1 inch equals 72 points. This applies to all coordinates and dimensions on the slide. ### Does word wrapping affect a paragraph's bounds? Yes. If [ITextFrameFormat::set_WrapText](https://reference.aspose.com/slides/cpp/aspose.slides/itextframeformat/set_wraptext/) is enabled for the [ITextFrame](https://reference.aspose.com/slides/cpp/aspose.slides/itextframe/), the text breaks to fit the area width, which changes the paragraph's actual bounds. ### Can paragraph coordinates be reliably mapped to pixels in the exported image? Yes. Convert points to pixels using this formula: pixels = points x (DPI / 72). The result depends on the DPI chosen for rendering or export. ### How do I get the "effective" paragraph formatting parameters, taking style inheritance into account? Use the [effective paragraph formatting data structure](https://docs.aspose.com/slides/cpp/shape-effective-properties/); it returns the final consolidated values for indents, spacing, wrapping, RTL, and more. ## Related articles - [Get Text Portion Bounds from Presentations in C++](https://docs.aspose.com/slides/cpp/portion-bounds/) # Password-Protect Presentations in C++ > Encrypt, detect, validate, open, and decrypt password-protected PowerPoint PPT and PPTX presentations in C++ with Aspose.Slides. Source: https://docs.aspose.com/slides/cpp/password-protected-presentation/ Updated: 2026-09-04 ## **Overview** An opening password encrypts a presentation. The correct password is required to load and view the presentation content, so this protection provides confidentiality. An opening password is different from a write-protection password. Write protection restricts modification but does not encrypt the content or prevent the presentation from being loaded. To manage passwords for modifying presentations, see [Write-Protect Presentations](https://docs.aspose.com/slides/cpp/write-protected-presentation/). The workflows below apply to both PPT and PPTX presentations. The examples use both formats where their file-based and stream-based behavior is important. ## **Encrypt a Presentation with an Opening Password** Use [IProtectionManager::Encrypt](https://reference.aspose.com/slides/cpp/aspose.slides/iprotectionmanager/encrypt/) to assign an opening password. Then use [IPresentation::Save](https://reference.aspose.com/slides/cpp/aspose.slides/ipresentation/save/) to persist the encrypted presentation. The following example encrypts a PPTX presentation: ```cpp #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(u"pres.pptx"); presentation->get_ProtectionManager()->Encrypt(u"open_password"); presentation->Save(u"encrypted-pres.pptx", SaveFormat::Pptx); ``` ## **Keep Document Properties Public** By default, Aspose.Slides includes document properties in presentation encryption. [IProtectionManager::set_EncryptDocumentProperties](https://reference.aspose.com/slides/cpp/aspose.slides/iprotectionmanager/set_encryptdocumentproperties/) controls this behavior independently of slide-content encryption. Pass `false` to this method before calling [IProtectionManager::Encrypt](https://reference.aspose.com/slides/cpp/aspose.slides/iprotectionmanager/encrypt/) when an indexing, classification, search, or document-management system must read metadata without the opening password. The following example creates an encrypted PPTX presentation while leaving its built-in document properties public: ```cpp #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(); auto properties = presentation->get_DocumentProperties(); properties->set_Author(u"Contoso Knowledge Management"); properties->set_Title(u"Quarterly Product Roadmap"); properties->set_Keywords(u"roadmap, planning, internal"); presentation->get_Slide(0)->set_Name(u"Encrypted presentation content"); presentation->get_ProtectionManager()->set_EncryptDocumentProperties(false); presentation->get_ProtectionManager()->Encrypt(u"open_password"); presentation->Save(u"public-properties-encrypted.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` Passing `false` to `set_EncryptDocumentProperties` does not make slides, masters, layouts, shapes, media, or other presentation content public. It affects only document properties. To read those properties without loading the encrypted content, see [Manage Presentation Properties](https://docs.aspose.com/slides/cpp/presentation-properties/). ## **Load an Encrypted Presentation** Set [LoadOptions::set_Password](https://reference.aspose.com/slides/cpp/aspose.slides/loadoptions/set_password/) to the opening password and pass the options to [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) when loading the file. Loading fails when an opening password is required but the supplied password is missing or incorrect. ```cpp #include #include using namespace Aspose::Slides; auto loadOptions = System::MakeObject(); loadOptions->set_Password(u"open_password"); auto presentation = System::MakeObject(u"encrypted-pres.pptx", loadOptions); // Work with the decrypted presentation. ``` ## **Remove Encryption from a Presentation** Load the presentation with its opening password, call [IProtectionManager::RemoveEncryption](https://reference.aspose.com/slides/cpp/aspose.slides/iprotectionmanager/removeencryption/), and save the result. The saved presentation can then be loaded without a password. ```cpp #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto loadOptions = System::MakeObject(); loadOptions->set_Password(u"open_password"); auto presentation = System::MakeObject(u"encrypted-pres.pptx", loadOptions); presentation->get_ProtectionManager()->RemoveEncryption(); presentation->Save(u"encryption-removed.pptx", SaveFormat::Pptx); ``` ## **Validate an Opening Password Before Loading** Use [IPresentationFactory::GetPresentationInfo](https://reference.aspose.com/slides/cpp/aspose.slides/ipresentationfactory/getpresentationinfo/) to obtain [IPresentationInfo](https://reference.aspose.com/slides/cpp/aspose.slides/ipresentationinfo/) without creating a complete presentation instance. Check [IPresentationInfo::get_IsPasswordProtected](https://reference.aspose.com/slides/cpp/aspose.slides/ipresentationinfo/get_ispasswordprotected/) before requesting or validating a password. When protection is present, validate the supplied value with [IPresentationInfo::CheckPassword](https://reference.aspose.com/slides/cpp/aspose.slides/ipresentationinfo/checkpassword/). ### **File-Path Workflow** The following example validates an opening password for a PPTX file, passes the validated value to [LoadOptions::set_Password](https://reference.aspose.com/slides/cpp/aspose.slides/loadoptions/set_password/), and then loads the complete presentation: ```cpp #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; String filePath = u"protected-presentation.pptx"; String password = u"open_password"; auto presentationInfo = PresentationFactory::get_Instance()->GetPresentationInfo(filePath); if (!presentationInfo->get_IsPasswordProtected()) { Console::WriteLine(u"The presentation does not have an opening password."); } else if (!presentationInfo->CheckPassword(password)) { Console::WriteLine(u"The opening password is incorrect."); } else { auto loadOptions = MakeObject(); loadOptions->set_Password(password); auto presentation = MakeObject(filePath, loadOptions); Console::WriteLine(u"The presentation was validated and loaded successfully."); } ``` ### **Stream Workflow** The stream overload of [IPresentationFactory::GetPresentationInfo](https://reference.aspose.com/slides/cpp/aspose.slides/ipresentationfactory/getpresentationinfo/) provides the same workflow. Reset the position of a seekable stream before loading the complete presentation from that stream. The following example uses a PPT file: ```cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; using namespace System::IO; String password = u"open_password"; auto presentationStream = File::OpenRead(u"protected-presentation.ppt"); auto presentationInfo = PresentationFactory::get_Instance()->GetPresentationInfo(presentationStream); if (!presentationInfo->get_IsPasswordProtected()) { Console::WriteLine(u"The presentation does not have an opening password."); } else if (!presentationInfo->CheckPassword(password)) { Console::WriteLine(u"The opening password is incorrect."); } else { presentationStream->set_Position(0); auto loadOptions = MakeObject(); loadOptions->set_Password(password); auto presentation = MakeObject(presentationStream, loadOptions); Console::WriteLine(u"The presentation was validated and loaded successfully."); } ``` ### **CheckPassword Return Values** [IPresentationInfo::CheckPassword](https://reference.aspose.com/slides/cpp/aspose.slides/ipresentationinfo/checkpassword/) returns `true` only when the presentation has an opening password and the supplied password is correct. It returns `false` in each of these cases: - The password is incorrect. - The presentation does not have an opening password. - The supplied password is null or empty. The behavior is the same for PPT and PPTX presentations. ## **Check Whether a Loaded Presentation Is Encrypted** After loading a presentation with the correct password, inspect [IProtectionManager::get_IsEncrypted](https://reference.aspose.com/slides/cpp/aspose.slides/iprotectionmanager/get_isencrypted/) to confirm that the source presentation was encrypted. To detect opening-password protection before loading, use `IPresentationInfo::get_IsPasswordProtected` as shown above. ```cpp #include #include #include #include using namespace Aspose::Slides; using namespace System; auto loadOptions = MakeObject(); loadOptions->set_Password(u"open_password"); auto presentation = MakeObject(u"encrypted-pres.pptx", loadOptions); bool isEncrypted = presentation->get_ProtectionManager()->get_IsEncrypted(); Console::WriteLine(isEncrypted ? u"The presentation is encrypted." : u"The presentation is not encrypted."); ``` ## **Security Recommendations** Do not log opening passwords or include them in diagnostic messages. Avoid unnecessary repeated validation attempts, keep passwords in memory only as long as needed, and reuse a successful validation result when immediately loading the presentation. Public document properties may disclose author names, titles, subjects, keywords, company information, comments, and custom values even though the presentation content is encrypted. Encrypt sensitive metadata together with the presentation. Leaving properties public should be an explicit decision made only when systems must index, classify, search, or manage the file without an opening password. ## **Password-Protect a Presentation Online** 1. Open the [Aspose.Slides Lock](https://products.aspose.app/slides/lock) application. 1. Select or upload the presentation. 1. Enter a password for view protection. 1. Optionally enter a separate password for edit protection. 1. Apply the protection and download the resulting file. - [Write-Protect Presentations](https://docs.aspose.com/slides/cpp/write-protected-presentation/) - [Digital Signature in PowerPoint](https://docs.aspose.com/slides/cpp/digital-signature-in-powerpoint/) ## **FAQ** **What is the difference between an opening password and a write-protection password?** An opening password encrypts the presentation and is required to load its content. A write-protection password restricts modification without encrypting the content. **Can I validate an opening password without loading all slides?** Yes. Obtain presentation information, check whether opening-password protection is present, and validate the password before creating a complete presentation instance. **Can an application read metadata without the opening password?** Yes, but only when the presentation was encrypted with `set_EncryptDocumentProperties(false)`. The application must then use the document-properties-only loading mode described in [Manage Presentation Properties](https://docs.aspose.com/slides/cpp/presentation-properties/). **Do the password-checking workflows support both PPT and PPTX?** Yes. File-path and stream-based password detection and validation behave the same for PPT and PPTX presentations. ## Related articles - [Secure Presentations in C++](https://docs.aspose.com/slides/cpp/presentation-security/) # Manage Picture Frames in Presentations Using C++ > Create, format, link, crop, extract, and compress picture frames in presentations with Aspose.Slides for C++. Source: https://docs.aspose.com/slides/cpp/picture-frame/ Updated: 2026-11-08 ## **Overview** A picture frame is a slide shape that displays an image. In Aspose.Slides, the image resource and the shape that displays it are separate objects: a [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) owns embedded image resources through its [image collection](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/get_images/), while an [IPictureFrame](https://reference.aspose.com/slides/cpp/aspose.slides/ipictureframe/) controls the image's position, size, line formatting, rotation, cropping, picture effects, and other frame-level settings. This separation is useful when the same image is shown more than once. Add the image to the presentation once, keep the returned [IPPImage](https://reference.aspose.com/slides/cpp/aspose.slides/ippimage/), and use that image resource when creating picture frames. Picture frames can contain raster images such as PNG or JPEG and vector SVG images. They can also refer to linked images instead of storing the image bytes in the presentation. The choice affects portability, file size, extraction, and export behavior, so it is useful to decide how the image should be stored before applying formatting or optimization. ## **Add and Format an Embedded Image** For an embedded image, add the image data to the presentation and create a picture frame with [IShapeCollection::AddPictureFrame](https://reference.aspose.com/slides/cpp/aspose.slides/shapecollection/addpictureframe/). The image becomes part of the presentation package, so the presentation remains self-contained when it is moved to another computer. The following example adds a JPEG image, creates a frame at the image's native dimensions, and applies line formatting and rotation: ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::Drawing; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto sourceImage = Images::FromFile(u"photo.jpg"); auto image = presentation->get_Images()->AddImage(sourceImage); auto pictureFrame = slide->get_Shapes()->AddPictureFrame(ShapeType::Rectangle, 50, 100, image->get_Width(), image->get_Height(), image); pictureFrame->get_LineFormat()->get_FillFormat()->set_FillType(FillType::Solid); pictureFrame->get_LineFormat()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Blue()); pictureFrame->get_LineFormat()->set_Width(3.0); pictureFrame->set_Rotation(15.0f); presentation->Save(u"picture-frame.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` The picture frame controls the displayed geometry; changing the frame size does not change the original pixel dimensions stored in the embedded image resource. This distinction becomes important when cropping or compressing an image later. ## **Use Relative Scale** [IPictureFrame](https://reference.aspose.com/slides/cpp/aspose.slides/ipictureframe/) exposes relative width and height scaling for the frame. A value of `1.0` corresponds to 100% of the original picture size. Relative scale is useful when a workflow needs to preserve a relationship to the source image size instead of calculating final dimensions manually. ```cpp #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto sourceImage = Images::FromFile(u"photo.jpg"); auto image = presentation->get_Images()->AddImage(sourceImage); auto pictureFrame = slide->get_Shapes()->AddPictureFrame(ShapeType::Rectangle, 50, 50, 100, 100, image); pictureFrame->set_RelativeScaleWidth(1.35f); pictureFrame->set_RelativeScaleHeight(0.8f); presentation->Save(u"relative-scale.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` Relative scale changes the frame's scale settings; it does not resample or compress the embedded image. ## **Embedded and Linked Images** An embedded picture stores image data inside the presentation and is therefore the safest choice for portability and predictable rendering. A linked picture stores an external location through the [ISlidesPicture](https://reference.aspose.com/slides/cpp/aspose.slides/islidespicture/) link path instead of embedding the image data in the same way. Linked images can reduce the amount of image data stored in the PPTX, but they introduce an external dependency. The linked file must remain accessible to the application that opens or renders the presentation. If the path changes, the file is moved, or the resource is unavailable, the linked picture may not be displayed as expected. For presentations that must be emailed, archived, or rendered in isolated environments, embedded images are usually more reliable. ### **Add a Linked Image** The following example creates a picture frame and points it to a local image file. It deals only with image linking; video linking is a separate media workflow and is intentionally not mixed into this example. ```cpp #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::IO; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto pictureFrame = slide->get_Shapes()->AddPictureFrame(ShapeType::Rectangle, 50, 50, 320, 180, nullptr); auto linkPath = Path::GetFullPath(u"linked-image.jpg"); pictureFrame->get_PictureFormat()->get_Picture()->set_LinkPathLong(linkPath); presentation->Save(u"linked-image.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` Use links when external file management is intentional. Do not use them merely as a replacement for compression: a small PPTX with broken image dependencies is usually less useful than a larger self-contained presentation. ## **Extract Images from Picture Frames** Before extracting an image from an existing presentation, check that a shape is actually an [IPictureFrame](https://reference.aspose.com/slides/cpp/aspose.slides/ipictureframe/) and that it contains an embedded image. Linked picture frames may not contain image bytes that can be extracted in the same way. ### **Extract a Raster Image** The modern image API uses [IImage](https://reference.aspose.com/slides/cpp/aspose.slides/iimage/) directly. The following example finds the first embedded raster picture on a slide and saves it as PNG: ```cpp #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto presentation = MakeObject(u"sample.pptx"); auto slide = presentation->get_Slide(0); for (auto&& shape : slide->get_Shapes()) { if (!ObjectExt::Is(shape)) { continue; } auto pictureFrame = ExplicitCast(shape); auto embeddedImage = pictureFrame->get_PictureFormat()->get_Picture()->get_Image(); if (embeddedImage == nullptr || embeddedImage->get_SvgImage() != nullptr) { continue; } auto rasterImage = embeddedImage->get_Image(); rasterImage->Save(u"extracted-image.png", ImageFormat::Png); break; } presentation->Dispose(); ``` Saving through [IImage](https://reference.aspose.com/slides/cpp/aspose.slides/iimage/) converts the extracted image to the requested output format. If you need the encoded bytes stored in the presentation rather than a converted raster file, use the image resource's binary data instead. ### **Extract an SVG Image** For an SVG picture, the [IPPImage](https://reference.aspose.com/slides/cpp/aspose.slides/ippimage/) exposes an [ISvgImage](https://reference.aspose.com/slides/cpp/aspose.slides/isvgimage/) object. This lets you retrieve the SVG data directly instead of rasterizing the picture first. ```cpp #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; using namespace System::IO; auto presentation = MakeObject(u"sample.pptx"); auto slide = presentation->get_Slide(0); for (auto&& shape : slide->get_Shapes()) { if (!ObjectExt::Is(shape)) { continue; } auto pictureFrame = ExplicitCast(shape); auto embeddedImage = pictureFrame->get_PictureFormat()->get_Picture()->get_Image(); if (embeddedImage == nullptr) { continue; } auto svgImage = embeddedImage->get_SvgImage(); if (svgImage == nullptr) { continue; } File::WriteAllBytes(u"extracted-image.svg", svgImage->get_SvgData()); break; } presentation->Dispose(); ``` Keeping SVG content as SVG preserves the vector source inside the presentation. Raster exports such as PNG or JPEG necessarily render that vector content to pixels. PDF or SVG slide export is also a rendering operation, so the exported graphics should not be treated as a byte-for-byte copy of the original embedded SVG; use the embedded [ISvgImage](https://reference.aspose.com/slides/cpp/aspose.slides/isvgimage/) data when the original vector resource itself is required. ## **Crop an Image** Cropping changes which part of an image is visible inside the frame. The crop values on [IPictureFillFormat](https://reference.aspose.com/slides/cpp/aspose.slides/ipicturefillformat/) are percentages of the source image dimensions. Cropping does not initially delete the hidden pixels from the embedded image; it only changes the visible region. The following example finds a picture frame safely and applies crop values: ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(u"sample.pptx"); auto slide = presentation->get_Slide(0); SharedPtr pictureFrame; for (auto&& shape : slide->get_Shapes()) { if (ObjectExt::Is(shape)) { pictureFrame = ExplicitCast(shape); break; } } if (pictureFrame != nullptr) { pictureFrame->get_PictureFormat()->set_CropLeft(23.6f); pictureFrame->get_PictureFormat()->set_CropRight(21.5f); pictureFrame->get_PictureFormat()->set_CropTop(3.0f); pictureFrame->get_PictureFormat()->set_CropBottom(31.0f); presentation->Save(u"cropped-image.pptx", SaveFormat::Pptx); } presentation->Dispose(); ``` Because the hidden image data is still present, the crop can be changed later without losing the original pixels. If file size matters more than reversibility, the cropped regions can be physically removed as described in the next section. ## **Remove Cropped Image Data** [IPictureFillFormat::DeletePictureCroppedAreas](https://reference.aspose.com/slides/cpp/aspose.slides/ipicturefillformat/deletepicturecroppedareas/) removes image data outside the current crop rectangle and returns the resulting image resource. This can reduce file size, but it is a destructive optimization: after the presentation is saved, the removed pixels are no longer available for a later uncrop operation. ```cpp #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(u"cropped-image.pptx"); auto slide = presentation->get_Slide(0); SharedPtr pictureFrame; for (auto&& shape : slide->get_Shapes()) { if (ObjectExt::Is(shape)) { pictureFrame = ExplicitCast(shape); break; } } if (pictureFrame != nullptr) { auto croppedImage = pictureFrame->get_PictureFormat()->DeletePictureCroppedAreas(); if (croppedImage != nullptr) { presentation->Save(u"cropped-data-removed.pptx", SaveFormat::Pptx); } } presentation->Dispose(); ``` The method may add a new image resource to the presentation. If the original image is also used by other picture frames, those frames still need their existing resource, so deleting cropped areas does not necessarily reduce the total number of images. Cropping WMF or EMF content with this method rasterizes the cropped result to PNG. ## **Compress Raster Images** [IPictureFillFormat::CompressImage](https://reference.aspose.com/slides/cpp/aspose.slides/ipicturefillformat/compressimage/) reduces raster image resolution relative to the size at which the picture is displayed. It can also remove cropped regions in the same operation. The method returns `true` when the image was resized or cropped and `false` when no change was necessary. Use a predefined [PicturesCompression](https://reference.aspose.com/slides/cpp/aspose.slides.export/picturescompression/) value when a standard target resolution is sufficient: ```cpp #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(u"sample.pptx"); auto slide = presentation->get_Slide(0); SharedPtr pictureFrame; for (auto&& shape : slide->get_Shapes()) { if (ObjectExt::Is(shape)) { pictureFrame = ExplicitCast(shape); break; } } if (pictureFrame != nullptr) { auto compressed = pictureFrame->get_PictureFormat()->CompressImage(true, PicturesCompression::Dpi150); Console::WriteLine(compressed ? String(u"The image was compressed.") : String(u"No compression was necessary.")); presentation->Save(u"compressed-image.pptx", SaveFormat::Pptx); } presentation->Dispose(); ``` A custom positive DPI value can be passed instead of an enum value when a specific target is required. Compression is intended for raster images. SVG and metafile content is not reduced by this raster compression workflow. Also remember that lower resolution and deleted cropped regions cannot be recovered from the optimized presentation. Choose a target resolution based on the largest size at which the image will actually be viewed or exported rather than applying the lowest DPI globally. ## **Manage Image Transform Effects** For a complete workflow covering brightness, contrast, color transformations, blur, alpha effects, ordered chains, inspection, removal, and round-trip verification, see [Image Transform Effects](https://docs.aspose.com/slides/cpp/image-transform-effects/). ## **Lock Picture Frame Geometry** The [IPictureFrameLock](https://reference.aspose.com/slides/cpp/aspose.slides/ipictureframelock/) settings control which editing operations are disabled for a picture frame. For example, the [aspect-ratio lock](https://reference.aspose.com/slides/cpp/aspose.slides/ipictureframelock/set_aspectratiolocked/) preserves the shape's proportions while it is resized. ```cpp #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto sourceImage = Images::FromFile(u"photo.jpg"); auto image = presentation->get_Images()->AddImage(sourceImage); auto pictureFrame = slide->get_Shapes()->AddPictureFrame(ShapeType::Rectangle, 50, 100, image->get_Width(), image->get_Height(), image); pictureFrame->get_PictureFrameLock()->set_AspectRatioLocked(true); presentation->Save(u"locked-picture-frame.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` The lock applies to the picture frame shape. It does not force the source image to be resampled or permanently changed to the same aspect ratio. ## **Adjust the StretchOffset Values** When the picture fill mode is stretch, the stretch-offset values on [IPictureFillFormat](https://reference.aspose.com/slides/cpp/aspose.slides/ipicturefillformat/) define the fill rectangle relative to the picture frame's bounding box. Positive percentages create an inset from an edge, while negative percentages create an outset. This is different from cropping. Crop values select which part of the source image is visible; stretch offsets change the rectangle into which the visible picture fill is stretched. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto sourceImage = Images::FromFile(u"photo.png"); auto image = presentation->get_Images()->AddImage(sourceImage); auto pictureFrame = slide->get_Shapes()->AddPictureFrame(ShapeType::Rectangle, 10, 10, 400, 300, image); pictureFrame->get_PictureFormat()->set_PictureFillMode(PictureFillMode::Stretch); pictureFrame->get_PictureFormat()->set_StretchOffsetLeft(12.0f); pictureFrame->get_PictureFormat()->set_StretchOffsetRight(12.0f); pictureFrame->get_PictureFormat()->set_StretchOffsetTop(8.0f); pictureFrame->get_PictureFormat()->set_StretchOffsetBottom(8.0f); presentation->Save(u"stretch-offsets.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` Use stretch offsets for fill placement. Use crop properties when the goal is to hide source-image edges. [![Crop selects source pixels. Positive stretch offsets inset the fill. Negative offsets extend it beyond the frame.](https://docs.aspose.com/slides/cpp/picture-frame/visual-image-crop-and-fit-8eb4e26c4fa1.svg)](https://docs.aspose.com/slides/cpp/picture-frame/visual-image-crop-and-fit-8eb4e26c4fa1.svg) *The solid outline marks the frame and the dashed outline marks the offset fill. The same image and frame are used in all three renders.* ## **Storage, File Size, and Export Considerations** The main tradeoffs are easier to manage when image storage and picture-frame formatting are treated separately: - **Embedded images** make the presentation self-contained and are the most reliable for sharing and server-side rendering, but large raster images increase PPTX size and memory use. - **Linked images** can keep the package smaller, but the presentation depends on external files remaining available at the stored paths or locations. - **Cropping** is initially non-destructive. The hidden pixels remain embedded until cropped areas are explicitly deleted or removed during compression. - **Compression** can reduce file size substantially for oversized raster images, but it trades away source resolution. It should be applied after the intended on-slide size is known. - **SVG images** should remain as SVG when vector preservation is important. Extract the embedded SVG directly when you need the vector resource itself. Raster slide exports always convert the rendered slide to pixels. - **Repeated images** should reuse an existing [IPPImage](https://reference.aspose.com/slides/cpp/aspose.slides/ippimage/) resource when possible instead of repeatedly loading the same file into the presentation workflow. For large presentations, image optimization is usually most effective when performed selectively: keep logos and diagrams as vector content, compress photographs according to their real display size, remove cropped pixels only when later editing is not required, and avoid external links unless dependency management is part of the deployment design. ## **FAQ** **What is the difference between a picture frame and an image resource?** An [IPPImage](https://reference.aspose.com/slides/cpp/aspose.slides/ippimage/) represents an image resource associated with the presentation. An [IPictureFrame](https://reference.aspose.com/slides/cpp/aspose.slides/ipictureframe/) is a shape on a slide that displays an image and stores frame-level geometry and formatting such as size, rotation, crop values, effects, and locks. **Should I embed or link images?** Embed images when the presentation must be portable, archived, or rendered without access to external resources. Link images only when keeping image files outside the PPTX is intentional and the external locations can be maintained reliably. **Does cropping reduce PPTX file size?** Not by itself. Normal crop settings hide parts of the source image but keep the underlying pixels. Use [IPictureFillFormat::DeletePictureCroppedAreas](https://reference.aspose.com/slides/cpp/aspose.slides/ipicturefillformat/deletepicturecroppedareas/) or image compression with cropped-area removal when those pixels can be discarded permanently. **Can I restore image quality after compression?** No. Compression can reduce stored raster resolution, and removing cropped regions discards image data. Keep the original source image outside the presentation if later high-resolution editing may be required. **How should SVG images be handled?** Keep SVG content as SVG when vector fidelity matters. The embedded [ISvgImage](https://reference.aspose.com/slides/cpp/aspose.slides/isvgimage/) can be extracted directly. Rendering a slide to a raster format such as PNG or JPEG rasterizes the SVG as part of the slide image. **How can I avoid unsafe casts when reading existing slides?** Check the shape type before using picture-frame-specific members. Test the shape with [IPictureFrame](https://reference.aspose.com/slides/cpp/aspose.slides/ipictureframe/) before applying a runtime cast, and assign the cast result to a local variable before accessing picture-frame-specific members. # Customize Pie Charts in Presentations Using C++ > Create and customize pie charts in C++ with Aspose.Slides. Configure secondary plots, display data labels, and apply automatic slice colors in PowerPoint. Source: https://docs.aspose.com/slides/cpp/pie-chart/ Updated: 2026-10-26 ## **Overview** This article explains how to work with pie charts in Aspose.Slides. It shows how to configure secondary plot options for Pie of Pie and Bar of Pie charts, and how to enable automatic slice coloring for a standard pie chart. The examples focus on chart customization tasks such as adding a chart to a slide, adjusting series and label settings, replacing default chart data with custom categories and values, and saving the updated presentation. ## **Second Plot Options for Pie of Pie and Bar of Pie Charts** Aspose.Slides for C++ supports secondary plot options for Pie of Pie and Bar of Pie charts. These options control the size of the secondary plot and how data points are split between the two plots. The following example creates a Pie of Pie chart in a new presentation and displays data point values as labels. The [set_SecondPieSize](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartseriesgroup/set_secondpiesize/) method sets the secondary plot size to 149% of the main plot. [set_PieSplitBy](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartseriesgroup/set_piesplitby/) selects percentage-based splitting, and [set_PieSplitPosition](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartseriesgroup/set_piesplitposition/) sets the threshold to 53%. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::PieOfPie, 50, 50, 500, 400); auto series = chart->get_ChartData()->get_Series()->idx_get(0); // Display values and configure the secondary plot. series->get_Labels()->get_DefaultDataLabelFormat()->set_ShowValue(true); auto seriesGroup = series->get_ParentSeriesGroup(); seriesGroup->set_SecondPieSize(149); seriesGroup->set_PieSplitBy(PieSplitType::ByPercentage); seriesGroup->set_PieSplitPosition(53); presentation->Save(u"pie_of_pie.pptx", SaveFormat::Pptx); ``` To show or hide the lines connecting the main and secondary plots in Pie of Pie and Bar of Pie charts, see [Show or Hide Series Lines](https://docs.aspose.com/slides/cpp/chart-series/#show-or-hide-series-lines). The setting applies to the entire series group. ### **Select Categories for the Secondary Plot** Use custom splitting when you want to group specific categories in the secondary plot regardless of their percentage values. For example, a sales report might show Online and Events together so readers can compare these two channels, even though they account for 35% and 10% of total sales. Call [set_PieSplitBy](https://reference.aspose.com/slides/cpp/aspose.slides.charts/chartseriesgroup/set_piesplitby/) with [PieSplitType::Custom](https://reference.aspose.com/slides/cpp/aspose.slides.charts/piesplittype/) and select the points through [get_PieSplitCustomPoints](https://reference.aspose.com/slides/cpp/aspose.slides.charts/chartseriesgroup/get_piesplitcustompoints/). The collection's [Add](https://reference.aspose.com/slides/cpp/aspose.slides.charts/piesplitcustompointcollection/add/) method accepts a zero-based index in the series. In this example, index 1 selects Online, and index 3 selects Events. Partners is also added temporarily, then excluded using [Remove](https://reference.aspose.com/slides/cpp/aspose.slides.charts/piesplitcustompointcollection/remove/). ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::PieOfPie, 50, 50, 600, 200); // Replace the default data with sales by channel. auto workbook = chart->get_ChartData()->get_ChartDataWorkbook(); chart->get_ChartData()->get_Series()->Clear(); chart->get_ChartData()->get_Categories()->Clear(); auto categoryNames = std::vector{ u"Retail", u"Online", u"Partners", u"Events" }; auto values = std::vector{ 40, 35, 15, 10 }; auto seriesNameCell = workbook->GetCell(0, 0, 1, System::ObjectExt::Box(System::String(u"Sales"))); auto series = chart->get_ChartData()->get_Series()->Add(seriesNameCell, chart->get_Type()); for (auto i = 0; i < static_cast(categoryNames.size()); i++) { auto categoryCell = workbook->GetCell(0, i + 1, 0, System::ObjectExt::Box(categoryNames[i])); chart->get_ChartData()->get_Categories()->Add(categoryCell); auto valueCell = workbook->GetCell(0, i + 1, 1, System::ObjectExt::Box(values[i])); series->get_DataPoints()->AddDataPointForPieSeries(valueCell); } series->get_Labels()->get_DefaultDataLabelFormat()->set_ShowValue(true); auto seriesGroup = series->get_ParentSeriesGroup(); seriesGroup->set_PieSplitBy(PieSplitType::Custom); seriesGroup->set_IsColorVaried(true); // Select Online and Events by their zero-based indexes in the series. seriesGroup->get_PieSplitCustomPoints()->Add(1); seriesGroup->get_PieSplitCustomPoints()->Add(3); // Exclude Partners from the selection without deleting its source data. seriesGroup->get_PieSplitCustomPoints()->Add(2); seriesGroup->get_PieSplitCustomPoints()->Remove(2); presentation->Save(u"pie_of_pie_custom.pptx", SaveFormat::Pptx); ``` Online (35) and Events (10) appear as separate slices in the secondary plot. In the primary plot, they are represented by one combined slice with a value of 45, alongside Retail (40) and Partners (15). Removing Partners from the custom selection keeps it in the primary plot; it does not remove the category or its value from the chart's source data. The following image shows the saved presentation in PowerPoint: ![Pie of Pie chart with Online and Events in the secondary plot and their combined value of 45 in the primary plot](https://docs.aspose.com/slides/cpp/pie-chart/pie_of_pie_custom.png) ## **Set Automatic Pie Chart Slice Colors** Aspose.Slides for C++ can automatically assign different colors to pie chart slices. The following example creates a pie chart with a centered title and replaces the default data with three quarterly categories and their values. The [set_ShowValue](https://reference.aspose.com/slides/cpp/aspose.slides.charts/idatalabelformat/set_showvalue/) method displays the values 20, 50, and 30 as labels, while [set_IsColorVaried](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ichartseriesgroup/set_iscolorvaried/) enables a distinct color for each slice. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::Pie, 100, 100, 400, 400); // Add a centered chart title. chart->get_ChartTitle()->AddTextFrameForOverriding(u"Sample Title"); chart->get_ChartTitle()->get_TextFrameForOverriding()->get_TextFrameFormat()->set_CenterText(NullableBool::True); chart->get_ChartTitle()->set_Height(20); chart->set_HasTitle(true); // Replace the default data using the first worksheet. auto workbook = chart->get_ChartData()->get_ChartDataWorkbook(); auto worksheetIndex = 0; chart->get_ChartData()->get_Series()->Clear(); chart->get_ChartData()->get_Categories()->Clear(); auto categoryNames = std::vector{ u"First Qtr", u"2nd Qtr", u"3rd Qtr" }; auto values = std::vector{ 20, 50, 30 }; auto seriesNameCell = workbook->GetCell(worksheetIndex, 0, 1, System::ObjectExt::Box(System::String(u"Series 1"))); auto series = chart->get_ChartData()->get_Series()->Add(seriesNameCell, chart->get_Type()); for (auto i = 0; i < static_cast(categoryNames.size()); i++) { auto categoryCell = workbook->GetCell(worksheetIndex, i + 1, 0, System::ObjectExt::Box(categoryNames[i])); chart->get_ChartData()->get_Categories()->Add(categoryCell); auto valueCell = workbook->GetCell(worksheetIndex, i + 1, 1, System::ObjectExt::Box(values[i])); series->get_DataPoints()->AddDataPointForPieSeries(valueCell); } // Show values and assign different colors to the slices. series->get_Labels()->get_DefaultDataLabelFormat()->set_ShowValue(true); series->get_ParentSeriesGroup()->set_IsColorVaried(true); presentation->Save(u"pie.pptx", SaveFormat::Pptx); ``` ## **FAQ** **Are the Pie of Pie and Bar of Pie variations supported?** Yes, the library [supports](https://reference.aspose.com/slides/cpp/aspose.slides.charts/charttype/) a secondary plot for pie charts, including the Pie of Pie and Bar of Pie types. **Can I export just the chart as an image (for example, PNG)?** Yes, you can [export the chart itself as an image](https://reference.aspose.com/slides/cpp/aspose.slides/shape/getimage/) (such as PNG) without exporting the entire presentation. # Portable Document Format (PDF) > Source: https://docs.aspose.com/slides/cpp/portable-document-format-pdf/ Updated: 2024-11-01 ## **About PDF** The [Portable Document Format](https://en.wikipedia.org/wiki/PDF) is a file format that was created by Adobe System for exchange of documents between different organizations. The purpose of this format was to make it possible that contents of the documents may be represented in such a way that their visual appearance is not dependent of the platform on which it is being viewed. ## **PDF in Aspose.Slides for C++** Any presentation document that can be loaded into Aspose.Slides for C++ can be converted to PDF document which may conform to [PDF 1.5](https://en.wikipedia.org/wiki/PDF/A) or [PDF /A-1b](https://en.wikipedia.org/wiki/PDF/A) depending upon your choice. Aspose.Slides for C++ exports the presentation documents to PDF in such a way that most of the time, the exported PDF document look almost similar to the original presentation document. The Aspose solution supports the following features of the presentation documents while converting to PDF documents: - Images, Text Boxes and other Shapes - Text and Formatting - Paragraphs and Formatting - Hyperlinks - Headers and Footers - Bullets - Tables You can export the presentation documents to PDF documents directly using Aspose.Slides for C++ component only. That is, you do not need any other third party or Aspose.Pdf component for this purpose. Further, you can customize the presentation to PDF export with different options as explained in [this topic](http://docs.aspose.com/display/slidesnet/Converting+to+PDF+File) . ## Related articles - [Different File Formats and Conversions](https://docs.aspose.com/slides/cpp/different-file-formats-and-conversions/) # Get Text Portion Bounds from Presentations in C++ > Learn how to retrieve text portion bounds in PowerPoint presentations using Aspose.Slides for C++. Source: https://docs.aspose.com/slides/cpp/portion-bounds/ Updated: 2026-08-05 ## **Overview** A text portion represents a specific fragment of text inside a paragraph and allows you to work with that fragment independently from surrounding content. In Aspose.Slides, portions can be used when you need to retrieve the bounds of a text fragment, apply formatting to only part of a paragraph, or control text behavior at a more detailed level. This article shows how to get the bounding rectangle of a portion by using [IPortion::GetRect](https://reference.aspose.com/slides/cpp/aspose.slides/iportion/getrect/). It also shows how to get the coordinates of the beginning of a portion by using [IPortion::GetCoordinates](https://reference.aspose.com/slides/cpp/aspose.slides/iportion/getcoordinates/). In addition, it highlights common portion-related scenarios, such as applying a hyperlink to a single text fragment, understanding how formatting is resolved through portion, paragraph, text frame, and theme inheritance, and handling cases where a specified font is unavailable. ## **Get Bounds of a Text Portion** Use [IPortion::GetRect](https://reference.aspose.com/slides/cpp/aspose.slides/iportion/getrect/) to retrieve the bounding rectangle of a text portion: ```cpp #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto presentation = System::MakeObject(u"Shapes.pptx"); auto slide = presentation->get_Slide(0); auto shape = System::ExplicitCast(slide->get_Shape(0)); auto paragraphs = shape->get_TextFrame()->get_Paragraphs(); for (const auto& paragraph : paragraphs) { auto portions = paragraph->get_Portions(); for (const auto& portion : portions) { auto rectangle = portion->GetRect(); auto rectangleX = rectangle.get_X(); auto rectangleY = rectangle.get_Y(); auto rectangleWidth = rectangle.get_Width(); auto rectangleHeight = rectangle.get_Height(); Console::WriteLine(u"X = {0}; Y = {1}; Width = {2}; Height = {3}", rectangleX, rectangleY, rectangleWidth, rectangleHeight); } } presentation->Dispose(); ``` ## **Get Coordinates of a Text Portion** Use [IPortion::GetCoordinates](https://reference.aspose.com/slides/cpp/aspose.slides/iportion/getcoordinates/) to retrieve the coordinates of the beginning of a text portion: ```cpp #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto presentation = System::MakeObject(u"Shapes.pptx"); auto slide = presentation->get_Slide(0); auto shape = System::ExplicitCast(slide->get_Shape(0)); auto paragraphs = shape->get_TextFrame()->get_Paragraphs(); for (const auto& paragraph : paragraphs) { auto portions = paragraph->get_Portions(); for (const auto& portion : portions) { auto point = portion->GetCoordinates(); auto pointX = point.get_X(); auto pointY = point.get_Y(); Console::WriteLine(u"X = {0}; Y = {1}", pointX, pointY); } } presentation->Dispose(); ``` ## **FAQ** ### Can I apply a hyperlink to only part of the text within a single paragraph? Yes, you can [assign a hyperlink](https://docs.aspose.com/slides/cpp/manage-hyperlinks/) to an individual portion; only that fragment will be clickable, not the entire paragraph. ### How does style inheritance work: what does a portion override, and what is taken from a paragraph or text frame? Portion-level properties have the highest precedence. If a property is not set on the [IPortion](https://reference.aspose.com/slides/cpp/aspose.slides/iportion/), Aspose.Slides takes it from the [IParagraph](https://reference.aspose.com/slides/cpp/aspose.slides/iparagraph/). If it is not set there either, Aspose.Slides uses the [ITextFrame](https://reference.aspose.com/slides/cpp/aspose.slides/itextframe/) or [theme](https://reference.aspose.com/slides/cpp/aspose.slides.theme/theme/) style. ### What happens if the font specified for a portion is missing on the target machine or server? [Font substitution rules](https://docs.aspose.com/slides/cpp/font-selection-sequence/) apply. The text may reflow: metrics, hyphenation, and width can change, which matters for precise positioning. ### Can I set portion-specific text fill transparency or a gradient independently of the rest of the paragraph? Yes, text color, fill, and transparency at the [IPortion](https://reference.aspose.com/slides/cpp/aspose.slides/iportion/) level can differ from neighboring fragments. ## Related articles - [Get Paragraph Bounds from Presentations in C++](https://docs.aspose.com/slides/cpp/paragraph-bounds/) # Enhance PowerPoint Presentations with Animations in C++ > Learn how to add and control advanced animation effects in Aspose.Slides for C++ to build dynamic PowerPoint and OpenDocument presentations. Source: https://docs.aspose.com/slides/cpp/powerpoint-animation/ Updated: 2026-09-18 ## **Introduction** Since presentations are meant to present something, their visual appearance and interactive behavior are always taken into account during creation. **PowerPoint animation** plays an important role in making a presentation eye-catching and engaging for viewers. Aspose.Slides provides a wide range of options to add animations to PowerPoint presentations: - Apply various types of PowerPoint animation effects to shapes, charts, tables, OLE objects, and other presentation elements. - Use multiple PowerPoint animation effects on a single shape. - Utilize the animation timeline to control animation effects. - Create custom animations. In Aspose.Slides, various animation effects can be applied to shapes. Since every element on a slide, including text, pictures, OLE objects, and tables, is considered a shape, animation effects can be applied to any element on the slide. The [Aspose::Slides::Animation](https://reference.aspose.com/slides/cpp/aspose.slides.animation/) namespace provides classes for working with PowerPoint animations. ## **Animation Effects** Aspose.Slides supports **150+ animation effects**, including basic effects such as Bounce, PathFootball, and Zoom, and specific effects such as OLEObjectShow and OLEObjectOpen. You can find a full listing in the [EffectType](https://reference.aspose.com/slides/cpp/aspose.slides.animation/effecttype/) enumeration. Additionally, these animation effects can be used in combination with the following behaviors: - [ColorEffect](https://reference.aspose.com/slides/cpp/aspose.slides.animation/coloreffect/) - [CommandEffect](https://reference.aspose.com/slides/cpp/aspose.slides.animation/commandeffect/) - [FilterEffect](https://reference.aspose.com/slides/cpp/aspose.slides.animation/filtereffect/) - [MotionEffect](https://reference.aspose.com/slides/cpp/aspose.slides.animation/motioneffect/) - [PropertyEffect](https://reference.aspose.com/slides/cpp/aspose.slides.animation/propertyeffect/) - [RotationEffect](https://reference.aspose.com/slides/cpp/aspose.slides.animation/rotationeffect/) - [ScaleEffect](https://reference.aspose.com/slides/cpp/aspose.slides.animation/scaleeffect/) - [SetEffect](https://reference.aspose.com/slides/cpp/aspose.slides.animation/seteffect/) ## **Custom Animation** For complete C++ examples that create, inspect, and modify behaviors and editable motion paths, see [Custom Animation](https://docs.aspose.com/slides/cpp/custom-animation/). It is possible to create your own **custom animations** in Aspose.Slides. This can be achieved by combining several behaviors into a new custom animation. [Behavior](https://reference.aspose.com/slides/cpp/aspose.slides.animation/behavior/) is a building block of a PowerPoint animation effect. Combine behaviors to customize an effect, or add a behavior to extend a predefined effect. Repetition is configured through timing settings rather than a separate repeat behavior. [Animation Point](https://reference.aspose.com/slides/cpp/aspose.slides.animation/point/) is a point at which a behavior should be applied. ## **Animation Time Line** [Sequence](https://reference.aspose.com/slides/cpp/aspose.slides.animation/sequence/) is a collection of animation effects that can target different shapes. [IAnimationTimeLine](https://reference.aspose.com/slides/cpp/aspose.slides/ianimationtimeline/) is a set of sequences used in a specific slide. It is an animation engine introduced in PowerPoint 2002. In earlier versions of PowerPoint, adding animation effects to presentations was challenging and could only be achieved with various workarounds. The timeline provides a clearer object model for PowerPoint animations. A slide can have only one animation timeline. ## **Interactive Animation** [Trigger](https://reference.aspose.com/slides/cpp/aspose.slides.animation/effecttriggertype/) allows you to define user actions, such as a button click, that start a particular animation. ## **Shape Animation** Aspose.Slides allows you to apply animations to shapes, which can include text, rectangles, lines, frames, OLE objects, and more. Read more [**About Shape Animation**](https://docs.aspose.com/slides/cpp/shape-animation/). ## **Animated Charts** To create animated charts, you should use the same classes as for shapes. However, PowerPoint animations can only be applied to chart categories or chart series. You can also apply animation effects to a category element or a series element. Read more [**About Animated Charts**](https://docs.aspose.com/slides/cpp/animated-charts/). ## **Animated Text** In addition to animating text, you can apply animation to a paragraph. Read more [**About Animated Text**](https://docs.aspose.com/slides/cpp/animated-text/). ## **FAQ** **Will animations be preserved when exporting to PDF?** No. PDF is a static format, so animations and [slide transitions](https://docs.aspose.com/slides/cpp/slide-transition/) don’t play. If you need motion, export to [HTML5](https://docs.aspose.com/slides/cpp/export-to-html5/), [animated GIF](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-animated-gif/), or [video](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/) instead. **Can I turn an animated presentation into a video and control the frame rate and frame size?** Yes. You can [render the presentation as frames](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/) and encode them into a video (e.g., via ffmpeg), choosing the FPS and resolution. Animations and slide transitions are played during rendering. **Will animations remain intact when working with ODP (not just PPTX)?** PPT, PPTX, and ODP are supported for [reading](https://docs.aspose.com/slides/cpp/open-presentation/) and [writing](https://docs.aspose.com/slides/cpp/save-presentation/), but this does not guarantee animation preservation. Custom animation data can be lost when converting to ODP. See [Custom Animation](https://docs.aspose.com/slides/cpp/custom-animation/) for examples and guidance on checking format compatibility. ## Related articles - [Animate PowerPoint Text in C++](https://docs.aspose.com/slides/cpp/animated-text/) - [Animate PowerPoint Charts in C++](https://docs.aspose.com/slides/cpp/animated-charts/) - [Animation](https://docs.aspose.com/slides/cpp/examples/elements/animation/) # Create and Customize PowerPoint Charts in C++ > Create and customize PowerPoint charts in C++ with Aspose.Slides—work with data, styles, and chart types in PPT and PPTX using clear code examples. Source: https://docs.aspose.com/slides/cpp/powerpoint-charts/ Updated: 2026-07-31 --- lastmod: 2026-07-31T17:58:11+04:00 title: Create and Customize PowerPoint Charts in C++ linktitle: PowerPoint Charts type: docs weight: 70 url: /cpp/powerpoint-charts/ keywords: - add chart - create chart - update chart - change chart - modify chart - customize chart - chart type - chart entities - format chart - chart workbook - animated chart - export chart - PowerPoint - presentation - C++ - Aspose.Slides description: "Create and customize PowerPoint charts in C++ with Aspose.Slides—work with data, styles, and chart types in PPT and PPTX using clear code examples." --- ## Related articles - [Chart](https://docs.aspose.com/slides/cpp/examples/elements/chart/) - [Note](https://docs.aspose.com/slides/cpp/examples/elements/note/) - [Customize Presentation Charts in C++](https://docs.aspose.com/slides/cpp/chart-types/) # Master PowerPoint Fonts in C++ > Learn to control PowerPoint fonts in Aspose.Slides for C++: embed, substitute, load custom fonts, and resolve missing glyphs with concise code. Source: https://docs.aspose.com/slides/cpp/powerpoint-fonts/ Updated: 2025-11-19 --- lastmod: 2025-11-19T22:55:59+04:00 title: Master PowerPoint Fonts in C++ linktitle: PowerPoint Fonts type: docs weight: 30 url: /cpp/powerpoint-fonts/ keywords: - PowerPoint font - customize font - default font - embed font - fallback font - font replacement - font substitution - font selection - PowerPoint - OpenDocument - presentation - C++ - Aspose.Slides description: "Learn to control PowerPoint fonts in Aspose.Slides for C++: embed, substitute, load custom fonts, and resolve missing glyphs with concise code." --- ## Related articles - [Manage Fallback Fonts for Presentations in C++](https://docs.aspose.com/slides/cpp/fallback-font/) - [Streamline Font Replacement in Presentations Using C++](https://docs.aspose.com/slides/cpp/font-replacement/) - [Font Selection Sequence in Aspose.Slides for C++](https://docs.aspose.com/slides/cpp/font-selection-sequence/) # Add Math Equations to PowerPoint Presentations in C++ > Insert and edit math equations in PowerPoint PPT and PPTX with Aspose.Slides for C++, supporting OMML, formatting controls, and clear C++ code samples. Source: https://docs.aspose.com/slides/cpp/powerpoint-math-equations/ Updated: 2026-11-18 ## **Overview** PowerPoint stores equations as Office Math Markup Language (OMML). With Aspose.Slides for C++, you can create the same kind of math content programmatically: fractions, radicals, functions, limits, N-ary operators, matrices, arrays, and formatted math blocks. In PowerPoint, users normally add equations from **Insert > Equation**: ![PowerPoint Insert tab with the Equation command selected](https://docs.aspose.com/slides/cpp/powerpoint-math-equations/powerpoint-math-equations_1.png) The result is editable math text on the slide: ![A PowerPoint slide containing an editable math equation](https://docs.aspose.com/slides/cpp/powerpoint-math-equations/powerpoint-math-equations_2.png) Aspose.Slides builds that math text through three main objects: - A math shape, created with [AddMathShape](https://reference.aspose.com/slides/cpp/aspose.slides/shapecollection/), is the shape that contains the equation. - [MathPortion](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/mathportion/) stores math content inside the shape text frame. - [MathParagraph](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/mathparagraph/) contains one or more [MathBlock](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/mathblock/) objects. Most examples below use [MathematicalText](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/mathematicaltext/) and the fluent methods from [IMathElement](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imathelement/) to keep the code short and readable. For MathML export scenarios, see [Export Math Equations from Presentations in C++](https://docs.aspose.com/slides/cpp/exporting-math-equations/). ## **Create an Equation** This example uses [AddMathShape](https://reference.aspose.com/slides/cpp/aspose.slides/ishapecollection/addmathshape/) to create a math shape and adds the Pythagorean theorem: ![The equation c squared equals a squared plus b squared](https://docs.aspose.com/slides/cpp/powerpoint-math-equations/powerpoint-math-equations_3.png) ```cpp #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace Aspose::Slides::MathText; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto mathShape = slide->get_Shapes()->AddMathShape(20.0f, 20.0f, 700.0f, 120.0f); auto mathPortion = System::ExplicitCast(mathShape->get_TextFrame()->get_Paragraph(0)->get_Portion(0)); auto mathParagraph = mathPortion->get_MathParagraph(); auto equation = System::MakeObject(u"c") ->SetSuperscript(u"2") ->Join(u"=") ->Join(System::MakeObject(u"a")->SetSuperscript(u"2")) ->Join(u"+") ->Join(System::MakeObject(u"b")->SetSuperscript(u"2")); mathParagraph->Add(equation); presentation->Save(u"pythagorean-theorem.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` [AddMathShape](https://reference.aspose.com/slides/cpp/aspose.slides/ishapecollection/addmathshape/) creates a shape that already contains a math paragraph. Access the first [MathPortion](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/mathportion/), call [get_MathParagraph](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/mathportion/get_mathparagraph/), and add math blocks or math elements to it. ## **Add Fractions** Use [Divide](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imathelement/divide/) to create a fraction. You can choose a fraction style with [MathFractionTypes](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/mathfractiontypes/). ![A skewed math fraction showing one divided by x](https://docs.aspose.com/slides/cpp/powerpoint-math-equations/powerpoint-math-equations_4.png) ```cpp #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace Aspose::Slides::MathText; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto mathShape = slide->get_Shapes()->AddMathShape(20.0f, 20.0f, 700.0f, 100.0f); auto mathPortion = System::ExplicitCast(mathShape->get_TextFrame()->get_Paragraph(0)->get_Portion(0)); auto mathParagraph = mathPortion->get_MathParagraph(); auto fraction = System::MakeObject(u"1") ->Divide(u"x", MathFractionTypes::Skewed); mathParagraph->Add(System::MakeObject(fraction)); presentation->Save(u"fraction.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` For a stacked fraction, use [MathFractionTypes::Bar](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/mathfractiontypes/): ```cpp #include #include using namespace Aspose::Slides::MathText; auto stackedFraction = System::MakeObject(u"x + 1")->Divide(u"y - 1", MathFractionTypes::Bar); ``` ## **Add Radicals** Use [Radical](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imathelement/radical/) to create a square root, cube root, or other root. The current element becomes the base, and the argument becomes the degree. ![An n-th root radical expression with x under the radical sign](https://docs.aspose.com/slides/cpp/powerpoint-math-equations/powerpoint-math-equations_5.png) ```cpp #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace Aspose::Slides::MathText; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto mathShape = slide->get_Shapes()->AddMathShape(20.0f, 20.0f, 700.0f, 100.0f); auto mathPortion = System::ExplicitCast(mathShape->get_TextFrame()->get_Paragraph(0)->get_Portion(0)); auto mathParagraph = mathPortion->get_MathParagraph(); auto radical = System::MakeObject(u"x") ->Radical(u"n"); mathParagraph->Add(System::MakeObject(radical)); presentation->Save(u"radical.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ### **Show or Hide the Degree of a Square Root** A square root can display an explicit 2 or use the conventional √x notation. Use [IMathRadical::set_HideDegree](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imathradical/set_hidedegree/) to switch between the two forms. Both retain the degree 2 and the radicand x in the editable equation. ![The same square root with the degree visible on the left and hidden on the right](https://docs.aspose.com/slides/cpp/powerpoint-math-equations/square-root-degree.png) The example saves the same square root twice. In `visible-degree.pptx` the 2 is visible. In `hidden-degree.pptx` it is hidden. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace Aspose::Slides::MathText; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto radicand = System::MakeObject(u"x"); auto radical = radicand->Radical(u"2"); auto block = System::MakeObject(radical); auto mathShape = slide->get_Shapes()->AddMathShape(20.0f, 20.0f, 200.0f, 100.0f); auto mathPortion = System::ExplicitCast(mathShape->get_TextFrame()->get_Paragraph(0)->get_Portion(0)); auto mathParagraph = mathPortion->get_MathParagraph(); mathParagraph->Add(block); radical->set_HideDegree(false); presentation->Save(u"visible-degree.pptx", SaveFormat::Pptx); radical->set_HideDegree(true); presentation->Save(u"hidden-degree.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ## **Add Functions and Limits** Use [AsArgumentOfFunction](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imathelement/asargumentoffunction/) or [Function](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imathelement/function/) for functions such as `sin(x)`, `log(x)`, or custom function names. For limits, put `lim` in a [MathLimit](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/mathlimit/) or use [SetLowerLimit](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imathelement/setlowerlimit/). ![The limit of x as x approaches infinity](https://docs.aspose.com/slides/cpp/powerpoint-math-equations/powerpoint-math-equations_8.png) ```cpp #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace Aspose::Slides::MathText; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto mathShape = slide->get_Shapes()->AddMathShape(20.0f, 20.0f, 700.0f, 100.0f); auto mathPortion = System::ExplicitCast(mathShape->get_TextFrame()->get_Paragraph(0)->get_Portion(0)); auto mathParagraph = mathPortion->get_MathParagraph(); auto limit = System::MakeObject(u"lim") ->SetLowerLimit(u"x→∞") ->Function(u"x"); mathParagraph->Add(System::MakeObject(limit)); presentation->Save(u"functions-and-limits.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` For a custom function name, make the function name the current element and call [Function](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imathelement/function/) with its argument: ```cpp #include using namespace Aspose::Slides::MathText; auto customFunction = System::MakeObject(u"f")->Function(u"x + 1"); ``` ## **Add N-ary Operators and Integrals** Use [Nary](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imathelement/nary/) for summations, unions, intersections, and other large operators. Use [Integral](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imathelement/integral/) for integrals. Both methods let you set lower and upper limits. ![A summation with lower and upper limits](https://docs.aspose.com/slides/cpp/powerpoint-math-equations/powerpoint-math-equations_7.png) ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace Aspose::Slides::MathText; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto mathShape = slide->get_Shapes()->AddMathShape(20.0f, 20.0f, 700.0f, 120.0f); auto mathPortion = System::ExplicitCast(mathShape->get_TextFrame()->get_Paragraph(0)->get_Portion(0)); auto mathParagraph = mathPortion->get_MathParagraph(); auto summationBase = System::MakeObject(u"x") ->SetSuperscript(u"k") ->Join(System::MakeObject(u"a")->SetSuperscript(u"n-k")); auto summation = summationBase->Nary(MathNaryOperatorTypes::Summation, u"k=0", u"n"); mathParagraph->Add(System::MakeObject(summation)); presentation->Save(u"nary-operators.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` N-ary operators are for large operators with optional limits. Simple operators such as `+`, `-`, and `=` are usually added as [MathematicalText](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/mathematicaltext/) and joined into the expression. For an integral, use [Integral](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imathelement/integral/): ```cpp #include #include #include #include #include using namespace Aspose::Slides::MathText; auto integralBase = System::MakeObject(u"x")->Join(System::MakeObject(u"dx")->ToBox()); auto integral = integralBase->Integral(MathIntegralTypes::Simple, u"0", u"1"); ``` ## **Add Matrices** Use [MathMatrix](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/mathmatrix/) for rows and columns. Matrices do not include brackets by default, so enclose the matrix when you need parentheses, brackets, or braces. ![A two-row math matrix with one empty cell](https://docs.aspose.com/slides/cpp/powerpoint-math-equations/powerpoint-math-equations_10.png) ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace Aspose::Slides::MathText; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto mathShape = slide->get_Shapes()->AddMathShape(20.0f, 20.0f, 700.0f, 120.0f); auto mathPortion = System::ExplicitCast(mathShape->get_TextFrame()->get_Paragraph(0)->get_Portion(0)); auto mathParagraph = mathPortion->get_MathParagraph(); auto matrix = System::MakeObject(2, 3); matrix->idx_set(0, 0, System::MakeObject(u"1")); matrix->idx_set(0, 1, System::MakeObject(u"x")); matrix->idx_set(1, 0, System::MakeObject(u"x")); matrix->idx_set(1, 1, System::MakeObject(u"2")); matrix->idx_set(1, 2, System::MakeObject(u"y")); mathParagraph->Add(System::MakeObject(matrix)); presentation->Save(u"matrix.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ### **Edit an Existing Matrix** Suppose a linear algebra lesson starts with the coefficient matrix in `matrix.pptx`, saved by the preceding example. For the next exercise, keep the first equation, replace the second with two new equations, and revise the set of variables. Open the existing matrix through [IMathMatrix](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imathmatrix/) to keep the coefficients that still apply. ![Original two-row coefficient matrix with entries 1, x, and an empty cell in the first row and x, 2, and y in the second](https://docs.aspose.com/slides/cpp/powerpoint-math-equations/matrix-before-edit.png) Row and column indices start at zero and refer to the matrix as it stands at each call. Inserting a row before index 1 moves the original second row to index 2. Inserting after index 2 then appends a row. Deleting row 2 removes the original second equation and moves the appended row up one position. Columns shift in the same way. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace Aspose::Slides::MathText; auto presentation = System::MakeObject(u"matrix.pptx"); auto shape = System::ExplicitCast(presentation->get_Slide(0)->get_Shape(0)); auto portion = System::ExplicitCast(shape->get_TextFrame()->get_Paragraph(0)->get_Portion(0)); auto block = portion->get_MathParagraph()->idx_get(0); auto matrix = System::ExplicitCast(block->idx_get(0)); matrix->InsertRowBefore(1); matrix->InsertRowAfter(2); matrix->DeleteRow(2); matrix->InsertColumnBefore(1); matrix->InsertColumnAfter(3); matrix->DeleteColumn(3); // New cells are initially null. Set the nonzero coefficients first. matrix->idx_set(1, 0, System::MakeObject(u"12")); matrix->idx_set(1, 1, System::MakeObject(u"1")); matrix->idx_set(2, 2, System::MakeObject(u"10")); matrix->idx_set(2, 3, System::MakeObject(u"1")); for (auto row = 0; row < matrix->get_RowCount(); ++row) { for (auto column = 0; column < matrix->get_ColumnCount(); ++column) { if (matrix->idx_get(row, column) == nullptr) matrix->idx_set(row, column, System::MakeObject(u"0")); } } matrix->SetColumnAlignment(0, MathHorizontalAlignment::Left); matrix->SetColumnsAlignment(1, 3, MathHorizontalAlignment::Right); presentation->Save(u"updated-matrix.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` [SetColumnAlignment](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imathmatrix/setcolumnalignment/) aligns the first column to the left. [SetColumnsAlignment](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imathmatrix/setcolumnsalignment/) aligns three consecutive columns to the right, starting at index 1. In `updated-matrix.pptx`, the matrix has three equations and four variables. The original first-row coefficients `1` and `x` now appear in the first and third columns. ![Updated three-row matrix showing the rows 1, 0, x, 0; 12, 1, 0, 0; and 0, 0, 10, 1](https://docs.aspose.com/slides/cpp/powerpoint-math-equations/matrix-after-edit.png) ## **Add Equation Arrays** Use [ToMathArray](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imathelement/tomatharray/) when you need aligned equations or a vertical stack of expressions. ![A vertical math array with x above y](https://docs.aspose.com/slides/cpp/powerpoint-math-equations/powerpoint-math-equations_11.png) ```cpp #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace Aspose::Slides::MathText; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto mathShape = slide->get_Shapes()->AddMathShape(20.0f, 20.0f, 700.0f, 140.0f); auto mathPortion = System::ExplicitCast(mathShape->get_TextFrame()->get_Paragraph(0)->get_Portion(0)); auto mathParagraph = mathPortion->get_MathParagraph(); auto equationArray = System::MakeObject(u"x") ->Join(u"y") ->ToMathArray(); mathParagraph->Add(System::MakeObject(equationArray)); presentation->Save(u"equation-array.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ### **Align an Array with Surrounding Elements** [IMathArray::set_BaseJustification](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imatharray/set_basejustification/) controls the vertical alignment of an array relative to the mathematical elements beside it. The example below compares alignment with the first row, the center of the array, and the last row. The following example creates three identical arrays, each with three rows and the neighboring elements `A=` and `=B`. All mathematical text uses Cambria Math at 24 points. Only the array alignment changes. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace Aspose::Slides::MathText; auto createText = [](System::String value) { auto text = System::MakeObject(value); text->get_Format()->set_FontHeight(24); auto font = System::MakeObject(u"Cambria Math"); text->get_Format()->set_LatinFont(font); return text; }; auto presentation = System::MakeObject(); presentation->get_SlideSize()->SetSize(780, 200, SlideSizeScaleType::DoNotScale); auto slide = presentation->get_Slide(0); MathVerticalAlignment alignments[] = {MathVerticalAlignment::Top, MathVerticalAlignment::Center, MathVerticalAlignment::Bottom}; System::String labels[] = {u"Top", u"Center", u"Bottom"}; for (auto i = 0; i < 3; i++) { auto label = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 20 + i * 260, 10, 240, 30); label->get_FillFormat()->set_FillType(FillType::NoFill); label->get_LineFormat()->get_FillFormat()->set_FillType(FillType::NoFill); label->get_TextFrame()->set_Text(labels[i]); auto labelFormat = label->get_TextFrame()->get_Paragraph(0)->get_Portion(0)->get_PortionFormat(); labelFormat->set_FontHeight(16); labelFormat->get_FillFormat()->set_FillType(FillType::Solid); labelFormat->get_FillFormat()->get_SolidFillColor()->set_Color(System::Drawing::Color::get_Black()); auto mathShape = slide->get_Shapes()->AddMathShape(20 + i * 260, 60, 240, 130); mathShape->get_TextFrame()->get_TextFrameFormat()->set_AnchoringType(TextAnchorType::Top); auto mathPortion = System::ExplicitCast(mathShape->get_TextFrame()->get_Paragraph(0)->get_Portion(0)); auto mathParagraph = mathPortion->get_MathParagraph(); mathParagraph->set_Justification(MathJustification::LeftJustified); auto rows = System::MakeArray>({createText(u"x+y=3"), createText(u"x-y=1"), createText(u"x=2")}); auto equationArray = System::MakeObject(rows); equationArray->set_BaseJustification(alignments[i]); auto leftText = createText(u"A="); auto rightText = createText(u"=B"); auto equation = System::MakeObject(leftText)->Join(equationArray)->Join(rightText); mathParagraph->Add(equation); } presentation->Save(u"equation-array-alignment.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` The following comparison shows the saved presentation in PowerPoint. Notice the position of `A=` and `=B` beside each array. ![Equation arrays in PowerPoint with Top, Center, and Bottom alignment and identical neighboring elements](https://docs.aspose.com/slides/cpp/powerpoint-math-equations/equation-array-alignment.png) ### **Configure Row Spacing** [set_RowSpacingRule](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imatharray/set_rowspacingrule/) selects the spacing rule for rows within the array. [set_RowSpacing](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imatharray/set_rowspacing/) supplies a numeric value for an explicit spacing rule and is ignored by the preset rules. For exact spacing, the value is measured in points. For proportional spacing, it is measured in half-lines: the value `3` in the example specifies 1.5 lines. Call both setters when specifying an explicit value; changing the numeric value alone does not select a spacing rule. The example below saves five presentations with the same equations, alignment, and font settings. The first three use presets; the last two show explicit values. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace Aspose::Slides::MathText; auto createText = [](System::String value) { auto text = System::MakeObject(value); text->get_Format()->set_FontHeight(24); auto font = System::MakeObject(u"Cambria Math"); text->get_Format()->set_LatinFont(font); return text; }; struct ArraySettings { MathRowSpacingRule rule; uint32_t spacing; System::String name; }; ArraySettings settings[] = { {MathRowSpacingRule::SingleLineGap, 0, u"SingleLineGap"}, {MathRowSpacingRule::OneAndAHalfLineGap, 0, u"OneAndAHalfLineGap"}, {MathRowSpacingRule::TwoLineGap, 0, u"TwoLineGap"}, {MathRowSpacingRule::Exactly, 20, u"Exactly"}, {MathRowSpacingRule::Multiple, 3, u"Multiple"} }; for (const auto& setting : settings) { auto fileName = u"equation-array-" + setting.name + u".pptx"; auto presentation = System::MakeObject(); auto mathShape = presentation->get_Slide(0)->get_Shapes()->AddMathShape(20, 20, 600, 300); auto paragraph = mathShape->get_TextFrame()->get_Paragraph(0); paragraph->get_ParagraphFormat()->set_SpaceBefore(0); paragraph->get_ParagraphFormat()->set_SpaceAfter(0); auto mathPortion = System::ExplicitCast(paragraph->get_Portion(0)); auto mathParagraph = mathPortion->get_MathParagraph(); mathParagraph->set_Justification(MathJustification::LeftJustified); auto rows = System::MakeArray>({createText(u"x+y=3"), createText(u"x-y=1"), createText(u"x=2")}); auto equationArray = System::MakeObject(rows); equationArray->set_BaseJustification(MathVerticalAlignment::Center); equationArray->set_RowSpacingRule(setting.rule); equationArray->set_RowSpacing(setting.spacing); auto leftText = createText(u"A="); auto rightText = createText(u"=B"); auto equation = System::MakeObject(leftText)->Join(equationArray)->Join(rightText); mathParagraph->Add(equation); presentation->Save(fileName, SaveFormat::Pptx); presentation->Dispose(); } ``` Array row spacing is separate from paragraph spacing. [set_SpaceBefore](https://reference.aspose.com/slides/cpp/aspose.slides/iparagraphformat/set_spacebefore/) and [set_SpaceAfter](https://reference.aspose.com/slides/cpp/aspose.slides/iparagraphformat/set_spaceafter/) add space around the containing paragraph, not between array rows. Likewise, [IMathParagraph::set_Justification](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imathparagraph/set_justification/) positions the whole math paragraph horizontally; it does not replace the array's vertical alignment setting. ## **Add Trigonometric Functions** Use [AsArgumentOfFunction](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imathelement/asargumentoffunction/) when the argument is the current element and the function name is known. ![The trigonometric function cos applied to 2x](https://docs.aspose.com/slides/cpp/powerpoint-math-equations/powerpoint-math-equations_6.png) ```cpp #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace Aspose::Slides::MathText; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto mathShape = slide->get_Shapes()->AddMathShape(20.0f, 20.0f, 700.0f, 100.0f); auto mathPortion = System::ExplicitCast(mathShape->get_TextFrame()->get_Paragraph(0)->get_Portion(0)); auto mathParagraph = mathPortion->get_MathParagraph(); auto cosine = System::MakeObject(u"2x") ->AsArgumentOfFunction(MathFunctionsOfOneArgument::Cos); mathParagraph->Add(System::MakeObject(cosine)); presentation->Save(u"trigonometric-function.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ## **Add Subscripts and Superscripts** Use the subscript and superscript helpers for indexes and powers. When the indexes must appear on the left side of the base, use [SetSubSuperscriptOnTheLeft](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imathelement/setsubsuperscriptontheleft/). ![A capital Y with left-side subscript 1 and superscript n](https://docs.aspose.com/slides/cpp/powerpoint-math-equations/powerpoint-math-equations_9.png) ```cpp #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace Aspose::Slides::MathText; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto mathShape = slide->get_Shapes()->AddMathShape(20.0f, 20.0f, 700.0f, 100.0f); auto mathPortion = System::ExplicitCast(mathShape->get_TextFrame()->get_Paragraph(0)->get_Portion(0)); auto mathParagraph = mathPortion->get_MathParagraph(); auto scripts = System::MakeObject(u"Y") ->SetSubSuperscriptOnTheLeft(u"1", u"n"); mathParagraph->Add(System::MakeObject(scripts)); presentation->Save(u"subscript-superscript.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ## **Add Delimiters** Use [Enclose](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imathelement/enclose/) to put an expression inside delimiters. You can also set a separator character for delimiter expressions that contain several elements. ![A delimiter expression containing x, y, and z separated by vertical bars](https://docs.aspose.com/slides/cpp/powerpoint-math-equations/powerpoint-math-equations_13.png) ```cpp #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace Aspose::Slides::MathText; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto mathShape = slide->get_Shapes()->AddMathShape(20.0f, 20.0f, 700.0f, 100.0f); auto mathPortion = System::ExplicitCast(mathShape->get_TextFrame()->get_Paragraph(0)->get_Portion(0)); auto mathParagraph = mathPortion->get_MathParagraph(); auto delimiter = System::MakeObject(u"x") ->Join(u"y") ->Join(u"z") ->Enclose(u'<', u'>', u'|'); mathParagraph->Add(System::MakeObject(delimiter)); presentation->Save(u"delimiters.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ### **Size and Align Delimiters** Pass `true` to [set_GrowToMatchOperandHeight](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imathdelimiter/set_growtomatchoperandheight/) to let the parentheses grow around a tall operand, or `false` to keep them at their normal size. [set_DelimiterShape](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imathdelimiter/set_delimitershape/) takes one of two [MathDelimiterShape](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/mathdelimitershape/) values. `Centered` centers the parentheses on the math axis, which runs through the middle of the equals sign. `Match` aligns them with the enclosed content. Both settings affect only the delimiters. The expression inside stays the same. The example places a fraction in the exponent of `x` so the expression extends farther above the baseline than below it. All four equations use the same parentheses and font settings. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace Aspose::Slides::MathText; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto addExpression = [slide](float left, float top, bool grow, MathDelimiterShape shape) { auto fraction = System::MakeObject(u"a + b")->Divide(u"c + d"); auto power = System::MakeObject(u"x")->SetSuperscript(fraction); auto delimiter = power->Enclose(u'(', u')'); delimiter->set_GrowToMatchOperandHeight(grow); delimiter->set_DelimiterShape(shape); auto mathShape = slide->get_Shapes()->AddMathShape(left, top, 300, 100); auto portion = System::ExplicitCast(mathShape->get_TextFrame()->get_Paragraph(0)->get_Portion(0)); portion->get_PortionFormat()->set_FontHeight(32); auto equation = System::MakeObject(u"y = ")->Join(delimiter); portion->get_MathParagraph()->Add(equation); }; addExpression(20, 20, true, MathDelimiterShape::Centered); addExpression(350, 20, true, MathDelimiterShape::Match); addExpression(20, 140, false, MathDelimiterShape::Centered); addExpression(350, 140, false, MathDelimiterShape::Match); presentation->Save(u"delimiter-sizing.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` In PowerPoint, compare the rows to see the effect of growth. In the top row, the parentheses grow to enclose the exponent and look alike for both shapes. In the bottom row, growth is off. The smaller parentheses on the left (`Centered`) align with the equals sign, while those on the right (`Match`) sit higher around the expression. ![Four equations in PowerPoint with delimiter growth enabled above and disabled below, and Centered on the left and Match on the right](https://docs.aspose.com/slides/cpp/powerpoint-math-equations/delimiter-sizing.png) ## **Add a Border Box** Call [ToBorderBox](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imathelement/toborderbox/) on a fraction to frame the entire expression. The returned [IMathBorderBox](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imathborderbox/) shows all four sides by default. Use [set_HideTop](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imathborderbox/set_hidetop/), [set_HideBottom](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imathborderbox/set_hidebottom/), [set_HideLeft](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imathborderbox/set_hideleft/), and [set_HideRight](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imathborderbox/set_hideright/) to remove individual sides. The example places six copies of the same fraction on one slide. To show cancellation, hide all four sides and set [set_StrikethroughBottomLeftToTopRight](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imathborderbox/set_strikethroughbottomlefttotopright/) for a rising diagonal (↗) or [set_StrikethroughTopLeftToBottomRight](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imathborderbox/set_strikethroughtoplefttobottomright/) for a falling diagonal (↘). You can also use [set_StrikethroughHorizontal](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imathborderbox/set_strikethroughhorizontal/) or [set_StrikethroughVertical](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imathborderbox/set_strikethroughvertical/) with any combination of visible sides. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace Aspose::Slides::MathText; auto presentation = System::MakeObject(); presentation->get_SlideSize()->SetSize(540, 220, SlideSizeScaleType::DoNotScale); auto slide = presentation->get_Slide(0); auto addFraction = [slide](float x, float y, bool hideBorder = false) { auto fraction = System::MakeObject(u"x+1")->Divide(u"y+2"); auto box = fraction->ToBorderBox(); box->set_HideTop(hideBorder); box->set_HideBottom(hideBorder); box->set_HideLeft(hideBorder); box->set_HideRight(hideBorder); auto shape = slide->get_Shapes()->AddMathShape(x, y, 160, 90); auto portion = System::ExplicitCast(shape->get_TextFrame()->get_Paragraph(0)->get_Portion(0)); portion->get_PortionFormat()->set_FontHeight(28); auto mathBlock = System::MakeObject(box); portion->get_MathParagraph()->Add(mathBlock); return box; }; addFraction(10, 10); auto partial = addFraction(190, 10); partial->set_HideTop(true); partial->set_HideRight(true); addFraction(370, 10, true)->set_StrikethroughBottomLeftToTopRight(true); addFraction(10, 120, true)->set_StrikethroughTopLeftToBottomRight(true); addFraction(190, 120, true)->set_StrikethroughHorizontal(true); addFraction(370, 120)->set_StrikethroughVertical(true); presentation->Save(u"border-box.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ![Six editable fractions in PowerPoint. Top row: full border, bottom and left sides, rising diagonal. Bottom row: falling diagonal, horizontal strike, vertical strike with a full border.](https://docs.aspose.com/slides/cpp/powerpoint-math-equations/border-box-fractions.png) On this fraction, the horizontal strike overlaps the fraction bar. The vertical strike crosses both the numerator and the denominator while the surrounding border stays visible. These lines decorate the whole expression. Ordinary text strikethrough applies to characters in a text run. After reopening the presentation in PowerPoint, you can still edit the numerator and denominator independently. ## **Control Visibility and Layout with Phantom Elements** Wrap an expression in [MathPhantom](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/mathphantom/) to control its visibility and the space it contributes to an equation independently. The [IMathPhantom](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imathphantom/) setter methods control the following: | Method | Effect | | --- | --- | | [set_Show](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imathphantom/set_show/) | Pass `false` to hide the expression. Its dimensions still contribute to layout unless the corresponding settings below are `true`. | | [set_ZeroWidth](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imathphantom/set_zerowidth/) | Treat the expression's horizontal width as zero, allowing neighboring elements to move closer together. | | [set_ZeroAsc](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imathphantom/set_zeroasc/) | Treat its ascent, the height above the baseline, as zero. This can reduce the space reserved above neighboring elements. | | [set_ZeroDesc](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imathphantom/set_zerodesc/) | Treat its descent, the depth below the baseline, as zero. This can move a fraction bar or other content below the expression closer to its neighbors. | The baseline is the reference line on which ordinary mathematical letters sit. Hiding content does not remove its dimensions, and treating a dimension as zero does not delete the expression. The underlying expression remains available through [get_Base](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imathphantom/get_base/). Pass `true` to [set_Show](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imathphantom/set_show/) to display it again; the dimension settings remain unchanged. The example below creates five side-by-side variants: a visible fraction, a hidden fraction that reserves space, and three hidden fractions with one dimension treated as zero. Each variant uses the same surrounding expression and Cambria Math at 24 points. All equation shapes have the same top position, marked by the gray guide. Placing the phantom in the numerator of an outer fraction makes the vertical layout changes easier to see. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace Aspose::Slides::MathText; auto createText = [](System::String value) { auto text = System::MakeObject(value); text->get_Format()->set_FontHeight(24); auto font = System::MakeObject(u"Cambria Math"); text->get_Format()->set_LatinFont(font); return text; }; auto presentation = System::MakeObject(); presentation->get_SlideSize()->SetSize(1000, 180, SlideSizeScaleType::DoNotScale); auto slide = presentation->get_Slide(0); std::array labels = {u"Visible", u"Hidden: reserves space", u"Hidden: ZeroWidth", u"Hidden: ZeroAsc", u"Hidden: ZeroDesc"}; auto guide = slide->get_Shapes()->AddAutoShape(ShapeType::Line, 10, 60, 980, 0); guide->get_LineFormat()->get_FillFormat()->set_FillType(FillType::Solid); guide->get_LineFormat()->get_FillFormat()->get_SolidFillColor()->set_Color(System::Drawing::Color::get_LightGray()); for (auto i = 0; i < labels.size(); i++) { auto left = 10 + i * 200; auto label = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, left, 10, 190, 30); label->get_FillFormat()->set_FillType(FillType::NoFill); label->get_LineFormat()->get_FillFormat()->set_FillType(FillType::NoFill); label->get_TextFrame()->set_Text(labels[i]); auto labelFormat = label->get_TextFrame()->get_Paragraph(0)->get_Portion(0)->get_PortionFormat(); labelFormat->set_FontHeight(14); labelFormat->get_FillFormat()->set_FillType(FillType::Solid); labelFormat->get_FillFormat()->get_SolidFillColor()->set_Color(System::Drawing::Color::get_Black()); auto fractionNumerator = createText(u"a+b"); auto fractionDenominator = createText(u"c+d"); auto fraction = System::MakeObject(fractionNumerator, fractionDenominator); auto phantom = System::MakeObject(fraction); phantom->set_Show(i == 0); phantom->set_ZeroWidth(i == 2); phantom->set_ZeroAsc(i == 3); phantom->set_ZeroDesc(i == 4); auto leadingText = createText(u"x+"); auto trailingText = createText(u"+y"); auto numeratorBlock = System::MakeObject(leadingText); auto numerator = numeratorBlock->Join(phantom)->Join(trailingText); auto denominator = createText(u"z"); auto equation = System::MakeObject(numerator, denominator); auto shape = slide->get_Shapes()->AddMathShape(left, 60, 190, 100); shape->get_TextFrame()->get_TextFrameFormat()->set_AnchoringType(TextAnchorType::Top); auto mathPortion = System::ExplicitCast(shape->get_TextFrame()->get_Paragraph(0)->get_Portion(0)); auto mathParagraph = mathPortion->get_MathParagraph(); auto mathBlock = System::MakeObject(equation); mathParagraph->Add(mathBlock); } presentation->Save(u"math-phantom.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ![Five equations in PowerPoint comparing a visible fraction, a hidden fraction that reserves space, and hidden fractions with ZeroWidth, ZeroAsc, or ZeroDesc enabled](https://docs.aspose.com/slides/cpp/powerpoint-math-equations/math-phantom.png) ## **Group Terms** Use [Group](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imathelement/group/) to place a grouping character above or below an expression. Add a limit to label the grouped terms. ![The expression x plus y grouped with the label any text below it](https://docs.aspose.com/slides/cpp/powerpoint-math-equations/powerpoint-math-equations_15.png) ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace Aspose::Slides::MathText; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto mathShape = slide->get_Shapes()->AddMathShape(20.0f, 20.0f, 700.0f, 120.0f); auto mathPortion = System::ExplicitCast(mathShape->get_TextFrame()->get_Paragraph(0)->get_Portion(0)); auto mathParagraph = mathPortion->get_MathParagraph(); auto grouped = System::MakeObject(u"x + y") ->Group(u'\u23DF', MathTopBotPositions::Bottom, MathTopBotPositions::Top) ->SetLowerLimit(u"any text"); mathParagraph->Add(System::MakeObject(grouped)); presentation->Save(u"grouped-terms.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ## **Format Math Elements** Use formatting helpers only where they clarify the formula. For example, [Overbar](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imathelement/overbar/) places a bar above a math element. ![A math expression ABC with an overbar](https://docs.aspose.com/slides/cpp/powerpoint-math-equations/powerpoint-math-equations_14.png) ```cpp #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace Aspose::Slides::MathText; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto mathShape = slide->get_Shapes()->AddMathShape(20.0f, 20.0f, 700.0f, 100.0f); auto mathPortion = System::ExplicitCast(mathShape->get_TextFrame()->get_Paragraph(0)->get_Portion(0)); auto mathParagraph = mathPortion->get_MathParagraph(); auto overbar = System::MakeObject(u"ABC")->Overbar(); mathParagraph->Add(System::MakeObject(overbar)); presentation->Save(u"overbar.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ### **Format Text in an Existing Equation** To format text throughout an existing equation, traverse each math block's element tree. [IMathElement::GetChildren](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imathelement/getchildren/) returns only the immediate children, so call it recursively to reach text inside fractions, scripts, radicals, and other nested structures. Check the current element as well as its children to include the starting element when it is [MathematicalText](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/mathematicaltext/). This example assumes that a presentation contains an equation such as `z = xᵢ / ∛y`, with a fraction containing a subscript in its numerator and a radical in its denominator. Processing only the block's top-level elements would miss the text inside the fraction. The example finds mathematical portions in slide text frames, accesses their blocks through [IMathPortion::get_MathParagraph](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imathportion/get_mathparagraph/), and sets the font height to 28 points with [set_FontHeight](https://reference.aspose.com/slides/cpp/aspose.slides/baseportionformat/set_fontheight/), accessing the formatting through each text element's [get_Format](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/mathematicaltext/get_format/) method. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace Aspose::Slides::MathText; std::function)> formatMathText; formatMathText = [&formatMathText](System::SharedPtr element) { auto text = System::DynamicCast(element); if (text != nullptr) text->get_Format()->set_FontHeight(28.0f); for (auto child : element->GetChildren()) formatMathText(child); }; auto presentation = System::MakeObject(u"input.pptx"); for (auto slide : presentation->get_Slides()) { for (auto shape : slide->get_Shapes()) { auto autoShape = System::DynamicCast(shape); if (autoShape == nullptr || autoShape->get_TextFrame() == nullptr) continue; for (auto paragraph : autoShape->get_TextFrame()->get_Paragraphs()) { for (auto portion : paragraph->get_Portions()) { auto mathPortion = System::DynamicCast(portion); if (mathPortion != nullptr) { for (auto block : mathPortion->get_MathParagraph()) formatMathText(block); } } } } } presentation->Save(u"formatted-equations.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` The saved presentation contains the updated text formatting at every level of each processed equation, while preserving its text content and mathematical structure. ## **Quick Reference** | Task | Main API | | --- | --- | | Create math text | [MathematicalText](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/mathematicaltext/) | | Combine elements | [IMathElement.Join](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imathelement/join/) | | Create fractions | [IMathElement.Divide](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imathelement/divide/) | | Add superscript or subscript | [SetSuperscript](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imathelement/setsuperscript/), [SetSubscript](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imathelement/setsubscript/) | | Add functions | [Function](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imathelement/function/), [AsArgumentOfFunction](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imathelement/asargumentoffunction/) | | Add radicals | [IMathElement.Radical](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imathelement/radical/) | | Add limits | [SetLowerLimit](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imathelement/setlowerlimit/), [SetUpperLimit](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imathelement/setupperlimit/) | | Add left-side scripts | [SetSubSuperscriptOnTheLeft](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imathelement/setsubsuperscriptontheleft/) | | Add summations and integrals | [Nary](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imathelement/nary/), [Integral](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imathelement/integral/) | | Add matrices | [MathMatrix](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/mathmatrix/) | | Add equation arrays | [ToMathArray](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imathelement/tomatharray/) | | Add delimiters | [Enclose](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imathelement/enclose/) | | Add bars and borders | [Overbar](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imathelement/overbar/), [ToBorderBox](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imathelement/toborderbox/) | | Group terms | [Group](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imathelement/group/) | ## **FAQ** **Can I edit an existing PowerPoint equation?** Yes. Open the presentation, find the shape that contains a [MathPortion](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/mathportion/), call [get_MathParagraph](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/mathportion/get_mathparagraph/), and update the math blocks in that paragraph. **Are equations saved as editable PowerPoint math?** Yes. When you save to PPTX, Aspose.Slides writes the equation as editable Office math content. **Can I export equations to LaTeX?** Yes. Get the equation's [IMathParagraph](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imathparagraph/) from its [IMathPortion](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imathportion/), and call [IMathParagraph::ToLatex](https://reference.aspose.com/slides/cpp/aspose.slides.mathtext/imathparagraph/tolatex/) to export it directly. For a complete example, see [Export Math Equations from Presentations in C++](https://docs.aspose.com/slides/cpp/exporting-math-equations/#export-math-equations-to-latex). ## Related articles - [Math Text](https://docs.aspose.com/slides/cpp/examples/elements/math-text/) - [Export Math Equations from Presentations in C++](https://docs.aspose.com/slides/cpp/exporting-math-equations/) # Manage PowerPoint Shapes in C++ > Learn how to create, edit, format, and manipulate shapes in Aspose.Slides for C++, with code examples for PPT and PPTX presentations. Source: https://docs.aspose.com/slides/cpp/powerpoint-shapes/ Updated: 2025-11-19 --- lastmod: 2025-11-19T22:55:59+04:00 title: Manage PowerPoint Shapes in C++ linktitle: PowerPoint Shapes type: docs weight: 90 url: /cpp/powerpoint-shapes/ keywords: - shape - format shape - shape effect - manage shape - effective properties - animation - rendering - ActiveX - PowerPoint - presentation - C++ - Aspose.Slides description: "Learn how to create, edit, format, and manipulate shapes in Aspose.Slides for C++, with code examples for PPT and PPTX presentations." --- ## Related articles - [ActiveX](https://docs.aspose.com/slides/cpp/examples/elements/activex/) - [Animation](https://docs.aspose.com/slides/cpp/examples/elements/animation/) - [Shape Types in Aspose.Slides for C++](https://docs.aspose.com/slides/cpp/shape-types/) # Create and Customize PowerPoint SmartArt in C++ > Learn how to create and edit PowerPoint SmartArt in C++ via Aspose.Slides API: layouts, nodes, styles, with step-by-step examples to automate slides fast. Source: https://docs.aspose.com/slides/cpp/powerpoint-smartart/ Updated: 2025-11-19 --- lastmod: 2025-11-19T22:55:59+04:00 title: Create and Customize PowerPoint SmartArt in C++ linktitle: PowerPoint SmartArt type: docs weight: 100 url: /cpp/powerpoint-smartart/ keywords: - SmartArt - manage SmartArt - SmartArt graphic - SmartArt node - PowerPoint - presentation - C++ - Aspose.Slides description: "Learn how to create and edit PowerPoint SmartArt in C++ via Aspose.Slides API: layouts, nodes, styles, with step-by-step examples to automate slides fast." --- ## Related articles - [SmartArt](https://docs.aspose.com/slides/cpp/examples/elements/smart-art/) - [Manage SmartArt in PowerPoint Presentations Using C++](https://docs.aspose.com/slides/cpp/manage-smartart/) - [Manage SmartArt Shape Nodes in Presentations Using C++](https://docs.aspose.com/slides/cpp/manage-smartart-shape-node/) # Create and Customize PowerPoint Tables in C++ > Create and format tables in PowerPoint PPT and PPTX using Aspose.Slides for C++ — insert rows and columns, merge cells, set borders, import data. Source: https://docs.aspose.com/slides/cpp/powerpoint-table/ Updated: 2025-11-19 --- lastmod: 2025-11-19T22:55:59+04:00 title: Create and Customize PowerPoint Tables in C++ type: docs weight: 110 url: /cpp/powerpoint-table/ keywords: - create table - add row - add column - customize table - customize row - customize column - customize cell - PowerPoint - presentation - C++ - Aspose.Slides description: "Create and format tables in PowerPoint PPT and PPTX using Aspose.Slides for C++ — insert rows and columns, merge cells, set borders, import data." --- ## Related articles - [Table](https://docs.aspose.com/slides/cpp/examples/elements/table/) - [Manage Rows and Columns in PowerPoint Tables Using C++](https://docs.aspose.com/slides/cpp/manage-rows-and-columns/) - [Manage Table Cells in Presentations Using C++](https://docs.aspose.com/slides/cpp/manage-cells/) # Manage Presentation Accessibility in C++ > Automate presentation accessibility checks in PPT, PPTX and ODP files with Aspose.Slides for C++—enhance screen reader experience and boost compliance. Source: https://docs.aspose.com/slides/cpp/presentation-accessibility/ Updated: 2026-09-25 ## **Introduction** Alternative text helps people using assistive technologies understand the meaning of images, charts, and other informative shapes. This article explains how to read and update alternative text titles and descriptions with Aspose.Slides for C++, distinguish accessibility descriptions from shape names used in code, and check whether a shape is marked as decorative. These features support presentation accessibility, but do not guarantee it. Reading order, color contrast, text readability, and other accessibility requirements also need review. ## **Manage Alternative Text Titles and Descriptions** Use alternative text to explain the meaning of images, charts, and other informative shapes to people who cannot see them. The following properties serve different purposes: | Property or content | Purpose | | --- | --- | | [AlternativeTextTitle](https://reference.aspose.com/slides/cpp/aspose.slides/ishape/get_alternativetexttitle/) | A short title for the alternative description. | | [AlternativeText](https://reference.aspose.com/slides/cpp/aspose.slides/ishape/get_alternativetext/) | A meaningful description of the shape's content or purpose in the context of the slide. | | [Name](https://reference.aspose.com/slides/cpp/aspose.slides/ishape/get_name/) | The shape's name, which code can use to find a specific shape in the presentation. | | Visible text | Content displayed on the slide, such as a shape's text or a chart's title and labels. Updating alternative text does not change this content. | When a presentation is reused as a template, code may find a shape by its [Name](https://reference.aspose.com/slides/cpp/aspose.slides/ishape/get_name/) before updating it. This name serves a different purpose from alternative text, which explains what the visual communicates to the reader. Searching by name allows authors to improve or translate descriptions without changing how code finds the shape. Names can be edited and are not guaranteed to be unique, so check that the name matches the intended shape; see [Identify and Find Shapes](https://docs.aspose.com/slides/cpp/shape-manipulations/#identify-and-find-shapes). The following example requires `input.pptx` with an image of an office entrance as the first shape on the first slide. The image should not be marked as decorative. The example reads and prints its current alternative text title and description, updates both values, and saves the presentation as `output.pptx`. Adapt the wording to the actual image and the information it conveys. ```cpp #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(u"input.pptx"); auto shape = presentation->get_Slide(0)->get_Shape(0); Console::WriteLine(u"Alternative text title: {0}", shape->get_AlternativeTextTitle()); Console::WriteLine(u"Alternative text description: {0}", shape->get_AlternativeText()); shape->set_AlternativeTextTitle(u"Office entrance"); shape->set_AlternativeText(u"The office entrance has a wheelchair ramp to the right of the steps."); presentation->Save(u"output.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` Adding alternative text alone does not guarantee presentation accessibility or compliance with accessibility standards. Review the descriptions for accuracy and relevance, and also check reading order, color contrast, readable text, and other accessibility requirements. Informative visuals should not be marked as decorative; the next section shows how to read [IsDecorative](https://reference.aspose.com/slides/cpp/aspose.slides/ishape/get_isdecorative/). ## **Mark as Decorative** Mark as decorative flags purely ornamental visuals so screen readers skip them, reducing noise and keeping focus on meaningful content. Apply it to backgrounds, flourishes, and spacers—never to charts, icons, or images that convey information. Aspose.Slides exposes this flag for detection and validation, enabling automated accessibility checks and cleanup. ![Mark as Decorative](https://docs.aspose.com/slides/cpp/presentation-accessibility/mark_as_decorative.png) The following code sample shows how to determine whether a shape is marked as decorative. ```cpp #include #include #include #include using namespace Aspose::Slides; using namespace System; auto presentation = MakeObject(u"sample.pptx"); auto shape = presentation->get_Slide(0)->get_Shape(0); Console::WriteLine(u"Is shape decorative: {0}", shape->get_IsDecorative()); presentation->Dispose(); ``` ## **FAQ** **What should I put in the alternative text title and description?** Use a short title to identify the subject and a description to explain the information the visual conveys in the context of the slide. For a chart, describe the relevant trend or comparison rather than only saying "chart." **Should I use alternative text to locate shapes in a template?** Prefer finding the shape by its [Name](https://reference.aspose.com/slides/cpp/aspose.slides/ishape/get_name/) and checking that it is the expected shape. Alternative text may be edited or translated, which can break code that searches for an exact description; see [Identify and Find Shapes](https://docs.aspose.com/slides/cpp/shape-manipulations/). **When should a shape be marked as decorative?** Use the decorative flag for visuals that add no information, such as ornamental flourishes. Images and charts that communicate meaning need an appropriate description instead. **Does adding alternative text make a presentation fully accessible?** No. Alternative text addresses only part of accessibility. Also review reading order, color contrast, text readability, and other applicable requirements; setting these properties alone does not establish compliance. # Manage Presentation Backgrounds in C++ > Learn how to set dynamic backgrounds in PowerPoint and OpenDocument files using Aspose.Slides for C++, with code tips to boost your presentations. Source: https://docs.aspose.com/slides/cpp/presentation-background/ Updated: 2026-08-13 ## **Introduction** Solid colors, gradients, and images are commonly used for slide backgrounds. You can set the background for a **normal slide** (a single slide) or a **master slide** (applies to multiple slides at once). ![PowerPoint background](https://docs.aspose.com/slides/cpp/presentation-background/powerpoint-background.png) ## **Set a Solid Color Background for a Normal Slide** Aspose.Slides allows you to set a solid color as the background for a specific slide in a presentation—even if the presentation uses a master slide. The change applies only to the selected slide. 1. Create an instance of the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) class. 2. Set the slide’s [BackgroundType](https://reference.aspose.com/slides/cpp/aspose.slides/backgroundtype/) to `OwnBackground`. 3. Set the slide background [FillType](https://reference.aspose.com/slides/cpp/aspose.slides/filltype/) to `Solid`. 4. Use the [get_SolidFillColor](https://reference.aspose.com/slides/cpp/aspose.slides/fillformat/get_solidfillcolor/) method on [FillFormat](https://reference.aspose.com/slides/cpp/aspose.slides/fillformat/) to specify the solid background color. 5. Save the modified presentation. The following C++ example shows how to set a blue solid color as the background for a normal slide: ```cpp #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::Drawing; // Create an instance of the Presentation class. auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); // Set the background color of the slide to blue. slide->get_Background()->set_Type(BackgroundType::OwnBackground); slide->get_Background()->get_FillFormat()->set_FillType(FillType::Solid); slide->get_Background()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Blue()); // Save the presentation to disk. presentation->Save(u"SolidColorBackground.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ## **Set a Solid Color Background for a Master Slide** Aspose.Slides allows you to set a solid color as the background for the master slide in a presentation. The master slide acts as a template that controls formatting for all slides, so when you choose a solid color for the master slide’s background, it applies to every slide. 1. Create an instance of the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) class. 2. Set the master slide’s [BackgroundType](https://reference.aspose.com/slides/cpp/aspose.slides/backgroundtype/) (via `get_Masters`) to `OwnBackground`. 3. Set the master slide background [FillType](https://reference.aspose.com/slides/cpp/aspose.slides/filltype/) to `Solid`. 4. Use the [get_SolidFillColor](https://reference.aspose.com/slides/cpp/aspose.slides/fillformat/get_solidfillcolor/) method to specify the solid background color. 5. Save the modified presentation. The following C++ example shows how to set a solid color (forest green) as the background for a master slide: ```cpp #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::Drawing; // Create an instance of the Presentation class. auto presentation = MakeObject(); auto masterSlide = presentation->get_Master(0); // Set the background color for the Master slide to Forest Green. masterSlide->get_Background()->set_Type(BackgroundType::OwnBackground); masterSlide->get_Background()->get_FillFormat()->set_FillType(FillType::Solid); masterSlide->get_Background()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_ForestGreen()); // Save the presentation to disk. presentation->Save(u"MasterSlideBackground.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ## **Set a Gradient Background for a Slide** A gradient is a graphical effect created by a gradual change in color. When used as a slide background, gradients can make presentations look more artistic and professional. Aspose.Slides allows you to set a gradient color as the background for slides. 1. Create an instance of the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) class. 2. Set the slide’s [BackgroundType](https://reference.aspose.com/slides/cpp/aspose.slides/backgroundtype/) to `OwnBackground`. 3. Set the slide background [FillType](https://reference.aspose.com/slides/cpp/aspose.slides/filltype/) to `Gradient`. 4. Use the [get_GradientFormat](https://reference.aspose.com/slides/cpp/aspose.slides/fillformat/get_gradientformat/) method on [FillFormat](https://reference.aspose.com/slides/cpp/aspose.slides/fillformat/) to configure your preferred gradient settings. 5. Save the modified presentation. The following C++ example shows how to set a gradient color as the background for a slide: ```cpp #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; // Create an instance of the Presentation class. auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); // Apply a gradient effect to the background. slide->get_Background()->set_Type(BackgroundType::OwnBackground); slide->get_Background()->get_FillFormat()->set_FillType(FillType::Gradient); slide->get_Background()->get_FillFormat()->get_GradientFormat()->set_TileFlip(TileFlip::FlipBoth); // Save the presentation to disk. presentation->Save(u"GradientBackground.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ## **Set an Image as a Slide Background** In addition to solid and gradient fills, Aspose.Slides allows you to use images as slide backgrounds. 1. Create an instance of the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) class. 2. Set the slide’s [BackgroundType](https://reference.aspose.com/slides/cpp/aspose.slides/backgroundtype/) to `OwnBackground`. 3. Set the slide background [FillType](https://reference.aspose.com/slides/cpp/aspose.slides/filltype/) to `Picture`. 4. Load the image you want to use as the slide background. 5. Add the image to the presentation’s image collection. 6. Use the [get_PictureFillFormat](https://reference.aspose.com/slides/cpp/aspose.slides/fillformat/get_picturefillformat/) method on [FillFormat](https://reference.aspose.com/slides/cpp/aspose.slides/fillformat/) to assign the image as the background. 7. Save the modified presentation. The following C++ example shows how to set an image as the background for a slide: ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; // Create an instance of the Presentation class. auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); // Set background image properties. slide->get_Background()->set_Type(BackgroundType::OwnBackground); slide->get_Background()->get_FillFormat()->set_FillType(FillType::Picture); slide->get_Background()->get_FillFormat()->get_PictureFillFormat()->set_PictureFillMode(PictureFillMode::Stretch); // Load the image. auto image = Images::FromFile(u"Tulips.jpg"); // Add the image to the presentation's image collection. auto ppImage = presentation->get_Images()->AddImage(image); image->Dispose(); slide->get_Background()->get_FillFormat()->get_PictureFillFormat()->get_Picture()->set_Image(ppImage); // Save the presentation to disk. presentation->Save(u"ImageAsBackground.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` The following code sample shows how to set the background fill type to a tiled picture and modify the tiling properties: ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(); auto firstSlide = presentation->get_Slide(0); auto background = firstSlide->get_Background(); background->set_Type(BackgroundType::OwnBackground); background->get_FillFormat()->set_FillType(FillType::Picture); auto newImage = Images::FromFile(u"image.png"); auto ppImage = presentation->get_Images()->AddImage(newImage); newImage->Dispose(); // Set the image used for the background fill. auto backPictureFillFormat = background->get_FillFormat()->get_PictureFillFormat(); backPictureFillFormat->get_Picture()->set_Image(ppImage); // Set the picture fill mode to Tile and adjust the tile properties. backPictureFillFormat->set_PictureFillMode(PictureFillMode::Tile); backPictureFillFormat->set_TileOffsetX(15.0); backPictureFillFormat->set_TileOffsetY(15.0); backPictureFillFormat->set_TileScaleX(46.0); backPictureFillFormat->set_TileScaleY(87.0); backPictureFillFormat->set_TileAlignment(RectangleAlignment::Center); backPictureFillFormat->set_TileFlip(TileFlip::FlipY); presentation->Save(u"TileBackground.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` Read more: [**Tile Picture As Texture**](https://docs.aspose.com/slides/cpp/shape-formatting/#tile-picture-as-texture). ### **Change the Background Image Transparency** You may want to adjust the transparency of a slide's background image to make the contents of the slide stand out. The following C++ code shows you how to change the transparency for a slide background image: ```cpp #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Effects; using namespace Aspose::Slides::Export; using namespace System; auto transparencyValue = 30; // For example. // Create an instance of the Presentation class. auto presentation = MakeObject(u"Sample.pptx"); auto slide = presentation->get_Slide(0); // Get the collection of picture transform operations. auto imageTransform = slide->get_Background()->get_FillFormat()->get_PictureFillFormat()->get_Picture()->get_ImageTransform(); // Find an existing fixed-percentage transparency effect. SharedPtr transparencyOperation; for (auto&& operation : imageTransform) { if (ObjectExt::Is(operation)) { transparencyOperation = ExplicitCast(operation); break; } } // Set the new transparency value. if (transparencyOperation == nullptr) { imageTransform->AddAlphaModulateFixedEffect(100.0f - transparencyValue); } else { transparencyOperation->set_Amount(100.0f - transparencyValue); } // Save the presentation to disk. presentation->Save(u"TransparentBackground.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ## **Get the Slide Background Value** Aspose.Slides provides the [IBackgroundEffectiveData](https://reference.aspose.com/slides/cpp/aspose.slides/ibackgroundeffectivedata/) interface for retrieving a slide’s effective background values. This interface exposes the effective [FillFormat](https://reference.aspose.com/slides/cpp/aspose.slides/ibackgroundeffectivedata/get_fillformat/) and [EffectFormat](https://reference.aspose.com/slides/cpp/aspose.slides/ibackgroundeffectivedata/get_effectformat/). Using the [BaseSlide](https://reference.aspose.com/slides/cpp/aspose.slides/baseslide/) class’s `get_Background` method, you can obtain the effective background for a slide. The following C++ example shows how to get a slide’s effective background value: ```cpp #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; // Create an instance of the Presentation class. auto presentation = MakeObject(u"Sample.pptx"); auto slide = presentation->get_Slide(0); // Retrieve the effective background, taking into account master, layout, and theme. auto effBackground = slide->get_Background()->GetEffective(); if (effBackground->get_FillFormat()->get_FillType() == FillType::Solid) { Console::WriteLine(u"Fill color: {0}", effBackground->get_FillFormat()->get_SolidFillColor()); } else { Console::WriteLine(u"Fill type: {0}", ObjectExt::ToString(effBackground->get_FillFormat()->get_FillType())); } ``` ## **FAQ** ### Can I reset a custom background and restore the theme/layout background? Yes. Remove the slide’s custom fill, and the background will be inherited again from the corresponding [layout](https://docs.aspose.com/slides/cpp/slide-layout/)/[master](https://docs.aspose.com/slides/cpp/slide-master/) slide (i.e., the [theme background](https://docs.aspose.com/slides/cpp/presentation-theme/)). ### What happens to the background if I change the presentation’s theme later? If a slide has its own fill, it will remain unchanged. If the background is inherited from the [layout](https://docs.aspose.com/slides/cpp/slide-layout/)/[master](https://docs.aspose.com/slides/cpp/slide-master/), it will update to match the [new theme](https://docs.aspose.com/slides/cpp/presentation-theme/). ## Related articles - [Format PowerPoint Shapes in C++](https://docs.aspose.com/slides/cpp/shape-formatting/) # Manage Presentation Comments in C++ > Manage presentation comments with Aspose.Slides for C++: add, read, edit, reply to, and remove comments in PowerPoint presentations quickly and easily. Source: https://docs.aspose.com/slides/cpp/presentation-comments/ Updated: 2026-11-08 ## **Overview** This article explains how to manage presentation comments with Aspose.Slides for C++. It introduces the main comment-related types and demonstrates how to add comments to slides, access existing comments, work with replies and modern comments, and remove comments from a presentation. The examples cover common review and collaboration scenarios in PowerPoint, such as assigning comments to authors, reading comment text and metadata, building reply chains, and removing selected comments or all comments. In PowerPoint, comments appear as annotations on slides. Selecting a comment displays its text and related discussion. To request that comments be shown or hidden when a presentation opens without changing the comments themselves, see [Show or Hide Comments When Opening a Presentation](https://docs.aspose.com/slides/cpp/presentation-view-properties/). ## **Why Add Comments to Presentations?** You can use comments to provide feedback and collaborate with colleagues when reviewing presentations. Aspose.Slides for C++ provides the following APIs for working with comments: * The [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) class, which provides access to the presentation's comment authors. * The [ICommentCollection](https://reference.aspose.com/slides/cpp/aspose.slides/icommentcollection/) interface, which represents the comments associated with an individual author. * The [IComment](https://reference.aspose.com/slides/cpp/aspose.slides/icomment/) interface, which provides information about a comment, including its author, creation time, position, and text. * The [CommentAuthor](https://reference.aspose.com/slides/cpp/aspose.slides/commentauthor/) class, which provides information about an author, including their name, initials, and associated comments. ## **Add Slide Comments** The example creates two slides and registers a comment author with [AddAuthor](https://reference.aspose.com/slides/cpp/aspose.slides/icommentauthorcollection/addauthor/). It uses [AddComment](https://reference.aspose.com/slides/cpp/aspose.slides/icommentcollection/addcomment/) to place one comment on each slide, then retrieves the first slide's comments for that author with [GetSlideComments](https://reference.aspose.com/slides/cpp/aspose.slides/islide/getslidecomments/). The console displays the first comment's text twice, demonstrating access through both the slide and the author, and the saved presentation contains both comments. ```cpp #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::Drawing; auto presentation = MakeObject(); auto firstSlide = presentation->get_Slide(0); auto secondSlide = presentation->get_Slides()->AddEmptySlide(presentation->get_LayoutSlide(0)); auto author = presentation->get_CommentAuthors()->AddAuthor(u"Jawad", u"MF"); auto position = PointF(0.2f, 0.2f); auto createdTime = DateTime::get_Now(); author->get_Comments()->AddComment(u"Hello Jawad, this is a slide comment", firstSlide, position, createdTime); author->get_Comments()->AddComment(u"Hello Jawad, this is the second slide comment", secondSlide, position, createdTime); auto comments = firstSlide->GetSlideComments(author); if (comments->get_Length() > 0) { auto firstComment = comments[0]; Console::WriteLine(firstComment->get_Text()); auto commentText = firstComment->get_Author()->get_Comments()->idx_get(0)->get_Text(); Console::WriteLine(commentText); } presentation->Save(u"Comments_out.pptx", SaveFormat::Pptx); ``` ## **Find or Create a Comment Author** When an automated review processes the same presentation repeatedly, search the collection returned by [get_CommentAuthors](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/get_commentauthors/) before adding an author. [FindByNameAndInitials](https://reference.aspose.com/slides/cpp/aspose.slides/icommentauthorcollection/findbynameandinitials/) matches both the name and initials and returns an array of matching authors, or an empty array if no matches exist. In contrast, [FindByName](https://reference.aspose.com/slides/cpp/aspose.slides/icommentauthorcollection/findbyname/) searches by name alone, regardless of initials. Calling [AddAuthor](https://reference.aspose.com/slides/cpp/aspose.slides/icommentauthorcollection/addauthor/) with a name and initials already present in the collection throws an exception. The example requires a presentation file with at least one slide. On each of two passes, it reuses the first matching author, or creates one only when the result is empty. If there are multiple matches, it selects the first array element without merging or removing the other authors. It then calls [AddComment](https://reference.aspose.com/slides/cpp/aspose.slides/icommentcollection/addcomment/) for the selected author and saves the presentation. The second pass opens the first pass's output and repeats the operation. ```cpp #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::Drawing; const String authorName = u"Reviewer"; const String authorInitials = u"RV"; auto inputFile = String(u"input.pptx"); auto position = PointF(20.0f, 20.0f); for (auto pass = 1; pass <= 2; pass++) { auto presentation = MakeObject(inputFile); auto matches = presentation->get_CommentAuthors()->FindByNameAndInitials(authorName, authorInitials); auto author = matches->get_Length() > 0 ? matches[0] : presentation->get_CommentAuthors()->AddAuthor(authorName, authorInitials); author->get_Comments()->AddComment(u"Please review this slide.", presentation->get_Slide(0), position, DateTime::get_Now()); auto outputFile = String::Format(u"review_pass_{0}.pptx", pass); presentation->Save(outputFile, SaveFormat::Pptx); inputFile = outputFile; } ``` The second pass adds another comment without adding another author or removing existing comments. The final file, `review_pass_2.pptx`, contains both new comments alongside any original comments. Reusing an author does not deduplicate comments: to avoid repeatedly adding the same comment, implement separate duplicate detection before adding it. ## **Access Slide Comments** The example opens an existing presentation and reads the collection returned by [get_CommentAuthors](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/get_commentauthors/). For each author, it iterates through the collection returned by [get_Comments](https://reference.aspose.com/slides/cpp/aspose.slides/icommentauthor/get_comments/) and prints the slide number, comment text, author name, and creation time. The input presentation must contain comments to produce console output. ```cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto presentation = MakeObject(u"Comments1.pptx"); for (auto&& author : presentation->get_CommentAuthors()) { for (auto&& comment : author->get_Comments()) { Console::WriteLine(u"Slide: {0}", comment->get_Slide()->get_SlideNumber()); Console::WriteLine(u"Comment: {0}", comment->get_Text()); Console::WriteLine(u"Author: {0}", comment->get_Author()->get_Name()); Console::WriteLine(u"Posted at: {0}", comment->get_CreatedTime()); Console::WriteLine(); } } ``` ## **Reply to Comments** A parent comment is the original comment at the top of a reply hierarchy. The [get_ParentComment](https://reference.aspose.com/slides/cpp/aspose.slides/icomment/get_parentcomment/) and [set_ParentComment](https://reference.aspose.com/slides/cpp/aspose.slides/icomment/set_parentcomment/) methods of the [IComment](https://reference.aspose.com/slides/cpp/aspose.slides/icomment/) interface let you get or set the parent of a comment. The example creates comments from two authors and uses [set_ParentComment](https://reference.aspose.com/slides/cpp/aspose.slides/icomment/set_parentcomment/) to build replies, including a reply to another reply. Passing `nullptr` to [GetSlideComments](https://reference.aspose.com/slides/cpp/aspose.slides/islide/getslidecomments/) retrieves comments from all authors; the console indents each entry according to its depth in the reply hierarchy. The example saves the complete discussion, calls [Remove](https://reference.aspose.com/slides/cpp/aspose.slides/icomment/remove/) on the first root comment, and saves a second presentation with that comment and its replies removed. ```cpp #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::Drawing; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto position = PointF(10.0f, 10.0f); auto createdTime = DateTime::get_Now(); auto originalAuthor = presentation->get_CommentAuthors()->AddAuthor(u"Author_1", u"A.A."); auto rootComment = originalAuthor->get_Comments()->AddComment(u"comment 1", slide, position, createdTime); auto reviewer = presentation->get_CommentAuthors()->AddAuthor(u"Author_2", u"B.B."); auto firstReply = reviewer->get_Comments()->AddComment(u"reply 1 for comment 1", slide, position, createdTime); firstReply->set_ParentComment(rootComment); auto secondReply = reviewer->get_Comments()->AddComment(u"reply 2 for comment 1", slide, position, createdTime); secondReply->set_ParentComment(rootComment); auto subReply = originalAuthor->get_Comments()->AddComment(u"subreply 3 for reply 2", slide, position, createdTime); subReply->set_ParentComment(secondReply); reviewer->get_Comments()->AddComment(u"comment 2", slide, position, createdTime); auto separateComment = reviewer->get_Comments()->AddComment(u"comment 3", slide, position, createdTime); auto separateReply = originalAuthor->get_Comments()->AddComment(u"reply 4 for comment 3", slide, position, createdTime); separateReply->set_ParentComment(separateComment); auto comments = slide->GetSlideComments(nullptr); for (auto i = 0; i < comments->get_Length(); i++) { auto comment = comments[i]; while (comment->get_ParentComment() != nullptr) { Console::Write(u"\t"); comment = comment->get_ParentComment(); } Console::WriteLine(u"{0}: {1}", comments[i]->get_Author()->get_Name(), comments[i]->get_Text()); } presentation->Save(u"parent_comment.pptx", SaveFormat::Pptx); rootComment->Remove(); presentation->Save(u"remove_comment.pptx", SaveFormat::Pptx); ``` * When the [Remove](https://reference.aspose.com/slides/cpp/aspose.slides/icomment/remove/) method of the [IComment](https://reference.aspose.com/slides/cpp/aspose.slides/icomment/) interface is used to delete a comment, all replies to that comment are also deleted. * If the [set_ParentComment](https://reference.aspose.com/slides/cpp/aspose.slides/icomment/set_parentcomment/) method creates a circular reference, a [PptxEditException](https://reference.aspose.com/slides/cpp/aspose.slides/pptxeditexception/) is thrown. ## **Add Modern Comments** Modern comments can be associated with the slide itself, with a specific shape, or with a text range inside an AutoShape. The [ICommentCollection::AddModernComment](https://reference.aspose.com/slides/cpp/aspose.slides/icommentcollection/addmoderncomment/) method accepts an [IShape](https://reference.aspose.com/slides/cpp/aspose.slides/ishape/) argument in addition to the slide and comment-marker coordinates. When `nullptr` is passed for the shape argument, the comment is a slide-level comment. Its marker is positioned by the supplied coordinates, but it is not associated with a particular shape, so [IModernComment::get_Shape](https://reference.aspose.com/slides/cpp/aspose.slides/imoderncomment/get_shape/) returns `nullptr`. When an [IShape](https://reference.aspose.com/slides/cpp/aspose.slides/ishape/) is supplied, the comment is anchored to that shape. The coordinates still define the position of the comment marker on the slide, while the shape association can be retrieved through [IModernComment::get_Shape](https://reference.aspose.com/slides/cpp/aspose.slides/imoderncomment/get_shape/). ### **Anchor a Modern Comment to a Shape** The example calls [AddModernComment](https://reference.aspose.com/slides/cpp/aspose.slides/icommentcollection/addmoderncomment/) twice: once with a `nullptr` shape for a slide-level comment and once with a rectangle as the anchor. Calling [get_Shape](https://reference.aspose.com/slides/cpp/aspose.slides/imoderncomment/get_shape/) prints `True` for the slide-level comment's null check and `Revenue title` for the anchored comment. Both comments are saved with the presentation. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::Drawing; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto author = presentation->get_CommentAuthors()->AddAuthor(u"Reviewer", u"RV"); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 50.0f, 50.0f, 300.0f, 80.0f); shape->set_Name(u"Revenue title"); shape->get_TextFrame()->set_Text(u"Quarterly revenue"); auto createdTime = DateTime::get_Now(); auto slideCommentPosition = PointF(20.0f, 20.0f); auto shapeCommentPosition = PointF(60.0f, 60.0f); auto slideComment = author->get_Comments()->AddModernComment(u"Review the overall slide layout.", slide, nullptr, slideCommentPosition, createdTime); auto shapeComment = author->get_Comments()->AddModernComment(u"Check this title.", slide, shape, shapeCommentPosition, createdTime); Console::WriteLine(slideComment->get_Shape() == nullptr); auto shapeAnchor = shapeComment->get_Shape(); if (shapeAnchor != nullptr) { Console::WriteLine(shapeAnchor->get_Name()); } presentation->Save(u"modern_comments.pptx", SaveFormat::Pptx); ``` ### **Anchor Comments to Different Shape Types** Any slide object that implements [IShape](https://reference.aspose.com/slides/cpp/aspose.slides/ishape/) can be used as a shape anchor. Common examples include [IAutoShape](https://reference.aspose.com/slides/cpp/aspose.slides/iautoshape/), [IPictureFrame](https://reference.aspose.com/slides/cpp/aspose.slides/ipictureframe/), [IGroupShape](https://reference.aspose.com/slides/cpp/aspose.slides/igroupshape/), [IConnector](https://reference.aspose.com/slides/cpp/aspose.slides/iconnector/), and [IGraphicalObject](https://reference.aspose.com/slides/cpp/aspose.slides/igraphicalobject/) instances such as charts. The example uses [AddModernComment](https://reference.aspose.com/slides/cpp/aspose.slides/icommentcollection/addmoderncomment/) to associate a comment with each of five shape types: an AutoShape, a picture frame, a group, a connector, and a chart. The picture uses embedded image data, so no external image is required. Each comment has its own marker position, and the saved presentation retains all five shape associations. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; using namespace System; using namespace System::Drawing; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto author = presentation->get_CommentAuthors()->AddAuthor(u"Reviewer", u"RV"); auto createdTime = DateTime::get_Now(); auto autoShape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 20.0f, 20.0f, 180.0f, 60.0f); autoShape->get_TextFrame()->set_Text(u"AutoShape"); auto autoShapeCommentPosition = PointF(30.0f, 30.0f); author->get_Comments()->AddModernComment(u"Comment on an AutoShape.", slide, autoShape, autoShapeCommentPosition, createdTime); auto imageBase64 = u"iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAIAAAD91JpzAAAAFklEQVR4nGP8//8/AwMDEwMDAwMDAwAkBgMB/DXemwAAAABJRU5ErkJggg=="; auto imageData = Convert::FromBase64String(imageBase64); auto image = presentation->get_Images()->AddImage(imageData); auto pictureFrame = slide->get_Shapes()->AddPictureFrame(ShapeType::Rectangle, 220.0f, 20.0f, 120.0f, 80.0f, image); auto pictureCommentPosition = PointF(230.0f, 30.0f); author->get_Comments()->AddModernComment(u"Comment on a picture.", slide, pictureFrame, pictureCommentPosition, createdTime); auto groupShape = slide->get_Shapes()->AddGroupShape(); groupShape->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 0.0f, 0.0f, 80.0f, 40.0f); groupShape->get_Shapes()->AddAutoShape(ShapeType::Ellipse, 100.0f, 0.0f, 80.0f, 40.0f); auto groupCommentPosition = PointF(40.0f, 150.0f); author->get_Comments()->AddModernComment(u"Comment on a group.", slide, groupShape, groupCommentPosition, createdTime); auto connector = slide->get_Shapes()->AddConnector(ShapeType::StraightConnector1, 220.0f, 150.0f, 140.0f, 40.0f); auto connectorCommentPosition = PointF(240.0f, 150.0f); author->get_Comments()->AddModernComment(u"Comment on a connector.", slide, connector, connectorCommentPosition, createdTime); auto chart = slide->get_Shapes()->AddChart(ChartType::ClusteredColumn, 400.0f, 20.0f, 250.0f, 180.0f); auto chartCommentPosition = PointF(420.0f, 40.0f); author->get_Comments()->AddModernComment(u"Comment on a graphical object.", slide, chart, chartCommentPosition, createdTime); presentation->Save(u"modern_comment_shape_types.pptx", SaveFormat::Pptx); ``` ### **Anchor a Comment to Text and Set Its Status** For a modern comment associated with an [IAutoShape](https://reference.aspose.com/slides/cpp/aspose.slides/iautoshape/), [IModernComment::get_TextSelectionStart](https://reference.aspose.com/slides/cpp/aspose.slides/imoderncomment/get_textselectionstart/) and [IModernComment::set_TextSelectionStart](https://reference.aspose.com/slides/cpp/aspose.slides/imoderncomment/set_textselectionstart/) control the starting position of the selected text in the shape's text frame. Similarly, [IModernComment::get_TextSelectionLength](https://reference.aspose.com/slides/cpp/aspose.slides/imoderncomment/get_textselectionlength/) and [IModernComment::set_TextSelectionLength](https://reference.aspose.com/slides/cpp/aspose.slides/imoderncomment/set_textselectionlength/) control the length of the selection. Together, these methods associate the comment with a specific text range inside the AutoShape. The [IModernComment::get_Status](https://reference.aspose.com/slides/cpp/aspose.slides/imoderncomment/get_status/) and [IModernComment::set_Status](https://reference.aspose.com/slides/cpp/aspose.slides/imoderncomment/set_status/) methods use a value from the [ModernCommentStatus](https://reference.aspose.com/slides/cpp/aspose.slides/moderncommentstatus/) enumeration: - `NotDefined` — no specific modern-comment status is defined. - `Active` — the comment is active. - `Resolved` — the comment has been resolved. - `Closed` — the comment is closed. The example anchors a modern comment to the words "quarterly revenue" in a rectangle's text. It calculates the zero-based selection start from the text, passes it to [set_TextSelectionStart](https://reference.aspose.com/slides/cpp/aspose.slides/imoderncomment/set_textselectionstart/), and calls [set_TextSelectionLength](https://reference.aspose.com/slides/cpp/aspose.slides/imoderncomment/set_textselectionlength/) with the number of selected characters. After calling [set_Status](https://reference.aspose.com/slides/cpp/aspose.slides/imoderncomment/set_status/) with `Resolved`, it saves and reopens the presentation. The four console checks should each print `True`, confirming that the shape anchor, text range, and status were preserved. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::Drawing; const String outputFile = u"modern_comment_text_anchor.pptx"; const String shapeText = u"Review the quarterly revenue forecast."; const String selectedText = u"quarterly revenue"; auto expectedSelectionStart = shapeText.IndexOf(selectedText); auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 50.0f, 50.0f, 400.0f, 100.0f); shape->set_Name(u"Forecast text"); shape->get_TextFrame()->set_Text(shapeText); auto author = presentation->get_CommentAuthors()->AddAuthor(u"Reviewer", u"RV"); auto commentPosition = PointF(60.0f, 60.0f); auto comment = author->get_Comments()->AddModernComment(u"Verify this forecast wording.", slide, shape, commentPosition, DateTime::get_Now()); comment->set_TextSelectionStart(expectedSelectionStart); comment->set_TextSelectionLength(selectedText.get_Length()); comment->set_Status(ModernCommentStatus::Resolved); presentation->Save(outputFile, SaveFormat::Pptx); auto reopenedPresentation = MakeObject(outputFile); auto reopenedSlide = reopenedPresentation->get_Slide(0); auto reopenedComments = reopenedSlide->GetSlideComments(nullptr); for (auto&& reopenedComment : reopenedComments) { auto modernComment = AsCast(reopenedComment); if (modernComment == nullptr) { continue; } auto shapeAnchor = modernComment->get_Shape(); auto shapeMatches = shapeAnchor != nullptr && shapeAnchor->get_Name() == u"Forecast text"; auto selectionStartMatches = modernComment->get_TextSelectionStart() == expectedSelectionStart; auto selectionLengthMatches = modernComment->get_TextSelectionLength() == selectedText.get_Length(); auto statusMatches = modernComment->get_Status() == ModernCommentStatus::Resolved; Console::WriteLine(u"Shape anchor preserved: {0}", shapeMatches); Console::WriteLine(u"Text selection start preserved: {0}", selectionStartMatches); Console::WriteLine(u"Text selection length preserved: {0}", selectionLengthMatches); Console::WriteLine(u"Resolved status preserved: {0}", statusMatches); } ``` [![The phrase quarterly revenue is highlighted inside Forecast text; stored start 11, length 17 and Resolved status are listed separately from marker coordinates (60, 60).](https://docs.aspose.com/slides/cpp/presentation-comments/visual-presentation-comments-94241d308643.svg)](https://docs.aspose.com/slides/cpp/presentation-comments/visual-presentation-comments-94241d308643.svg) *Schematic annotation of the example’s text range. A licensed .NET 26.11 save/reopen check retained the Forecast text anchor, start 11, length 17 and Resolved status. Marker coordinates are separate from the anchor; this figure does not depict a client comment pane.* ### **Inspect Existing Modern Comments** The example requires an existing presentation containing modern comments and prints their text, status, and anchor details. To inspect it, check which comments implement [IModernComment](https://reference.aspose.com/slides/cpp/aspose.slides/imoderncomment/), then examine [IModernComment::get_Shape](https://reference.aspose.com/slides/cpp/aspose.slides/imoderncomment/get_shape/), [IModernComment::get_TextSelectionStart](https://reference.aspose.com/slides/cpp/aspose.slides/imoderncomment/get_textselectionstart/), [IModernComment::get_TextSelectionLength](https://reference.aspose.com/slides/cpp/aspose.slides/imoderncomment/get_textselectionlength/), and [IModernComment::get_Status](https://reference.aspose.com/slides/cpp/aspose.slides/imoderncomment/get_status/). A `nullptr` shape indicates a slide-level comment. For an [IAutoShape](https://reference.aspose.com/slides/cpp/aspose.slides/iautoshape/) anchor, the text-selection methods identify the associated range in the shape's text frame. ```cpp #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto presentation = MakeObject(u"comments.pptx"); for (auto&& slide : presentation->get_Slides()) { auto comments = slide->GetSlideComments(nullptr); for (auto&& comment : comments) { auto modernComment = AsCast(comment); if (modernComment == nullptr) { continue; } Console::WriteLine(u"Slide: {0}", slide->get_SlideNumber()); Console::WriteLine(u"Text: {0}", modernComment->get_Text()); Console::WriteLine(u"Status: {0}", modernComment->get_Status()); auto shape = modernComment->get_Shape(); if (shape == nullptr) { Console::WriteLine(u"Anchor: slide level"); } else { Console::WriteLine(u"Anchor shape: {0}", shape->get_Name()); Console::WriteLine(u"Anchor type: {0}", shape->GetType().get_Name()); auto autoShape = AsCast(shape); if (autoShape != nullptr) { Console::WriteLine(u"Text selection start: {0}", modernComment->get_TextSelectionStart()); Console::WriteLine(u"Text selection length: {0}", modernComment->get_TextSelectionLength()); } } Console::WriteLine(); } } ``` ## **Remove Comments** Aspose.Slides for C++ lets you remove all comments and their authors from a presentation or delete selected comments while keeping the rest. The following examples demonstrate both approaches and save the updated presentation. ### **Remove All Comments and Comment Authors** The example opens an existing presentation and calls [ICommentCollection::Clear](https://reference.aspose.com/slides/cpp/aspose.slides/icommentcollection/clear/) for each author, then calls [ICommentAuthorCollection::Clear](https://reference.aspose.com/slides/cpp/aspose.slides/icommentauthorcollection/clear/) to remove the authors themselves. The saved presentation contains neither comments nor comment authors. Use a presentation containing comments to observe the removal. ```cpp #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(u"example.pptx"); for (auto&& author : presentation->get_CommentAuthors()) { author->get_Comments()->Clear(); } presentation->get_CommentAuthors()->Clear(); presentation->Save(u"example_out.pptx", SaveFormat::Pptx); ``` ### **Remove Specific Comments** The example creates two comments on one slide and uses [GetSlideComments](https://reference.aspose.com/slides/cpp/aspose.slides/islide/getslidecomments/) to find comments by each author. It collects comments whose text equals "comment 1" before calling [ICommentCollection::Remove](https://reference.aspose.com/slides/cpp/aspose.slides/icommentcollection/remove/), avoiding changes to the collection during selection. The saved presentation retains only "comment 2". ```cpp #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::Collections::Generic; using namespace System::Drawing; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto author = presentation->get_CommentAuthors()->AddAuthor(u"Author", u"A"); auto createdTime = DateTime::get_Now(); auto firstCommentPosition = PointF(0.2f, 0.2f); auto secondCommentPosition = PointF(0.3f, 0.2f); author->get_Comments()->AddComment(u"comment 1", slide, firstCommentPosition, createdTime); author->get_Comments()->AddComment(u"comment 2", slide, secondCommentPosition, createdTime); for (auto&& commentAuthor : presentation->get_CommentAuthors()) { auto commentsToRemove = MakeObject>>(); auto comments = slide->GetSlideComments(commentAuthor); for (auto&& comment : comments) { if (comment->get_Text() == u"comment 1") { commentsToRemove->Add(comment); } } for (auto&& comment : commentsToRemove) { commentAuthor->get_Comments()->Remove(comment); } } presentation->Save(u"pres.pptx", SaveFormat::Pptx); ``` ## **FAQ** **Does Aspose.Slides support a resolved status for modern comments?** Yes. [IModernComment::get_Status](https://reference.aspose.com/slides/cpp/aspose.slides/imoderncomment/get_status/) and [IModernComment::set_Status](https://reference.aspose.com/slides/cpp/aspose.slides/imoderncomment/set_status/) use a [ModernCommentStatus](https://reference.aspose.com/slides/cpp/aspose.slides/moderncommentstatus/) value, including `Resolved`. The status is stored in the presentation and can be read again after the file is reopened. **Are threaded discussions (reply chains) supported, and is there a nesting limit?** Yes. Each comment can reference its [parent comment](https://reference.aspose.com/slides/cpp/aspose.slides/icomment/set_parentcomment/), enabling reply chains. The API does not define a specific nesting-depth limit. **In what coordinate system is a comment marker's position defined on a slide?** The marker position is defined by floating-point coordinates in the slide coordinate system, allowing you to place it precisely on the slide. ## Related articles - [Comment](https://docs.aspose.com/slides/cpp/examples/elements/comment/) # Manage Presentation Content in C++ > Create, edit, and extract presentation content with Aspose.Slides for C++ — get code examples for text, images, shapes, charts; PPT, PPTX and ODP. Source: https://docs.aspose.com/slides/cpp/presentation-content/ Updated: 2026-07-31 --- lastmod: 2026-07-31T17:58:11+04:00 title: Manage Presentation Content in C++ linktitle: Presentation Content type: docs weight: 30 url: /cpp/presentation-content/ keywords: - content - BLOB - hyperlink - media - OLE - text - zoom - chart - equation - shape - ink - SmartArt - table - PowerPoint - OpenDocument - presentation - C++ - Aspose.Slides description: "Create, edit, and extract presentation content with Aspose.Slides for C++ — get code examples for text, images, shapes, charts; PPT, PPTX and ODP." --- ## Related articles - [Ink](https://docs.aspose.com/slides/cpp/examples/elements/ink/) - [OLE Object](https://docs.aspose.com/slides/cpp/examples/elements/ole-object/) # Design Professional Presentations in C++ > Boost your slides with Aspose.Slides for C++ — design, automate, and convert PowerPoint and OpenDocument presentations effortlessly. Learn more now! Source: https://docs.aspose.com/slides/cpp/presentation-design/ Updated: 2025-11-19 --- lastmod: 2025-11-19T22:55:59+04:00 title: Design Professional Presentations in C++ linktitle: Presentation Design type: docs weight: 40 url: /cpp/presentation-design/ keywords: - PowerPoint design - OpenDocument design - presentation design - slide design - PPT design - PPTX design - ODP design - PowerPoint - OpenDocument - presentation - C++ - Aspose.Slides description: "Boost your slides with Aspose.Slides for C++ — design, automate, and convert PowerPoint and OpenDocument presentations effortlessly. Learn more now!" --- # Manage Presentation Headers and Footers in C++ > Learn how to manage footer, date-time, slide-number, and header placeholders on slides, notes pages, and handouts with Aspose.Slides for C++. Source: https://docs.aspose.com/slides/cpp/presentation-header-and-footer/ Updated: 2026-11-08 ## **Overview** PowerPoint uses different header and footer placeholders depending on the page type. Aspose.Slides for C++ lets you control the text and visibility of these placeholders through header/footer manager interfaces. The available placeholders depend on the scope: | Scope | Header | Footer | Date/time | Slide/page number | |---|---|---|---|---| | Regular slide | No | Yes | Yes | Yes | | Notes master | Yes | Yes | Yes | Yes | | Notes slide | Yes | Yes | Yes | Yes | | Handout master | Yes | Yes | Yes | Yes | A regular presentation slide does not have a header placeholder. Headers are available on notes pages and handouts. For regular slides, use footer, date/time, and slide-number placeholders instead. The scope of a change depends on the manager you use. The [ISlideHeaderFooterManager](https://reference.aspose.com/slides/cpp/aspose.slides/islideheaderfootermanager/) interface controls one regular slide. The [INotesSlideHeaderFooterManager](https://reference.aspose.com/slides/cpp/aspose.slides/inotesslideheaderfootermanager/) interface controls one notes slide. Master and layout managers can also propagate settings to dependent slides, while the [IMasterHandoutSlideHeaderFooterManager](https://reference.aspose.com/slides/cpp/aspose.slides/imasterhandoutslideheaderfootermanager/) interface controls the handout master. ## **Update Header, Footer, and Date/Time Text Across a Presentation** Use the manager returned by [Presentation::get_HeaderFooterManager](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/get_headerfootermanager/), which implements [IPresentationHeaderFooterManager](https://reference.aspose.com/slides/cpp/aspose.slides/ipresentationheaderfootermanager/), to apply consistent text across a presentation without updating each page or master individually. | Method | Affected objects | |---|---| | [SetAllHeadersText](https://reference.aspose.com/slides/cpp/aspose.slides/presentationheaderfootermanager/setallheaderstext/) | Existing notes pages, notes master, and handout master | | [SetAllFootersText](https://reference.aspose.com/slides/cpp/aspose.slides/presentationheaderfootermanager/setallfooterstext/) | Regular slides, layouts, slide masters, existing notes pages, notes master, and handout master | | [SetAllDateTimesText](https://reference.aspose.com/slides/cpp/aspose.slides/presentationheaderfootermanager/setalldatetimestext/) | Regular slides, layouts, slide masters, existing notes pages, notes master, and handout master | Headers apply only to notes pages and handouts; regular slides do not support header placeholders. Handout settings are updated through the handout master. Setting text does not make a placeholder visible. First use [SetAllHeadersVisibility](https://reference.aspose.com/slides/cpp/aspose.slides/presentationheaderfootermanager/setallheadersvisibility/), [SetAllFootersVisibility](https://reference.aspose.com/slides/cpp/aspose.slides/presentationheaderfootermanager/setallfootersvisibility/), and [SetAllDateTimesVisibility](https://reference.aspose.com/slides/cpp/aspose.slides/presentationheaderfootermanager/setalldatetimesvisibility/) to enable the corresponding placeholders, then set their text. These visibility methods have the same scope as the corresponding text methods. The following example assumes that a presentation contains regular slides, notes pages, a notes master, and a handout master. It applies corporate text and a fixed date label, then saves the result. ```cpp #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(u"presentation.pptx"); auto manager = presentation->get_HeaderFooterManager(); manager->SetAllHeadersVisibility(true); manager->SetAllFootersVisibility(true); manager->SetAllDateTimesVisibility(true); manager->SetAllHeadersText(u"Contoso"); manager->SetAllFootersText(u"Internal use only"); manager->SetAllDateTimesText(u"October 2026"); presentation->Save(u"updated.pptx", SaveFormat::Pptx); ``` The text methods skip missing placeholders. Enabling visibility first creates the required placeholders on existing pages and masters. Neither the text methods nor the visibility methods create missing notes pages, notes masters, or handout masters. The date/time text is a fixed label, not an automatically updating date/time field. For narrower changes, see the examples for [regular slides](https://docs.aspose.com/slides/cpp/presentation-header-and-footer/#set-footer-datetime-and-slide-numbers-on-regular-slides), the [notes master](https://docs.aspose.com/slides/cpp/presentation-header-and-footer/#set-headers-and-footers-on-the-notes-master), an [individual notes page](https://docs.aspose.com/slides/cpp/presentation-header-and-footer/#set-headers-and-footers-on-an-individual-notes-slide), and the [handout master](https://docs.aspose.com/slides/cpp/presentation-header-and-footer/#set-headers-and-footers-on-the-handout-master). See [Presentation Notes](https://docs.aspose.com/slides/cpp/presentation-notes/) for creating and managing notes pages. ## **Set Footer, Date/Time, and Slide Numbers on Regular Slides** For regular slides, the basic workflow is to access each slide's header/footer manager, set the footer and date/time text, enable the required placeholders, and save the presentation. Slide numbers are generated by the presentation, so you only need to control their visibility. Use [SetFooterText](https://reference.aspose.com/slides/cpp/aspose.slides/ibaseslideheaderfootermanager/setfootertext/) and [SetDateTimeText](https://reference.aspose.com/slides/cpp/aspose.slides/ibaseslideheaderfootermanager/setdatetimetext/) to set text, and use [SetFooterVisibility](https://reference.aspose.com/slides/cpp/aspose.slides/ibaseslideheaderfootermanager/setfootervisibility/), [SetDateTimeVisibility](https://reference.aspose.com/slides/cpp/aspose.slides/ibaseslideheaderfootermanager/setdatetimevisibility/), and [SetSlideNumberVisibility](https://reference.aspose.com/slides/cpp/aspose.slides/ibaseslideheaderfootermanager/setslidenumbervisibility/) to show the corresponding placeholders. The following end-to-end example applies the same footer, date/time text, and slide-number visibility to all regular slides: ```cpp #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(u"presentation.pptx"); for (const auto& slide : System::IterateOver(presentation->get_Slides())) { auto headerFooterManager = slide->get_HeaderFooterManager(); headerFooterManager->SetFooterText(u"Company Confidential"); headerFooterManager->SetFooterVisibility(true); headerFooterManager->SetDateTimeText(u"Date and time text"); headerFooterManager->SetDateTimeVisibility(true); headerFooterManager->SetSlideNumberVisibility(true); } presentation->Save(u"presentation_with_slide_footers.pptx", SaveFormat::Pptx); ``` If you need to update only one slide, access that slide directly through [Presentation::get_Slide](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/get_slide/) instead of iterating through the entire slide collection. ## **Set Headers and Footers on the Notes Master** The notes master defines common formatting and placeholder behavior for notes pages. Use the [IMasterNotesSlideHeaderFooterManager](https://reference.aspose.com/slides/cpp/aspose.slides/imasternotesslideheaderfootermanager/) interface when you want to change only the notes master itself. The following example sets header, footer, and date/time text on the notes master and makes all supported placeholders visible on that master: ```cpp #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(u"presentation.pptx"); auto masterNotesSlide = presentation->get_MasterNotesSlideManager()->get_MasterNotesSlide(); if (masterNotesSlide != nullptr) { auto headerFooterManager = masterNotesSlide->get_HeaderFooterManager(); headerFooterManager->SetHeaderText(u"Notes header"); headerFooterManager->SetHeaderVisibility(true); headerFooterManager->SetFooterText(u"Notes footer"); headerFooterManager->SetFooterVisibility(true); headerFooterManager->SetDateTimeText(u"Date and time text"); headerFooterManager->SetDateTimeVisibility(true); headerFooterManager->SetSlideNumberVisibility(true); } presentation->Save(u"presentation_with_notes_master_footers.pptx", SaveFormat::Pptx); ``` The [IMasterNotesSlideManager::get_MasterNotesSlide](https://reference.aspose.com/slides/cpp/aspose.slides/imasternotesslidemanager/get_masternotesslide/) method returns `nullptr` when the presentation does not contain a notes master. To clean up a template without notes pages, see [Remove an Unused Notes Master](https://docs.aspose.com/slides/cpp/presentation-notes/#remove-an-unused-notes-master). ## **Apply Notes Master Settings to Child Notes Slides** A notes master can apply header and footer settings to itself and to all dependent notes slides. Use the dedicated propagation methods on [IMasterNotesSlideHeaderFooterManager](https://reference.aspose.com/slides/cpp/aspose.slides/imasternotesslideheaderfootermanager/) when the same settings should be applied across the notes hierarchy. For example, [SetHeaderAndChildHeadersText](https://reference.aspose.com/slides/cpp/aspose.slides/imasternotesslideheaderfootermanager/setheaderandchildheaderstext/) and [SetHeaderAndChildHeadersVisibility](https://reference.aspose.com/slides/cpp/aspose.slides/imasternotesslideheaderfootermanager/setheaderandchildheadersvisibility/) update the notes master header and all child headers. Equivalent methods are available for footers, date/time, and slide numbers. ```cpp #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(u"presentation.pptx"); auto masterNotesSlide = presentation->get_MasterNotesSlideManager()->get_MasterNotesSlide(); if (masterNotesSlide != nullptr) { auto headerFooterManager = masterNotesSlide->get_HeaderFooterManager(); headerFooterManager->SetHeaderAndChildHeadersText(u"Notes header"); headerFooterManager->SetHeaderAndChildHeadersVisibility(true); headerFooterManager->SetFooterAndChildFootersText(u"Notes footer"); headerFooterManager->SetFooterAndChildFootersVisibility(true); headerFooterManager->SetDateTimeAndChildDateTimesText(u"Date and time text"); headerFooterManager->SetDateTimeAndChildDateTimesVisibility(true); headerFooterManager->SetSlideNumberAndChildSlideNumbersVisibility(true); } presentation->Save(u"presentation_with_child_notes_footers.pptx", SaveFormat::Pptx); ``` The propagation methods used above are [SetFooterAndChildFootersText](https://reference.aspose.com/slides/cpp/aspose.slides/imasternotesslideheaderfootermanager/setfooterandchildfooterstext/), [SetFooterAndChildFootersVisibility](https://reference.aspose.com/slides/cpp/aspose.slides/imasternotesslideheaderfootermanager/setfooterandchildfootersvisibility/), [SetDateTimeAndChildDateTimesText](https://reference.aspose.com/slides/cpp/aspose.slides/imasternotesslideheaderfootermanager/setdatetimeandchilddatetimestext/), [SetDateTimeAndChildDateTimesVisibility](https://reference.aspose.com/slides/cpp/aspose.slides/imasternotesslideheaderfootermanager/setdatetimeandchilddatetimesvisibility/), and [SetSlideNumberAndChildSlideNumbersVisibility](https://reference.aspose.com/slides/cpp/aspose.slides/imasternotesslideheaderfootermanager/setslidenumberandchildslidenumbersvisibility/). ## **Set Headers and Footers on an Individual Notes Slide** A notes slide belongs to a specific regular slide. Use its [INotesSlideHeaderFooterManager](https://reference.aspose.com/slides/cpp/aspose.slides/inotesslideheaderfootermanager/) interface when you want to customize only that notes page. The [INotesSlideManager::AddNotesSlide](https://reference.aspose.com/slides/cpp/aspose.slides/inotesslidemanager/addnotesslide/) method returns the notes slide for the current slide and creates one if it does not already exist. The following example configures the notes page associated with the first presentation slide: ```cpp #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(u"presentation.pptx"); auto slide = presentation->get_Slide(0); auto notesSlide = slide->get_NotesSlideManager()->AddNotesSlide(); auto headerFooterManager = notesSlide->get_HeaderFooterManager(); headerFooterManager->SetHeaderText(u"Header for the first notes page"); headerFooterManager->SetHeaderVisibility(true); headerFooterManager->SetFooterText(u"Footer for the first notes page"); headerFooterManager->SetFooterVisibility(true); headerFooterManager->SetDateTimeText(u"Date and time text"); headerFooterManager->SetDateTimeVisibility(true); headerFooterManager->SetSlideNumberVisibility(true); presentation->Save(u"presentation_with_custom_notes_footers.pptx", SaveFormat::Pptx); ``` If you first propagate settings from the notes master and then change an individual notes slide, the later per-slide settings let you customize that notes page independently. ## **Set Headers and Footers on the Handout Master** Handout pages use the handout master for their header, footer, date/time, and page-number placeholders. Unlike notes pages, handout settings are managed through the handout master rather than through individual handout slides. Use [IMasterHandoutSlideManager::get_MasterHandoutSlide](https://reference.aspose.com/slides/cpp/aspose.slides/imasterhandoutslidemanager/get_masterhandoutslide/) to access the handout master. If it is not present, call [IMasterHandoutSlideManager::SetDefaultMasterHandoutSlide](https://reference.aspose.com/slides/cpp/aspose.slides/imasterhandoutslidemanager/setdefaultmasterhandoutslide/) to create the default handout master. ```cpp #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(u"presentation.pptx"); auto masterHandoutSlideManager = presentation->get_MasterHandoutSlideManager(); auto masterHandoutSlide = masterHandoutSlideManager->get_MasterHandoutSlide(); if (masterHandoutSlide == nullptr) { masterHandoutSlide = masterHandoutSlideManager->SetDefaultMasterHandoutSlide(); } if (masterHandoutSlide != nullptr) { auto headerFooterManager = masterHandoutSlide->get_HeaderFooterManager(); headerFooterManager->SetHeaderText(u"Handout header"); headerFooterManager->SetHeaderVisibility(true); headerFooterManager->SetFooterText(u"Handout footer"); headerFooterManager->SetFooterVisibility(true); headerFooterManager->SetDateTimeText(u"Date and time text"); headerFooterManager->SetDateTimeVisibility(true); headerFooterManager->SetSlideNumberVisibility(true); } presentation->Save(u"presentation_with_handout_footers.pptx", SaveFormat::Pptx); ``` To remove the entire handout master, including its formatting and placeholders, see [Remove a Handout Master](https://docs.aspose.com/slides/cpp/presentation-notes/#remove-a-handout-master). If you only need to hide a header or footer, change its visibility instead to preserve the master's other formatting. ## **Understand Scope and Inheritance** Choose the header/footer manager that matches the scope you want to change: - [IPresentationHeaderFooterManager](https://reference.aspose.com/slides/cpp/aspose.slides/ipresentationheaderfootermanager/) updates supported placeholders throughout the presentation, as shown in the [presentation-wide example](https://docs.aspose.com/slides/cpp/presentation-header-and-footer/#update-header-footer-and-datetime-text-across-a-presentation). - [ISlideHeaderFooterManager](https://reference.aspose.com/slides/cpp/aspose.slides/islideheaderfootermanager/) changes footer, date/time, and slide-number settings for one regular slide. - [ILayoutSlideHeaderFooterManager](https://reference.aspose.com/slides/cpp/aspose.slides/ilayoutslideheaderfootermanager/) controls a layout slide and can propagate supported settings to dependent slides. - [IMasterSlideHeaderFooterManager](https://reference.aspose.com/slides/cpp/aspose.slides/imasterslideheaderfootermanager/) controls a regular slide master and can propagate supported settings to dependent slides. - [IMasterNotesSlideHeaderFooterManager](https://reference.aspose.com/slides/cpp/aspose.slides/imasternotesslideheaderfootermanager/) controls the notes master and can propagate settings to all dependent notes slides. - [INotesSlideHeaderFooterManager](https://reference.aspose.com/slides/cpp/aspose.slides/inotesslideheaderfootermanager/) changes one notes slide and supports a header placeholder in addition to footer, date/time, and slide number. - [IMasterHandoutSlideHeaderFooterManager](https://reference.aspose.com/slides/cpp/aspose.slides/imasterhandoutslideheaderfootermanager/) changes the handout master and supports all four placeholder types. Use propagation from a master or layout when the same setting should apply throughout its hierarchy. Use an individual slide or notes-slide manager when you need a local setting for one page. [![A scope hierarchy leads to a table: regular slides support footer, date and slide number; notes and handouts also support headers.](https://docs.aspose.com/slides/cpp/presentation-header-and-footer/visual-presentation-header-and-footer-542f03b4f600.svg)](https://docs.aspose.com/slides/cpp/presentation-header-and-footer/visual-presentation-header-and-footer-542f03b4f600.svg) *Choose a manager for the presentation, a regular master/layout, one regular slide, a notes master/slide or a handout master. Regular slides have no header placeholder. Propagation methods apply supported settings to dependents; individual managers target local settings.* ## **FAQ** **Can I add a header to a regular slide?** No. PowerPoint does not define a header placeholder for regular slides. On regular slides, use the footer, date/time, and slide-number placeholders. Header placeholders are available on notes pages and handouts. **What if a footer, date/time, or slide-number placeholder is not visible?** Use the corresponding header/footer manager to check its visibility and enable it when needed. For example, [get_IsFooterVisible](https://reference.aspose.com/slides/cpp/aspose.slides/ibaseslideheaderfootermanager/get_isfootervisible/) reports whether a footer placeholder is present, and [SetFooterVisibility](https://reference.aspose.com/slides/cpp/aspose.slides/ibaseslideheaderfootermanager/setfootervisibility/) changes its visibility. **How do I start slide numbering from a value other than 1?** Use [Presentation::set_FirstSlideNumber](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/set_firstslidenumber/) to set the first slide number. The slide-number placeholders then use the updated numbering sequence. **What happens to headers and footers when exporting to PDF, images, or HTML?** Visible header and footer elements are rendered with the rest of the presentation content in the output format. Their appearance depends on the page type being exported and the corresponding placeholder visibility settings. ## Related articles - [Header Footer](https://docs.aspose.com/slides/cpp/examples/elements/header-footer/) - [Apply or Change Slide Layouts in C++](https://docs.aspose.com/slides/cpp/slide-layout/) - [Manage Presentation Placeholders in C++](https://docs.aspose.com/slides/cpp/manage-placeholder/) # Automate Presentation Localization in C++ > Set proofing languages for PowerPoint and OpenDocument presentation text in C++ with Aspose.Slides, including defaults and multilingual paragraphs. Source: https://docs.aspose.com/slides/cpp/presentation-localization/ Updated: 2026-08-31 ## **Overview** Aspose.Slides for C++ lets you configure proofing metadata for individual text portions. Use [IBasePortionFormat::set_LanguageId](https://reference.aspose.com/slides/cpp/aspose.slides/ibaseportionformat/set_languageid/) to identify the proofing language, [BasePortionFormat::set_SpellCheck](https://reference.aspose.com/slides/cpp/aspose.slides/baseportionformat/set_spellcheck/) to allow or suppress spelling checks, and [BasePortionFormat::set_ProofDisabled](https://reference.aspose.com/slides/cpp/aspose.slides/baseportionformat/set_proofdisabled/) to control the broader no-proof state. Because these settings are applied at the portion level, one paragraph can contain multiple languages and different proofing rules. This article explains how to assign a language to specific text, set the default language for new text with [ILoadOptions::set_DefaultTextLanguage](https://reference.aspose.com/slides/cpp/aspose.slides/iloadoptions/set_defaulttextlanguage/), build multilingual paragraphs, choose between `SpellCheck` and `ProofDisabled`, and preserve the intended settings when using [Presentation::JoinPortionsWithSameFormatting](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/joinportionswithsameformatting/). These properties store metadata for presentation applications; they do not translate text, perform dictionary-based spell checking, or return misspelled words. ## **Set the Proofing Language for Text** Create or load a [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/), access the required text portion through [IPortion::get_PortionFormat](https://reference.aspose.com/slides/cpp/aspose.slides/iportion/get_portionformat/), and assign its language identifier. The following example creates a shape, sets British English as the proofing language, and saves the result with [Presentation::Save](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/save/): ```cpp #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 50.0f, 50.0f, 320.0f, 80.0f); shape->get_TextFrame()->set_Text(u"Set the proofing language for this text."); auto portion = shape->get_TextFrame()->get_Paragraph(0)->get_Portion(0); portion->get_PortionFormat()->set_LanguageId(u"en-GB"); presentation->Save(u"proofing_language.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ## **Set the Default Language for New Text** Use [ILoadOptions::set_DefaultTextLanguage](https://reference.aspose.com/slides/cpp/aspose.slides/iloadoptions/set_defaulttextlanguage/) to specify the proofing language that Aspose.Slides assigns to newly created text. This setting is useful when most or all new text in a presentation uses the same language. It does not change the language metadata of text that already has an explicit language. The following example creates a presentation whose new text uses German proofing rules: ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto loadOptions = System::MakeObject(); loadOptions->set_DefaultTextLanguage(u"de-DE"); auto presentation = System::MakeObject(loadOptions); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 50.0f, 50.0f, 320.0f, 80.0f); shape->get_TextFrame()->set_Text(u"Willkommen zur Präsentation"); presentation->Save(u"default_text_language.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ## **Use Multiple Languages in One Paragraph** An [IParagraph](https://reference.aspose.com/slides/cpp/aspose.slides/iparagraph/) contains a collection of text portions. Create a separate [Portion](https://reference.aspose.com/slides/cpp/aspose.slides/portion/) for each language and set its `LanguageId` independently. This example creates one paragraph with English and French portions: ```cpp #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 50.0f, 50.0f, 420.0f, 80.0f); auto paragraph = shape->get_TextFrame()->get_Paragraph(0); paragraph->get_Portions()->Clear(); auto englishPortion = System::MakeObject(u"Welcome"); englishPortion->get_PortionFormat()->set_LanguageId(u"en-US"); paragraph->get_Portions()->Add(englishPortion); auto frenchPortion = System::MakeObject(u" — Bienvenue"); frenchPortion->get_PortionFormat()->set_LanguageId(u"fr-FR"); paragraph->get_Portions()->Add(frenchPortion); presentation->Save(u"multilingual_text.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ## **Enable or Suppress Spell Checking for Individual Portions** [IPortionFormat](https://reference.aspose.com/slides/cpp/aspose.slides/iportionformat/) inherits the common text properties defined by [IBasePortionFormat](https://reference.aspose.com/slides/cpp/aspose.slides/ibaseportionformat/). Access a portion's format through [IPortion::get_PortionFormat](https://reference.aspose.com/slides/cpp/aspose.slides/iportion/get_portionformat/) and call [BasePortionFormat::set_SpellCheck](https://reference.aspose.com/slides/cpp/aspose.slides/baseportionformat/set_spellcheck/) to control whether a presentation application may check spelling for that portion. The default value is `false`: `true` allows spell checking, while `false` suppresses it. The setting applies to individual text portions. Different portions in the same paragraph can therefore use different values. [BasePortionFormat::set_LanguageId](https://reference.aspose.com/slides/cpp/aspose.slides/baseportionformat/set_languageid/) and `SpellCheck` serve complementary purposes: `LanguageId` identifies the proofing language, while `SpellCheck` determines whether spelling checks are allowed for the portion. [BasePortionFormat::set_ProofDisabled](https://reference.aspose.com/slides/cpp/aspose.slides/baseportionformat/set_proofdisabled/) also controls proofing, but it represents the broader "do not proof" state as a [NullableBool](https://reference.aspose.com/slides/cpp/aspose.slides/nullablebool/). Use `SpellCheck` when you need a direct Boolean switch specifically for spelling checks. Use `ProofDisabled` when you need to preserve or explicitly control the presentation's no-proof metadata, including its `NullableBool::NotDefined` state. If you set both properties, keep their values consistent; do not combine `SpellCheck = true` with `ProofDisabled = NullableBool::True`. These properties configure proofing metadata used by PowerPoint and other presentation applications. Aspose.Slides does not use them to run dictionary-based spell checking or return a list of misspelled words. The following complete example creates an input presentation, loads it, assigns different spell-check settings and proofing languages to two portions in the same paragraph, saves the result, reopens it, and verifies the stored values: ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; const System::String inputFile = u"spell_check_input.pptx"; const System::String outputFile = u"spell_check_settings.pptx"; { auto sourcePresentation = System::MakeObject(); auto sourceSlide = sourcePresentation->get_Slide(0); auto sourceShape = sourceSlide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 50.0f, 50.0f, 420.0f, 80.0f); auto sourceParagraph = sourceShape->get_TextFrame()->get_Paragraph(0); sourceParagraph->get_Portions()->Clear(); auto sourceEnglishPortion = System::MakeObject(u"Check this text. "); sourceEnglishPortion->get_PortionFormat()->set_LanguageId(u"en-US"); sourceParagraph->get_Portions()->Add(sourceEnglishPortion); auto sourceFrenchPortion = System::MakeObject(u"Ignorer ce code : ZX-81."); sourceFrenchPortion->get_PortionFormat()->set_LanguageId(u"fr-FR"); sourceParagraph->get_Portions()->Add(sourceFrenchPortion); sourcePresentation->Save(inputFile, SaveFormat::Pptx); sourcePresentation->Dispose(); } { auto presentation = System::MakeObject(inputFile); auto firstShape = presentation->get_Slide(0)->get_Shape(0); auto shape = System::ExplicitCast(firstShape); auto paragraph = shape->get_TextFrame()->get_Paragraph(0); auto checkedPortion = paragraph->get_Portion(0); checkedPortion->get_PortionFormat()->set_LanguageId(u"en-US"); checkedPortion->get_PortionFormat()->set_SpellCheck(true); auto suppressedPortion = paragraph->get_Portion(1); suppressedPortion->get_PortionFormat()->set_LanguageId(u"fr-FR"); suppressedPortion->get_PortionFormat()->set_SpellCheck(false); presentation->Save(outputFile, SaveFormat::Pptx); presentation->Dispose(); } auto reopenedPresentation = System::MakeObject(outputFile); auto reopenedFirstShape = reopenedPresentation->get_Slide(0)->get_Shape(0); auto reopenedShape = System::ExplicitCast(reopenedFirstShape); auto storedParagraph = reopenedShape->get_TextFrame()->get_Paragraph(0); bool portionsStored = storedParagraph->get_Portions()->get_Count() == 2; if (portionsStored) { auto firstStoredPortion = storedParagraph->get_Portion(0); auto secondStoredPortion = storedParagraph->get_Portion(1); bool firstPortionStored = firstStoredPortion->get_PortionFormat()->get_LanguageId() == u"en-US" && firstStoredPortion->get_PortionFormat()->get_SpellCheck(); bool secondPortionStored = secondStoredPortion->get_PortionFormat()->get_LanguageId() == u"fr-FR" && !secondStoredPortion->get_PortionFormat()->get_SpellCheck(); if (firstPortionStored && secondPortionStored) { System::Console::WriteLine(u"The proofing settings were stored correctly."); } else { System::Console::WriteLine(u"The proofing settings could not be verified."); } } else { System::Console::WriteLine(u"The proofing settings could not be verified."); } reopenedPresentation->Dispose(); ``` [Presentation::JoinPortionsWithSameFormatting](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/joinportionswithsameformatting/) combines adjacent portions that have the same formatting. A difference in `SpellCheck` alone does not keep such portions separate; after they are joined, the resulting portion retains the `SpellCheck` value of the first portion. If portions need different spell-check settings, call `JoinPortionsWithSameFormatting` before assigning those settings, or inspect the resulting portion boundaries and reapply the settings afterward. Portions with different `LanguageId` values remain separate because their proofing-language formatting differs. ## **FAQ** **Does a language ID translate the text?** No. [IBasePortionFormat::set_LanguageId](https://reference.aspose.com/slides/cpp/aspose.slides/ibaseportionformat/set_languageid/) stores proofing metadata for spelling and grammar; it does not alter the text content. Translate the text separately, and then set the appropriate language identifier for each translated portion. **Does the proofing language control fonts, hyphenation, or line wrapping?** No. The language identifier is for proofing. Text rendering and layout primarily depend on the available [fonts](https://docs.aspose.com/slides/cpp/powerpoint-fonts/), the writing system, and the text-frame settings. For reliable rendering, provide the required fonts, configure [font substitution](https://docs.aspose.com/slides/cpp/font-substitution/), or [embed fonts](https://docs.aspose.com/slides/cpp/embedded-font/) in the presentation. **Can one paragraph use several proofing languages?** Yes. Assign each language to a separate portion, as shown in the multilingual paragraph example. **Should I use `DefaultTextLanguage` or `LanguageId`?** Use [ILoadOptions::set_DefaultTextLanguage](https://reference.aspose.com/slides/cpp/aspose.slides/iloadoptions/set_defaulttextlanguage/) when you want a default for newly created text. Use [IBasePortionFormat::set_LanguageId](https://reference.aspose.com/slides/cpp/aspose.slides/ibaseportionformat/set_languageid/) when a specific portion needs an explicit proofing language or when a paragraph contains multiple languages. # Manage Presentation Notes in C++ > Remove slide notes and customize master notes text styles in PowerPoint and OpenDocument presentations with Aspose.Slides for C++. Source: https://docs.aspose.com/slides/cpp/presentation-notes/ Updated: 2026-10-28 ## **Overview** Aspose.Slides for C++ lets you remove notes from individual slides or an entire presentation, customize the text style defined in the master notes slide, and remove notes and handout masters. This article shows how to perform these operations and save the updated presentation. To read or change notes page dimensions, switch orientation, and check export behavior, see [Notes Page Size](https://docs.aspose.com/slides/cpp/notes-size/). ## **Remove Notes from a Slide** To remove notes from a specific slide, use its [get_NotesSlideManager](https://reference.aspose.com/slides/cpp/aspose.slides/slide/get_notesslidemanager/) and call [RemoveNotesSlide](https://reference.aspose.com/slides/cpp/aspose.slides/notesslidemanager/removenotesslide/). The example loads a presentation containing at least one slide and removes the notes from the first slide, accessed at index zero. Notes on other slides remain unchanged, and the updated presentation is saved in PPTX format. ```cpp #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(u"presentation.pptx"); auto notesManager = presentation->get_Slide(0)->get_NotesSlideManager(); notesManager->RemoveNotesSlide(); presentation->Save(u"presentation_without_first_slide_notes.pptx", SaveFormat::Pptx); ``` ## **Remove Notes from All Slides** To remove all slide notes, iterate through the collection returned by [get_Slides](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/get_slides/) and call [RemoveNotesSlide](https://reference.aspose.com/slides/cpp/aspose.slides/notesslidemanager/removenotesslide/) for each slide. This example processes every slide in an existing presentation and saves a PPTX copy without slide notes. ```cpp #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(u"presentation.pptx"); for (const auto& slide : System::IterateOver(presentation->get_Slides())) { slide->get_NotesSlideManager()->RemoveNotesSlide(); } presentation->Save(u"presentation_without_notes.pptx", SaveFormat::Pptx); ``` ## **Remove Notes and Handout Masters** Notes and handout masters define shared formatting and placeholders for their respective page types. Removing a master is a separate operation from removing an individual slide's notes with [RemoveNotesSlide](https://reference.aspose.com/slides/cpp/aspose.slides/notesslidemanager/removenotesslide/). ### **Remove an Unused Notes Master** When cleaning up a template that has no notes pages, you can remove its unused notes master. Access [get_MasterNotesSlideManager](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/get_masternotesslidemanager/), check [get_MasterNotesSlide](https://reference.aspose.com/slides/cpp/aspose.slides/imasternotesslidemanager/get_masternotesslide/), and call [RemoveMasterNotesSlide](https://reference.aspose.com/slides/cpp/aspose.slides/imasternotesslidemanager/removemasternotesslide/). The following example requires a presentation to contain no notes pages. It removes the notes master if one exists, including its formatting and header/footer placeholders, and saves the template. ```cpp #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(u"template_without_notes.pptx"); auto manager = presentation->get_MasterNotesSlideManager(); if (manager->get_MasterNotesSlide() != nullptr) { manager->RemoveMasterNotesSlide(); } presentation->Save(u"template_without_notes_master.pptx", SaveFormat::Pptx); ``` After removal, [get_MasterNotesSlide](https://reference.aspose.com/slides/cpp/aspose.slides/imasternotesslidemanager/get_masternotesslide/) returns `nullptr`. If the master is already absent, the example skips removal and still saves the presentation. ### **Remove a Handout Master** To remove a handout master, access [get_MasterHandoutSlideManager](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/get_masterhandoutslidemanager/), check [get_MasterHandoutSlide](https://reference.aspose.com/slides/cpp/aspose.slides/imasterhandoutslidemanager/get_masterhandoutslide/), and call [RemoveMasterHandoutSlide](https://reference.aspose.com/slides/cpp/aspose.slides/imasterhandoutslidemanager/removemasterhandoutslide/). For this example, use a presentation containing slide notes and customized notes and handout masters. Give the handout master a visible banner and header/footer text so that the effect of removal is easy to compare in handout output. ```cpp #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(u"presentation_with_custom_masters.pptx"); auto manager = presentation->get_MasterHandoutSlideManager(); if (manager->get_MasterHandoutSlide() != nullptr) { manager->RemoveMasterHandoutSlide(); } presentation->Save(u"presentation_without_handout_master.pptx", SaveFormat::Pptx); ``` After removal, [get_MasterHandoutSlide](https://reference.aspose.com/slides/cpp/aspose.slides/imasterhandoutslidemanager/get_masterhandoutslide/) returns `nullptr`. Existing slide notes and the notes master remain unchanged. If the handout master is already absent, the example simply saves the presentation. In handout output, the removed master's banner, formatting, and header, footer, date/time, and page-number placeholders no longer appear. The presentation slides still appear in the handout layout, including any footer or date text on the slides themselves. Slide numbers added by the handout export settings are separate from the master's page-number placeholder. If you only want to hide handout headers or footers, change the corresponding placeholder visibility through the [handout master's header/footer manager](https://docs.aspose.com/slides/cpp/presentation-header-and-footer/#set-headers-and-footers-on-the-handout-master) instead. This keeps the master and its other formatting, such as a custom banner. ## **Add a Notes Style** The [get_NotesStyle](https://reference.aspose.com/slides/cpp/aspose.slides/masternotesslide/get_notesstyle/) method of [IMasterNotesSlide](https://reference.aspose.com/slides/cpp/aspose.slides/imasternotesslide/) returns the master notes text style. The example accesses the existing [get_MasterNotesSlide](https://reference.aspose.com/slides/cpp/aspose.slides/imasternotesslidemanager/get_masternotesslide/) and uses [GetLevel](https://reference.aspose.com/slides/cpp/aspose.slides/textstyle/getlevel/) with index zero to select the first paragraph level. It sets the bullet type to [BulletType::Symbol](https://reference.aspose.com/slides/cpp/aspose.slides/bullettype/) and saves the presentation in PPTX format. The input must contain a master notes slide for the style change to take effect; otherwise, the presentation is saved without changing the notes style. ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(u"presentation.pptx"); auto notesMaster = presentation->get_MasterNotesSlideManager()->get_MasterNotesSlide(); if (notesMaster != nullptr) { auto notesStyle = notesMaster->get_NotesStyle(); auto paragraphFormat = notesStyle->GetLevel(0); paragraphFormat->get_Bullet()->set_Type(BulletType::Symbol); } presentation->Save(u"presentation_with_notes_style.pptx", SaveFormat::Pptx); ``` ## **FAQ** **Which API provides access to the notes of a specific slide?** Use the slide's [get_NotesSlideManager](https://reference.aspose.com/slides/cpp/aspose.slides/slide/get_notesslidemanager/) method. The manager's [get_NotesSlide](https://reference.aspose.com/slides/cpp/aspose.slides/notesslidemanager/get_notesslide/) method returns the notes slide, or `nullptr` if the slide has no notes. **Does working with notes require Microsoft PowerPoint to be installed?** No. Aspose.Slides works with notes in PowerPoint and OpenDocument presentations without requiring Microsoft PowerPoint to be installed. # Manage Presentation Properties in C++ > Master presentation properties in Aspose.Slides for C++ and streamline search, branding and workflow in your PowerPoint and OpenDocument files. Source: https://docs.aspose.com/slides/cpp/presentation-properties/ Updated: 2026-11-02 ## **Introduction** Aspose.Slides for C++ supports **built-in** and **custom** document properties. Use these properties to read and update presentation metadata, such as the author, title, and user-defined values. Aspose.Slides allows you to work with presentation document properties through the [IDocumentProperties](https://reference.aspose.com/slides/cpp/aspose.slides/idocumentproperties/) interface. An instance of this interface is returned by [IPresentation::get_DocumentProperties](https://reference.aspose.com/slides/cpp/aspose.slides/ipresentation/get_documentproperties/). The following examples show how to read, modify, and manage these properties. Aspose.Slides manages the application and producer metadata when saving presentations; these fields identify the software that created the output. ## **Manage Presentation Properties** Document properties store descriptive information alongside presentation content. They fall into two categories: - **Built-in properties** contain standard metadata, such as the title, author, and document statistics. - **Custom properties** store user-defined name/value pairs. Aspose.Slides for C++ provides access to both categories. In PowerPoint, select **File → Info → Properties → Advanced Properties** to inspect document metadata. The dialog groups information into tabs such as **Summary**, **Statistics**, **Contents**, and **Custom**. Use the **Custom** tab to manage user-defined properties. ## **Read Public Properties from an Encrypted Presentation** An opening password normally protects both presentation content and document properties. When a presentation is encrypted by passing `false` to [IProtectionManager::set_EncryptDocumentProperties](https://reference.aspose.com/slides/cpp/aspose.slides/iprotectionmanager/set_encryptdocumentproperties/), its document properties remain public. An application can then pass `true` to [LoadOptions::set_OnlyLoadDocumentProperties](https://reference.aspose.com/slides/cpp/aspose.slides/loadoptions/set_onlyloaddocumentproperties/) and read the public metadata without supplying the opening password. [LoadOptions::set_OnlyLoadDocumentProperties](https://reference.aspose.com/slides/cpp/aspose.slides/loadoptions/set_onlyloaddocumentproperties/) controls what Aspose.Slides loads; it does not decrypt anything. If the properties were included in encryption, loading them without the password fails. If the presentation is not encrypted, the option is ignored and the complete presentation is loaded. The example requires an encrypted presentation whose document properties were left public. It verifies the loading mode through [IProtectionManager::get_IsOnlyDocumentPropertiesLoaded](https://reference.aspose.com/slides/cpp/aspose.slides/iprotectionmanager/get_isonlydocumentpropertiesloaded/) and then reads built-in properties through [IPresentation::get_DocumentProperties](https://reference.aspose.com/slides/cpp/aspose.slides/ipresentation/get_documentproperties/): ```cpp #include #include #include #include #include using namespace Aspose::Slides; auto loadOptions = System::MakeObject(); loadOptions->set_OnlyLoadDocumentProperties(true); auto presentation = System::MakeObject(u"public-properties-encrypted.pptx", loadOptions); if (presentation->get_ProtectionManager()->get_IsOnlyDocumentPropertiesLoaded()) { auto documentProperties = presentation->get_DocumentProperties(); System::Console::WriteLine(u"Author: {0}", documentProperties->get_Author()); System::Console::WriteLine(u"Title: {0}", documentProperties->get_Title()); System::Console::WriteLine(u"Keywords: {0}", documentProperties->get_Keywords()); } else { System::Console::WriteLine(u"The presentation was not loaded in document-properties-only mode."); } ``` In this mode, slide content is not loaded. Slides, masters, layouts, shapes, media, and other presentation objects are unavailable. Applications should always check [IProtectionManager::get_IsOnlyDocumentPropertiesLoaded](https://reference.aspose.com/slides/cpp/aspose.slides/iprotectionmanager/get_isonlydocumentpropertiesloaded/) before performing an operation that requires the complete presentation object model. Public metadata may expose author names, titles, subjects, keywords, company information, comments, and custom values. Encrypt sensitive properties together with the presentation. Leave them public only when indexing, classification, search, or document-management systems have a specific requirement to access them without a password. ## **Update Properties of an Encrypted Presentation** For an encrypted PPTX file, a presentation loaded by passing `true` to [LoadOptions::set_OnlyLoadDocumentProperties](https://reference.aspose.com/slides/cpp/aspose.slides/loadoptions/set_onlyloaddocumentproperties/) is intended for reading public metadata. Aspose.Slides cannot save changed properties from that metadata-only object because the public properties must remain consistent with the corresponding data inside the encrypted presentation. Updating them therefore requires the correct opening password and a complete load. The example requires an encrypted PPTX presentation with public document properties and a known opening password. It opens the complete presentation with [LoadOptions::set_Password](https://reference.aspose.com/slides/cpp/aspose.slides/loadoptions/set_password/), updates public built-in properties, and saves the result. It then uses [IPresentationInfo::get_IsEncrypted](https://reference.aspose.com/slides/cpp/aspose.slides/ipresentationinfo/get_isencrypted/) to verify that encryption is preserved and reopens the public metadata without a password to verify the new values: ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; const System::String inputPath = u"public-properties-encrypted.pptx"; const System::String outputPath = u"updated-public-properties-encrypted.pptx"; auto loadOptions = System::MakeObject(); loadOptions->set_Password(u"open_password"); auto presentation = System::MakeObject(inputPath, loadOptions); auto documentProperties = presentation->get_DocumentProperties(); documentProperties->set_Title(u"Updated Product Roadmap"); documentProperties->set_Keywords(u"roadmap, planning, indexed"); presentation->Save(outputPath, SaveFormat::Pptx); auto presentationInfo = PresentationFactory::get_Instance()->GetPresentationInfo(outputPath); System::Console::WriteLine(u"The presentation is encrypted: {0}", presentationInfo->get_IsEncrypted()); auto metadataLoadOptions = System::MakeObject(); metadataLoadOptions->set_OnlyLoadDocumentProperties(true); auto metadataPresentation = System::MakeObject(outputPath, metadataLoadOptions); if (metadataPresentation->get_ProtectionManager()->get_IsOnlyDocumentPropertiesLoaded()) { System::Console::WriteLine(u"Title: {0}", metadataPresentation->get_DocumentProperties()->get_Title()); System::Console::WriteLine(u"Keywords: {0}", metadataPresentation->get_DocumentProperties()->get_Keywords()); } else { System::Console::WriteLine(u"The presentation was not loaded in document-properties-only mode."); } ``` If an application is not allowed to decrypt or load the presentation content, it must treat public properties of an encrypted PPTX file as read-only. ## **Access Built-in Properties** The [IDocumentProperties](https://reference.aspose.com/slides/cpp/aspose.slides/idocumentproperties/) interface exposes built-in metadata through typed getters, including [get_Author](https://reference.aspose.com/slides/cpp/aspose.slides/idocumentproperties/get_author/), [get_Title](https://reference.aspose.com/slides/cpp/aspose.slides/idocumentproperties/get_title/), and [get_CreatedTime](https://reference.aspose.com/slides/cpp/aspose.slides/idocumentproperties/get_createdtime/). This example opens an existing presentation and prints its stored metadata to the console. Values depend on the input presentation; some fields may be empty. ```cpp #include #include #include using namespace Aspose::Slides; auto presentation = System::MakeObject(u"AccessBuiltInProperties.pptx"); auto documentProperties = presentation->get_DocumentProperties(); System::Console::WriteLine(u"Category: {0}", documentProperties->get_Category()); System::Console::WriteLine(u"Content status: {0}", documentProperties->get_ContentStatus()); System::Console::WriteLine(u"Creation date: {0}", documentProperties->get_CreatedTime()); System::Console::WriteLine(u"Author: {0}", documentProperties->get_Author()); System::Console::WriteLine(u"Comments: {0}", documentProperties->get_Comments()); System::Console::WriteLine(u"Keywords: {0}", documentProperties->get_Keywords()); System::Console::WriteLine(u"Last modified by: {0}", documentProperties->get_LastSavedBy()); System::Console::WriteLine(u"Manager: {0}", documentProperties->get_Manager()); System::Console::WriteLine(u"Modified date: {0}", documentProperties->get_LastSavedTime()); System::Console::WriteLine(u"Presentation format: {0}", documentProperties->get_PresentationFormat()); System::Console::WriteLine(u"Last print date: {0}", documentProperties->get_LastPrinted()); System::Console::WriteLine(u"Is shared between producers: {0}", documentProperties->get_SharedDoc()); System::Console::WriteLine(u"Subject: {0}", documentProperties->get_Subject()); System::Console::WriteLine(u"Title: {0}", documentProperties->get_Title()); ``` ## **Modify Built-in Properties** To update built-in metadata, use the setters on the object returned by [IPresentation::get_DocumentProperties](https://reference.aspose.com/slides/cpp/aspose.slides/ipresentation/get_documentproperties/). This example opens an existing presentation, calls [set_Author](https://reference.aspose.com/slides/cpp/aspose.slides/idocumentproperties/set_author/), [set_Title](https://reference.aspose.com/slides/cpp/aspose.slides/idocumentproperties/set_title/), [set_Subject](https://reference.aspose.com/slides/cpp/aspose.slides/idocumentproperties/set_subject/), [set_Comments](https://reference.aspose.com/slides/cpp/aspose.slides/idocumentproperties/set_comments/), and [set_Manager](https://reference.aspose.com/slides/cpp/aspose.slides/idocumentproperties/set_manager/), then saves the updated presentation with [Presentation::Save](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/save/). The saved PPTX contains the new metadata. ```cpp #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(u"ModifyBuiltInProperties.pptx"); auto documentProperties = presentation->get_DocumentProperties(); documentProperties->set_Author(u"Aspose.Slides for C++"); documentProperties->set_Title(u"Manage PowerPoint Presentation Properties"); documentProperties->set_Subject(u"Modify Built-in Properties"); documentProperties->set_Comments(u"Aspose description"); documentProperties->set_Manager(u"Aspose manager"); presentation->Save(u"DocumentProperties_output.pptx", SaveFormat::Pptx); ``` ## **Manage the Hyperlink Base** [IDocumentProperties::get_HyperlinkBase](https://reference.aspose.com/slides/cpp/aspose.slides/idocumentproperties/get_hyperlinkbase/) reads the document-level base for relative hyperlinks. This is useful when moving a presentation and its linked files to another location. It is separate from an individual hyperlink's [IHyperlink::get_ExternalUrl](https://reference.aspose.com/slides/cpp/aspose.slides/ihyperlink/get_externalurl/): changing the base does not rewrite the stored link addresses or change absolute destinations. The example requires a presentation containing both a relative link, such as `target.html`, and an absolute link, such as `https://example.org/absolute.html`. It reads the existing base, assigns a new base address with [IDocumentProperties::set_HyperlinkBase](https://reference.aspose.com/slides/cpp/aspose.slides/idocumentproperties/set_hyperlinkbase/), and saves and reopens the presentation to check the value. It then clears the base with `u""` and verifies the empty value in a separate saved file. Replace the example base address with the location of your linked files. ```cpp #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(u"hyperlinks.pptx"); System::Console::WriteLine(u"Original base: {0}", presentation->get_DocumentProperties()->get_HyperlinkBase()); const System::String newBase = u"https://example.com/new/"; presentation->get_DocumentProperties()->set_HyperlinkBase(newBase); presentation->Save(u"hyperlinks-updated.pptx", SaveFormat::Pptx); auto updatedPresentation = System::MakeObject(u"hyperlinks-updated.pptx"); System::Console::WriteLine(u"Base preserved: {0}", (updatedPresentation->get_DocumentProperties()->get_HyperlinkBase() == newBase)); updatedPresentation->get_DocumentProperties()->set_HyperlinkBase(u""); updatedPresentation->Save(u"hyperlinks-cleared.pptx", SaveFormat::Pptx); auto clearedPresentation = System::MakeObject(u"hyperlinks-cleared.pptx"); System::Console::WriteLine(u"Base cleared: {0}", (clearedPresentation->get_DocumentProperties()->get_HyperlinkBase() == u"")); ``` The two verification messages should print `True`. Clearing the base leaves the individual hyperlink addresses intact. A relative link to `target.pptx` opened `old/target.pptx` when the base pointed to the `old` folder. After changing the base to the `new` folder, saving, and reopening the presentation, the same link opened `new/target.pptx`. An absolute link continued to open the same file. Test your relative links in PowerPoint before and after moving the presentation or changing its base. ## **Add Custom Presentation Properties** Custom properties store metadata that has no corresponding built-in field. [IDocumentProperties::idx_set](https://reference.aspose.com/slides/cpp/aspose.slides/idocumentproperties/idx_set/) lets you assign a value by property name. This example creates a presentation, adds two text values and an integer version value, and saves the presentation with [Presentation::Save](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/save/). Assigning a value to an existing name replaces that property’s value. ```cpp #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(); auto documentProperties = presentation->get_DocumentProperties(); documentProperties->idx_set(u"Reviewed by", System::ObjectExt::Box(u"John Smith")); documentProperties->idx_set(u"Confidentiality level", System::ObjectExt::Box(u"Internal")); documentProperties->idx_set(u"Document version", System::ObjectExt::Box(2)); presentation->Save(u"CustomDocumentProperties_output.pptx", SaveFormat::Pptx); ``` ## **Access and Modify Custom Properties** This example opens a presentation containing custom properties and uses [get_CountOfCustomProperties](https://reference.aspose.com/slides/cpp/aspose.slides/idocumentproperties/get_countofcustomproperties/) to iterate over them. [GetCustomPropertyName](https://reference.aspose.com/slides/cpp/aspose.slides/idocumentproperties/getcustompropertyname/) accepts a zero-based index and returns the name used by [IDocumentProperties::idx_get](https://reference.aspose.com/slides/cpp/aspose.slides/idocumentproperties/idx_get/) and [idx_set](https://reference.aspose.com/slides/cpp/aspose.slides/idocumentproperties/idx_set/). The example prints each original name and value, replaces every value with a numbered string regardless of its original type, and saves the changes. If there are no custom properties, the loop makes no changes. ```cpp #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(u"AccessAndModifyProperties.pptx"); auto documentProperties = presentation->get_DocumentProperties(); for (auto i = 0; i < documentProperties->get_CountOfCustomProperties(); i++) { auto propertyName = documentProperties->GetCustomPropertyName(i); auto propertyValue = documentProperties->idx_get(propertyName); System::Console::WriteLine(u"Custom property name: {0}", propertyName); System::Console::WriteLine(u"Custom property value: {0}", propertyValue); documentProperties->idx_set(propertyName, System::ObjectExt::Box(System::String::Format(u"New Value {0}", i + 1))); } presentation->Save(u"CustomProperties_output.pptx", SaveFormat::Pptx); ``` ## **Live Example** Try the [**View & Edit PowerPoint Metadata**](https://products.aspose.app/slides/metadata) online app to see how to work with document properties using the Aspose.Slides API: [![View & Edit PowerPoint Metadata](https://docs.aspose.com/slides/cpp/presentation-properties/slides-metadata.png)](https://products.aspose.app/slides/metadata) ## **FAQ** **How can I remove a built-in property from a presentation?** Built-in properties are an integral part of the presentation and cannot be removed entirely. However, you can either change their values or set them to empty if allowed by the specific property. **What happens if I add a custom property that already exists?** If you add a custom property that already exists, its existing value will be overwritten with the new one. You do not need to remove or check the property beforehand, as Aspose.Slides automatically updates the property's value. **Can I access presentation properties without fully loading the presentation?** Yes. Use [PresentationFactory::GetPresentationInfo](https://reference.aspose.com/slides/cpp/aspose.slides/presentationfactory/getpresentationinfo/) and then [IPresentationInfo::ReadDocumentProperties](https://reference.aspose.com/slides/cpp/aspose.slides/ipresentationinfo/readdocumentproperties/) to read stored document metadata without creating a [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) instance. See [Build a Lightweight Presentation Inventory](https://docs.aspose.com/slides/cpp/examine-presentation/) for a complete reporting example and format-specific limitations. **Can I read public properties of an encrypted presentation without its opening password?** Yes. The presentation must have been encrypted by passing `false` to [IProtectionManager::set_EncryptDocumentProperties](https://reference.aspose.com/slides/cpp/aspose.slides/iprotectionmanager/set_encryptdocumentproperties/), and it must be loaded by passing `true` to [LoadOptions::set_OnlyLoadDocumentProperties](https://reference.aspose.com/slides/cpp/aspose.slides/loadoptions/set_onlyloaddocumentproperties/). **Can I update an encrypted PPTX file in document-properties-only mode?** No. Public and encrypted property data must remain consistent, so updating an encrypted PPTX file requires loading the complete presentation with the correct opening password. # Secure Presentations in C++ > Protect PowerPoint PPT, PPTX and ODP presentations in C++ with Aspose.Slides—set passwords, apply encryption, enforce read-only, and remove protection with code. Source: https://docs.aspose.com/slides/cpp/presentation-security/ Updated: 2025-11-19 --- lastmod: 2025-11-19T22:55:59+04:00 title: Secure Presentations in C++ linktitle: Presentation Security type: docs weight: 60 url: /cpp/presentation-security/ keywords: - presentation security - digital signature - password protection - read only - watermark - PowerPoint - OpenDocument - presentation - C++ - Aspose.Slides description: "Protect PowerPoint PPT, PPTX and ODP presentations in C++ with Aspose.Slides—set passwords, apply encryption, enforce read-only, and remove protection with code." --- ## Related articles - [Secure Presentations with Passwords in C++](https://docs.aspose.com/slides/cpp/password-protected-presentation/) # Manage Presentation Slides in C++ > Learn how to create, access, and manage slides in PPT, PPTX, and ODP presentations using Aspose.Slides for C++. Easy-to-follow guide with code examples. Source: https://docs.aspose.com/slides/cpp/presentation-slide/ Updated: 2025-11-19 --- lastmod: 2025-11-19T22:55:59+04:00 title: Manage Presentation Slides in C++ linktitle: Presentation Slide type: docs weight: 20 url: /cpp/presentation-slide/ keywords: - add slide - access slide - remove slide - clone slide - copy slide - convert slide - compare slides - slide layout - slide master - slide size - slide transition - slide section - PowerPoint - OpenDocument - presentation - C++ - Aspose.Slides description: "Learn how to create, access, and manage slides in PPT, PPTX, and ODP presentations using Aspose.Slides for C++. Easy-to-follow guide with code examples." --- ## Related articles - [Slide Transition](https://docs.aspose.com/slides/cpp/examples/elements/slide-transition/) # Manage Presentation Themes in C++ > Master presentation themes in Aspose.Slides for C++ to create, customize and convert PowerPoint files with consistent branding. Source: https://docs.aspose.com/slides/cpp/presentation-theme/ Updated: 2026-10-27 ## **Introduction** A presentation theme defines a coordinated set of colors, fonts, background styles, fills, lines, and effects. Theme-aware objects refer to these shared definitions instead of storing every visual property as a fixed value, so a theme change can update many objects at once. In Aspose.Slides, the presentation-level theme is available through [Presentation::get_MasterTheme](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/get_mastertheme/). A presentation can also contain theme overrides at lower levels. A master can override the presentation theme through [MasterThemeManager::get_OverrideTheme](https://reference.aspose.com/slides/cpp/aspose.slides.theme/masterthememanager/get_overridetheme/), while a layout or an individual slide can use [IOverrideThemeManager::get_OverrideTheme](https://reference.aspose.com/slides/cpp/aspose.slides.theme/ioverridethememanager/get_overridetheme/). In practice, the effective theme for a slide is resolved through this inheritance chain: presentation theme, master override, layout override, and slide override. ![Theme components: colors, fonts, background styles, and effects](https://docs.aspose.com/slides/cpp/presentation-theme/theme-constituents.png) The sections below show the most common theme workflows: inspect a theme, change colors and fonts, copy or apply a theme, update background and effect styles, and read effective values after inheritance and overrides have been resolved. ## **Inspect a Theme** The [MasterTheme](https://reference.aspose.com/slides/cpp/aspose.slides.theme/mastertheme/) object exposes the theme's [get_ColorScheme](https://reference.aspose.com/slides/cpp/aspose.slides.theme/mastertheme/get_colorscheme/), [get_FontScheme](https://reference.aspose.com/slides/cpp/aspose.slides.theme/mastertheme/get_fontscheme/), and [get_FormatScheme](https://reference.aspose.com/slides/cpp/aspose.slides.theme/mastertheme/get_formatscheme/) methods. Inspecting these collections before changing them is especially useful when a presentation comes from an external source because the number and content of style entries can vary. The following example reads the main theme properties and reports how many background, fill, line, and effect styles are stored in the theme: ```cpp #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto presentation = MakeObject(u"input.pptx"); auto theme = presentation->get_MasterTheme(); auto formatScheme = theme->get_FormatScheme(); Console::WriteLine(u"Theme name: {0}", theme->get_Name()); Console::WriteLine(u"Accent 1: {0}", theme->get_ColorScheme()->get_Accent1()->get_Color()); Console::WriteLine(u"Major Latin font: {0}", theme->get_FontScheme()->get_Major()->get_LatinFont()->get_FontName()); Console::WriteLine(u"Minor Latin font: {0}", theme->get_FontScheme()->get_Minor()->get_LatinFont()->get_FontName()); Console::WriteLine(u"Background fill styles: {0}", formatScheme->get_BackgroundFillStyles()->get_Count()); Console::WriteLine(u"Fill styles: {0}", formatScheme->get_FillStyles()->get_Count()); Console::WriteLine(u"Line styles: {0}", formatScheme->get_LineStyles()->get_Count()); Console::WriteLine(u"Effect styles: {0}", formatScheme->get_EffectStyles()->get_Count()); ``` If a file uses multiple masters, do not assume that every slide has the same effective theme. Inspect the master associated with the slide, and use the effective-theme workflow shown later in this article when layout or slide overrides may be present. ## **Change Theme Colors** Theme-aware fills, lines, and text can refer to a logical color from the [SchemeColor](https://reference.aspose.com/slides/cpp/aspose.slides/schemecolor/) enumeration. When you change the corresponding entry in the theme's [IColorScheme](https://reference.aspose.com/slides/cpp/aspose.slides.theme/icolorscheme/), all objects that still reference that theme color are resolved against the new value. Objects that use a direct RGB color are not changed by a theme-color update. The following end-to-end example creates a shape that uses `Accent4`, changes the theme's `Accent4` color to red, saves the presentation, reopens it, and prints the effective fill color: ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::Drawing; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 10.0f, 10.0f, 100.0f, 100.0f); shape->get_FillFormat()->set_FillType(FillType::Solid); shape->get_FillFormat()->get_SolidFillColor()->set_SchemeColor(SchemeColor::Accent4); presentation->get_MasterTheme()->get_ColorScheme()->get_Accent4()->set_Color(Color::get_Red()); presentation->Save(u"theme-color.pptx", SaveFormat::Pptx); auto savedPresentation = MakeObject(u"theme-color.pptx"); auto savedSlide = savedPresentation->get_Slide(0); auto savedShape = savedSlide->get_Shape(0); auto effectiveFill = savedShape->get_FillFormat()->GetEffective(); Console::WriteLine(u"Effective fill color: {0}", effectiveFill->get_SolidFillColor()); ``` Because the rectangle remains linked to `Accent4`, its visible color becomes red after the theme is changed. If you replace the scheme color with a direct color on the shape, later changes to `Accent4` will no longer affect that fill. ### **Use Colors from the Additional Palette** PowerPoint derives lighter and darker variants from a theme color by applying color transformations. Aspose.Slides exposes these transformations through [ColorTransformOperation](https://reference.aspose.com/slides/cpp/aspose.slides/colortransformoperation/). ![Main theme colors and lighter and darker colors generated from the additional palette](https://docs.aspose.com/slides/cpp/presentation-theme/additional-palette-colors.png) **1** - Main theme colors. **2** - Lighter and darker variants produced from the main theme colors. The following example creates six rectangles based on `Accent4`, applies luminance transformations to five of them, and saves the result: ```cpp #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(); auto shapes = presentation->get_Slide(0)->get_Shapes(); auto shape1 = shapes->AddAutoShape(ShapeType::Rectangle, 10.0f, 10.0f, 50.0f, 50.0f); auto fillFormat1 = shape1->get_FillFormat(); fillFormat1->set_FillType(FillType::Solid); fillFormat1->get_SolidFillColor()->set_SchemeColor(SchemeColor::Accent4); auto shape2 = shapes->AddAutoShape(ShapeType::Rectangle, 10.0f, 70.0f, 50.0f, 50.0f); auto fillFormat2 = shape2->get_FillFormat(); auto solidFillColor2 = fillFormat2->get_SolidFillColor(); fillFormat2->set_FillType(FillType::Solid); solidFillColor2->set_SchemeColor(SchemeColor::Accent4); solidFillColor2->get_ColorTransform()->Add(ColorTransformOperation::MultiplyLuminance, 0.2f); solidFillColor2->get_ColorTransform()->Add(ColorTransformOperation::AddLuminance, 0.8f); auto shape3 = shapes->AddAutoShape(ShapeType::Rectangle, 10.0f, 130.0f, 50.0f, 50.0f); auto fillFormat3 = shape3->get_FillFormat(); auto solidFillColor3 = fillFormat3->get_SolidFillColor(); fillFormat3->set_FillType(FillType::Solid); solidFillColor3->set_SchemeColor(SchemeColor::Accent4); solidFillColor3->get_ColorTransform()->Add(ColorTransformOperation::MultiplyLuminance, 0.4f); solidFillColor3->get_ColorTransform()->Add(ColorTransformOperation::AddLuminance, 0.6f); auto shape4 = shapes->AddAutoShape(ShapeType::Rectangle, 10.0f, 190.0f, 50.0f, 50.0f); auto fillFormat4 = shape4->get_FillFormat(); auto solidFillColor4 = fillFormat4->get_SolidFillColor(); fillFormat4->set_FillType(FillType::Solid); solidFillColor4->set_SchemeColor(SchemeColor::Accent4); solidFillColor4->get_ColorTransform()->Add(ColorTransformOperation::MultiplyLuminance, 0.6f); solidFillColor4->get_ColorTransform()->Add(ColorTransformOperation::AddLuminance, 0.4f); auto shape5 = shapes->AddAutoShape(ShapeType::Rectangle, 10.0f, 250.0f, 50.0f, 50.0f); auto fillFormat5 = shape5->get_FillFormat(); auto solidFillColor5 = fillFormat5->get_SolidFillColor(); fillFormat5->set_FillType(FillType::Solid); solidFillColor5->set_SchemeColor(SchemeColor::Accent4); solidFillColor5->get_ColorTransform()->Add(ColorTransformOperation::MultiplyLuminance, 0.75f); auto shape6 = shapes->AddAutoShape(ShapeType::Rectangle, 10.0f, 310.0f, 50.0f, 50.0f); auto fillFormat6 = shape6->get_FillFormat(); auto solidFillColor6 = fillFormat6->get_SolidFillColor(); fillFormat6->set_FillType(FillType::Solid); solidFillColor6->set_SchemeColor(SchemeColor::Accent4); solidFillColor6->get_ColorTransform()->Add(ColorTransformOperation::MultiplyLuminance, 0.5f); presentation->Save(u"theme-color-palette.pptx", SaveFormat::Pptx); ``` These variants remain based on the theme color. If `Accent4` changes later, the transformed colors are recalculated from the new `Accent4` value. ### **Map `SchemeColor` Values to `IColorScheme` Slots** The [SchemeColor](https://reference.aspose.com/slides/cpp/aspose.slides/schemecolor/) enumeration uses `Text1`, `Background1`, `Text2`, and `Background2`, while [IColorScheme](https://reference.aspose.com/slides/cpp/aspose.slides.theme/icolorscheme/) exposes the same theme slots as `Dark1`, `Light1`, `Dark2`, and `Light2`. The mapping is fixed: * `Text1` = `Dark1` * `Background1` = `Light1` * `Text2` = `Dark2` * `Background2` = `Light2` These are alternate names for the same theme slots; they are not values that are dynamically converted from one form to another. ## **Change Theme Fonts** A theme font scheme contains a major font set for headings and a minor font set for body text. The [FontScheme::get_Major](https://reference.aspose.com/slides/cpp/aspose.slides.theme/fontscheme/get_major/) and [FontScheme::get_Minor](https://reference.aspose.com/slides/cpp/aspose.slides.theme/fontscheme/get_minor/) methods expose those sets. PowerPoint-compatible theme font identifiers can be used in text formatting: * `+mn-lt` - Body Font Latin (Minor Latin Font) * `+mj-lt` - Heading Font Latin (Major Latin Font) * `+mn-ea` - Body Font East Asian (Minor East Asian Font) * `+mj-ea` - Heading Font East Asian (Major East Asian Font) * `+mn-cs` - Body Font Complex Script (Minor Complex Script Font) * `+mj-cs` - Heading Font Complex Script (Major Complex Script Font) The following example creates one heading that uses the major Latin theme font and one body line that uses the minor Latin theme font. It then changes the theme fonts and saves the result: ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto heading = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 40.0f, 40.0f, 500.0f, 60.0f); heading->get_TextFrame()->set_Text(u"Theme heading"); heading->get_TextFrame()->get_Paragraph(0)->get_Portion(0)->get_PortionFormat()->set_LatinFont(MakeObject(u"+mj-lt")); auto body = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 40.0f, 120.0f, 500.0f, 60.0f); body->get_TextFrame()->set_Text(u"Theme body text"); body->get_TextFrame()->get_Paragraph(0)->get_Portion(0)->get_PortionFormat()->set_LatinFont(MakeObject(u"+mn-lt")); presentation->get_MasterTheme()->get_FontScheme()->get_Major()->set_LatinFont(MakeObject(u"Aptos Display")); presentation->get_MasterTheme()->get_FontScheme()->get_Minor()->set_LatinFont(MakeObject(u"Arial")); presentation->Save(u"theme-fonts.pptx", SaveFormat::Pptx); ``` The heading follows the major font and the body text follows the minor font. Text that has an explicit font name instead of a theme identifier will not automatically switch when the theme font scheme changes. The major and minor font collections can also contain font mappings for individual writing systems, such as Cyrillic, Arabic, Japanese, Georgian, and Thaana. To inspect, add, replace, or remove these mappings, see [Script-Specific Theme Fonts](https://docs.aspose.com/slides/cpp/script-specific-font-mappings/). For more information about presentation fonts, see [PowerPoint Fonts](https://docs.aspose.com/slides/cpp/powerpoint-fonts/). ### **Resolve Theme Font References** When inspecting text, [IFontData::get_FontName](https://reference.aspose.com/slides/cpp/aspose.slides/ifontdata/get_fontname/) can contain a theme reference such as `+mn-lt` instead of a font family name. Call [IFontData::GetFontName](https://reference.aspose.com/slides/cpp/aspose.slides/ifontdata/getfontname/) with the appropriate [IThemeEffectiveData](https://reference.aspose.com/slides/cpp/aspose.slides.theme/ithemeeffectivedata/) to resolve that reference. The `+mj` and `+mn` prefixes select the major and minor font sets; the `-lt`, `-ea`, and `-cs` suffixes select their Latin, East Asian, and Complex Script fonts, respectively. Obtain the effective theme through [IThemeable::CreateThemeEffective](https://reference.aspose.com/slides/cpp/aspose.slides.theme/ithemeable/createthemeeffective/) on the object whose theme applies to the inspected text. For ordinary text on a slide, use `slide->CreateThemeEffective()` so the context includes that slide's inherited theme and local overrides. When inspecting a layout or master itself, use its own effective theme. Do not assume that the first master's theme applies to every slide. The following example creates a text portion that explicitly references the minor Latin font. It initializes a slide font scheme through [IOverrideTheme::InitFontSchemeFromInherited](https://reference.aspose.com/slides/cpp/aspose.slides.theme/ioverridetheme/initfontschemefrominherited/) and sets the major and minor Latin families to `Arial` and `Calibri`, making the result reproducible without an input file. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto theme = slide->get_ThemeManager()->get_OverrideTheme(); theme->InitFontSchemeFromInherited(); theme->get_FontScheme()->get_Major()->set_LatinFont(MakeObject(u"Arial")); theme->get_FontScheme()->get_Minor()->set_LatinFont(MakeObject(u"Calibri")); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 20.0f, 20.0f, 400.0f, 60.0f); shape->get_TextFrame()->set_Text(u"Text using the minor theme font"); auto portion = shape->get_TextFrame()->get_Paragraph(0)->get_Portion(0); portion->get_PortionFormat()->set_LatinFont(MakeObject(u"+mn-lt")); auto font = portion->get_PortionFormat()->get_LatinFont(); auto effectiveTheme = slide->CreateThemeEffective(); auto resolvedFontName = font->GetFontName(effectiveTheme); Console::WriteLine(u"{0} -> {1}", font->get_FontName(), resolvedFontName); auto explicitFont = MakeObject(u"Verdana"); auto explicitFontName = explicitFont->GetFontName(effectiveTheme); Console::WriteLine(u"{0} -> {1}", explicitFont->get_FontName(), explicitFontName); ``` The output is `+mn-lt -> Calibri` followed by `Verdana -> Verdana`. The stored reference remains unchanged, while an explicit family name is returned as-is. If the portion used `+mj-lt`, it would resolve to `Arial` in this theme. Resolving a theme reference identifies the font family specified by the theme. It does not check font availability or determine the font file ultimately used after substitution or glyph fallback during rendering. See [Font Selection Sequence](https://docs.aspose.com/slides/cpp/font-selection-sequence/) and [Font Substitution](https://docs.aspose.com/slides/cpp/font-substitution/) for those separate steps. ## **Copy or Apply a Theme** The workflows below solve different theme-related problems. ### **Apply an External Theme to a Master's Dependent Slides** Use [IMasterSlide::ApplyExternalThemeToDependingSlides](https://reference.aspose.com/slides/cpp/aspose.slides/imasterslide/applyexternalthemetodependingslides/) when you have a PowerPoint theme file (`.thmx`) and want to restyle every slide that depends on a particular master. Select the master from the [Presentation::get_Masters](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/get_masters/) collection, which implements [IMasterSlideCollection](https://reference.aspose.com/slides/cpp/aspose.slides/imasterslidecollection/), and pass the theme file path to the method. The method performs the following operations: 1. Creates a new master slide based on the selected master. 1. Applies the external theme to the new master. 1. Assigns the new master to all slides that previously depended on the selected master. 1. Returns the newly created [IMasterSlide](https://reference.aspose.com/slides/cpp/aspose.slides/imasterslide/). The following example applies an external theme to the slides that depend on the first master and saves the presentation: ```cpp #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(u"presentation.pptx"); auto selectedMaster = presentation->get_Master(0); auto themedMaster = selectedMaster->ApplyExternalThemeToDependingSlides(u"corporate-theme.thmx"); Console::WriteLine(u"Created master: {0}", themedMaster->get_Name()); presentation->Save(u"presentation-with-external-theme.pptx", SaveFormat::Pptx); ``` An invalid, corrupted, or unsupported theme can cause [PptxException](https://reference.aspose.com/slides/cpp/aspose.slides/pptxexception/) or one of its format-related subclasses. Validate paths supplied by users, handle file-system access failures, and save the presentation only after the theme has been applied successfully. Only the slides that depended on the selected master are reassigned. Slides associated with other masters retain their existing masters and themes. Theme-aware colors, fonts, fills, lines, backgrounds, and effects are resolved against the external theme. Directly assigned colors, fonts, fills, and other explicit formatting may remain unchanged. Layout-level and slide-level overrides can also take precedence over values inherited from the new master. The theme can reference fonts that are not available in the runtime environment. For consistent rendering and export, install the required fonts, provide them through [custom font sources](https://docs.aspose.com/slides/cpp/custom-font/), or configure [font substitution](https://docs.aspose.com/slides/cpp/font-substitution/). This is a direct master-level workflow: the method accepts a file path to a `.thmx` file and does not require manually creating slide-level or layout-level theme overrides. ### **Apply Different External Themes in a Multi-Master Presentation** When the relevant master is not known in advance, obtain it from a representative slide through [ISlide::get_LayoutSlide](https://reference.aspose.com/slides/cpp/aspose.slides/islide/get_layoutslide/) and [ILayoutSlide::get_MasterSlide](https://reference.aspose.com/slides/cpp/aspose.slides/ilayoutslide/get_masterslide/). Store the original master references before applying any themes because each call creates another master in the presentation. The following example uses slides from two sections to locate their masters and applies a different external theme to each group: ```cpp #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(u"multi-master-presentation.pptx"); if (presentation->get_Slides()->get_Count() < 5) { std::cout << "The presentation does not contain the expected representative slides." << std::endl; } else { auto firstGroupMaster = presentation->get_Slide(0)->get_LayoutSlide()->get_MasterSlide(); auto secondGroupMaster = presentation->get_Slide(4)->get_LayoutSlide()->get_MasterSlide(); if (firstGroupMaster->get_SlideId() == secondGroupMaster->get_SlideId()) { std::cout << "The representative slides use the same master." << std::endl; } else { auto firstThemedMaster = firstGroupMaster->ApplyExternalThemeToDependingSlides(u"blue-theme.thmx"); auto secondThemedMaster = secondGroupMaster->ApplyExternalThemeToDependingSlides(u"green-theme.thmx"); Console::WriteLine(u"First themed master: {0}", firstThemedMaster->get_Name()); Console::WriteLine(u"Second themed master: {0}", secondThemedMaster->get_Name()); presentation->Save(u"multi-master-with-external-themes.pptx", SaveFormat::Pptx); } } ``` The first call affects only slides that depended on `firstGroupMaster`, and the second call affects only slides that depended on `secondGroupMaster`. Slides belonging to any other master are not restyled. ### **Preserve a Source Theme When Moving Slides** If you want to move a slide to another presentation and preserve its original design, clone the source master into the target presentation with [IMasterSlideCollection::AddClone](https://reference.aspose.com/slides/cpp/aspose.slides/imasterslidecollection/addclone/), then clone the slide with [ISlideCollection::AddClone](https://reference.aspose.com/slides/cpp/aspose.slides/islidecollection/addclone/) and the cloned master. This carries the master, its layouts, and the associated theme together. ```cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto source = MakeObject(u"source-theme.pptx"); auto target = MakeObject(u"target.pptx"); auto sourceSlide = source->get_Slide(0); auto sourceMaster = sourceSlide->get_LayoutSlide()->get_MasterSlide(); auto clonedMaster = target->get_Masters()->AddClone(sourceMaster); target->get_Slides()->AddClone(sourceSlide, clonedMaster, true); target->Save(u"theme-preserved.pptx", SaveFormat::Pptx); ``` This is the preferred workflow when the source slide must look the same in the destination. Simply cloning content onto an unrelated destination master can change theme-driven colors, fonts, backgrounds, and effects. ### **Apply Theme Values to an Existing Slide** If the target slide must stay on its current master and layout, initialize a slide-level override from the source theme. The [OverrideTheme::InitColorSchemeFrom](https://reference.aspose.com/slides/cpp/aspose.slides.theme/overridetheme/initcolorschemefrom/), [OverrideTheme::InitFontSchemeFrom](https://reference.aspose.com/slides/cpp/aspose.slides.theme/overridetheme/initfontschemefrom/), and [OverrideTheme::InitFormatSchemeFrom](https://reference.aspose.com/slides/cpp/aspose.slides.theme/overridetheme/initformatschemefrom/) methods copy the three main theme components into the override. ```cpp #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto source = MakeObject(u"source-theme.pptx"); auto target = MakeObject(u"target.pptx"); auto targetSlide = target->get_Slide(0); auto overrideTheme = targetSlide->get_ThemeManager()->get_OverrideTheme(); overrideTheme->InitColorSchemeFrom(source->get_MasterTheme()->get_ColorScheme()); overrideTheme->InitFontSchemeFrom(source->get_MasterTheme()->get_FontScheme()); overrideTheme->InitFormatSchemeFrom(source->get_MasterTheme()->get_FormatScheme()); target->Save(u"theme-applied-to-slide.pptx", SaveFormat::Pptx); ``` This changes the theme used by that slide without changing the theme inherited by other slides. To remove the local override and return to inherited values, call [OverrideTheme::Clear](https://reference.aspose.com/slides/cpp/aspose.slides.theme/overridetheme/clear/). ### **Apply a Theme Override to a Layout** A layout-level override applies to slides that use that layout, unless a particular slide has its own override. The same initialization methods can be used through the layout's [IOverrideThemeManager](https://reference.aspose.com/slides/cpp/aspose.slides.theme/ioverridethememanager/): ```cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto source = MakeObject(u"source-theme.pptx"); auto target = MakeObject(u"target.pptx"); auto targetSlide = target->get_Slide(0); auto targetLayout = targetSlide->get_LayoutSlide(); auto overrideTheme = targetLayout->get_ThemeManager()->get_OverrideTheme(); overrideTheme->InitColorSchemeFrom(source->get_MasterTheme()->get_ColorScheme()); overrideTheme->InitFontSchemeFrom(source->get_MasterTheme()->get_FontScheme()); overrideTheme->InitFormatSchemeFrom(source->get_MasterTheme()->get_FormatScheme()); target->Save(u"theme-applied-to-layout.pptx", SaveFormat::Pptx); ``` Use a master or presentation-level theme when many layouts and slides should share the same base design, a layout override when one layout family needs different styling, and a slide override only for true exceptions. Excessive slide-level overrides make later global theme changes harder to predict. ## **Update Theme Background Styles** The theme's background fills are stored in [FormatScheme::get_BackgroundFillStyles](https://reference.aspose.com/slides/cpp/aspose.slides.theme/formatscheme/get_backgroundfillstyles/). PowerPoint can present more background choices in its UI than the number of fill definitions physically stored in this collection because the UI can combine theme fills with theme colors and other style references. ![PowerPoint background style gallery for a presentation theme](https://docs.aspose.com/slides/cpp/presentation-theme/presentation-design_8.png) Before using a background style, inspect the stored collection and the current [Background::get_StyleIndex](https://reference.aspose.com/slides/cpp/aspose.slides/background/get_styleindex/). `StyleIndex` uses `0` for no themed fill; positive values are theme background-style references. This is different from indexing a C++ collection directly with `idx_get(0)`, where `0` means the first stored item. Do not assume that every presentation contains the same number of background fill styles. The following example reports the available background fill count, assigns a themed background reference to the first master, and saves the presentation: ```cpp #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(u"input.pptx"); auto backgroundStyles = presentation->get_MasterTheme()->get_FormatScheme()->get_BackgroundFillStyles(); Console::WriteLine(u"Background fill styles: {0}", backgroundStyles->get_Count()); if (backgroundStyles->get_Count() > 0) { auto masterSlide = presentation->get_Master(0); masterSlide->get_Background()->set_Type(BackgroundType::Themed); masterSlide->get_Background()->set_StyleIndex(1); presentation->Save(u"theme-background.pptx", SaveFormat::Pptx); } ``` The visible result depends on the theme entry referenced by the master and on any background overrides at the layout or slide level. If a slide uses its own background, changing only the master background may not change that slide. Use [Background::GetEffective](https://reference.aspose.com/slides/cpp/aspose.slides/background/geteffective/) when you need to know the final background after inheritance has been applied. Do not treat `StyleIndex` as a zero-based collection index. Also avoid hard-coding a style number from one file and assuming it has the same appearance in another file; theme style definitions are presentation-specific. For direct background formatting and background inheritance, see [Presentation Background](https://docs.aspose.com/slides/cpp/presentation-background/). ## **Update Theme Effects** A theme format scheme contains separate [FormatScheme::get_FillStyles](https://reference.aspose.com/slides/cpp/aspose.slides.theme/formatscheme/get_fillstyles/), [FormatScheme::get_LineStyles](https://reference.aspose.com/slides/cpp/aspose.slides.theme/formatscheme/get_linestyles/), and [FormatScheme::get_EffectStyles](https://reference.aspose.com/slides/cpp/aspose.slides.theme/formatscheme/get_effectstyles/) collections. Typical Office themes often contain three principal style entries that correspond visually to subtle, moderate, and intense formatting, but code should inspect each collection instead of assuming a fixed count. ![Subtle, moderate, and intense theme effects applied to the same shape](https://docs.aspose.com/slides/cpp/presentation-theme/presentation-design_10.png) When you access these collections in C++, the collection index is zero-based: `idx_get(0)` is the first stored style and `idx_get(2)` is the third. A shape's style-reference indexes are a separate concept, exposed through [IShapeStyle](https://reference.aspose.com/slides/cpp/aspose.slides/ishapestyle/). Modifying a theme style affects shapes that reference that theme style; shapes with direct formatting may remain unchanged. The following example checks that the required style entries exist, changes the first line style, changes the third fill style, enables an outer shadow in the third effect style, and saves the result: ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::Drawing; auto presentation = MakeObject(u"Subtle_Moderate_Intense.pptx"); auto formatScheme = presentation->get_MasterTheme()->get_FormatScheme(); auto lineStyles = formatScheme->get_LineStyles(); auto fillStyles = formatScheme->get_FillStyles(); auto effectStyles = formatScheme->get_EffectStyles(); if (lineStyles->get_Count() < 1 || fillStyles->get_Count() < 3 || effectStyles->get_Count() < 3) { Console::WriteLine(u"The theme does not contain the style entries required by this example."); } else { auto lineStyle = lineStyles->idx_get(0); lineStyle->get_FillFormat()->set_FillType(FillType::Solid); lineStyle->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Red()); auto fillStyle = fillStyles->idx_get(2); fillStyle->set_FillType(FillType::Solid); fillStyle->get_SolidFillColor()->set_Color(Color::get_ForestGreen()); auto effectFormat = effectStyles->idx_get(2)->get_EffectFormat(); effectFormat->EnableOuterShadowEffect(); effectFormat->get_OuterShadowEffect()->set_Distance(10.0f); presentation->Save(u"theme-effects.pptx", SaveFormat::Pptx); } ``` For shapes that reference these slots, the first theme line style becomes red, the third theme fill style becomes solid forest green, and the third effect style gains an outer shadow with a distance of 10 points. The exact visual result still depends on which style slots each shape references and whether direct formatting overrides the theme. ![Theme effect styles after changing line, fill, and shadow settings](https://docs.aspose.com/slides/cpp/presentation-theme/presentation-design_11.png) ## **Determine Whether an Effective Solid Fill Uses a Theme Color** A fill can be stored directly on an object or inherited from a paragraph, layout, master, theme style, or another formatting level. Call [IFillFormat::GetEffective](https://reference.aspose.com/slides/cpp/aspose.slides/ifillformat/geteffective/) to resolve that hierarchy into immutable [IFillFormatEffectiveData](https://reference.aspose.com/slides/cpp/aspose.slides/ifillformateffectivedata/). First check [IFillFormatEffectiveData::get_FillType](https://reference.aspose.com/slides/cpp/aspose.slides/ifillformateffectivedata/get_filltype/). Only when it is `FillType::Solid` should you read the solid-fill properties. For a solid fill, [IFillFormatEffectiveData::get_SolidFillColor](https://reference.aspose.com/slides/cpp/aspose.slides/ifillformateffectivedata/get_solidfillcolor/) returns the final rendered RGB value after inheritance, theme lookup, and color transformations are applied. [IFillFormatEffectiveData::get_SolidFillSchemeColor](https://reference.aspose.com/slides/cpp/aspose.slides/ifillformateffectivedata/get_solidfillschemecolor/) returns the corresponding logical [SchemeColor](https://reference.aspose.com/slides/cpp/aspose.slides/schemecolor/) slot, such as `Text1` or `Accent6`. A value of `SchemeColor::NotDefined` means that the effective solid fill is not based on a scheme color. In a workflow where fills are either theme colors or direct RGB colors, this value identifies a direct RGB fill. Do not use the local [IColorFormat::get_SchemeColor](https://reference.aspose.com/slides/cpp/aspose.slides/icolorformat/get_schemecolor/) value alone to classify a fill. For example, a text portion can have no locally defined scheme color, so its local value is `NotDefined`, while its effective fill inherits a theme color and resolves to `Text1` or `Accent6`. Conversely, `get_SolidFillSchemeColor` tells you which logical theme slot produced the effective color, but it does not tell you whether that slot came from the object, paragraph, layout, master, or another level of the formatting hierarchy. The following example loads a presentation, audits both shape fills and text-portion fills, prints each final RGB value and associated scheme color, and flags solid fills that will not track theme color changes: ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto auditFill = [](const String& objectName, const SharedPtr& localFill) { auto effectiveFill = localFill->GetEffective(); if (effectiveFill->get_FillType() != FillType::Solid) { Console::WriteLine(u"{0}: fill type = {1}; not a solid fill.", objectName, effectiveFill->get_FillType()); return; } auto rgb = effectiveFill->get_SolidFillColor(); auto effectiveSchemeColor = effectiveFill->get_SolidFillSchemeColor(); auto localSchemeColor = localFill->get_SolidFillColor()->get_SchemeColor(); Console::WriteLine(u"{0}: RGB = #{1:X2}{2:X2}{3:X2}", objectName, rgb.get_R(), rgb.get_G(), rgb.get_B()); Console::WriteLine(u"{0}: local scheme = {1}, effective scheme = {2}", objectName, localSchemeColor, effectiveSchemeColor); if (effectiveSchemeColor == SchemeColor::NotDefined) { Console::WriteLine(u"{0}: direct RGB or another non-scheme fill; audit as theme-independent.", objectName); } else { Console::WriteLine(u"{0}: theme-dependent through {1}.", objectName, effectiveSchemeColor); } }; auto presentation = MakeObject(u"input.pptx"); auto slideCount = presentation->get_Slides()->get_Count(); for (int32_t slideIndex = 0; slideIndex < slideCount; slideIndex++) { auto slide = presentation->get_Slide(slideIndex); auto shapeCount = slide->get_Shapes()->get_Count(); for (int32_t shapeIndex = 0; shapeIndex < shapeCount; shapeIndex++) { auto shape = slide->get_Shape(shapeIndex); auto shapeName = String::Format(u"Slide {0}, shape {1}", slideIndex + 1, shapeIndex + 1); auditFill(shapeName, shape->get_FillFormat()); if (ObjectExt::Is(shape)) { auto autoShape = ExplicitCast(shape); auto textFrame = autoShape->get_TextFrame(); auto paragraphCount = textFrame->get_Paragraphs()->get_Count(); for (int32_t paragraphIndex = 0; paragraphIndex < paragraphCount; paragraphIndex++) { auto paragraph = textFrame->get_Paragraph(paragraphIndex); auto portionCount = paragraph->get_Portions()->get_Count(); for (int32_t portionIndex = 0; portionIndex < portionCount; portionIndex++) { auto portion = paragraph->get_Portion(portionIndex); auto portionName = String::Format(u"{0}, paragraph {1}, portion {2}", shapeName, paragraphIndex + 1, portionIndex + 1); auditFill(portionName, portion->get_PortionFormat()->get_FillFormat()); } } } } } ``` The `NotDefined` branch provides an audit list of solid fills that will not respond to changes in theme color slots. Review those objects when a presentation must follow a new brand palette. The reported RGB value still shows the current appearance, while the scheme value explains whether that appearance is connected to the theme. Effective-format objects are snapshots. After changing the presentation theme, a theme override, or any inherited formatting, call `GetEffective` again and read a new `IFillFormatEffectiveData` object before comparing or reporting colors. ## **Read Effective Theme Values** Raw theme objects tell you what is defined at a particular level. Effective values tell you what a slide or shape actually uses after inheritance and local overrides are resolved. For a slide, call [IThemeable::CreateThemeEffective](https://reference.aspose.com/slides/cpp/aspose.slides.theme/ithemeable/createthemeeffective/). For a background, use [Background::GetEffective](https://reference.aspose.com/slides/cpp/aspose.slides/background/geteffective/), and for a fill, use [FillFormat::GetEffective](https://reference.aspose.com/slides/cpp/aspose.slides/fillformat/geteffective/). The following example reads the effective theme, background, and first shape fill from a slide: ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto presentation = MakeObject(u"input.pptx"); auto slide = presentation->get_Slide(0); auto effectiveTheme = slide->CreateThemeEffective(); auto effectiveBackground = slide->get_Background()->GetEffective(); Console::WriteLine(u"Effective major Latin font: {0}", effectiveTheme->get_FontScheme()->get_Major()->get_LatinFont()->get_FontName()); Console::WriteLine(u"Effective minor Latin font: {0}", effectiveTheme->get_FontScheme()->get_Minor()->get_LatinFont()->get_FontName()); Console::WriteLine(u"Effective background fill type: {0}", effectiveBackground->get_FillFormat()->get_FillType()); if (slide->get_Shapes()->get_Count() > 0) { auto effectiveFill = slide->get_Shape(0)->get_FillFormat()->GetEffective(); Console::WriteLine(u"First shape effective fill type: {0}", effectiveFill->get_FillType()); if (effectiveFill->get_FillType() == FillType::Solid) { Console::WriteLine(u"First shape effective fill color: {0}", effectiveFill->get_SolidFillColor()); } } ``` Use effective data for rendering diagnostics, validation, and comparisons. If you inspect only [Presentation::get_MasterTheme](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/get_mastertheme/), you can miss a master, layout, slide, or shape override that changes the final appearance. ## **FAQ** **Does applying an external theme affect every slide in the presentation?** No. [IMasterSlide::ApplyExternalThemeToDependingSlides](https://reference.aspose.com/slides/cpp/aspose.slides/imasterslide/applyexternalthemetodependingslides/) reassigns only the slides that depend on the selected master. Slides that use other masters retain their existing themes. **Can I apply a theme to a single slide without changing the master?** Yes. Use the slide's [IOverrideThemeManager](https://reference.aspose.com/slides/cpp/aspose.slides.theme/ioverridethememanager/) and initialize its override theme. The change remains local to that slide; other slides continue to inherit their existing themes. **What is the safest way to carry a theme from one presentation to another?** When moving a slide and preserving its source appearance, clone the source master into the destination and clone the slide with that master using [IMasterSlideCollection::AddClone](https://reference.aspose.com/slides/cpp/aspose.slides/imasterslidecollection/addclone/) and [ISlideCollection::AddClone](https://reference.aspose.com/slides/cpp/aspose.slides/islidecollection/addclone/). This keeps the master, layouts, and theme together. **How can I see the effective values after inheritance and overrides?** Use [IThemeable::CreateThemeEffective](https://reference.aspose.com/slides/cpp/aspose.slides.theme/ithemeable/createthemeeffective/) for a slide or layout theme and the corresponding effective-data methods for format objects such as [Background::GetEffective](https://reference.aspose.com/slides/cpp/aspose.slides/background/geteffective/) and [FillFormat::GetEffective](https://reference.aspose.com/slides/cpp/aspose.slides/fillformat/geteffective/). These APIs return the resolved values after inheritance and overrides are applied. # Manage VBA Projects in Presentations Using C++ > Discover how to generate and manipulate PowerPoint and OpenDocument presentations via VBA with Aspose.Slides for C++ to streamline your workflow. Source: https://docs.aspose.com/slides/cpp/presentation-via-vba/ Updated: 2026-08-13 ## **Introduction** The [Aspose.Slides.Vba](https://reference.aspose.com/slides/cpp/namespace/aspose.slides.vba/) namespace contains classes and interfaces for working with macros and VBA code. When you convert a presentation containing macros to a different file format (PDF, HTML, etc.), Aspose.Slides ignores all macros (macros are not carried into the resulting file). When you add macros to a presentation or resave a presentation containing macros, Aspose.Slides simply writes the bytes for the macros. Aspose.Slides **never** runs the macros in a presentation. ## **Add VBA Macros** Aspose.Slides provides the [VbaProject](https://reference.aspose.com/slides/cpp/class/aspose.slides.vba.vba_project) class to allow you to create VBA projects (and project references) and edit existing modules. You can use the [IVbaProject](https://reference.aspose.com/slides/cpp/class/aspose.slides.vba.i_vba_project/) interface to manage VBA embedded in a presentation. 1. Create an instance of the [Presentation](https://reference.aspose.com/slides/cpp/class/aspose.slides.presentation) class. 1. Use the [VbaProject](https://reference.aspose.com/slides/cpp/class/aspose.slides.vba.vba_project#a01b7a0287df8a75f2f8d85185f3e197b) constructor to add a new VBA project. 1. Add a module to the VbaProject. 1. Set the module source code. 1. Add references to . 1. Add references to **Microsoft Office**. 1. Associate the references with the VBA project. 1. Save the presentation. This C++ code shows you how to add a VBA macro from scratch to a presentation: ```c++ #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace Aspose::Slides::Vba; using namespace System; // The path to the documents directory. const String outPath = u"../out/AddVBAMacros_out.pptm"; // Creates an instance of the presentation class SharedPtr presentation = MakeObject(); // Creates a new VBA Project presentation->set_VbaProject(MakeObject()); // Adds an empty module to the VBA project SharedPtr module = presentation->get_VbaProject()->get_Modules()->AddEmptyModule(u"Module"); // Sets the module source code module->set_SourceCode(u"Sub Test(oShape As Shape) MsgBox \"Test\" End Sub"); // Creates a reference to SharedPtr stdoleReference = MakeObject(u"stdole", u"*\\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\\Windows\\system32\\stdole2.tlb#OLE Automation"); // Creates a reference to Office SharedPtr officeReference = MakeObject(u"Office", u"*\\G{2DF8D04C-5BFA-101B-BDE5-00AA0044DE52}#2.0#0#C:\\Program Files\\Common Files\\Microsoft Shared\\OFFICE14\\MSO.DLL#Microsoft Office 14.0 Object Library"); // Adds references to the VBA project presentation->get_VbaProject()->get_References()->Add(stdoleReference); presentation->get_VbaProject()->get_References()->Add(officeReference); // Saves the Presentation presentation->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptm); ``` You may want to check out **Aspose** [Macro Remover](https://products.aspose.app/slides/remove-macros), which a free web app used to remove macros from PowerPoint, Excel, and Word documents. ## **Remove VBA Macros** Using the [VbaProject](https://reference.aspose.com/slides/cpp/class/aspose.slides.presentation#ac9554082a2ac5ed57adf6012c90da5f4) property under the [Presentation](https://reference.aspose.com/slides/cpp/class/aspose.slides.presentation) class, you can remove a VBA macro. 1. Create an instance of the [Presentation](https://reference.aspose.com/slides/cpp/class/aspose.slides.presentation) class and load the presentation containing the macro. 1. Access the Macro module and remove it. 1. Save the modified presentation. This C++ code shows you how to remove a VBA macro: ```c++ #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; // The path to the documents directory. const String outPath = u"../out/RemoveVBAMacros_out.pptm"; const String templatePath = u"../templates/vba.pptm"; // Loads the presentation containing the macro SharedPtr presentation = MakeObject(templatePath); // Accesses the Vba module and removes it presentation->get_VbaProject()->get_Modules()->Remove(presentation->get_VbaProject()->get_Modules()->idx_get(0)); // Saves the Presentation presentation->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptm); ``` ## **Extract VBA Macros** 1. Create an instance of the [Presentation](https://reference.aspose.com/slides/cpp/class/aspose.slides.presentation) class and load the presentation containing the macro. 2. Check if the presentation contains a VBA Project. 3. Loop through all the modules contained in the VBA Project to view the macros. This C++ code shows you how to extract VBA macros from a presentation containing macros: ```c++ #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Vba; using namespace System; // The path to the documents directory. const String templatePath = u"../templates/VBA.pptm"; // Loads the presentation containing the macro SharedPtr pres = MakeObject(templatePath); if (pres->get_VbaProject() != NULL) // Checks whether the Presentation contains a VBA Project { //for (SharedPtr module : pres->get_VbaProject()->get_Modules()) for (int i = 0; i < pres->get_VbaProject()->get_Modules()->get_Count(); i++) { SharedPtr module = pres->get_VbaProject()->get_Modules()->idx_get(i); System::Console::WriteLine(module->get_Name()); System::Console::WriteLine(module->get_SourceCode()); } } ``` ## **Check Whether a VBA Project Is Password-Protected** Using the [IVbaProject::get_IsPasswordProtected](https://reference.aspose.com/slides/cpp/aspose.slides.vba/ivbaproject/get_ispasswordprotected/) property, you can determine whether a project’s properties are password-protected. 1. Create an instance of the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) class and load a presentation that contains a macro. 2. Check whether the presentation contains a [VBA project](https://reference.aspose.com/slides/cpp/aspose.slides.vba/vbaproject/). 3. Check whether the VBA project is password-protected to view its properties. ```cpp #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Vba; using namespace System; auto presentation = MakeObject(u"VBA.pptm"); if (presentation->get_VbaProject() != nullptr) // Check whether the presentation contains a VBA project. { if (presentation->get_VbaProject()->get_IsPasswordProtected()) { Console::WriteLine(u"The VBA Project '{0}' is protected by password to view project properties.", presentation->get_VbaProject()->get_Name()); } } presentation->Dispose(); ``` ## **FAQ** ### What happens to macros if I save the presentation as PPTX? Macros will be removed because PPTX does not support VBA. To keep macros, choose PPTM, PPSM, or POTM. ### Can Aspose.Slides run macros inside a presentation to, for example, refresh data? No. The library never executes VBA code; execution is only possible inside PowerPoint with the appropriate security settings. ### Is working with ActiveX controls linked to VBA code supported? Yes, you can access existing [ActiveX controls](https://docs.aspose.com/slides/cpp/activex/), modify their properties, and remove them. This is useful when macros interact with ActiveX. ## Related articles - [VBA Macro](https://docs.aspose.com/slides/cpp/examples/elements/vba-macro/) # Retrieve and Update Presentation View Properties in C++ > Use Aspose.Slides for C++ to configure the normal view layout, slide and notes zoom, grid spacing, and comment visibility in PowerPoint presentations. Source: https://docs.aspose.com/slides/cpp/presentation-view-properties/ Updated: 2026-11-16 ## **Introduction** In PowerPoint's normal view, the slide appears between a side pane for thumbnails or an outline and a notes pane below. Aspose.Slides for C++ exposes the presentation's saved editing preferences through [Presentation::get_ViewProperties](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/get_viewproperties/). These include the pane layout, zoom levels, grid spacing, and comment visibility. ## **About INormalViewProperties** Use [get_NormalViewProperties](https://reference.aspose.com/slides/cpp/aspose.slides/iviewproperties/get_normalviewproperties/) to access the [INormalViewProperties](https://reference.aspose.com/slides/cpp/aspose.slides/inormalviewproperties/) interface. [set_ShowOutlineIcons](https://reference.aspose.com/slides/cpp/aspose.slides/inormalviewproperties/set_showoutlineicons/) controls whether icons appear beside slide titles in the outline. [set_SnapVerticalSplitter](https://reference.aspose.com/slides/cpp/aspose.slides/inormalviewproperties/set_snapverticalsplitter/) lets the side pane snap to its minimized state when the user narrows it. [set_PreferSingleView](https://reference.aspose.com/slides/cpp/aspose.slides/inormalviewproperties/set_prefersingleview/) indicates a preference for displaying one pane in the full window. [set_VerticalBarState](https://reference.aspose.com/slides/cpp/aspose.slides/inormalviewproperties/set_verticalbarstate/) controls the divider between the side pane and the slide. [set_HorizontalBarState](https://reference.aspose.com/slides/cpp/aspose.slides/inormalviewproperties/set_horizontalbarstate/) controls the divider above the notes pane. Both accept a [SplitterBarStateType](https://reference.aspose.com/slides/cpp/aspose.slides/splitterbarstatetype/) value of `Minimized`, `Maximized`, or `Restored`. ## **About Restoring INormalViewProperties** When a divider is restored, [get_RestoredLeft](https://reference.aspose.com/slides/cpp/aspose.slides/inormalviewproperties/get_restoredleft/) supplies the saved size of the side pane and [get_RestoredTop](https://reference.aspose.com/slides/cpp/aspose.slides/inormalviewproperties/get_restoredtop/) supplies the saved size of the upper slide area. Both expose [INormalViewRestoredProperties](https://reference.aspose.com/slides/cpp/aspose.slides/inormalviewrestoredproperties/). Its [set_DimensionSize](https://reference.aspose.com/slides/cpp/aspose.slides/inormalviewrestoredproperties/set_dimensionsize/) method accepts a percentage from 0 to 100, and [set_AutoAdjust](https://reference.aspose.com/slides/cpp/aspose.slides/inormalviewrestoredproperties/set_autoadjust/) controls whether the editor adjusts the size when the window is resized. This example updates an existing presentation. It restores the horizontal divider, sets the size of the upper slide area exposed by [get_RestoredTop](https://reference.aspose.com/slides/cpp/aspose.slides/inormalviewproperties/get_restoredtop/) to 80% with automatic adjustment enabled, and maximizes the vertical divider. It also enables outline icons with [set_ShowOutlineIcons](https://reference.aspose.com/slides/cpp/aspose.slides/inormalviewproperties/set_showoutlineicons/) for outline view. ```cpp #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(u"demo.pptx"); auto normalView = presentation->get_ViewProperties()->get_NormalViewProperties(); normalView->set_HorizontalBarState(SplitterBarStateType::Restored); normalView->set_VerticalBarState(SplitterBarStateType::Maximized); auto restoredTop = normalView->get_RestoredTop(); restoredTop->set_AutoAdjust(true); restoredTop->set_DimensionSize(80.0f); normalView->set_ShowOutlineIcons(true); presentation->Save(u"presentation_normal_view_state.pptx", SaveFormat::Pptx); ``` ## **Set the Default Zoom Value** [get_SlideViewProperties](https://reference.aspose.com/slides/cpp/aspose.slides/iviewproperties/get_slideviewproperties/) and [get_NotesViewProperties](https://reference.aspose.com/slides/cpp/aspose.slides/iviewproperties/get_notesviewproperties/) store independent zoom settings for the editor. These settings do not affect slide dimensions, slide-show playback, or image export resolution. This example opens an existing presentation and enables automatic scaling with [set_VariableScale](https://reference.aspose.com/slides/cpp/aspose.slides/icommonslideviewproperties/set_variablescale/) to fit the slide to the editing window. For the notes page, it disables automatic scaling and uses [set_Scale](https://reference.aspose.com/slides/cpp/aspose.slides/icommonslideviewproperties/set_scale/) to set a fixed 80% zoom. ```cpp #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(u"demo.pptx"); auto viewProperties = presentation->get_ViewProperties(); viewProperties->get_SlideViewProperties()->set_VariableScale(true); auto notesView = viewProperties->get_NotesViewProperties(); notesView->set_VariableScale(false); notesView->set_Scale(80); presentation->Save(u"zoom.pptx", SaveFormat::Pptx); ``` ## **Set the Grid Spacing** [set_GridSpacing](https://reference.aspose.com/slides/cpp/aspose.slides/iviewproperties/set_gridspacing/) sets the distance between editing grid lines throughout the presentation. It takes a positive value in points, with 72 points per inch. This example prints the current spacing in an existing presentation and saves a quarter-inch grid by setting the interval to 18 points. ```cpp #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(u"demo.pptx"); auto viewProperties = presentation->get_ViewProperties(); auto gridSpacing = viewProperties->get_GridSpacing(); System::Console::WriteLine(u"Current grid spacing: {0} points", gridSpacing); viewProperties->set_GridSpacing(18.0f); presentation->Save(u"grid-spacing.pptx", SaveFormat::Pptx); ``` The grid repeats at a fixed interval. [Drawing guides](https://docs.aspose.com/slides/cpp/drawing-guides/) mark individual horizontal or vertical positions. Both are editing aids and appear only in editors that display them. Slide shows and exports to PDF, images, or SVG omit them. ## **Show or Hide Comments When Opening a Presentation** [set_ShowComments](https://reference.aspose.com/slides/cpp/aspose.slides/iviewproperties/set_showcomments/) stores a preference that compatible editors use when opening the presentation. For an existing presentation with comments, this example prints the current setting and saves a copy with comments hidden. It also calls [set_LastView](https://reference.aspose.com/slides/cpp/aspose.slides/iviewproperties/set_lastview/) with [ViewType::SlideView](https://reference.aspose.com/slides/cpp/aspose.slides/viewtype/) so the copy opens in slide view. ```cpp #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(u"comments.pptx"); auto viewProperties = presentation->get_ViewProperties(); auto showComments = viewProperties->get_ShowComments(); System::Console::WriteLine(u"Current comment visibility: {0}", showComments); viewProperties->set_ShowComments(NullableBool::False); viewProperties->set_LastView(ViewType::SlideView); presentation->Save(u"comments-hidden.pptx", SaveFormat::Pptx); ``` Hiding comments preserves their text, authors, positions, replies, and statuses. To change the comments themselves, see [Presentation Comments](https://docs.aspose.com/slides/cpp/presentation-comments/). Export settings control whether comments appear in PDF, HTML, images, notes, or handouts. ## **FAQ** **Why is the grid hidden when I reopen the presentation?** The presentation stores the grid interval. To see the grid, enable grid visibility in the editor. **Does clearing drawing guides change the grid spacing?** No. Adding, moving, or clearing a guide leaves the grid interval unchanged. **Can different sections of a presentation have different view settings?** No. [Presentation::get_ViewProperties](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/get_viewproperties/) applies to the entire presentation. **Can I save different view settings for different users?** The file stores one set of view properties for everyone. An editor may also apply a user's local preferences. **Can I save view settings in a template?** Yes. Presentations created from the template inherit its saved view settings. # Create a Presentation Viewer in C++ > Create a custom presentation viewer in C++ using Aspose.Slides. Easily display PowerPoint and OpenDocument files without Microsoft PowerPoint. Source: https://docs.aspose.com/slides/cpp/presentation-viewer/ Updated: 2026-08-05 ## **Introduction** Aspose.Slides for C++ is used to create presentation files with slides. These slides can be viewed by opening presentations in Microsoft PowerPoint, for example. However, sometimes developers may need to view slides as images in their preferred image viewer or create their own presentation viewer. In such cases, Aspose.Slides allows you to export an individual slide as an image. This article describes how to do it. ## **Generate an SVG Image from a Slide** To generate an SVG image from a presentation slide with Aspose.Slides, please follow the steps below: 1. Create an instance of the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) class. 1. Get the slide reference by its index. 1. Open a file stream. 1. Save the slide as an SVG image to the file stream. ```cpp #include #include #include #include using namespace Aspose::Slides; using namespace System; using namespace System::IO; auto slideIndex = 0; auto presentation = MakeObject(u"sample.pptx"); auto slide = presentation->get_Slide(slideIndex); auto svgStream = File::Create(u"output.svg"); slide->WriteAsSvg(svgStream); svgStream->Dispose(); presentation->Dispose(); ``` ## **Generate an SVG with a Custom Shape ID** Aspose.Slides can be used to generate an [SVG](https://docs.fileformat.com/page-description-language/svg/) from a slide with a custom shape ID. To do this, use the `set_Id` method from [ISvgShape](https://reference.aspose.com/slides/cpp/aspose.slides.export/isvgshape/). `CustomSvgShapeFormattingController` can be used to set the shape ID. ```cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::IO; class CustomSvgShapeFormattingController : public ISvgShapeFormattingController { private: int m_shapeIndex; public: CustomSvgShapeFormattingController(int shapeStartIndex = 0) { m_shapeIndex = shapeStartIndex; } void FormatShape(SharedPtr svgShape, SharedPtr shape) override { svgShape->set_Id(String::Format(u"shape-{0}", m_shapeIndex++)); } }; auto slideIndex = 0; auto presentation = MakeObject(u"sample.pptx"); auto slide = presentation->get_Slide(slideIndex); auto svgOptions = MakeObject(); svgOptions->set_ShapeFormattingController(MakeObject()); auto svgStream = File::Create(u"output.svg"); slide->WriteAsSvg(svgStream, svgOptions); svgStream->Dispose(); presentation->Dispose(); ``` ```cpp #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; class CustomSvgShapeFormattingController : public ISvgShapeFormattingController { private: int m_shapeIndex; public: CustomSvgShapeFormattingController(int shapeStartIndex = 0) { m_shapeIndex = shapeStartIndex; } void FormatShape(SharedPtr svgShape, SharedPtr shape) { svgShape->set_Id(String::Format(u"shape-{0}", m_shapeIndex++)); } }; ``` ## **Create a Slide Thumbnail Image** Aspose.Slides helps you generate thumbnail images of slides. To generate a thumbnail of a slide using Aspose.Slides, please follow the steps below: 1. Create an instance of the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) class. 1. Get the slide reference by its index. 1. Get the thumbnail image of the referenced slide at a defined scale. 1. Save the thumbnail image in any desired image format. ```cpp #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto slideIndex = 0; auto scaleX = 1; auto scaleY = scaleX; auto presentation = MakeObject(u"sample.pptx"); auto slide = presentation->get_Slide(slideIndex); auto image = slide->GetImage(scaleX, scaleY); image->Save(u"output.jpg", ImageFormat::Png); image->Dispose(); presentation->Dispose(); ``` ## **Create a Slide Thumbnail with User-Defined Dimensions** To create a slide thumbnail image with user defined dimensions, please follow the steps below: 1. Create an instance of the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) class. 1. Get the slide reference by its index. 1. Get the thumbnail image of the referenced slide with the defined dimensions. 1. Save the thumbnail image in any desired image format. ```cpp #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto slideIndex = 0; auto slideSize = System::Drawing::Size(1200, 800); auto presentation = MakeObject(u"sample.pptx"); auto slide = presentation->get_Slide(slideIndex); auto image = slide->GetImage(slideSize); image->Save(u"output.jpg", ImageFormat::Png); image->Dispose(); presentation->Dispose(); ``` ## **Create a Slide Thumbnail with Speaker Notes** To generate the thumbnail of a slide with speaker notes using Aspose.Slides, please follow the steps below: 1. Create an instance of the [RenderingOptions](https://reference.aspose.com/slides/cpp/aspose.slides.export/renderingoptions/) class. 1. Use the `RenderingOptions.set_SlidesLayoutOptions` method to set the position of speaker notes. 1. Create an instance of the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) class. 1. Get the slide reference by its index. 1. Get the thumbnail image of the referenced slide with the rendering options. 1. Save the thumbnail image in any desired image format. ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto slideIndex = 0; auto layoutingOptions = MakeObject(); layoutingOptions->set_NotesPosition(NotesPositions::BottomTruncated); auto renderingOptions = MakeObject(); renderingOptions->set_SlidesLayoutOptions(layoutingOptions); auto presentation = MakeObject(u"sample.pptx"); auto slide = presentation->get_Slide(slideIndex); auto image = slide->GetImage(renderingOptions); image->Save(u"output.png", ImageFormat::Png); image->Dispose(); presentation->Dispose(); ``` ## **Live Example** You can try [**Aspose.Slides Viewer**](https://products.aspose.app/slides/viewer/) free app to see what you can implement with Aspose.Slides API: ![Online PowerPoint Viewer](https://docs.aspose.com/slides/cpp/presentation-viewer/online-PowerPoint-viewer.png) ## **FAQ** ### Can I embed a presentation viewer in a web application? Yes. You can use Aspose.Slides on the server side to render slides as images or HTML and display them in the browser. Navigation and zoom features can be implemented with JavaScript for an interactive experience. ### What is the best way to display slides inside a custom viewer? The recommended approach is to render each slide as an image (e.g., PNG or SVG) or convert it to HTML using Aspose.Slides, then display the output inside a picture box (for desktop) or HTML container (for web). ### How do I handle large presentations with many slides? For large decks, consider lazy-loading or on-demand rendering of slides. This means generating a slide's content only when the user navigates to it, reducing memory and load time. ## Related articles - [Create Thumbnails of Presentation Shapes in C++](https://docs.aspose.com/slides/cpp/shape-thumbnails/) # Handle Presentation Warnings in C++ > Learn how to collect, classify, and act on warnings while loading, rendering, converting, and saving presentations with Aspose.Slides for C++. Source: https://docs.aspose.com/slides/cpp/presentation-warnings/ Updated: 2026-09-03 ## **Overview** Aspose.Slides can report recoverable problems while it loads, renders, converts, or saves a presentation. Examples include damaged source records, content that cannot be preserved, font substitution, and limitations of a target format. A warning callback lets an application record these conditions and decide whether the current operation may continue. Implement the [IWarningCallback](https://reference.aspose.com/slides/cpp/aspose.slides.warnings/iwarningcallback/) interface and examine the [IWarningInfo::get_WarningType](https://reference.aspose.com/slides/cpp/aspose.slides.warnings/iwarninginfo/get_warningtype/) and [IWarningInfo::get_Description](https://reference.aspose.com/slides/cpp/aspose.slides.warnings/iwarninginfo/get_description/) methods supplied through [IWarningInfo](https://reference.aspose.com/slides/cpp/aspose.slides.warnings/iwarninginfo/). Return [ReturnAction::Continue](https://reference.aspose.com/slides/cpp/aspose.slides.warnings/returnaction/) to accept the warning or `ReturnAction::Abort` to stop the operation. Use [LoadOptions::set_WarningCallback](https://reference.aspose.com/slides/cpp/aspose.slides/loadoptions/set_warningcallback/) for warnings raised while opening a presentation. Rendering and export option classes inherit [SaveOptions::set_WarningCallback](https://reference.aspose.com/slides/cpp/aspose.slides.export/saveoptions/set_warningcallback/), which receives warnings from slide rendering, conversion, and saving. Because the warning itself does not identify the application operation, associate each callback instance with an operation stage when you build a combined report. ## **Warnings and Exceptions** A warning describes a condition from which Aspose.Slides can recover if the callback returns `ReturnAction::Continue`. An exception means the requested operation cannot complete normally; exceptions are not converted into warnings and cannot be handled by a warning policy. Returning `ReturnAction::Abort` asks the warning dispatcher to terminate the current operation by raising an exception. The public exception depends on the operation and presentation format. For example, loading can surface a [PptxReadException](https://reference.aspose.com/slides/cpp/aspose.slides/pptxreadexception/) or [PptReadException](https://reference.aspose.com/slides/cpp/aspose.slides/pptreadexception/), while saving or exporting can surface a [PptxException](https://reference.aspose.com/slides/cpp/aspose.slides/pptxexception/). Handle the exception at the boundary of the operation and use the warning report to determine whether the application policy caused the termination instead of relying on one exception subtype or message. The callback records the warning before returning `ReturnAction::Abort`, ensuring that the reason remains available to the application. ## **Warning Categories** The [WarningType](https://reference.aspose.com/slides/cpp/aspose.slides.warnings/warningtype/) enumeration provides the following categories: | Warning type | Meaning | Typical policy | | --- | --- | --- | | `SourceFileCorruption` | The source presentation contains corruption that can make a document saved in its original format unusable. | Abort. | | `DataLoss` | Text, charts, images, or other data may be absent after loading or saving. | Abort. | | `MajorFormattingLoss` | The presentation may lose important formatting. | Abort in strict validation mode; otherwise record and continue. | | `MinorFormattingLoss` | A limited formatting difference may occur. | Record for diagnostics and continue. | | `CompatibilityIssue` | The result may not open or behave correctly in some applications or older versions. | Log and continue unless compatibility is mandatory. | | `UnexpectedContent` | The source contains unsupported or unrecognized content whose effect may not yet be known. | Record and continue, or treat as an error in a strict policy. | The category should drive the policy decision. Store the warning description for diagnostics, but do not depend on its wording for application logic because message text can vary between warning scenarios and product versions. ## **Collect and Classify Warnings** The following example uses one application-level report for the complete processing pipeline. A separate callback instance labels warnings from loading, rendering, PDF conversion, and PPTX saving. The policy aborts on source corruption or data loss, optionally aborts on major formatting loss, and continues for other warnings. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace Aspose::Slides::Warnings; using namespace System; struct WarningEntry { String Stage; WarningType Type; String Description; }; class WarningReport { public: const std::vector& GetEntries() const { return entries; } void Add(const String& stage, const SharedPtr& warning) { entries.push_back({stage, warning->get_WarningType(), warning->get_Description()}); } private: std::vector entries; }; class WarningPolicy { public: explicit WarningPolicy(bool abortOnMajorFormattingLoss) : abortOnMajorFormattingLoss(abortOnMajorFormattingLoss) { } ReturnAction GetAction(WarningType warningType) const { if (warningType == WarningType::SourceFileCorruption || warningType == WarningType::DataLoss) { return ReturnAction::Abort; } if (warningType == WarningType::MajorFormattingLoss && abortOnMajorFormattingLoss) { return ReturnAction::Abort; } return ReturnAction::Continue; } private: bool abortOnMajorFormattingLoss; }; class ReportingWarningCallback : public IWarningCallback { public: ReportingWarningCallback(const String& stage, const std::shared_ptr& report, const WarningPolicy& policy) : stage(stage), report(report), policy(policy) { } ReturnAction Warning(SharedPtr warning) override { report->Add(stage, warning); return policy.GetAction(warning->get_WarningType()); } private: String stage; std::shared_ptr report; WarningPolicy policy; }; class PresentationWarningExample { public: static void Run() { auto report = std::make_shared(); auto policy = WarningPolicy(true); auto completed = ProcessPresentation(u"input.pptx", report, policy); Console::WriteLine(completed ? u"Processing completed." : u"Processing stopped."); for (const auto& entry : report->GetEntries()) { Console::WriteLine(u"[{0}] {1}: {2}", entry.Stage, entry.Type, entry.Description); } } private: static bool ProcessPresentation(const String& inputPath, const std::shared_ptr& report, const WarningPolicy& policy) { try { auto loadOptions = MakeObject(); auto callback = MakeObject(u"Loading", report, policy); loadOptions->set_WarningCallback(callback); auto presentation = MakeObject(inputPath, loadOptions); auto cleanup = MakeScopeGuard([&presentation] { presentation->Dispose(); }); if (!RenderFirstSlide(presentation, report, policy)) { return false; } if (!ConvertToPdf(presentation, report, policy)) { return false; } return SaveValidatedCopy(presentation, report, policy); } catch (Exception& exception) { Console::WriteLine(u"Loading stopped: {0}", exception->get_Message()); return false; } } static bool RenderFirstSlide(const SharedPtr& presentation, const std::shared_ptr& report, const WarningPolicy& policy) { try { if (presentation->get_Slides()->get_Count() == 0) { Console::WriteLine(u"Rendering stopped: the presentation has no slides."); return false; } auto options = MakeObject(); auto callback = MakeObject(u"Rendering", report, policy); options->set_WarningCallback(callback); auto image = presentation->get_Slide(0)->GetImage(options); auto cleanup = MakeScopeGuard([&image] { image->Dispose(); }); image->Save(u"slide-1.png", ImageFormat::Png); return true; } catch (Exception& exception) { Console::WriteLine(u"Rendering stopped: {0}", exception->get_Message()); return false; } } static bool ConvertToPdf(const SharedPtr& presentation, const std::shared_ptr& report, const WarningPolicy& policy) { try { auto options = MakeObject(); auto callback = MakeObject(u"Conversion", report, policy); options->set_WarningCallback(callback); presentation->Save(u"converted.pdf", SaveFormat::Pdf, options); return true; } catch (Exception& exception) { Console::WriteLine(u"Conversion stopped: {0}", exception->get_Message()); return false; } } static bool SaveValidatedCopy(const SharedPtr& presentation, const std::shared_ptr& report, const WarningPolicy& policy) { try { auto options = MakeObject(); auto callback = MakeObject(u"Saving", report, policy); options->set_WarningCallback(callback); presentation->Save(u"validated-output.pptx", SaveFormat::Pptx, options); return true; } catch (Exception& exception) { Console::WriteLine(u"Saving stopped: {0}", exception->get_Message()); return false; } } }; PresentationWarningExample::Run(); ``` Set `abortOnMajorFormattingLoss` to `false` when major formatting differences are acceptable. Compatibility issues, minor formatting loss, and unexpected content are still retained in the report even when the operation continues. Extend `WarningPolicy::GetAction` if the application must reject any of those categories. ## **Common Warning Scenarios** Warnings can appear at different stages of a workflow: - **Digital signatures:** A signed presentation can produce a warning during loading that its signature will be lost during processing. Aspose.Slides reports this `DataLoss` condition through [IPresentationSignedWarningInfo](https://reference.aspose.com/slides/cpp/aspose.slides.warnings/ipresentationsignedwarninginfo/). A load-stage callback lets the application reject the file or explicitly accept the reported loss. - **Font substitution:** An unavailable font can be replaced while a slide is rendered or exported. Font substitution warnings are reported as `DataLoss`, so the strict policy above aborts even if the application would consider a particular replacement visually acceptable. To observe this behavior, use an input presentation containing text in a font unavailable to the runtime. The warning description identifies the substitution; configure the required fonts or [font substitution rules](https://docs.aspose.com/slides/cpp/font-substitution/) before retrying. - **Unsupported or unexpected content:** A loader can encounter presentation records or features it does not recognize. Such warnings may use `UnexpectedContent`, or a more severe category when data or formatting is known to be affected. - **Format compatibility:** Saving to another presentation format can omit features or produce a result that behaves differently in some applications. For example, saving a presentation with more than eight horizontal or eight vertical drawing guides to legacy PPT reports a `CompatibilityIssue`. The save-stage callback can record the loss and continue, or reject it if preserving all guides is required. - **Loading behavior:** Loading options and legacy behaviors can also produce warnings. For example, [IObsoletePresLockingBehaviorWarningInfo](https://reference.aspose.com/slides/cpp/aspose.slides.warnings/iobsoletepreslockingbehaviorwarninginfo/) identifies use of an obsolete presentation-locking behavior as a `CompatibilityIssue`. Warnings depend on the source document, target format, operation, and Aspose.Slides version. Do not assume that every file produces a warning or that a scenario always maps to only one category. ## **Safely Handle Aborted Operations** When a callback returns `ReturnAction::Abort`, do not use an object that failed to load and do not assume that a rendering or save output is complete. The operation can terminate after creating an output file but before finishing it. Save validated results to a separate path such as `validated-output.pptx`. Replace an existing presentation only after the operation finishes successfully, the warning report satisfies the application policy, and the output can be opened and checked. This avoids overwriting a valid source file with a partial or rejected result. An empty warning report is not a guarantee that every source feature has been preserved. Apply any additional content and visual checks required by the application. See also [Open Presentations](https://docs.aspose.com/slides/cpp/open-presentation/) and [Save Presentations](https://docs.aspose.com/slides/cpp/save-presentation/). ## **FAQ** **Can a warning callback handle every Aspose.Slides error?** No. It handles recoverable conditions reported as warnings. Exceptions that occur independently of the callback must be handled by the application around the loading, rendering, conversion, or saving call. **Does returning `ReturnAction::Continue` guarantee identical output?** No. It only permits processing to continue. The reported condition can still cause data, formatting, or compatibility differences, so review the collected warning types and descriptions. **How can an application identify the operation that produced a warning?** Create a callback instance for each operation and store an application-defined stage together with the warning type and description, as shown in the example. # PresentationML (PPTX, XML) > Source: https://docs.aspose.com/slides/cpp/presentationml-pptx-xml/ Updated: 2026-08-05 ## **About PresentationML** PresentationML is a name for a family of XML-based formats for presentation documents. Office OpenXML (OOXML) is the XML-based format introduced in Microsoft Office 2007 applications. Office OpenXML is a container format for several specialized XML-based markup languages. PresentationML is the markup language used by Microsoft Office PowerPoint 2007 to store its documents. ## **PresentationML in Aspose.Slides for C++** OOXML PresentationML documents come as PPTX files which are zipped XML packages following the [OOXML ECMA-376](https://www.ecma-international.org/publications-and-standards/standards/ecma-376/) specifications. Aspose.Slides for C++ extensively supports creating, reading, manipulating and writing PresentationML documents. In addition, Aspose.Slides for C++ is capable of exporting PresentationML documents to different widely used document formats like PDF, TIFF and XPS. This is possible because Aspose.Slides for C++ was designed with the aim to comprehensively handle presentation documents and PresentationML basically holds the internal presentation of documents as zipped XML package. ## **PresentationML is Open, Why Use Aspose.Slides for C++** Since PresentationML is XML based, it is quite possible to build applications for processing and generating of PresentationML documents by using XML classes without relying on the third party class libraries such as Aspose.Slides for C++. However, there are several advantages of using Aspose.Slides for C++ over XML classes while working with PresentationML documents. The OOXML specification is too long to several thousands of pages. It means, in order to properly handle the PresentationML documents, you will have to spend a lot of time and effort to understand the format of such documents. On the other hand, while using Aspose.Slides for C++, you simply have to use the relevant classes and their respective methods / properties for performing operations which seem quite complex if performed via XML classes. The following are some of the features which are even unavailable when dealing with PresentationML documents through XML classes: - Export PPT documents to PDF, TIFF, XPS formats - Export slides in the PPT documents to SVG formats - Render slide to any image format supported by C++ Framework - Automatic copying of masters from source presentations using cloning feature - Applying protection on shapes Let us take an example of a PresentationML document having single slide with one text box containing “Hello World” text. In order to read the text through XML classes, you will have to write a program that can parse this simple text from the following fragment: ## **Example** ``` xml Hello World ``` ## Related articles - [Different File Formats and Conversions](https://docs.aspose.com/slides/cpp/different-file-formats-and-conversions/) # Product Overview > Aspose.Slides for C++ lets you create, edit and convert PowerPoint (PPT, PPTX) and OpenDocument (ODP) presentations without Microsoft Office. Source: https://docs.aspose.com/slides/cpp/product-overview/ Updated: 2026-10-26 ![todo:image_alt_text](https://docs.aspose.com/slides/cpp/product-overview/product-overview_1.png) ## **Welcome to Aspose.Slides for C++!** Aspose.Slides for C++ is a Microsoft PowerPoint® management API that enables C++ applications to read and write PowerPoint® documents without using Microsoft PowerPoint®. Aspose.Slides for C++ is the first and only component that provides the functionality to manage PowerPoint® documents. Aspose.Slides for C++ provides a lot of key features such as managing text, shapes, tables & animations, adding audio and video to slides, previewing slides, exporting slides to SVG, PDF format and more. ## **Product Description** Aspose.Slides for C++ is developed using Native C++. Now it is compiled for Windows x64 environment but it will be compiled for Linux environment too. Aspose.Slides for C++ can not only open PowerPoint files from different sources, but it also allows you to save your presentations in a variety of ways. For example, you can save your presentation in not only PPT, but also PDF format. Moreover, you can also save your slides as images. Aspose.Slides for C++ gives you almost all those features that you may find in Microsoft PowerPoint. The versatility of Aspose.Slides for C++ is that you can not only add tables and different kinds of shapes to your slides, but also different kinds of frames (that is text, audio & video frames). ## **Rich Set of Features** Aspose.Slides for C++ features can be divided into following areas: 1. Presentation Features. 1. Slides Features. 1. Graphics and Multimedia Features. 1. Table Features 1. Text & Paragraph Features 1. Advance Features ### **Presentation Features** - Open Microsoft PowerPoint presentations from different sources. - Save presentations in different Microsoft PowerPoint formats. - Create presentations from scratch. - Convert presentations to PDF documents without using any other component - Read or modify a presentation's document properties - Applying protection on presentation - Exporting presentation to PDF - Exporting presentation to XPS - Exporting presentation to SWF - Exporting presentation to PDF Notes - Exporting presentation to HTML ### **Slide Features** - Create new slides from scratch and add them to presentations. - Access any slide through its position in a presentation. - Copy or clone slides to the same or another presentation. - Edit and delete slides. - Copy masters with slides automatically. - Preview slides. - Get or set a slide's name. - Save slides as images. - Export slides to SVG format. - Work with many masters in presentations. - Fill slide Background with any supported style. - Add new or manage slide notes. - Set new slide masters and styles dynamically. - Add or modify slide show transition. - Add Morph Transitions ### **Graphics & Multimedia Features** - Create or manage shapes such as lines, rectangles, ellipses and polylines. - Manage line styles in shapes. - Get a shape's alternative text. - Rotate a flip shapes. - Fill shapes in different styles, for example solid, gradient, pattern, texture and picture. - Use any of 48 pre-defined patterns and 24 textures. - Assign links to shapes. - Read, modify or add new animation effects to slides and shapes. - Add new pictures to presentations or manage existing ones. - Add new picture bullets to the presentation or manage existing ones. - Add new audio frames to the presentations or manage existing ones. - Add new video frames to the presentations or manage existing ones. ### **Table Features** - Create tables from scratch and add to slides. - Resize and move tables. - Access any cell in a table. - Change the format and borders of any cell. - Resize columns and rows. - Add and delete columns and rows. - Set border width and color for the whole table. ### **Text & Paragraph Features** - Get and set text in text placeholders and text frames. - Get a placeholder's type. - Change the text formatting in a text frame. - Add new or manage the existing fonts used in a presentation. - Change text and text Formatting. - Create or manage links to the text. - Supports tabs and effective tabs. - Add new text frames to almost any type of shape. - Access and modify margins and text wrap settings of text frames. - Access and modify paragraph indentation. ### **Advance Features** - Access OLE objects embedded in presentations. - Lock presentations. ## **Supported Platforms** - Windows x64/x86 (Microsoft Visual Studio 2017 or later). - Linux (Clang 3.9 or later, GCC 6.1 or later). - macOS (Xcode 13.4 or later). ## **Technical support** Aspose provides unlimited free technical support for all its products. The support is available to all users, including evaluation. If you need help with Aspose.Slides for C++, consider the following: - The main avenue for support is the [Aspose. Forums](https://forum.aspose.com/). Post your question in the [Aspose.Slides forum](https://forum.aspose.com/c/slides/11) and it will be answered within a few hours. The questions are answered directly by the Aspose.Slides support team. - Please note, Aspose does not provide technical support over the phone. Phone support is only available for sales and purchase questions. - When expecting a reply in the forums, please allow for time zone differences. If you have an issue with Aspose.Slides for C++, follow these simple steps to make sure it is resolved in the most efficient way: - Make sure you use the latest Aspose.Slides for C++ version before reporting the issue, see [Aspose.Slides download](https://downloads.aspose.com/slides/cpp) to find out about the latest version. - Have a look through the forums, this documentation and API Reference before reporting the issue; maybe your question was already answered. - When reporting an issue, please include the original document and possibly a fragment of your code that causes the problem. If you need to attach multiple files, zip them into one. It is safe to attach your documents in Aspose.Forums since only you and Aspose developers will have access to the attached files. - Please try to report one issue per thread. If you have another issue, report it in a separate thread. This table lists important Aspose.Slides for C++ technical resources. |**Resource**|**Description**| | :- | :- | |[Aspose.Slides for C++ home page](https://products.aspose.com/slides/cpp/)|Product home page.| |[Aspose.Slide blog](https://blog.aspose.com/category/slides/)|Check this often for information about new releases and useful tips about Aspose.Slides.| |[Aspose.Slides for C++ download](https://downloads.aspose.com/slides/cpp)|All new and old product release are maintained for customer reference.| |[Aspose.Slides support forum](https://forum.aspose.com/c/slides/11)|Post your questions and issues here for a speedy resolution.| |[Aspose.Slides for C++ product documentation](https://docs.aspose.com/slides/cpp/)|Full online documentation that includes this documentation as well as Aspose.Slides API Reference.| ## **FAQ** ### Does it support PDF conformance levels for archiving and accessibility (PDF/A and PDF/UA)? Yes. You can save to PDF with PDF/A-2a/2b/2u, PDF/A-3a/3b, as well as PDF/UA by configuring [PDF export options](https://reference.aspose.com/slides/cpp/aspose.slides.export/pdfoptions/). ### Is there a font substitution mechanism and support for custom fonts to ensure correct rendering? Yes. The library lets you [load custom fonts](https://docs.aspose.com/slides/cpp/custom-font/) and [define fallback rules](https://docs.aspose.com/slides/cpp/fallback-font/) so missing glyphs are substituted reliably during conversion and rendering. ### Can I detect whether a file is password-protected without fully opening it? Yes. You can [inspect a presentation](https://docs.aspose.com/slides/cpp/examine-presentation/) to determine if it requires a password before loading the full document. ### Is Microsoft PowerPoint required for processing and conversions? No. Aspose.Slides is a standalone engine; PowerPoint is not needed on the server or workstation. ### Is it safe to process presentations from multiple threads? Yes, you can process different documents in parallel in separate threads; just avoid using the same presentation instance concurrently [across threads](https://docs.aspose.com/slides/cpp/multithreading/). ### Are macros preserved and can I manage VBA in PPTM/PPSM files? Yes. Presentations with macros [are supported](https://docs.aspose.com/slides/cpp/presentation-via-vba/), and you can [inspect and manage VBA projects](https://reference.aspose.com/slides/cpp/aspose.slides.vba/) in those files. ### Can I convert PDF or HTML back into PowerPoint slides? Yes. You can [import PDF pages or HTML content](https://docs.aspose.com/slides/cpp/import-presentation/) to create or populate slides in a presentation. ### Is XPS export supported, and can I control the quality and content of the XPS output? Yes. [Export to XPS](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-xps/) is available, and [save options](https://reference.aspose.com/slides/cpp/aspose.slides.export/xpsoptions/) allow you to tune output quality and included content. ### Can I convert slides to images and control the output quality? Yes. Slides can be [rendered to PNG, JPEG, GIF, BMP, TIFF](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-png/) and other formats with fine-grained control over size and quality. ### Are mathematical formulas supported (MathML/MathText) and can they be exported? Yes. You can [create and edit mathematical text](https://docs.aspose.com/slides/cpp/powerpoint-math-equations/) and [export equations](https://docs.aspose.com/slides/cpp/exporting-math-equations/), including to MathML. ### How does the library handle encryption and passwords (open, set, remove)? [It supports](https://docs.aspose.com/slides/cpp/password-protected-presentation/) opening encrypted presentations, setting or removing passwords for opening and modifying, and checking a file’s protection status. Related feature: [Process presentations without PowerPoint](https://docs.aspose.com/slides/features/without-powerpoint/). ## Related articles - [Product Support](https://docs.aspose.com/slides/cpp/product-support/) - [Aspose.Slides for C++](https://docs.aspose.com/slides/cpp/) - [Features Overview](https://docs.aspose.com/slides/cpp/features-overview/) # Product Support > Get free, fast Aspose.Slides for C++ product support: forums, docs, updates, code help to fix issues across PowerPoint and OpenDocument workflows. Source: https://docs.aspose.com/slides/cpp/product-support/ Updated: 2026-08-02 ## **Overview** This article explains how to get support for Aspose.Slides and how to report issues effectively. It describes the main support channel, provides recommendations for submitting a problem, and points to useful technical resources such as the product page, blog, downloads, support forum, documentation, and API Reference. The article also answers common questions about paid support, issue escalation, and support for older library versions. ## **Technical support** Aspose provides unlimited free technical support for all its products. The support is available to all users, including evaluation. If you need help with Aspose.Slides for C++, consider the following: - The main avenue for support is the Aspose Forums. Post your question in the Aspose.Slides forum and it will be answered within a few hours. The questions are answered directly by the Aspose.Slides support team. - Please note, Aspose does not provide technical support over the phone. Phone support is only available for sales and purchase questions. - When expecting a reply in the forums, please allow for time zone differences. If you have an issue with Aspose.Slides for C++, follow these simple steps to make sure it is resolved in the most efficient way: - Make sure you use the latest Aspose.Slides for C++ version before reporting the issue, see Aspose.Slides download to find out about the latest version. - Have a look through the forums, this documentation and API Reference before reporting the issue; maybe your question was already answered. - When reporting an issue, please include the original document and possibly a fragment of your code that causes the problem. If you need to attach multiple files, zip them into one. It is safe to attach your documents in Aspose.Forums since only you and Aspose developers will have access to the attached files. - Please try to report one issue per thread. If you have another issue, report it in a separate thread. ## **Resources** This table lists important Aspose.Slides for C++ technical resources. |**Resource**|**Description**| | :- | :- | |[Aspose.Slides for C++ home page](https://products.aspose.com/slides/cpp/)|Product home page.| |[Aspose.Slide blog](https://blog.aspose.com/category/slides/)|Check this often for information about new releases and useful tips about Aspose.Slides.| |[Aspose.Slides for C++ download](https://downloads.aspose.com/slides/cpp)|All new and old product release are maintained for customer reference.| |[Aspose.Slides support forum](https://forum.aspose.com/c/slides/11)|Post your questions and issues here for a speedy resolution.| |[Aspose.Slides for C++ product documentation](https://docs.aspose.com/slides/cpp/)|Full online documentation that includes this documentation as well as Aspose.Slides API Reference.| ## **FAQ** ### What paid support tiers are available and how do they differ? [Developer, Business, and Enterprise](https://helpdesk.aspose.com/kb/faq/1-Introduction-to-Paid-Support-Services). They differ by the number of incidents included, response priority, and available communication channels. ### Can I escalate a bug directly to the engineering team? Yes. [Paid support](https://helpdesk.aspose.com/) allows escalation to the developers when an issue requires deeper investigation. ### Are older library versions supported, and do you release fixes for them? You can use older versions, but fixes are provided for the current release; patches for legacy versions are not issued. ## Related articles - [Product Overview](https://docs.aspose.com/slides/cpp/product-overview/) # Save Presentations in Read-Only Mode Using C++ > Load and save PowerPoint files (PPT, PPTX) in read-only mode with Aspose.Slides for C++, offering precise slide previews without altering your presentations. Source: https://docs.aspose.com/slides/cpp/read-only-presentation/ Updated: 2026-08-13 ## **Introduction** In PowerPoint 2019, Microsoft introduced the **Always Open Read-Only** setting as one of the options users can use to protect their presentations. You may want to use this Read-Only setting to protect a presentation when - You want to prevent accidental edits and keep the content of your presentation safe. - You want to alert people that the presentation you provided is the final version. After you select the **Always Open Read-Only** option for a presentation, when users open the presentation, they see the **Read-Only** recommendation and may see a message in this form: *To prevent accidental changes, the author has set this file to open as read-only.* The Read-Only recommendation is a simple yet effective deterrent that discourages editing because users have to perform a task to remove it before they are allowed to edit a presentation. If you do not want users to make changes to a presentation and want to tell them about this in a polite way, then the Read-Only recommendation may a good option for you. > If a presentation with the **Read-Only** protection gets opened in an older Microsoft PowerPoint application—which does not support the recently introduced function—the **Read-Only** recommendation gets ignored (the presentation is opened normally). ## **Apply Read-Only Mode** Aspose.Slides for C++ allows you to set a presentation to **Read-Only**, which means users (after they open the presentation) see the **Read-Only** recommendation. This sample code shows you how to set a presentation to **Read-Only** in C++ using Aspose.Slides: ``` cpp #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto pres = System::MakeObject(); pres->get_ProtectionManager()->set_ReadOnlyRecommended(true); pres->Save(u"ReadOnlyPresentation.pptx", SaveFormat::Pptx); ``` **Note**: The **Read-Only** recommendation is simply meant to discourage editing or stop users from making accidental changes to a PowerPoint presentation. If a motivated person—who knows what they are doing—decides to edit your presentation, they can easily remove the Read-Only setting. If you seriously need to prevent unauthorized editing, you are better off using [more stringent protections that involve encryptions and passwords](https://docs.aspose.com/slides/cpp/password-protected-presentation/). ## **FAQ** ### How is 'Read-Only recommended' different from full password protection? 'Read-Only recommended' only displays a suggestion to open the file in read-only mode and is easy to bypass. [Password protection](https://docs.aspose.com/slides/cpp/password-protected-presentation/) actually restricts opening or editing and is appropriate when you need real security controls. ### Can 'Read-Only recommended' be combined with watermarks to further discourage edits? Yes. The recommendation can be paired with [watermarks](https://docs.aspose.com/slides/cpp/watermark/) as a visual deterrent; they are separate mechanisms and work well together. ### Can a macro or external tool still modify the file when the recommendation is enabled? Yes. The recommendation does not block programmatic changes. To prevent automated edits, use [passwords and encryption](https://docs.aspose.com/slides/cpp/password-protected-presentation/). ### How does 'Read-Only recommended' relate to the flags 'is encrypted' and 'is write protected'? They are different signals. 'Read-Only recommended' is a soft, optional prompt; [get_IsWriteProtected](https://reference.aspose.com/slides/cpp/aspose.slides/protectionmanager/get_iswriteprotected/) and [get_IsEncrypted](https://reference.aspose.com/slides/cpp/aspose.slides/protectionmanager/get_isencrypted/) indicate actual write or read restrictions that depend on passwords or encryption. # Add Rectangles to Presentations in C++ > Boost your PowerPoint presentations by adding rectangles with Aspose.Slides for C++ — easily design and modify shapes programmatically. Source: https://docs.aspose.com/slides/cpp/rectangle/ Updated: 2026-08-02 ## **Overview** This article shows how to add rectangle shapes to PowerPoint slides by using Aspose.Slides. It covers creating a simple rectangle, creating a formatted rectangle, and saving the updated presentation as a PPTX file. ## **Create a Simple Rectangle** Like previous topics, this one is also about adding a shape and this time the shape we will discuss about is Rectangle. In this topic, we have described that how developers can add simple or formatted rectangles to their slides using Aspose.Slides for C++ . To add a simple rectangle to a selected slide of the presentation, please follow the steps below: 1. Create an instance of [Presentation class](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/). 1. Obtain the reference of a slide by using its Index. 1. Add an IAutoShape of Rectangle type using AddAutoShape method exposed by IShapes object. 1. Write the modified presentation as a PPTX file. In the example given below, we have added a simple rectangle to the first slide of the presentation. ```cpp For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C // The path to the documents directory. const String outPath = u"../out/SimpleRectangle.pptx"; const String templatePath = u"../templates/HelloWorld.pptx"; // Load the desired the presentation SharedPtr pres = MakeObject(); // Access first slide SharedPtr slide = pres->get_Slides()->idx_get(0); // Add autoshape of ellipse type SharedPtr ashp = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 50, 150, 150, 50); // Save PPTX to Disk pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx); ``` [Source: Examples-SlidesCPP-SimpleRectangle-SimpleRectangle.cpp](https://gist.githubusercontent.com/aspose-slides/a690df625dc0b1fff869ab198affe7a4/raw/1c9f121228da5d8d995b7568f6c90b67d920d3aa/Examples-SlidesCPP-SimpleRectangle-SimpleRectangle.cpp) ## **Create a Formatted Rectangle** To add a formatted rectangle to a slide, please follow the steps below: 1. Create an instance of [Presentation class](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/). 1. Obtain the reference of a slide by using its Index. 1. Add an IAutoShape of Rectangle type using AddAutoShape method exposed by IShapes object. 1. Set the Fill Type of the Rectangle to Solid. 1. Set the Color of the Rectangle using SolidFillColor.Color property as exposed by FillFormat object associated with the IShape object. 1. Set the Color of the lines of the Rectangle. 1. Set the Width of the lines of the Rectangle. 1. Write the modified presentation as PPTX file. The above steps are implemented in the example given below. ```cpp For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C // The path to the documents directory. const String outPath = u"../out/FormattedRectangle_out.pptx"; const String templatePath = u"../templates/AltText.pptx"; // Load the desired the presentation SharedPtr pres = MakeObject(); // Access first slide SharedPtr slide = pres->get_Slides()->idx_get(0); // Add an autoshape of type line SharedPtr shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 50, 150, 150, 75); // Set the fill color of the rectangle shape shape->get_FillFormat()->set_FillType(FillType::Solid); shape->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_White()); // Apply some formatting on the line shape->get_LineFormat()->set_Style(LineStyle::ThickThin); shape->get_LineFormat()->set_Width(7); shape->get_LineFormat()->set_DashStyle(LineDashStyle::Dash); shape->get_LineFormat()->get_FillFormat()->set_FillType(FillType::Solid); shape->get_LineFormat()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Blue()); //Write the PPTX to Disk pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx); ``` [Source: Examples-SlidesCPP-FormattedRectangle-FormattedRectangle.cpp](https://gist.githubusercontent.com/aspose-slides/a690df625dc0b1fff869ab198affe7a4/raw/70848e3113e20ccbc9fa72e208516832511dbdf9/Examples-SlidesCPP-FormattedRectangle-FormattedRectangle.cpp) ## **FAQ** ### How do I add a rectangle with rounded corners? Use the rounded-corner [shape type](https://reference.aspose.com/slides/cpp/aspose.slides/shapetype/) and adjust the corner radius in the shape’s properties; rounding can also be applied per corner via geometry adjustments. ### How do I fill a rectangle with an image (texture)? Select the picture [fill type](https://reference.aspose.com/slides/cpp/aspose.slides/filltype/), provide the image source, and configure [stretching/tiling modes](https://reference.aspose.com/slides/cpp/aspose.slides/picturefillmode/). ### Can a rectangle have shadow and glow? Yes. [Outer/inner shadow, glow, and soft edges](https://docs.aspose.com/slides/cpp/shape-effect/) are available with adjustable parameters. ### Can I turn a rectangle into a button with a hyperlink? Yes. [Assign a hyperlink](https://docs.aspose.com/slides/cpp/manage-hyperlinks/) to the shape click (jump to a slide, file, web address, or e-mail). ### How can I protect a rectangle from moving and changes? [Use shape locks](https://docs.aspose.com/slides/cpp/applying-protection-to-presentation/): you can forbid moving, resizing, selection, or text editing to preserve the layout. ### Can I convert a rectangle to a raster image or SVG? Yes. You can [render the shape](http://reference.aspose.com/slides/cpp/aspose.slides/shape/getimage/) to an image with a specified size/scale or [export it as SVG](https://reference.aspose.com/slides/cpp/aspose.slides/shape/writeassvg/) for vector use. ### How do I quickly get the actual (effective) properties of a rectangle considering theme and inheritance? [Use the shape’s effective properties](https://docs.aspose.com/slides/cpp/shape-effective-properties/): the API returns computed values that account for theme styles, layout, and local settings, simplifying formatting analysis. ## Related articles - [Add Ellipses to Presentations in C++](https://docs.aspose.com/slides/cpp/ellipse/) # Remove Slides from Presentations in C++ > Effortlessly remove slides from PowerPoint and OpenDocument presentations with Aspose.Slides for C++. Get clear code examples and boost your workflow. Source: https://docs.aspose.com/slides/cpp/remove-slide-from-presentation/ Updated: 2026-08-05 ## **Introduction** If a slide (or its contents) becomes redundant, you can delete it. Aspose.Slides provides the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) class that encapsulates [ISlideCollection](https://reference.aspose.com/slides/cpp/aspose.slides/islidecollection/), which is a repository for all slides in a presentation. Using pointers (reference or index) for a known [ISlide](https://reference.aspose.com/slides/cpp/aspose.slides/islide/) object, you can specify the slide you want to remove. ## **Remove a Slide by Reference** 1. Create an instance of the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) class. 1. Get a reference of the slide you want to remove through its ID or Index. 1. Remove the referenced slide from the presentation. 1. Save the modified presentation. This C++ code shows you how to remove a slide through its reference: ```c++ #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; // The path to the documents directory const String templatePath = u"../templates/AddSlides.pptx"; const String outPath = u"../out/RemoveSlidesByReference.pptx"; // Instantiates a Presentation object that represents a presentation file SharedPtr pres = MakeObject(templatePath); // Accesses a slide through its index in the slides collection SharedPtr slide = pres->get_Slides()->idx_get(0); // Removes a slide through its reference pres->get_Slides()->Remove(slide); // Saves the modified presentation pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx); ``` ## **Remove a Slide by Index** 1. Create an instance of the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) class. 1. Remove the slide from the presentation through its index position. 1. Save the modified presentation. This C++ code shows you how to remove a slide through its index: ```c++ #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; // The path to the documents directory const String templatePath = u"../templates/AddSlides.pptx"; const String outPath = u"../out/RemoveSlidesByID.pptx"; // Instantiates a Presentation object that represents a presentation file SharedPtr pres = MakeObject(templatePath); // Removes a slide through its slide index pres->get_Slides()->RemoveAt(0); // Saves the modified presentation pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx); ``` ## **Remove Unused Layout Slides** Aspose.Slides provides the [RemoveUnusedLayoutSlides()](https://reference.aspose.com/slides/cpp/aspose.slides.lowcode/compress/removeunusedlayoutslides/) method (from the [Compress](https://reference.aspose.com/slides/cpp/aspose.slides.lowcode/compress/) class) to allow you to delete unwanted and unused layout slides. This C++ code shows you how to remove a layout slide from a PowerPoint presentation: ```c++ #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace Aspose::Slides::LowCode; auto pres = System::MakeObject(u"pres.pptx"); LowCode::Compress::RemoveUnusedLayoutSlides(pres); pres->Save(u"pres-out.pptx", SaveFormat::Pptx); ``` ## **Remove Unused Master Slides** Aspose.Slides provides the [RemoveUnusedMasterSlides()](https://reference.aspose.com/slides/cpp/aspose.slides.lowcode/compress/removeunusedmasterslides/) method (from the [Compress](https://reference.aspose.com/slides/cpp/aspose.slides.lowcode/compress/) class) to allow you to delete unwanted and unused master slides. This C++ code shows you how to remove a master slide from a PowerPoint presentation: ```c++ #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace Aspose::Slides::LowCode; auto pres = System::MakeObject(u"pres.pptx"); LowCode::Compress::RemoveUnusedMasterSlides(pres); pres->Save(u"pres-out.pptx", SaveFormat::Pptx); ``` ## **FAQ** ### What happens to slide indexes after I delete a slide? After deletion, the [collection](https://reference.aspose.com/slides/cpp/aspose.slides/slidecollection/) reindexes: every subsequent slide shifts left by one position, so previous index numbers become outdated. If you need a stable reference, use each slide’s persistent ID rather than its index. ### Is a slide’s ID different from its index, and does it change when neighboring slides are deleted? Yes. The index is the slide’s position and will change when slides are added or removed. The slide ID is a persistent identifier and does not change when other slides are deleted. ### How does deleting a slide affect slide sections? If the slide belonged to a section, that section will simply contain one fewer slide. The section structure remains; if a section becomes empty, you can [remove or reorganize sections](https://docs.aspose.com/slides/cpp/slide-section/) as needed. ### What happens to notes and comments attached to a slide when it’s deleted? [Notes](https://docs.aspose.com/slides/cpp/presentation-notes/) and [comments](https://docs.aspose.com/slides/cpp/presentation-comments/) are tied to that specific slide and are removed along with it. Content on other slides is unaffected. ### How is deleting slides different from cleaning up unused layouts/masters? Deleting removes specific normal slides from the deck. Cleaning up unused layouts/masters removes layout or master slides that nothing references, reducing file size without changing remaining slide content. These actions are complementary: typically delete first, then clean up. # Render Presentation Slides as SVG Images in C++ > Export PowerPoint slides as SVG images in C++ and control fonts, text, images, IDs, and events with Aspose.Slides. Source: https://docs.aspose.com/slides/cpp/render-a-slide-as-an-svg-image/ Updated: 2026-11-11 ## **Overview** SVG is a scalable XML-based image format that works well for web publishing, slide viewers, accessibility workflows, and automated post-processing. Aspose.Slides for C++ exports each slide to a separate SVG file and lets you control how text, fonts, pictures, and SVG elements are written. Use [SVGOptions](https://reference.aspose.com/slides/cpp/aspose.slides.export/svgoptions/) when the exported SVG must be compact, predictable across browsers, or ready for interactive use. ## **Export a Slide as SVG** Create a [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/), select a slide, and write it to a stream. The following example exports every slide in a presentation as a separate SVG file. ```cpp #include #include #include #include using namespace Aspose::Slides; using namespace System; using namespace System::IO; auto presentation = MakeObject(u"presentation.pptx"); auto slideCount = presentation->get_Slides()->get_Count(); for (int slideIndex = 0; slideIndex < slideCount; slideIndex++) { auto slide = presentation->get_Slide(slideIndex); auto svgFileName = String::Format(u"slide-{0}.svg", slide->get_SlideNumber()); auto svgStream = File::Create(svgFileName); slide->WriteAsSvg(svgStream); svgStream->Dispose(); } presentation->Dispose(); ``` The filename uses [ISlide::get_SlideNumber](https://reference.aspose.com/slides/cpp/aspose.slides/islide/get_slidenumber/) rather than the loop index. You can also export an individual shape with [IShape::WriteAsSvg](https://reference.aspose.com/slides/cpp/aspose.slides/ishape/writeassvg/) when a slide viewer or web page needs only that shape. ## **Configure SVG Output** [SVGOptions](https://reference.aspose.com/slides/cpp/aspose.slides.export/svgoptions/) controls SVG rendering. For text frames, [SVGOptions::set_UseFrameSize](https://reference.aspose.com/slides/cpp/aspose.slides.export/svgoptions/set_useframesize/) includes the text frame in the rendering area, and [SVGOptions::set_UseFrameRotation](https://reference.aspose.com/slides/cpp/aspose.slides.export/svgoptions/set_useframerotation/) determines whether the frame rotation is applied. Set [SVGOptions::set_DisableFontLigatures](https://reference.aspose.com/slides/cpp/aspose.slides.export/svgoptions/set_disablefontligatures/) to `true` when text must be rendered without ligatures. ```cpp #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::IO; auto presentation = MakeObject(u"presentation.pptx"); auto svgOptions = MakeObject(); svgOptions->set_DisableFontLigatures(true); svgOptions->set_UseFrameSize(true); svgOptions->set_UseFrameRotation(false); auto slide = presentation->get_Slide(0); auto svgStream = File::Create(u"slide-with-custom-options.svg"); slide->WriteAsSvg(svgStream, svgOptions); svgStream->Dispose(); presentation->Dispose(); ``` ## **Control Line-End Cropping at Arrowheads** SVG 1.1 has no marker inset setting to specify where a line should stop beneath an arrowhead. By default, Aspose.Slides shortens the exported line so its stroke does not protrude through the marker. Set [SVGOptions::set_DisableLineEndCropping](https://reference.aspose.com/slides/cpp/aspose.slides.export/svgoptions/set_disablelineendcropping/) to `true` to draw the stroke all the way to the line's original endpoint. This setting affects only the SVG output. The line keeps its position and length on the slide. The example draws triangle and diamond arrowheads on lines 2 and 10 points wide. It exports the same slide twice, changing only the cropping option. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::Drawing; using namespace System::IO; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto y = 40; const LineArrowheadStyle styles[] = { LineArrowheadStyle::Triangle, LineArrowheadStyle::Diamond }; const int widths[] = { 2, 10 }; for (auto style : styles) { for (auto width : widths) { auto line = slide->get_Shapes()->AddAutoShape(ShapeType::Line, 40, y, 200, 0); auto format = line->get_LineFormat(); format->get_FillFormat()->set_FillType(FillType::Solid); format->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_DarkBlue()); format->set_Width(width); format->set_EndArrowheadStyle(style); y += 50; } } auto options = MakeObject(); options->set_DisableLineEndCropping(false); auto cropped = File::Create(u"cropped.svg"); slide->WriteAsSvg(cropped, options); cropped->Dispose(); options->set_DisableLineEndCropping(true); auto uncropped = File::Create(u"uncropped.svg"); slide->WriteAsSvg(uncropped, options); uncropped->Dispose(); presentation->Dispose(); ``` The comparison shows the triangular arrowhead on the 10-point line. With cropping enabled, the tip is sharp. With cropping disabled, the stroke protrudes through the sloping sides of the marker and leaves a flat end. ![Enlarged 10-point triangle with a sharp tip when cropping is enabled and a flat end when cropping is disabled](https://docs.aspose.com/slides/cpp/render-a-slide-as-an-svg-image/line-end-cropping.png) In the other lines from the example, the protruding stroke is less visible on the 2-point triangle. The filled diamond covers the end of the stroke at both widths. ## **Control Text and Fonts** When exporting slides to SVG, you can control whether text remains as text or is converted to vector graphics, and how external fonts are included or referenced. The following options help you balance visual consistency, text selection, and font dependencies in the exported SVG. ### **Vectorize All Text** Set [SVGOptions::set_VectorizeText](https://reference.aspose.com/slides/cpp/aspose.slides.export/svgoptions/set_vectorizetext/) to `true` to write all slide text as vector graphics. This eliminates font dependencies and makes the visual result more consistent across browsers, but the text is no longer selectable or searchable as SVG text. ```cpp #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::IO; auto presentation = MakeObject(u"presentation.pptx"); auto svgOptions = MakeObject(); svgOptions->set_VectorizeText(true); auto slide = presentation->get_Slide(0); auto svgStream = File::Create(u"slide-with-vectorized-text.svg"); slide->WriteAsSvg(svgStream, svgOptions); svgStream->Dispose(); presentation->Dispose(); ``` ### **Choose How External Fonts Are Handled** [SVGOptions::set_ExternalFontsHandling](https://reference.aspose.com/slides/cpp/aspose.slides.export/svgoptions/set_externalfontshandling/) uses a [SvgExternalFontsHandling](https://reference.aspose.com/slides/cpp/aspose.slides.export/svgexternalfontshandling/) value for fonts that are loaded externally. Choose `AddLinksToFontFiles` to reference separate font files, `Embed` to include font data in the SVG, or `Vectorize` to render only text that uses external fonts as graphics. Verify font licensing before embedding fonts. ```cpp #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::IO; auto presentation = MakeObject(u"presentation.pptx"); auto slide = presentation->get_Slide(0); auto linkedFontsOptions = MakeObject(); linkedFontsOptions->set_ExternalFontsHandling(SvgExternalFontsHandling::AddLinksToFontFiles); auto linkedFontsStream = File::Create(u"slide-with-font-links.svg"); slide->WriteAsSvg(linkedFontsStream, linkedFontsOptions); linkedFontsStream->Dispose(); auto embeddedFontsOptions = MakeObject(); embeddedFontsOptions->set_ExternalFontsHandling(SvgExternalFontsHandling::Embed); auto embeddedFontsStream = File::Create(u"slide-with-embedded-fonts.svg"); slide->WriteAsSvg(embeddedFontsStream, embeddedFontsOptions); embeddedFontsStream->Dispose(); auto vectorizedExternalFontsOptions = MakeObject(); vectorizedExternalFontsOptions->set_ExternalFontsHandling(SvgExternalFontsHandling::Vectorize); auto vectorizedExternalFontsStream = File::Create(u"slide-with-vectorized-external-fonts.svg"); slide->WriteAsSvg(vectorizedExternalFontsStream, vectorizedExternalFontsOptions); vectorizedExternalFontsStream->Dispose(); presentation->Dispose(); ``` ## **Reduce Embedded Image Size** Use [SVGOptions::set_PicturesCompression](https://reference.aspose.com/slides/cpp/aspose.slides.export/svgoptions/set_picturescompression/) to reduce the resolution of embedded pictures, [SVGOptions::set_DeletePicturesCroppedAreas](https://reference.aspose.com/slides/cpp/aspose.slides.export/svgoptions/set_deletepicturescroppedareas/) to omit cropped source areas, and [SVGOptions::set_JpegQuality](https://reference.aspose.com/slides/cpp/aspose.slides.export/svgoptions/set_jpegquality/) to control JPEG encoding quality. These settings reduce file size at the cost of image fidelity or retained image data. ```cpp #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::IO; auto presentation = MakeObject(u"presentation.pptx"); auto svgOptions = MakeObject(); svgOptions->set_PicturesCompression(PicturesCompression::Dpi150); svgOptions->set_DeletePicturesCroppedAreas(true); svgOptions->set_JpegQuality(80); auto slide = presentation->get_Slide(0); auto svgStream = File::Create(u"compressed-slide.svg"); slide->WriteAsSvg(svgStream, svgOptions); svgStream->Dispose(); presentation->Dispose(); ``` ## **Control Metafile Rasterization Resolution** [SVGOptions::set_MetafileRasterizationDpi](https://reference.aspose.com/slides/cpp/aspose.slides.export/svgoptions/set_metafilerasterizationdpi/) sets the lower resolution limit for rasterizing metafiles during SVG export. Use it to balance detail and file size when an EMF or WMF image is rasterized. It does not define a global DPI for the SVG or force every object on the slide to become a raster image. Download [metafile-rasterization.pptx](https://docs.aspose.com/slides/cpp/render-a-slide-as-an-svg-image/metafile-rasterization.pptx), which contains an EMF image with closely spaced diagonal lines. The following example exports its first slide at three rasterization resolutions through [ISlide::WriteAsSvg](https://reference.aspose.com/slides/cpp/aspose.slides/islide/writeassvg/). All other export settings remain identical so that the results can be compared. ```cpp #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::IO; auto presentation = MakeObject(u"metafile-rasterization.pptx"); auto slide = presentation->get_Slide(0); const int resolutions[] = { 72, 150, 300 }; for (auto dpi : resolutions) { auto svgOptions = MakeObject(); svgOptions->set_MetafileRasterizationDpi(dpi); svgOptions->set_PicturesCompression(PicturesCompression::Dpi330); svgOptions->set_JpegQuality(90); auto svgFileName = String::Format(u"slide-{0}.svg", dpi); auto svgStream = File::Create(svgFileName); slide->WriteAsSvg(svgStream, svgOptions); svgStream->Dispose(); } presentation->Dispose(); ``` In the output, the EMF became one embedded PNG in each SVG. The following measurements are for the supplied presentation; they are not a general formula for converting DPI to pixel dimensions. | Metafile rasterization DPI | Embedded PNG dimensions | SVG file size (bytes) | | --- | --- | --- | | 72 | 1196 × 596 | 170,221 | | 150 | 2492 × 1242 | 423,149 | | 300 | 4983 × 2483 | 1,027,169 | The comparison below shows the same area of the embedded raster at the same enlarged display size. The diagonal lines show visible pixelation at 72 DPI and smoother edges at higher resolutions, while the SVG file grows. Increasing the value does not necessarily improve every detail or change every exported image. ![Enlarged diagonal-line detail at 72, 150, and 300 DPI](https://docs.aspose.com/slides/cpp/render-a-slide-as-an-svg-image/metafile-rasterization-comparison.png) [SVGOptions::set_PicturesCompression](https://reference.aspose.com/slides/cpp/aspose.slides.export/svgoptions/set_picturescompression/) controls image resolution reduction and can mask the effect of changing the metafile rasterization resolution. [SVGOptions::set_JpegQuality](https://reference.aspose.com/slides/cpp/aspose.slides.export/svgoptions/set_jpegquality/) controls JPEG encoding quality, not metafile rasterization resolution. ## **Assign Stable IDs to Shapes and Text** Use [ISvgShapeFormattingController](https://reference.aspose.com/slides/cpp/aspose.slides.export/isvgshapeformattingcontroller/) to set [ISvgShape::set_Id](https://reference.aspose.com/slides/cpp/aspose.slides.export/isvgshape/set_id/) for each SVG shape. To set [ISvgTSpan::set_Id](https://reference.aspose.com/slides/cpp/aspose.slides.export/isvgtspan/set_id/) values on text `tspan` elements as well, implement [ISvgShapeAndTextFormattingController](https://reference.aspose.com/slides/cpp/aspose.slides.export/isvgshapeandtextformattingcontroller/). Assign either controller with [SVGOptions::set_ShapeFormattingController](https://reference.aspose.com/slides/cpp/aspose.slides.export/svgoptions/set_shapeformattingcontroller/). The following controller uses [IShape::get_OfficeInteropShapeId](https://reference.aspose.com/slides/cpp/aspose.slides/ishape/get_officeinteropshapeid/), which is stable for the lifetime of the shape, and a repeatable counter for its text spans. This makes the generated IDs suitable for post-processing an unchanged presentation. ```cpp #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::IO; class StableSvgIdController : public ISvgShapeAndTextFormattingController { private: String m_currentShapeId; int m_textSpanIndex = 0; public: void FormatShape(SharedPtr svgShape, SharedPtr shape) override { m_currentShapeId = String::Format(u"shape-{0}", shape->get_OfficeInteropShapeId()); m_textSpanIndex = 0; svgShape->set_Id(m_currentShapeId); } void FormatText(SharedPtr svgTSpan, SharedPtr portion, SharedPtr textFrame) override { auto currentTextSpanIndex = m_textSpanIndex; m_textSpanIndex++; svgTSpan->set_Id(String::Format(u"{0}-text-{1}", m_currentShapeId, currentTextSpanIndex)); } }; auto presentation = MakeObject(u"presentation.pptx"); auto svgOptions = MakeObject(); svgOptions->set_ShapeFormattingController(MakeObject()); auto slide = presentation->get_Slide(0); auto svgStream = File::Create(u"slide-with-stable-ids.svg"); slide->WriteAsSvg(svgStream, svgOptions); svgStream->Dispose(); presentation->Dispose(); ``` ## **Add SVG Event Handlers** In an [ISvgShapeFormattingController](https://reference.aspose.com/slides/cpp/aspose.slides.export/isvgshapeformattingcontroller/), call [ISvgShape::SetEventHandler](https://reference.aspose.com/slides/cpp/aspose.slides.export/isvgshape/seteventhandler/) with a [SvgEvent](https://reference.aspose.com/slides/cpp/aspose.slides.export/svgevent/) value to add a JavaScript event handler to an exported shape. Assign the controller with [SVGOptions::set_ShapeFormattingController](https://reference.aspose.com/slides/cpp/aspose.slides.export/svgoptions/set_shapeformattingcontroller/) and define the JavaScript function in the page or SVG document that hosts the result. ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::IO; class SvgEventController : public ISvgShapeFormattingController { public: void FormatShape(SharedPtr svgShape, SharedPtr shape) override { if (shape->get_Name() == u"ActionButton") { svgShape->set_Id(u"action-button"); svgShape->SetEventHandler(SvgEvent::OnClick, u"handleShapeClick(event)"); } } }; auto presentation = MakeObject(u"presentation.pptx"); auto svgOptions = MakeObject(); svgOptions->set_ShapeFormattingController(MakeObject()); auto slide = presentation->get_Slide(0); auto svgStream = File::Create(u"interactive-slide.svg"); slide->WriteAsSvg(svgStream, svgOptions); svgStream->Dispose(); presentation->Dispose(); ``` The host page can define the JavaScript function referenced by the handler. Assigning IDs and event handlers enables slide viewers, accessibility enhancements, and other interactive SVG workflows. ## **FAQ** **When should I use [SVGOptions::set_VectorizeText](https://reference.aspose.com/slides/cpp/aspose.slides.export/svgoptions/set_vectorizetext/) instead of [SvgExternalFontsHandling::Vectorize](https://reference.aspose.com/slides/cpp/aspose.slides.export/svgexternalfontshandling/)?** Use [SVGOptions::set_VectorizeText](https://reference.aspose.com/slides/cpp/aspose.slides.export/svgoptions/set_vectorizetext/) when all text must be independent of fonts. Use [SvgExternalFontsHandling::Vectorize](https://reference.aspose.com/slides/cpp/aspose.slides.export/svgexternalfontshandling/) when only text that uses external fonts should be converted to graphics. **What is the best way to make an SVG smaller?** Start by compressing embedded pictures, deleting cropped image areas, and choosing linked font files when the target environment can serve them. Test the result because lower image resolution, lower JPEG quality, and vectorized text each have different quality and size tradeoffs. **Can I modify exported SVG elements after export?** Yes. Assign IDs through a formatting controller, then select the matching SVG elements in your post-processing tool or browser script. # Render Presentations with Fallback Fonts in C++ > Render presentations with fallback fonts in Aspose.Slides for C++ – keep text consistent across PPT, PPTX and ODP with step-by-step C++ code samples. Source: https://docs.aspose.com/slides/cpp/render-presentation-with-fallback-font/ Updated: 2026-08-13 ## **Overview** Aspose.Slides allows you to render presentations using fallback font rules. This article shows how to create a fallback font rules collection, modify its rules by removing or adding fallback fonts, and assign the collection using the `FontsManager::set_FontFallBackRulesCollection` method. Once the fallback font rules collection is assigned to the presentation's `FontsManager`, the rules are applied during operations such as saving, rendering, and converting the presentation. The example demonstrates how to use the configured rules when rendering a slide thumbnail and saving it as a PNG image. ## **Render a Slide Using Fallback Font Rules** The following example includes these steps: 1. We [create fallback font rules collection](https://docs.aspose.com/slides/cpp/create-fallback-fonts-collection/). 1. [Remove()](https://reference.aspose.com/slides/cpp/aspose.slides/fontfallbackrule/remove/) a fallback font rule and [AddFallBackFonts()](https://reference.aspose.com/slides/cpp/aspose.slides/fontfallbackrule/addfallbackfonts/) to another rule. 1. Pass the rules collection to [FontsManager::set_FontFallBackRulesCollection()](https://reference.aspose.com/slides/cpp/aspose.slides/fontsmanager/set_fontfallbackrulescollection/) method. 1. With [Presentation::Save()](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/save/) method we can save presentation in the same format, or save it in another one. After fallback font rules collection is set to FontsManager, these rules are applied during any operations over the presentation: save, render, convert, etc. ``` cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; // Create new instance of a rules collection auto rulesList = MakeObject(); // Create a number of rules rulesList->Add(MakeObject(static_cast(0x400), static_cast(0x4FF), u"Times New Roman")); //rulesList.Add(new FontFallBackRule(...)); for (const auto& fallBackRule : rulesList) { // Trying to remove FallBack font "Tahoma" from loaded rules fallBackRule->Remove(u"Tahoma"); // And to update of rules for specified range if ((fallBackRule->get_RangeEndIndex() >= static_cast(0x4000)) && (fallBackRule->get_RangeStartIndex() < static_cast(0x5000))) { fallBackRule->AddFallBackFonts(u"Verdana"); } } // Also we can remove any existing rules from list if (rulesList->get_Count() > 0) { rulesList->Remove(rulesList->idx_get(0)); } auto pres = System::MakeObject(u"input.pptx"); // Assigning a prepared rules list for using pres->get_FontsManager()->set_FontFallBackRulesCollection(rulesList); // Rendering of thumbnail with using of initialized rules collection and saving to PNG auto image = pres->get_Slide(0)->GetImage(1.f, 1.f); image->Save(u"Slide_0.png", Aspose::Slides::ImageFormat::Png); image->Dispose(); pres->Dispose(); ``` Read more about how to [Convert PowerPoint Slides to PNG in C++](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-png/). ## Related articles - [Configure Fallback Font Collections in C++](https://docs.aspose.com/slides/cpp/create-fallback-fonts-collection/) - [Manage Fallback Fonts for Presentations in C++](https://docs.aspose.com/slides/cpp/fallback-font/) - [Specify Fallback Fonts for Presentations in C++](https://docs.aspose.com/slides/cpp/create-fallback-font/) # Resize Shapes on Presentation Slides in C++ > Easily resize shapes on PowerPoint and OpenDocument slides with Aspose.Slides for C++—automate slide layout adjustments and boost productivity. Source: https://docs.aspose.com/slides/cpp/resizing-shapes-on-slide/ Updated: 2026-11-08 ## **Overview** When you change a presentation's slide size, you may also need to resize and reposition its shapes to fit the new dimensions. This article shows how to scale shapes manually and how to handle tables on slides, masters, and layouts. ## **Resize Shapes** To preserve each shape's relative position and size, multiply its horizontal coordinates and width by the ratio of the new slide width to the original width. Apply the corresponding height ratio to its vertical coordinates and height. The first example loads a presentation whose slides contain no tables, changes the slide size to A4, and saves the result. It uses [SlideSize::SetSize](https://reference.aspose.com/slides/cpp/aspose.slides/slidesize/setsize/) with [SlideSizeScaleType::DoNotScale](https://reference.aspose.com/slides/cpp/aspose.slides/slidesizescaletype/) so that the subsequent loop controls the scaling. The ratios are unitless; shape positions and dimensions are measured in points. Different width and height ratios can distort shapes, and changing a shape's dimensions does not scale its font sizes. ```cpp #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(u"sample.pptx"); // Calculate independent horizontal and vertical scale factors. auto originalSize = presentation->get_SlideSize()->get_Size(); presentation->get_SlideSize()->SetSize(SlideSizeType::A4Paper, SlideSizeScaleType::DoNotScale); auto targetSize = presentation->get_SlideSize()->get_Size(); auto widthRatio = targetSize.get_Width() / originalSize.get_Width(); auto heightRatio = targetSize.get_Height() / originalSize.get_Height(); for (auto&& slide : presentation->get_Slides()) { for (auto&& shape : slide->get_Shapes()) { shape->set_Width(shape->get_Width() * widthRatio); shape->set_Height(shape->get_Height() * heightRatio); shape->set_X(shape->get_X() * widthRatio); shape->set_Y(shape->get_Y() * heightRatio); } } presentation->Save(u"output.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` Tables require separate handling: scale their column widths and row heights instead of assigning the table's overall width and height. Row heights may remain larger than requested if the cell content requires more space. The second example supports tables and processes shapes on masters and layouts as well as individual slides before saving the resized presentation. Its helper handles each [ITable](https://reference.aspose.com/slides/cpp/aspose.slides/itable/) by scaling [IColumn::set_Width](https://reference.aspose.com/slides/cpp/aspose.slides/icolumn/set_width/) and [IRow::set_MinimalHeight](https://reference.aspose.com/slides/cpp/aspose.slides/irow/set_minimalheight/). It then scales the table's position without separately scaling its overall dimensions. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(u"sample.pptx"); // Calculate independent horizontal and vertical scale factors. auto originalSize = presentation->get_SlideSize()->get_Size(); presentation->get_SlideSize()->SetSize(SlideSizeType::A4Paper, SlideSizeScaleType::DoNotScale); auto targetSize = presentation->get_SlideSize()->get_Size(); auto widthRatio = targetSize.get_Width() / originalSize.get_Width(); auto heightRatio = targetSize.get_Height() / originalSize.get_Height(); auto resizeShapes = [](SharedPtr shapes, float widthRatio, float heightRatio) { for (auto&& shape : shapes) { if (ObjectExt::Is(shape)) { auto table = ExplicitCast(shape); // Table dimensions are controlled by column widths and row heights. for (auto&& column : table->get_Columns()) { column->set_Width(column->get_Width() * widthRatio); } for (auto&& row : table->get_Rows()) { row->set_MinimalHeight(row->get_MinimalHeight() * heightRatio); } } else { shape->set_Width(shape->get_Width() * widthRatio); shape->set_Height(shape->get_Height() * heightRatio); } shape->set_X(shape->get_X() * widthRatio); shape->set_Y(shape->get_Y() * heightRatio); } }; // Resize shapes defined on masters and layouts as well as individual slides. for (auto&& master : presentation->get_Masters()) { resizeShapes(master->get_Shapes(), widthRatio, heightRatio); for (auto&& layoutSlide : master->get_LayoutSlides()) { resizeShapes(layoutSlide->get_Shapes(), widthRatio, heightRatio); } } for (auto&& slide : presentation->get_Slides()) { resizeShapes(slide->get_Shapes(), widthRatio, heightRatio); } presentation->Save(u"output.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` [![Before and after A4 resizing, the shape and table move and resize. Column widths and minimum row heights increase, while font sizes stay fixed.](https://docs.aspose.com/slides/cpp/resizing-shapes-on-slide/visual-resizing-shapes-on-slide-068c15ee95ae.svg)](https://docs.aspose.com/slides/cpp/resizing-shapes-on-slide/visual-resizing-shapes-on-slide-068c15ee95ae.svg) *In this table-aware resize, the width ratio scales X, shape width and column widths. The height ratio scales Y, shape height and minimum row heights. Font sizes stay fixed.* ## **FAQ** **Why are shapes distorted or cut off after resizing a slide?** If you change the slide size without scaling the shapes, they keep their original positions and dimensions and may extend beyond the slide. Scaling width and height by different ratios can also distort shapes. **Does the provided code work for all shape types?** The first example changes shape bounds directly and is intended for slides without tables. The second example handles tables separately. Check the resulting layout, particularly text and tables, because these examples do not scale font sizes and table content can constrain row heights. **How do I resize tables when resizing a slide?** Scale column widths by the width ratio and minimum row heights by the height ratio, then scale the table's position, as shown in the second example. **Will this resizing work for master slides and layout slides?** Yes. The second example iterates through [Presentation::get_Masters](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/get_masters/) and each master's [IMasterSlide::get_LayoutSlides](https://reference.aspose.com/slides/cpp/aspose.slides/imasterslide/get_layoutslides/) and applies the same resizing logic to their shapes. **Can I change the orientation of a slide (portrait/landscape) along with the resizing?** Yes. Set [SlideSize::set_Orientation](https://reference.aspose.com/slides/cpp/aspose.slides/slidesize/set_orientation/) after changing the slide size and before reading the target dimensions, so the scale factors reflect the final orientation. **Is there a limit to the slide size I can set?** You can specify custom slide dimensions with [SlideSize::SetSize](https://reference.aspose.com/slides/cpp/aspose.slides/slidesize/setsize/). The supported dimensions also depend on the presentation format and the application used to open the file. **How can I prevent shapes with a fixed aspect ratio from becoming distorted?** Use the same scale factor for width and height. To fit the original layout within the new slide dimensions, use the smaller of the width and height ratios for both dimensions and positions. This preserves proportions but may leave unused space along one edge. # Save Presentations in C++ > Save PowerPoint and OpenDocument presentations to files or streams in C++ with Aspose.Slides, and configure PPTX output and progress reporting. Source: https://docs.aspose.com/slides/cpp/save-presentation/ Updated: 2026-09-22 ## **Overview** After you create a presentation or [open an existing one](https://docs.aspose.com/slides/cpp/open-presentation/), use the [Presentation::Save](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/save/) method to write the result. Aspose.Slides for C++ can save a presentation to a file or stream in PowerPoint, OpenDocument, PDF, and other formats. The following sections cover the standard save operations and the options available for PPTX output. ## **Save Presentations to Files** To save a presentation to a file, pass the output path and a [SaveFormat](https://reference.aspose.com/slides/cpp/aspose.slides.export/saveformat/) value to the [Presentation::Save](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/save/) method. The format value determines the type of file that Aspose.Slides creates. The following example creates a presentation and saves it as a PPTX file: ```cpp #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(); // Add or modify presentation content here. presentation->Save(u"Output.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ## **Save Presentations in Their Original Format** For file and stream detection examples, the behavior of newly created presentations, and the distinction between source and output formats, see [Determine the Original Presentation Format](https://docs.aspose.com/slides/cpp/detect-presentation-source-format/). In a batch-processing application, the input format may not be known in advance. After loading a file, read its original format with [IPresentation::get_SourceFormat](https://reference.aspose.com/slides/cpp/aspose.slides/ipresentation/get_sourceformat/). Pass the resulting [SourceFormat](https://reference.aspose.com/slides/cpp/aspose.slides/sourceformat/) value to [SlideUtil::ToSaveFormat](https://reference.aspose.com/slides/cpp/aspose.slides.util/slideutil/tosaveformat/) to obtain the corresponding [SaveFormat](https://reference.aspose.com/slides/cpp/aspose.slides.export/saveformat/) value, and then use [Presentation::Save](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/save/) to write the modified presentation. The following complete example processes every file in an input directory, updates its title, and saves it to an output directory in the format from which it was loaded: ```cpp #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace Aspose::Slides::Util; using namespace System; using namespace System::IO; String inputDirectory = u"Input"; String outputDirectory = u"Output"; Directory::CreateDirectory_(outputDirectory); auto inputPaths = Directory::GetFiles(inputDirectory); for (const auto& inputPath : inputPaths) { try { auto presentation = MakeObject(inputPath); auto sourceFormat = presentation->get_SourceFormat(); auto saveFormat = SlideUtil::ToSaveFormat(sourceFormat); presentation->get_DocumentProperties()->set_Title(u"Processed by the batch application"); auto outputPath = Path::Combine(outputDirectory, Path::GetFileName(inputPath)); presentation->Save(outputPath, saveFormat); presentation->Dispose(); } catch (ArgumentException& exception) { Console::get_Error()->WriteLine(String::Format(u"Cannot map the source format of '{0}': {1}", inputPath, exception->get_Message())); } catch (Exception& exception) { Console::get_Error()->WriteLine(String::Format(u"Cannot process '{0}': {1}", inputPath, exception->get_Message())); } } ``` [SlideUtil::ToSaveFormat](https://reference.aspose.com/slides/cpp/aspose.slides.util/slideutil/tosaveformat/) maps PPT, PPTX, ODP, PPTM, PPSX, PPSM, POTX, POTM, PPS, POT, OTP, FODP, and PowerPoint XML to their corresponding presentation save formats. It maps presentation source formats only; it is not intended to select export formats such as PDF, HTML, TIFF, or images. Passing an unsupported or invalid [SourceFormat](https://reference.aspose.com/slides/cpp/aspose.slides/sourceformat/) value results in an [ArgumentException](https://reference.aspose.com/slides/cpp/system/argumentexception/). Legacy PPT, PPS, and POT files use the same binary container. When such a presentation is loaded from a stream without a file extension, a PPS or POT file may therefore be identified as PPT. If preserving these legacy subtypes is required, retain the original filename or format metadata separately and use it when choosing the output filename and format. ## **Save Presentations to Streams** To write a presentation without relying on a final file path, pass a writable [Stream](https://reference.aspose.com/slides/cpp/system.io/stream/) and a [SaveFormat](https://reference.aspose.com/slides/cpp/aspose.slides.export/saveformat/) value to the [Presentation::Save](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/save/) method. This approach is useful when the output must be returned from a web service, stored in a database, or processed in memory. The following example saves a new presentation to a file stream: ```cpp #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::IO; auto presentation = MakeObject(); auto outputStream = MakeObject(u"Output.pptx", FileMode::Create); presentation->Save(outputStream, SaveFormat::Pptx); outputStream->Close(); presentation->Dispose(); ``` ## **Save Presentations with a Predefined View Type** You can specify the view in which PowerPoint initially opens a saved presentation. Call [ViewProperties::set_LastView](https://reference.aspose.com/slides/cpp/aspose.slides/viewproperties/set_lastview/) with a [ViewType](https://reference.aspose.com/slides/cpp/aspose.slides/viewtype/) value before saving. The following example configures Slide Master view as the initial view: ```cpp #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(); presentation->get_ViewProperties()->set_LastView(ViewType::SlideMasterView); presentation->Save(u"SlideMasterView.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ## **Save Presentations in the Strict Office Open XML Format** To create a PPTX file that conforms to the Strict profile of Office Open XML, create a [PptxOptions](https://reference.aspose.com/slides/cpp/aspose.slides.export/pptxoptions/) instance and call [PptxOptions::set_Conformance](https://reference.aspose.com/slides/cpp/aspose.slides.export/pptxoptions/set_conformance/) with `Conformance::Iso29500_2008_Strict`. Then pass the options to the [Presentation::Save](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/save/) method. ```cpp #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto options = MakeObject(); options->set_Conformance(Conformance::Iso29500_2008_Strict); auto presentation = MakeObject(); presentation->Save(u"StrictOfficeOpenXml.pptx", SaveFormat::Pptx, options); presentation->Dispose(); ``` ## **Save Presentations in Office Open XML Format in Zip64 Mode** A standard ZIP archive limits the compressed and uncompressed size of each entry, the total archive size, and the number of entries. Because a PPTX file is a ZIP archive, a very large presentation can exceed those limits. ZIP64 extensions raise the applicable size and entry-count limits. Use [PptxOptions::set_Zip64Mode](https://reference.aspose.com/slides/cpp/aspose.slides.export/pptxoptions/set_zip64mode/) to control whether Aspose.Slides writes ZIP64 extensions: - `IfNecessary` uses ZIP64 only when the presentation exceeds standard ZIP limits. This is the default mode. - `Never` disables ZIP64 extensions. - `Always` always writes ZIP64 extensions. The following example always enables ZIP64 extensions for the output presentation: ```cpp #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(u"Sample.pptx"); auto options = MakeObject(); options->set_Zip64Mode(Zip64Mode::Always); presentation->Save(u"OutputZip64.pptx", SaveFormat::Pptx, options); presentation->Dispose(); ``` If `Zip64Mode` is set to `Never` and the presentation cannot fit within standard ZIP limits, the save operation throws a [PptxException](https://reference.aspose.com/slides/cpp/aspose.slides/pptxexception/). ## **Save Presentations in Office Open XML Format with Compression Levels** For PPTX output, you can balance saving speed against file size by calling [PptxOptions::set_CompressionLevel](https://reference.aspose.com/slides/cpp/aspose.slides.export/pptxoptions/set_compressionlevel/). The [CompressionLevel](https://reference.aspose.com/slides/cpp/aspose.slides.export/compressionlevel/) enumeration provides these values: - `None` stores data without compression. - `Level1` provides the fastest compression and the largest compressed output. - `Level2` through `Level5` progressively favor smaller output over saving speed. - `Level6` balances saving speed and file size. This is the default level. - `Level7` and `Level8` further favor smaller output over saving speed. - `Level9` provides the strongest compression and requires the most processing time. The following example saves a presentation without compression: ```cpp #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(u"Sample.pptx"); auto options = MakeObject(); options->set_CompressionLevel(CompressionLevel::None); presentation->Save(u"OutputNoCompression.pptx", SaveFormat::Pptx, options); presentation->Dispose(); ``` The following example uses the maximum compression level: ```cpp #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(u"Sample.pptx"); auto options = MakeObject(); options->set_CompressionLevel(CompressionLevel::Level9); presentation->Save(u"OutputMaximumCompression.pptx", SaveFormat::Pptx, options); presentation->Dispose(); ``` ## **Save Presentations without Refreshing the Thumbnail** When a presentation is saved as PPTX, [PptxOptions::set_RefreshThumbnail](https://reference.aspose.com/slides/cpp/aspose.slides.export/pptxoptions/set_refreshthumbnail/) controls its document thumbnail: - `true` regenerates the thumbnail during the save operation. This is the default value. - `false` preserves the existing thumbnail. If the presentation has no thumbnail, Aspose.Slides does not generate one. The following example saves a presentation without refreshing its thumbnail: ```cpp #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(u"Sample.pptx"); auto options = MakeObject(); options->set_RefreshThumbnail(false); presentation->Save(u"Output.pptx", SaveFormat::Pptx, options); presentation->Dispose(); ``` Disabling thumbnail refresh can reduce the time required to save a PPTX file. ## **Save Progress Updates in Percentage** To monitor a save operation, implement the [IProgressCallback](https://reference.aspose.com/slides/cpp/aspose.slides/iprogresscallback/) interface and pass the implementation to [ISaveOptions::set_ProgressCallback](https://reference.aspose.com/slides/cpp/aspose.slides.export/isaveoptions/set_progresscallback/). Aspose.Slides then calls [IProgressCallback::Reporting](https://reference.aspose.com/slides/cpp/aspose.slides/iprogresscallback/reporting/) with progress values during the export. The following example reports the progress of a PDF export to the console: ```cpp #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; class ExportProgressHandler : public IProgressCallback { public: void Reporting(double progressValue) override { int progress = static_cast(progressValue); Console::WriteLine(u"{0}% of the file has been converted.", progress); } }; auto options = MakeObject(); options->set_ProgressCallback(MakeObject()); auto presentation = MakeObject(u"Sample.pptx"); presentation->Save(u"Output.pdf", SaveFormat::Pdf, options); presentation->Dispose(); ``` Aspose provides a free [PowerPoint Splitter](https://products.aspose.app/slides/splitter) built with the Aspose.Slides API. It saves selected slides from a presentation as separate PPT or PPTX files. ## **FAQ** **Does Aspose.Slides support incremental or “fast save”?** No. Each save operation writes a complete output file rather than updating only the changed parts. **Can multiple threads save the same Presentation instance?** No. A [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) instance [is not thread-safe](https://docs.aspose.com/slides/cpp/multithreading/). Access and save each instance from only one thread at a time. **What happens to hyperlinks and externally linked files when I save a presentation?** [Hyperlinks](https://docs.aspose.com/slides/cpp/manage-hyperlinks/) remain in the presentation. Aspose.Slides does not copy externally linked files, so the saved presentation must still be able to access their locations. **Can I save document metadata such as the author, title, company, and creation date?** Yes. Set the appropriate [document properties](https://docs.aspose.com/slides/cpp/presentation-properties/) before saving, and Aspose.Slides writes them to the output file. # Manage Script-Specific Theme Fonts in C++ > Inspect, add, replace, and remove script-specific font mappings in PowerPoint themes with Aspose.Slides for C++. Source: https://docs.aspose.com/slides/cpp/script-specific-font-mappings/ Updated: 2026-08-25 ## **Overview** A presentation theme can select different font families for different writing systems. This allows multilingual text that still uses theme fonts to follow one coordinated font scheme while using suitable fonts for Cyrillic, Arabic, Japanese, Georgian, Thaana, and other scripts. The theme's [IFontScheme](https://reference.aspose.com/slides/cpp/aspose.slides.theme/ifontscheme/) contains a major font collection, typically used for headings, and a minor font collection, typically used for body text. In addition to their Latin and East Asian font properties, both collections expose mappings from writing-system tags to font family names through the [IFonts](https://reference.aspose.com/slides/cpp/aspose.slides/ifonts/) interface. This article shows how to inspect and modify those mappings in the presentation's master theme and verify that the changes survive a save-and-reload cycle. ## **Understand Script Tags** The script font methods use four-letter BCP 47 script subtags to identify writing systems. Common values include: | Script tag | Writing system | |---|---| | `Cyrl` | Cyrillic | | `Arab` | Arabic | | `Hans` | Simplified Chinese | | `Jpan` | Japanese | | `Geor` | Georgian | | `Thaa` | Thaana | These mappings belong to the theme font scheme, not to individual text portions. A presentation may define different mappings for the major and minor collections, and it may omit mappings for some scripts. ## **Access and Inspect Script Font Mappings** Use [Presentation::get_MasterTheme](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/get_mastertheme/) to access the presentation-level theme. The [FontScheme::get_Major](https://reference.aspose.com/slides/cpp/aspose.slides.theme/fontscheme/get_major/) and [FontScheme::get_Minor](https://reference.aspose.com/slides/cpp/aspose.slides.theme/fontscheme/get_minor/) methods return the two [IFonts](https://reference.aspose.com/slides/cpp/aspose.slides/ifonts/) collections. Call [Fonts::GetScriptFontMap](https://reference.aspose.com/slides/cpp/aspose.slides/fonts/getscriptfontmap/) to retrieve all mappings from a collection. To look up one writing system, call [Fonts::GetScriptFont](https://reference.aspose.com/slides/cpp/aspose.slides/fonts/getscriptfont/) with its script tag. `GetScriptFont` returns a null string when that collection does not define the requested mapping. ## **Modify Mappings and Verify Persistence** Use [Fonts::SetScriptFont](https://reference.aspose.com/slides/cpp/aspose.slides/fonts/setscriptfont/) to create a mapping or replace its current font family. Use [Fonts::RemoveScriptFont](https://reference.aspose.com/slides/cpp/aspose.slides/fonts/removescriptfont/) to remove a mapping. The following end-to-end example reads all existing major and minor mappings, looks up the Japanese major font, changes the Cyrillic major font, removes the Thaana minor mapping, saves the presentation, and reopens it to verify both changes. To make the removal step independent of the initial theme, the example first creates a Thaana mapping only when one is not already defined. ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(); auto fontScheme = presentation->get_MasterTheme()->get_FontScheme(); auto majorFonts = fontScheme->get_Major(); auto minorFonts = fontScheme->get_Minor(); Console::WriteLine(u"Existing major mappings:"); for (auto&& mapping : majorFonts->GetScriptFontMap()) { Console::WriteLine(u" {0}: {1}", mapping.get_Key(), mapping.get_Value()); } Console::WriteLine(u"Existing minor mappings:"); for (auto&& mapping : minorFonts->GetScriptFontMap()) { Console::WriteLine(u" {0}: {1}", mapping.get_Key(), mapping.get_Value()); } auto japaneseFont = majorFonts->GetScriptFont(u"Jpan"); if (japaneseFont.IsNull()) { Console::WriteLine(u"No major Japanese font is defined."); } else { Console::WriteLine(u"Major Japanese font: {0}", japaneseFont); } majorFonts->SetScriptFont(u"Cyrl", u"Arial"); if (minorFonts->GetScriptFont(u"Thaa").IsNull()) { minorFonts->SetScriptFont(u"Thaa", u"Arial"); } minorFonts->RemoveScriptFont(u"Thaa"); presentation->Save(u"script-font-mappings.pptx", SaveFormat::Pptx); auto savedPresentation = MakeObject(u"script-font-mappings.pptx"); auto savedFontScheme = savedPresentation->get_MasterTheme()->get_FontScheme(); auto savedMajorFonts = savedFontScheme->get_Major(); auto savedMinorFonts = savedFontScheme->get_Minor(); auto savedCyrillicFont = savedMajorFonts->GetScriptFont(u"Cyrl"); auto savedThaanaFont = savedMinorFonts->GetScriptFont(u"Thaa"); if (savedCyrillicFont == u"Arial") { Console::WriteLine(u"The Cyrillic mapping was preserved."); } else { Console::WriteLine(u"The Cyrillic mapping was not preserved."); } if (savedThaanaFont.IsNull()) { Console::WriteLine(u"The Thaana mapping removal was preserved."); } else { Console::WriteLine(u"The Thaana mapping still exists."); } ``` The verification uses the same null-string behavior as an ordinary lookup: after the removal is saved, `GetScriptFont(u"Thaa")` returns a null string for the minor collection. ## **Distinguish Theme Mappings from Other Font Settings** Script-specific theme mappings participate in font selection, but they solve a different problem from direct text formatting, substitution, and fallback: | Mechanism | Purpose | Effect of changing a theme mapping | |---|---|---| | Script-specific theme font mapping | Selects a major or minor theme font for a writing system. | Text that still uses the corresponding theme font can resolve to the new mapped family. | | Font assigned explicitly to a text portion | Fixes the requested font family on that portion instead of relying on the theme. | The portion may remain unchanged because its direct formatting overrides the theme choice. | | Font substitution | Replaces a requested font when that font is unavailable or when a substitution rule applies. | It acts after a font has been requested; it does not redefine the theme's script mapping. | | Font fallback | Supplies glyphs that the selected font does not contain, often for specific Unicode ranges. | It fills missing glyph coverage; it does not change the stored theme mapping. | For more information about the last two mechanisms, see [Font Substitution](https://docs.aspose.com/slides/cpp/font-substitution/) and [Fallback Fonts](https://docs.aspose.com/slides/cpp/fallback-font/). Changing a mapping in [Presentation::get_MasterTheme](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/get_mastertheme/) affects only content whose effective formatting still depends on that theme. Text can instead inherit a theme override from a master, layout, or slide, or use an explicitly assigned font. Inspect those levels when the visible result does not follow the presentation-level mapping. ## **Make Mapped Fonts Available and Validate the Result** A script mapping stores a font family name; it does not install or load the corresponding font file. For consistent rendering and export, every mapped font must be installed in the environment or supplied to Aspose.Slides through a custom source such as [FontsLoader::LoadExternalFonts](https://reference.aspose.com/slides/cpp/aspose.slides/fontsloader/loadexternalfonts/) or [LoadOptions::set_DocumentLevelFontSources](https://reference.aspose.com/slides/cpp/aspose.slides/loadoptions/set_documentlevelfontsources/). See [Custom Fonts](https://docs.aspose.com/slides/cpp/custom-font/) for the available loading options. Verifying the saved mapping confirms only that the theme definition was preserved. It does not prove that the font is available, contains all required glyphs, or produces the intended layout. Render representative text for every required writing system to an image or PDF and inspect the output. This catches missing fonts, incomplete glyph coverage, fallback behavior, and layout changes before the presentation is distributed. See [Convert PowerPoint Presentations](https://docs.aspose.com/slides/cpp/convert-powerpoint/) for rendering and export examples. ## **FAQ** **What does `GetScriptFont` return when a script is not mapped?** [Fonts::GetScriptFont](https://reference.aspose.com/slides/cpp/aspose.slides/fonts/getscriptfont/) returns a null string when the requested script mapping is not defined in that major or minor font collection. **Does `SetScriptFont` add a second mapping when the script already exists?** No. [Fonts::SetScriptFont](https://reference.aspose.com/slides/cpp/aspose.slides/fonts/setscriptfont/) creates the mapping when it is missing and replaces the mapped font family when the same script tag is already present. **Why did changing a theme mapping not change some text?** The text may have an explicitly assigned font, inherit a different theme through an override, or be affected by substitution or fallback during rendering. A presentation-level script mapping controls only text whose effective formatting still refers to that theme font collection. **Is saving and reopening enough to validate multilingual output?** No. Reopening verifies persistence of the theme data. Also render representative text from each required writing system to confirm that the mapped fonts are available and contain the necessary glyphs. # Search and Replace Text in PowerPoint Presentations in C++ > Search, highlight, and replace text in PowerPoint presentations while collecting every match with Aspose.Slides for C++. Source: https://docs.aspose.com/slides/cpp/search-and-replace-text/ Updated: 2026-08-27 ## **Overview** Aspose.Slides for C++ can search, highlight, and replace text in an individual text frame or across an entire presentation. Each operation can also notify an application about every match through a result callback. This makes it possible to update a presentation and simultaneously build an audit trail containing the matched text, its context, position, text frame, and slide number. These capabilities are useful for review, redaction, terminology checks, template cleanup, and automated reporting workflows. In the first examples below, we use a file named "sample.pptx", which contains a single text box on the first slide with the following text: ![Sample text](https://docs.aspose.com/slides/cpp/search-and-replace-text/sample_text.png) ## **Choose the Search Scope** Use methods on [ITextFrame](https://reference.aspose.com/slides/cpp/aspose.slides/itextframe/) to limit an operation to one text frame. Use methods on [IPresentation](https://reference.aspose.com/slides/cpp/aspose.slides/ipresentation/) to process all applicable text in the presentation. | Operation | One text frame | Entire presentation | |---|---|---| | Highlight literal text | [ITextFrame::HighlightText](https://reference.aspose.com/slides/cpp/aspose.slides/itextframe/highlighttext/) | [IPresentation::HighlightText](https://reference.aspose.com/slides/cpp/aspose.slides/ipresentation/highlighttext/) | | Highlight regular-expression matches | [ITextFrame::HighlightRegex](https://reference.aspose.com/slides/cpp/aspose.slides/itextframe/highlightregex/) | [IPresentation::HighlightRegex](https://reference.aspose.com/slides/cpp/aspose.slides/ipresentation/highlightregex/) | | Replace literal text | [ITextFrame::ReplaceText](https://reference.aspose.com/slides/cpp/aspose.slides/itextframe/replacetext/) | [IPresentation::ReplaceText](https://reference.aspose.com/slides/cpp/aspose.slides/ipresentation/replacetext/) | | Replace regular-expression matches | [ITextFrame::ReplaceRegex](https://reference.aspose.com/slides/cpp/aspose.slides/itextframe/replaceregex/) | [IPresentation::ReplaceRegex](https://reference.aspose.com/slides/cpp/aspose.slides/ipresentation/replaceregex/) | ## **Configure Text Matching** For literal-text operations, use [ITextSearchOptions](https://reference.aspose.com/slides/cpp/aspose.slides/itextsearchoptions/) to control matching: - [ITextSearchOptions::set_WholeWordsOnly](https://reference.aspose.com/slides/cpp/aspose.slides/itextsearchoptions/set_wholewordsonly/) limits matches to complete words. - [ITextSearchOptions::set_CaseSensitive](https://reference.aspose.com/slides/cpp/aspose.slides/itextsearchoptions/set_casesensitive/) controls whether character case must match. - [ITextSearchOptions::set_IncludeNotes](https://reference.aspose.com/slides/cpp/aspose.slides/itextsearchoptions/set_includenotes/) includes slide notes in presentation-level search, replacement, and highlighting operations. Regular-expression operations use a `System::Text::RegularExpressions::Regex`, so matching rules such as case sensitivity and word boundaries are defined by the expression and its options. ## **Identify the Owner of a Text Frame** Generic text-processing workflows often receive an [ITextFrame](https://reference.aspose.com/slides/cpp/aspose.slides/itextframe/) while searching, replacing, validating, or exporting text. Use [ITextFrame::get_ParentShape](https://reference.aspose.com/slides/cpp/aspose.slides/itextframe/get_parentshape/) and [ITextFrame::get_ParentCell](https://reference.aspose.com/slides/cpp/aspose.slides/itextframe/get_parentcell/) to determine which presentation object owns the text frame. The expected values depend on the owner: | Text frame owner | `get_ParentShape` | `get_ParentCell` | |---|---|---| | An AutoShape or another text-containing shape | The owning [IShape](https://reference.aspose.com/slides/cpp/aspose.slides/ishape/) | `nullptr` | | A table cell | `nullptr` | The owning [ICell](https://reference.aspose.com/slides/cpp/aspose.slides/icell/) | Both methods provide read-only navigation. Calling them does not move the text frame or change its owner. Generic code should check both values for `nullptr` and handle the possibility that neither owner is available. The following example uses [SlideUtil::GetAllTextFrames](https://reference.aspose.com/slides/cpp/aspose.slides.util/slideutil/getalltextframes/) to iterate through the text frames in a presentation. For shapes, it reports the shape name, C++ runtime type, and containing slide. For table cells, it reports the zero-based column and row coordinates and the containing slide. ```cpp #include #include #include #include #include #include #include #include #include #include #include using Aspose::Slides::IBaseSlide; using Aspose::Slides::INotesSlide; using Aspose::Slides::IShape; using Aspose::Slides::ISlide; using Aspose::Slides::ITextFrame; using Aspose::Slides::Presentation; using Aspose::Slides::Util::SlideUtil; using System::AsCast; using System::Console; using System::MakeObject; using System::String; auto presentation = MakeObject(u"presentation.pptx"); auto textFrames = SlideUtil::GetAllTextFrames(presentation, false); for (const auto& textFrame : textFrames) { auto ownerShape = textFrame->get_ParentShape(); if (ownerShape != nullptr) { auto shapeName = String::IsNullOrEmpty(ownerShape->get_Name()) ? u"(unnamed)" : ownerShape->get_Name(); auto shapeType = ownerShape->GetType().get_Name(); auto baseSlide = ownerShape->get_Slide(); String slideLabel; auto slide = AsCast(baseSlide); if (slide != nullptr) { slideLabel = String::Format(u"slide {0}", slide->get_SlideNumber()); } else { auto notesSlide = AsCast(baseSlide); if (notesSlide != nullptr) { slideLabel = String::Format(u"notes for slide {0}", notesSlide->get_ParentSlide()->get_SlideNumber()); } else { slideLabel = baseSlide->GetType().get_Name(); } } Console::WriteLine(u"Shape: {0}; type: {1}; {2}", shapeName, shapeType, slideLabel); continue; } auto ownerCell = textFrame->get_ParentCell(); if (ownerCell != nullptr) { auto baseSlide = ownerCell->get_Slide(); String slideLabel; auto slide = AsCast(baseSlide); if (slide != nullptr) { slideLabel = String::Format(u"slide {0}", slide->get_SlideNumber()); } else { auto notesSlide = AsCast(baseSlide); if (notesSlide != nullptr) { slideLabel = String::Format(u"notes for slide {0}", notesSlide->get_ParentSlide()->get_SlideNumber()); } else { slideLabel = baseSlide->GetType().get_Name(); } } Console::WriteLine(u"Table cell: column {0}, row {1}; {2}", ownerCell->get_FirstColumnIndex(), ownerCell->get_FirstRowIndex(), slideLabel); continue; } Console::WriteLine(u"The text frame owner is not available as a shape or table cell."); } ``` For SmartArt content, iterate through the shapes in [ISmartArtNode::get_Shapes](https://reference.aspose.com/slides/cpp/aspose.slides.smartart/ismartartnode/get_shapes/) and access each [ISmartArtShape::get_TextFrame](https://reference.aspose.com/slides/cpp/aspose.slides.smartart/ismartartshape/get_textframe/). The text frame can be traced to its associated shape through [ITextFrame::get_ParentShape](https://reference.aspose.com/slides/cpp/aspose.slides/itextframe/get_parentshape/), while [ITextFrame::get_ParentCell](https://reference.aspose.com/slides/cpp/aspose.slides/itextframe/get_parentcell/) returns `nullptr`. Therefore, the shape branch in the example also handles text from SmartArt nodes. ## **Collect Match Information with a Callback** Implement [IFindResultCallback](https://reference.aspose.com/slides/cpp/aspose.slides/ifindresultcallback/) to receive a notification for every match. Its [IFindResultCallback::FoundResult](https://reference.aspose.com/slides/cpp/aspose.slides/ifindresultcallback/foundresult/) method provides the related text frame, the source text, the matched text, and the match position. The callback does not receive a slide number directly. The implementation below derives it from [ISlideComponent::get_Slide](https://reference.aspose.com/slides/cpp/aspose.slides/islidecomponent/get_slide/) and also handles text found in slide notes through [INotesSlide::get_ParentSlide](https://reference.aspose.com/slides/cpp/aspose.slides/inotesslide/get_parentslide/). A nullable slide number allows the same result model to represent text associated with other slide types. ```cpp #include #include #include #include #include #include #include #include #include #include #include using Aspose::Slides::IBaseSlide; using Aspose::Slides::IFindResultCallback; using Aspose::Slides::INotesSlide; using Aspose::Slides::IShape; using Aspose::Slides::ISlide; using Aspose::Slides::ITextFrame; using System::AsCast; using System::MakeObject; using System::Nullable; using System::SharedPtr; using System::String; using System::Collections::Generic::List; class TextMatch : public System::Object { public: TextMatch(SharedPtr textFrame, String sourceText, String foundText, int32_t textPosition, Nullable slideNumber) : TextFrame(textFrame), SourceText(sourceText), FoundText(foundText), TextPosition(textPosition), SlideNumber(slideNumber) { } SharedPtr TextFrame; String SourceText; String FoundText; int32_t TextPosition; Nullable SlideNumber; }; class TextSearchCallback : public IFindResultCallback { public: TextSearchCallback() : Results(MakeObject>>()) { } void FoundResult(SharedPtr textFrame, String sourceText, String foundText, int32_t textPosition) override { auto slideNumber = GetSlideNumber(textFrame); auto result = MakeObject(textFrame, sourceText, foundText, textPosition, slideNumber); Results->Add(result); } SharedPtr>> Results; private: static Nullable GetSlideNumber(SharedPtr textFrame) { auto parentShape = textFrame->get_ParentShape(); auto parentCell = textFrame->get_ParentCell(); SharedPtr baseSlide; if (parentShape != nullptr) { baseSlide = parentShape->get_Slide(); } else if (parentCell != nullptr) { baseSlide = parentCell->get_Slide(); } else { baseSlide = textFrame->get_Slide(); } auto slide = AsCast(baseSlide); if (slide != nullptr) { return slide->get_SlideNumber(); } auto notesSlide = AsCast(baseSlide); if (notesSlide != nullptr) { auto parentSlide = notesSlide->get_ParentSlide(); return parentSlide->get_SlideNumber(); } return nullptr; } }; ``` For replacement operations, `FoundText` contains the original matched text, so the callback can record exactly which terms were replaced. ## **Highlight Text** Use the [ITextFrame::HighlightText](https://reference.aspose.com/slides/cpp/aspose.slides/itextframe/highlighttext/) method to highlight literal-text matches in a text frame. Pass [ITextSearchOptions](https://reference.aspose.com/slides/cpp/aspose.slides/itextsearchoptions/) to control the search and a callback to collect match details. The code example below highlights all occurrences of the characters **"try"** and then highlights only the complete word **"to"**. Both searches report their matches to the same callback. ```cpp #include #include #include #include #include #include #include #include using Aspose::Slides::IAutoShape; using Aspose::Slides::Presentation; using Aspose::Slides::TextSearchOptions; using Aspose::Slides::Export::SaveFormat; using System::ExplicitCast; using System::MakeObject; auto presentation = MakeObject(u"sample.pptx"); // Get the first shape from the first slide. auto shape = ExplicitCast(presentation->get_Slide(0)->get_Shape(0)); auto callback = MakeObject(); auto substringSearchOptions = MakeObject(); substringSearchOptions->set_CaseSensitive(false); // Highlight every occurrence of "try" in the text frame. shape->get_TextFrame()->HighlightText( u"try", System::Drawing::Color::get_LightBlue(), substringSearchOptions, callback); auto wholeWordSearchOptions = MakeObject(); wholeWordSearchOptions->set_WholeWordsOnly(true); wholeWordSearchOptions->set_CaseSensitive(false); // Highlight only the complete word "to". shape->get_TextFrame()->HighlightText( u"to", System::Drawing::Color::get_Violet(), wholeWordSearchOptions, callback); for (auto&& result : callback->Results) { auto slideLabel = result->SlideNumber.get_HasValue() ? System::String::Format(u"{0}", result->SlideNumber.get_Value()) : u"Other"; System::Console::WriteLine(u"Found '{0}' at position {1} on slide {2}.", result->FoundText, result->TextPosition, slideLabel); } presentation->Save(u"highlighted_text.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` The result: ![The highlighted text](https://docs.aspose.com/slides/cpp/search-and-replace-text/highlighted_text.png) ## **Highlight Text Using Regular Expressions** The [ITextFrame::HighlightRegex](https://reference.aspose.com/slides/cpp/aspose.slides/itextframe/highlightregex/) method highlights text matches found by a regular expression in a text frame. The following code highlights all words containing seven or more characters and collects each match: ```cpp #include #include #include #include #include #include #include using Aspose::Slides::IAutoShape; using Aspose::Slides::Presentation; using Aspose::Slides::Export::SaveFormat; using System::ExplicitCast; using System::MakeObject; using System::Text::RegularExpressions::Regex; auto presentation = MakeObject(u"sample.pptx"); auto shape = ExplicitCast(presentation->get_Slide(0)->get_Shape(0)); auto callback = MakeObject(); auto regex = MakeObject(u"\\b[^\\s]{7,}\\b"); shape->get_TextFrame()->HighlightRegex( regex, System::Drawing::Color::get_Yellow(), callback); presentation->Save(u"highlighted_text_using_regex.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` The result: ![The highlighted text using the regular expression](https://docs.aspose.com/slides/cpp/search-and-replace-text/highlighted_text_using_regex.png) ## **Highlight Text Across a Presentation** Use [IPresentation::HighlightText](https://reference.aspose.com/slides/cpp/aspose.slides/ipresentation/highlighttext/) and [IPresentation::HighlightRegex](https://reference.aspose.com/slides/cpp/aspose.slides/ipresentation/highlightregex/) to search all applicable text frames in a presentation. The following example highlights a literal term and all email addresses while keeping separate result collections for the two searches. ```cpp #include #include #include #include #include #include #include using Aspose::Slides::Presentation; using Aspose::Slides::TextSearchOptions; using Aspose::Slides::Export::SaveFormat; using System::MakeObject; using System::Text::RegularExpressions::Regex; using System::Text::RegularExpressions::RegexOptions; auto presentation = MakeObject(u"presentation.pptx"); auto termCallback = MakeObject(); auto searchOptions = MakeObject(); searchOptions->set_WholeWordsOnly(true); searchOptions->set_CaseSensitive(false); presentation->HighlightText( u"confidential", System::Drawing::Color::get_Orange(), searchOptions, termCallback); auto emailCallback = MakeObject(); auto emailRegex = MakeObject( u"\\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,}\\b", RegexOptions::IgnoreCase); presentation->HighlightRegex( emailRegex, System::Drawing::Color::get_Yellow(), emailCallback); presentation->Save(u"highlighted_presentation.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ## **Replace Text in a Text Frame** Use [ITextFrame::ReplaceText](https://reference.aspose.com/slides/cpp/aspose.slides/itextframe/replacetext/) for literal text and [ITextFrame::ReplaceRegex](https://reference.aspose.com/slides/cpp/aspose.slides/itextframe/replaceregex/) for pattern-based replacement. These methods update matched text within the existing text frame, which retains the surrounding portion formatting instead of rebuilding the text frame from a plain string. The following example standardizes a spelling variant and then replaces version labels. The same callback records the original terms matched by both operations. ```cpp #include #include #include #include #include #include #include #include using Aspose::Slides::IAutoShape; using Aspose::Slides::Presentation; using Aspose::Slides::TextSearchOptions; using Aspose::Slides::Export::SaveFormat; using System::ExplicitCast; using System::MakeObject; using System::Text::RegularExpressions::Regex; using System::Text::RegularExpressions::RegexOptions; auto presentation = MakeObject(u"presentation.pptx"); auto shape = ExplicitCast(presentation->get_Slide(0)->get_Shape(0)); auto callback = MakeObject(); auto searchOptions = MakeObject(); searchOptions->set_WholeWordsOnly(true); searchOptions->set_CaseSensitive(false); shape->get_TextFrame()->ReplaceText(u"colour", u"color", searchOptions, callback); auto versionRegex = MakeObject( u"\\bv\\d+(?:\\.\\d+)*\\b", RegexOptions::IgnoreCase); shape->get_TextFrame()->ReplaceRegex(versionRegex, u"current version", callback); presentation->Save(u"updated_text_frame.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` If one match spans portions with different formatting, review the output to confirm which formatting should apply to the replacement text. ## **Replace Text Across a Presentation** Use [IPresentation::ReplaceText](https://reference.aspose.com/slides/cpp/aspose.slides/ipresentation/replacetext/) and [IPresentation::ReplaceRegex](https://reference.aspose.com/slides/cpp/aspose.slides/ipresentation/replaceregex/) to apply the same operations across the presentation. This is useful for template cleanup, terminology updates, and redaction. ```cpp #include #include #include #include #include using Aspose::Slides::Presentation; using Aspose::Slides::TextSearchOptions; using Aspose::Slides::Export::SaveFormat; using System::MakeObject; using System::Text::RegularExpressions::Regex; auto presentation = MakeObject(u"presentation.pptx"); auto callback = MakeObject(); auto searchOptions = MakeObject(); searchOptions->set_WholeWordsOnly(true); searchOptions->set_CaseSensitive(true); presentation->ReplaceText(u"Contoso", u"Example Corp", searchOptions, callback); auto accountNumberRegex = MakeObject(u"\\bACCT-\\d{6}\\b"); presentation->ReplaceRegex(accountNumberRegex, u"ACCT-REDACTED", callback); presentation->Save(u"updated_presentation.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ## **Group Matches for Reporting** Because every result stores its slide number and text frame, applications can group matches for audit, reporting, or review workflows. The following example groups the collected results first by slide and then by text frame: ```cpp #include #include #include #include #include std::map>>> matchesBySlide; for (auto&& result : callback->Results) { int32_t slideKey = result->SlideNumber.get_HasValue() ? result->SlideNumber.get_Value() : 0; auto textFrameKey = result->TextFrame.get(); matchesBySlide[slideKey][textFrameKey].push_back(result); } for (const auto& slideGroup : matchesBySlide) { auto slideLabel = slideGroup.first == 0 ? System::String(u"Other") : System::String::Format(u"{0}", slideGroup.first); System::Console::WriteLine(u"Slide: {0}", slideLabel); for (const auto& textFrameGroup : slideGroup.second) { auto textFrameText = textFrameGroup.first->get_Text(); System::Console::WriteLine(u" Text frame: {0}", textFrameText); for (const auto& result : textFrameGroup.second) { System::Console::WriteLine( u" '{0}' at position {1}; context: '{2}'", result->FoundText, result->TextPosition, result->SourceText); } } } ``` ## **FAQ** **How can I search only one text box instead of the entire presentation?** Get the shape's text frame and call [ITextFrame::HighlightText](https://reference.aspose.com/slides/cpp/aspose.slides/itextframe/highlighttext/), [ITextFrame::HighlightRegex](https://reference.aspose.com/slides/cpp/aspose.slides/itextframe/highlightregex/), [ITextFrame::ReplaceText](https://reference.aspose.com/slides/cpp/aspose.slides/itextframe/replacetext/), or [ITextFrame::ReplaceRegex](https://reference.aspose.com/slides/cpp/aspose.slides/itextframe/replaceregex/) on that text frame. Presentation-level methods process all applicable text frames instead. **How can I match complete words with the correct capitalization?** Call [ITextSearchOptions::set_WholeWordsOnly](https://reference.aspose.com/slides/cpp/aspose.slides/itextsearchoptions/set_wholewordsonly/) and [ITextSearchOptions::set_CaseSensitive](https://reference.aspose.com/slides/cpp/aspose.slides/itextsearchoptions/set_casesensitive/) with `true`, and pass the options to a literal-text highlighting or replacement method. For regular expressions, define word boundaries and case sensitivity in the `System::Text::RegularExpressions::Regex` itself. **Can search and replacement include text in slide notes?** Yes. Call [ITextSearchOptions::set_IncludeNotes](https://reference.aspose.com/slides/cpp/aspose.slides/itextsearchoptions/set_includenotes/) with `true` when using a presentation-level literal-text operation. The callback implementation shown above maps a match in a notes slide back to its parent slide number. **How can I create a report without scanning the presentation a second time?** Pass an [IFindResultCallback](https://reference.aspose.com/slides/cpp/aspose.slides/ifindresultcallback/) implementation to the highlighting or replacement operation. The callback receives every match while the operation runs, so the application can store the source text, matched text, position, text frame, and derived slide number for later grouping or export. **Does replacing text preserve its formatting?** [ITextFrame::ReplaceText](https://reference.aspose.com/slides/cpp/aspose.slides/itextframe/replacetext/) and [ITextFrame::ReplaceRegex](https://reference.aspose.com/slides/cpp/aspose.slides/itextframe/replaceregex/) modify matched text within the existing text frame and retain the surrounding portion formatting. If a match spans portions with different formatting, inspect the result to ensure the replacement uses the desired style. # Manage Sensitivity Labels in PowerPoint Presentations in C++ > Read, add, update, remove, and migrate Microsoft Purview sensitivity labels in PowerPoint PPTX presentations with Aspose.Slides for C++. Source: https://docs.aspose.com/slides/cpp/sensitivity-labels/ Updated: 2026-08-13 ## **Overview** Microsoft Purview sensitivity labels help organizations classify and govern documents. During automated presentation processing, an application may need to preserve an existing label, apply a label selected by a policy, update its state, or migrate label metadata written by an older Microsoft Information Protection (MIP) workflow. Aspose.Slides exposes modern sensitivity label metadata through [IPresentation::get_SensitivityLabels](https://reference.aspose.com/slides/cpp/aspose.slides/ipresentation/get_sensitivitylabels/). This method returns an [ISensitivityLabelCollection](https://reference.aspose.com/slides/cpp/aspose.slides/isensitivitylabelcollection/) that can be inspected and modified before the presentation is saved as PPTX. Sensitivity label identifiers and policy information are defined by your Microsoft Purview configuration. Validate label availability and policy requirements in your environment before adding or migrating metadata. The [ISensitivityLabel::get_ContentMarkTypes](https://reference.aspose.com/slides/cpp/aspose.slides/isensitivitylabel/get_contentmarktypes/) values describe the content markings associated with a label; they do not by themselves add visible text or shapes to slides. ## **Understand Sensitivity Label Properties** Each [ISensitivityLabel](https://reference.aspose.com/slides/cpp/aspose.slides/isensitivitylabel/) contains the following metadata: | Accessors | Purpose | | --- | --- | | [ISensitivityLabel::get_Id](https://reference.aspose.com/slides/cpp/aspose.slides/isensitivitylabel/get_id/), [ISensitivityLabel::set_Id](https://reference.aspose.com/slides/cpp/aspose.slides/isensitivitylabel/set_id/) | Identify the sensitivity label in the Purview policy. | | [ISensitivityLabel::get_SiteId](https://reference.aspose.com/slides/cpp/aspose.slides/isensitivitylabel/get_siteid/), [ISensitivityLabel::set_SiteId](https://reference.aspose.com/slides/cpp/aspose.slides/isensitivitylabel/set_siteid/) | Identify the site associated with the label policy. | | [ISensitivityLabel::get_IsEnabled](https://reference.aspose.com/slides/cpp/aspose.slides/isensitivitylabel/get_isenabled/), [ISensitivityLabel::set_IsEnabled](https://reference.aspose.com/slides/cpp/aspose.slides/isensitivitylabel/set_isenabled/) | Indicate whether the label is enabled. | | [ISensitivityLabel::get_IsRemoved](https://reference.aspose.com/slides/cpp/aspose.slides/isensitivitylabel/get_isremoved/), [ISensitivityLabel::set_IsRemoved](https://reference.aspose.com/slides/cpp/aspose.slides/isensitivitylabel/set_isremoved/) | Indicate that the label has been removed. Set the value to `true` when the removal state must be retained in the metadata. | | [ISensitivityLabel::get_AssignmentMethodType](https://reference.aspose.com/slides/cpp/aspose.slides/isensitivitylabel/get_assignmentmethodtype/), [ISensitivityLabel::set_AssignmentMethodType](https://reference.aspose.com/slides/cpp/aspose.slides/isensitivitylabel/set_assignmentmethodtype/) | Specify whether the label was applied automatically or through a user decision. | | [ISensitivityLabel::get_ContentMarkTypes](https://reference.aspose.com/slides/cpp/aspose.slides/isensitivitylabel/get_contentmarktypes/) | List the content marking types associated with the label. | The [SensitivityLabelAssignmentType](https://reference.aspose.com/slides/cpp/aspose.slides/sensitivitylabelassignmenttype/) enumeration describes how a label was assigned: - [SensitivityLabelAssignmentType::Standard](https://reference.aspose.com/slides/cpp/aspose.slides/sensitivitylabelassignmenttype/) represents a default or automatically applied label. - [SensitivityLabelAssignmentType::Privileged](https://reference.aspose.com/slides/cpp/aspose.slides/sensitivitylabelassignmenttype/) represents a label applied through a user decision, including manually applied, recommended, and mandatory labels. The [SensitivityLabelContentType](https://reference.aspose.com/slides/cpp/aspose.slides/sensitivitylabelcontenttype/) enumeration identifies the marking associated with a label: | Value | Meaning | | --- | --- | | [SensitivityLabelContentType::None](https://reference.aspose.com/slides/cpp/aspose.slides/sensitivitylabelcontenttype/) | The label was applied by default or automatically. | | [SensitivityLabelContentType::Header](https://reference.aspose.com/slides/cpp/aspose.slides/sensitivitylabelcontenttype/) | Header content marking is associated with the label. | | [SensitivityLabelContentType::Footer](https://reference.aspose.com/slides/cpp/aspose.slides/sensitivitylabelcontenttype/) | Footer content marking is associated with the label. | | [SensitivityLabelContentType::Watermark](https://reference.aspose.com/slides/cpp/aspose.slides/sensitivitylabelcontenttype/) | Watermark content marking is associated with the label. | | [SensitivityLabelContentType::Encryption](https://reference.aspose.com/slides/cpp/aspose.slides/sensitivitylabelcontenttype/) | Encryption protection is associated with the label. | Multiple marking types can be associated with one label. ## **List Existing Sensitivity Labels** Read the modern label collection from [IPresentation::get_SensitivityLabels](https://reference.aspose.com/slides/cpp/aspose.slides/ipresentation/get_sensitivitylabels/) and enumerate it. The following example lists every property and content marking stored for each label: ```cpp #include #include #include #include #include #include #include #include #include #include using Aspose::Slides::Presentation; using System::Console; using System::MakeObject; auto presentation = MakeObject(u"presentation.pptx"); auto sensitivityLabels = presentation->get_SensitivityLabels(); for (auto&& sensitivityLabel : sensitivityLabels) { auto labelIdentifier = sensitivityLabel->get_Id(); auto siteIdentifier = sensitivityLabel->get_SiteId(); auto isEnabled = sensitivityLabel->get_IsEnabled(); auto isRemoved = sensitivityLabel->get_IsRemoved(); auto assignmentMethod = sensitivityLabel->get_AssignmentMethodType(); Console::WriteLine(u"Label ID: {0}", labelIdentifier); Console::WriteLine(u"Site ID: {0}", siteIdentifier); Console::WriteLine(u"Enabled: {0}", isEnabled); Console::WriteLine(u"Removed: {0}", isRemoved); Console::WriteLine(u"Assignment method: {0}", assignmentMethod); for (auto contentMarkType : sensitivityLabel->get_ContentMarkTypes()) { Console::WriteLine(u"Content marking: {0}", contentMarkType); } } presentation->Dispose(); ``` ## **Add a Sensitivity Label with Content Marking** Use [ISensitivityLabelCollection::Add](https://reference.aspose.com/slides/cpp/aspose.slides/isensitivitylabelcollection/add/) with the label identifier, site identifier, enabled state, and assignment method. After the method returns the new [ISensitivityLabel](https://reference.aspose.com/slides/cpp/aspose.slides/isensitivitylabel/), add the required marking values through [ISensitivityLabel::get_ContentMarkTypes](https://reference.aspose.com/slides/cpp/aspose.slides/isensitivitylabel/get_contentmarktypes/). The following example adds a manually selected label associated with footer and watermark markings, and then saves the result as PPTX: ```cpp #include #include #include #include #include #include #include #include #include using Aspose::Slides::Presentation; using Aspose::Slides::SensitivityLabelAssignmentType; using Aspose::Slides::SensitivityLabelContentType; using Aspose::Slides::Export::SaveFormat; using System::Guid; using System::MakeObject; auto presentation = MakeObject(u"presentation.pptx"); auto sensitivityLabels = presentation->get_SensitivityLabels(); auto labelIdentifier = u"{11111111-2222-3333-4444-555555555555}"; auto siteIdentifier = Guid::Parse(u"{aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee}"); bool isEnabled = true; auto assignmentMethod = SensitivityLabelAssignmentType::Privileged; auto sensitivityLabel = sensitivityLabels->Add( labelIdentifier, siteIdentifier, isEnabled, assignmentMethod); sensitivityLabel->get_ContentMarkTypes()->Add(SensitivityLabelContentType::Footer); sensitivityLabel->get_ContentMarkTypes()->Add(SensitivityLabelContentType::Watermark); presentation->Save(u"presentation_with_label.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ## **Update a Sensitivity Label** The [ISensitivityLabel](https://reference.aspose.com/slides/cpp/aspose.slides/isensitivitylabel/) values are read/write through their getter and setter methods, except that the collection returned by [ISensitivityLabel::get_ContentMarkTypes](https://reference.aspose.com/slides/cpp/aspose.slides/isensitivitylabel/get_contentmarktypes/) is modified through its list operations. After locating the required label, you can update its identifier, site identifier, enabled state, assignment method, removal state, and content marking types. Save the presentation to persist the changes. The following example updates the enabled state and assignment method of the first label: ```cpp #include #include #include #include #include #include using Aspose::Slides::Presentation; using Aspose::Slides::SensitivityLabelAssignmentType; using Aspose::Slides::Export::SaveFormat; using System::MakeObject; auto presentation = MakeObject(u"presentation.pptx"); auto sensitivityLabels = presentation->get_SensitivityLabels(); int labelCount = sensitivityLabels->get_Count(); if (labelCount > 0) { auto sensitivityLabel = sensitivityLabels->idx_get(0); sensitivityLabel->set_IsEnabled(true); sensitivityLabel->set_AssignmentMethodType(SensitivityLabelAssignmentType::Privileged); } presentation->Save(u"presentation_with_updated_label.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ## **Mark a Sensitivity Label as Removed** To preserve the fact that a label was removed, find the label and call [ISensitivityLabel::set_IsRemoved](https://reference.aspose.com/slides/cpp/aspose.slides/isensitivitylabel/set_isremoved/) with `true`. This retains the label entry while recording its removed state. If you instead need to delete an entry from the modern collection, use [ISensitivityLabelCollection::RemoveAt](https://reference.aspose.com/slides/cpp/aspose.slides/isensitivitylabelcollection/removeat/); use [ISensitivityLabelCollection::Clear](https://reference.aspose.com/slides/cpp/aspose.slides/isensitivitylabelcollection/clear/) to delete every entry. The following example marks a specific label as removed and saves the updated presentation: ```cpp #include #include #include #include #include #include #include using Aspose::Slides::Presentation; using Aspose::Slides::Export::SaveFormat; using System::MakeObject; using System::String; using System::StringComparison; auto presentation = MakeObject(u"presentation.pptx"); auto sensitivityLabels = presentation->get_SensitivityLabels(); auto targetLabelIdentifier = u"{11111111-2222-3333-4444-555555555555}"; for (auto&& sensitivityLabel : sensitivityLabels) { auto labelIdentifier = sensitivityLabel->get_Id(); bool isTargetLabel = String::Equals( labelIdentifier, targetLabelIdentifier, StringComparison::OrdinalIgnoreCase); if (isTargetLabel) { sensitivityLabel->set_IsRemoved(true); break; } } presentation->Save(u"presentation_with_removed_label.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ## **Read and Migrate Legacy MIP Sensitivity Labels** Older MIP-based workflows can store sensitivity label metadata in custom document properties instead of the modern label collection. Read that metadata with [IDocumentProperties::GetSensitivityLabels](https://reference.aspose.com/slides/cpp/aspose.slides/idocumentproperties/getsensitivitylabels/). The method parses the legacy custom properties and returns an array of [ISensitivityLabel](https://reference.aspose.com/slides/cpp/aspose.slides/isensitivitylabel/) objects. To migrate the metadata, add each returned label to the modern [ISensitivityLabelCollection](https://reference.aspose.com/slides/cpp/aspose.slides/isensitivitylabelcollection/) through [ISensitivityLabelCollection::Add](https://reference.aspose.com/slides/cpp/aspose.slides/isensitivitylabelcollection/add/). Because adding a duplicate label identifier raises an exception, the example checks the destination collection before copying each label. You can add further validation to confirm that each legacy label still exists in the current Purview policy. ```cpp #include #include #include #include #include #include #include #include #include using Aspose::Slides::Presentation; using Aspose::Slides::Export::SaveFormat; using System::MakeObject; using System::String; using System::StringComparison; auto presentation = MakeObject(u"presentation_with_legacy_labels.pptx"); auto documentProperties = presentation->get_DocumentProperties(); auto legacySensitivityLabels = documentProperties->GetSensitivityLabels(); auto modernSensitivityLabels = presentation->get_SensitivityLabels(); for (auto&& legacySensitivityLabel : legacySensitivityLabels) { bool labelAlreadyExists = false; auto legacyLabelIdentifier = legacySensitivityLabel->get_Id(); for (auto&& modernSensitivityLabel : modernSensitivityLabels) { auto modernLabelIdentifier = modernSensitivityLabel->get_Id(); labelAlreadyExists = String::Equals( modernLabelIdentifier, legacyLabelIdentifier, StringComparison::OrdinalIgnoreCase); if (labelAlreadyExists) { break; } } if (!labelAlreadyExists) { modernSensitivityLabels->Add(legacySensitivityLabel); } } presentation->Save(u"presentation_with_modern_labels.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` The migration copies the parsed label objects into the modern collection. It does not require clearing all custom document properties, so unrelated document metadata remains intact. Use [IPresentation::Save](https://reference.aspose.com/slides/cpp/aspose.slides/ipresentation/save/) with [SaveFormat::Pptx](https://reference.aspose.com/slides/cpp/aspose.slides.export/saveformat/) to write the modern label metadata to a PPTX file. ## **FAQ** **Does adding a content marking type create a visible header, footer, or watermark on slides?** No. Values added through [ISensitivityLabel::get_ContentMarkTypes](https://reference.aspose.com/slides/cpp/aspose.slides/isensitivitylabel/get_contentmarktypes/) describe the markings associated with the sensitivity label. They do not create visible text or shapes in the presentation. Add the corresponding slide content separately if your workflow must render those markings. **What is the difference between marking a label as removed and deleting it from the collection?** Calling [ISensitivityLabel::set_IsRemoved](https://reference.aspose.com/slides/cpp/aspose.slides/isensitivitylabel/set_isremoved/) with `true` keeps the label entry and records its removed state. Calling [ISensitivityLabelCollection::RemoveAt](https://reference.aspose.com/slides/cpp/aspose.slides/isensitivitylabelcollection/removeat/) deletes the entry from the modern collection. Choose the operation that matches your organization's metadata retention requirements. **Can a presentation contain both legacy MIP metadata and modern sensitivity labels?** Yes. Legacy labels can remain in custom document properties while modern labels are available through [IPresentation::get_SensitivityLabels](https://reference.aspose.com/slides/cpp/aspose.slides/ipresentation/get_sensitivitylabels/). Use [IDocumentProperties::GetSensitivityLabels](https://reference.aspose.com/slides/cpp/aspose.slides/idocumentproperties/getsensitivitylabels/) to read the legacy metadata and migrate only the valid labels that are not already present in the modern collection. **What happens when a label with the same identifier is added more than once?** [ISensitivityLabelCollection::Add](https://reference.aspose.com/slides/cpp/aspose.slides/isensitivitylabelcollection/add/) throws an argument exception when the collection already contains a label with the same identifier. Check existing [ISensitivityLabel::get_Id](https://reference.aspose.com/slides/cpp/aspose.slides/isensitivitylabel/get_id/) values before adding or migrating labels. **Which output format should be used to preserve updated sensitivity labels?** Save the presentation as PPTX by calling [IPresentation::Save](https://reference.aspose.com/slides/cpp/aspose.slides/ipresentation/save/) with [SaveFormat::Pptx](https://reference.aspose.com/slides/cpp/aspose.slides.export/saveformat/), as shown in the examples above. # Apply Shape Animations in Presentations Using C++ > Learn how to add, inspect, and customize shape animations, timing, sounds, after-animation behavior, and animated text with Aspose.Slides for C++. Source: https://docs.aspose.com/slides/cpp/shape-animation/ Updated: 2026-10-26 ## **Overview** To work with the individual behaviors inside an effect or edit motion-path segments, see [Custom Animation](https://docs.aspose.com/slides/cpp/custom-animation/). Aspose.Slides for C++ represents slide animations as effects in a slide timeline. An effect has a target shape, an animation type and subtype, a trigger, timing settings, and optional properties such as sound or after-animation behavior. The timeline contains two kinds of sequences: - The **main sequence** plays as the slide advances. - An **interactive sequence** starts when its trigger shape is clicked. Because text boxes, pictures, charts, tables, and other slide objects implement [IShape](https://reference.aspose.com/slides/cpp/aspose.slides/ishape/), you use the same [ISequence::AddEffect](https://reference.aspose.com/slides/cpp/aspose.slides.animation/isequence/addeffect/) method for most slide content. The available effects are listed in the [EffectType](https://reference.aspose.com/slides/cpp/aspose.slides.animation/effecttype/) enumeration. ## **Add Shape Animations** To add an animation, get the slide's main sequence and call [ISequence::AddEffect](https://reference.aspose.com/slides/cpp/aspose.slides.animation/isequence/addeffect/) with the target shape, effect type, subtype, and trigger. For an effect that starts when another shape is clicked, create an interactive sequence whose trigger is that other shape. The following example creates both types of animation and saves the result to `shape-animations.pptx`. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Animation; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto targetShape = slide->get_Shapes()->AddAutoShape(ShapeType::RoundCornerRectangle, 120.0f, 100.0f, 320.0f, 80.0f); targetShape->get_TextFrame()->set_Text(u"Click to animate this shape"); auto mainSequence = slide->get_Timeline()->get_MainSequence(); auto entranceEffect = mainSequence->AddEffect(targetShape, EffectType::Fade, EffectSubtype::None, EffectTriggerType::OnClick); entranceEffect->get_Timing()->set_Duration(1.5f); auto triggerShape = slide->get_Shapes()->AddAutoShape(ShapeType::Bevel, 20.0f, 20.0f, 100.0f, 40.0f); triggerShape->get_TextFrame()->set_Text(u"Move"); auto interactiveSequence = slide->get_Timeline()->get_InteractiveSequences()->Add(triggerShape); interactiveSequence->AddEffect(targetShape, EffectType::PathFootball, EffectSubtype::None, EffectTriggerType::OnClick); presentation->Save(u"shape-animations.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` The trigger controls when an effect starts: - [EffectTriggerType::OnClick](https://reference.aspose.com/slides/cpp/aspose.slides.animation/effecttriggertype/) waits for a click in the main sequence, or for a click on the trigger shape in an interactive sequence. - [EffectTriggerType::WithPrevious](https://reference.aspose.com/slides/cpp/aspose.slides.animation/effecttriggertype/) starts with the preceding effect. - [EffectTriggerType::AfterPrevious](https://reference.aspose.com/slides/cpp/aspose.slides.animation/effecttriggertype/) starts when the preceding effect finishes. To animate a picture, chart, or another shape type, pass that object to [ISequence::AddEffect](https://reference.aspose.com/slides/cpp/aspose.slides.animation/isequence/addeffect/) instead of `targetShape`. For chart-specific grouping options, see [Animated Charts](https://docs.aspose.com/slides/cpp/animated-charts/). ## **Read Shape Animations** Use [ISequence::GetEffectsByShape](https://reference.aspose.com/slides/cpp/aspose.slides.animation/isequence/geteffectsbyshape/) when you know the target shape. To inspect every effect, enumerate the main sequence and every interactive sequence. Enumeration avoids assuming that a sequence contains an effect at index `0`. The following example creates a shape with main-sequence and interactive effects, gets the effects that target the shape, and then enumerates every sequence on the slide. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Animation; using namespace System; auto printSequence = [](const String& label, const SharedPtr& sequence) { Console::WriteLine(String::Format(u" {0}: {1} effect(s)", label, sequence->get_Count())); for (const auto& effect : sequence) { auto targetName = effect->get_TargetShape() == nullptr ? u"unknown" : effect->get_TargetShape()->get_Name(); auto effectDescription = String::Format(u"{0} {1}; target: {2}; trigger: {3}", effect->get_Type(), effect->get_Subtype(), targetName, effect->get_Timing()->get_TriggerType()); Console::WriteLine(u" " + effectDescription); } }; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto targetShape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 120.0f, 100.0f, 320.0f, 80.0f); targetShape->get_TextFrame()->set_Text(u"Animated shape"); auto mainSequence = slide->get_Timeline()->get_MainSequence(); mainSequence->AddEffect(targetShape, EffectType::Fade, EffectSubtype::None, EffectTriggerType::OnClick); auto triggerShape = slide->get_Shapes()->AddAutoShape(ShapeType::Bevel, 20.0f, 20.0f, 100.0f, 40.0f); triggerShape->get_TextFrame()->set_Text(u"Move"); auto interactiveSequence = slide->get_Timeline()->get_InteractiveSequences()->Add(triggerShape); interactiveSequence->AddEffect(targetShape, EffectType::PathFootball, EffectSubtype::None, EffectTriggerType::OnClick); auto targetEffects = mainSequence->GetEffectsByShape(targetShape); Console::WriteLine(String::Format(u"The main sequence contains {0} effect(s) for {1}.", targetEffects->get_Length(), targetShape->get_Name())); printSequence(u"Main sequence", mainSequence); int32_t interactiveIndex = 1; for (const auto& sequence : slide->get_Timeline()->get_InteractiveSequences()) { auto triggerName = sequence->get_TriggerShape() == nullptr ? u"unknown" : sequence->get_TriggerShape()->get_Name(); auto sequenceLabel = String::Format(u"Interactive sequence {0}, trigger: {1}", interactiveIndex, triggerName); printSequence(sequenceLabel, sequence); interactiveIndex++; } presentation->Dispose(); ``` If you only need the effects for one shape, first identify the shape by name, placeholder type, or another stable property; then call [ISequence::GetEffectsByShape](https://reference.aspose.com/slides/cpp/aspose.slides.animation/isequence/geteffectsbyshape/). Do not assume that [IShapeCollection::idx_get](https://reference.aspose.com/slides/cpp/aspose.slides/ishapecollection/idx_get/) at index `0` is always the intended object. ## **Remove All Animations from a Shape** Use [ISequence::RemoveByShape](https://reference.aspose.com/slides/cpp/aspose.slides.animation/isequence/removebyshape/) to remove effects targeting a particular shape. Each call affects only the sequence on which it is invoked. To remove the shape's effects throughout a slide's timeline, call it on [IAnimationTimeLine::get_MainSequence](https://reference.aspose.com/slides/cpp/aspose.slides/ianimationtimeline/get_mainsequence/) and on every sequence in [IAnimationTimeLine::get_InteractiveSequences](https://reference.aspose.com/slides/cpp/aspose.slides/ianimationtimeline/get_interactivesequences/). The example expects a presentation file with two shapes named `Target` and `Other` on the first slide. Both shapes have effects in the main sequence and in an interactive sequence triggered by clicking `Target`. It finds the target by name, removes its effects from all these sequences, and saves the presentation. ```cpp #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(u"animated-shapes.pptx"); auto slide = presentation->get_Slide(0); SharedPtr targetShape; for (const auto& shape : slide->get_Shapes()) { if (shape->get_Name() == u"Target") { targetShape = shape; break; } } if (targetShape != nullptr) { slide->get_Timeline()->get_MainSequence()->RemoveByShape(targetShape); for (const auto& sequence : slide->get_Timeline()->get_InteractiveSequences()) { sequence->RemoveByShape(targetShape); } presentation->Save(u"shape-animations-removed.pptx", SaveFormat::Pptx); } else { Console::WriteLine(u"The target shape was not found."); } presentation->Dispose(); ``` The `Target` shape remains on the slide, and effects targeting `Other` are preserved in both sequences. An effect's [IEffect::get_TargetShape](https://reference.aspose.com/slides/cpp/aspose.slides.animation/ieffect/get_targetshape/) is distinct from a sequence's [ISequence::get_TriggerShape](https://reference.aspose.com/slides/cpp/aspose.slides.animation/isequence/get_triggershape/): removing effects targeting `Target` does not remove every animation triggered by it. In this example, clicking `Target` still starts the interactive effect for `Other`. ## **Work with Inherited Placeholder Effects** A placeholder on a normal slide can inherit animation behavior from the corresponding placeholder on its layout slide and master slide. [IShape::GetBasePlaceholder](https://reference.aspose.com/slides/cpp/aspose.slides/ishape/getbaseplaceholder/) returns that parent placeholder, or `nullptr` when no parent exists. In the following example presentation, the footer has **Random Bars** on the normal slide, **Split** on the layout slide, and **Fly In** on the master slide. ![Footer animation effect on the normal slide](https://docs.aspose.com/slides/cpp/shape-animation/slide-shape-animation.png) ![Footer placeholder animation effect on the layout slide](https://docs.aspose.com/slides/cpp/shape-animation/layout-shape-animation.png) ![Footer placeholder animation effect on the master slide](https://docs.aspose.com/slides/cpp/shape-animation/master-shape-animation.png) The next example builds the placeholder hierarchy itself. It adds effects to a master placeholder, a layout placeholder, and the corresponding placeholder on a normal slide. Every call to [IShape::GetBasePlaceholder](https://reference.aspose.com/slides/cpp/aspose.slides/ishape/getbaseplaceholder/) is checked before the returned shape is used. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Animation; using namespace Aspose::Slides::Export; using namespace System; auto findPlaceholderWithBase = [](const SharedPtr& slide) -> SharedPtr { for (const auto& shape : slide->get_Shapes()) { if (shape->GetBasePlaceholder() != nullptr) return shape; } return nullptr; }; auto printEffects = [](const String& source, const ArrayPtr>& effects) { Console::WriteLine(String::Format(u"{0}: {1} effect(s)", source, effects->get_Length())); for (const auto& effect : effects) Console::WriteLine(String::Format(u" {0} {1}", effect->get_Type(), effect->get_Subtype())); }; auto presentation = MakeObject(); auto layoutSlide = presentation->get_LayoutSlides()->GetByType(SlideLayoutType::Blank); auto layoutPlaceholder = layoutSlide->get_PlaceholderManager()->AddTextPlaceholder(100.0f, 100.0f, 400.0f, 80.0f); layoutSlide->get_Timeline()->get_MainSequence()->AddEffect(layoutPlaceholder, EffectType::Split, EffectSubtype::VerticalIn, EffectTriggerType::OnClick); auto masterPlaceholder = layoutPlaceholder->GetBasePlaceholder(); if (masterPlaceholder != nullptr) { auto masterSequence = layoutSlide->get_MasterSlide()->get_Timeline()->get_MainSequence(); masterSequence->AddEffect(masterPlaceholder, EffectType::Fly, EffectSubtype::Bottom, EffectTriggerType::OnClick); } auto slide = presentation->get_Slides()->AddEmptySlide(layoutSlide); auto slidePlaceholder = findPlaceholderWithBase(slide); if (slidePlaceholder == nullptr) throw InvalidOperationException(u"The slide does not contain a placeholder linked to its layout slide."); slide->get_Timeline()->get_MainSequence()->AddEffect(slidePlaceholder, EffectType::RandomBars, EffectSubtype::Horizontal, EffectTriggerType::OnClick); printEffects(u"Normal slide", slide->get_Timeline()->get_MainSequence()->GetEffectsByShape(slidePlaceholder)); auto baseLayoutPlaceholder = slidePlaceholder->GetBasePlaceholder(); if (baseLayoutPlaceholder != nullptr) { printEffects(u"Layout slide", layoutSlide->get_Timeline()->get_MainSequence()->GetEffectsByShape(baseLayoutPlaceholder)); auto baseMasterPlaceholder = baseLayoutPlaceholder->GetBasePlaceholder(); if (baseMasterPlaceholder != nullptr) printEffects(u"Master slide", layoutSlide->get_MasterSlide()->get_Timeline()->get_MainSequence()->GetEffectsByShape(baseMasterPlaceholder)); } presentation->Save(u"placeholder-animations.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ## **Change Animation Timing** The PowerPoint **Timing** dialog maps to the methods of [ITiming](https://reference.aspose.com/slides/cpp/aspose.slides.animation/itiming/). ![PowerPoint Timing dialog for an animation effect](https://docs.aspose.com/slides/cpp/shape-animation/shape-animation.png) - **Start** maps to [ITiming::set_TriggerType](https://reference.aspose.com/slides/cpp/aspose.slides.animation/itiming/set_triggertype/). - **Duration** maps to [ITiming::set_Duration](https://reference.aspose.com/slides/cpp/aspose.slides.animation/itiming/set_duration/), in seconds. - **Delay** maps to [ITiming::set_TriggerDelayTime](https://reference.aspose.com/slides/cpp/aspose.slides.animation/itiming/set_triggerdelaytime/), in seconds. - **Repeat** maps to [ITiming::set_RepeatCount](https://reference.aspose.com/slides/cpp/aspose.slides.animation/itiming/set_repeatcount/), [ITiming::set_RepeatUntilNextClick](https://reference.aspose.com/slides/cpp/aspose.slides.animation/itiming/set_repeatuntilnextclick/), or [ITiming::set_RepeatUntilEndSlide](https://reference.aspose.com/slides/cpp/aspose.slides.animation/itiming/set_repeatuntilendslide/). - **Rewind when done playing** maps to [ITiming::set_Rewind](https://reference.aspose.com/slides/cpp/aspose.slides.animation/itiming/set_rewind/). This independent example adds an effect, changes its timing through the object returned by [ISequence::AddEffect](https://reference.aspose.com/slides/cpp/aspose.slides.animation/isequence/addeffect/), and saves the result. Keeping the returned [IEffect](https://reference.aspose.com/slides/cpp/aspose.slides.animation/ieffect/) reference avoids an unnecessary collection index. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Animation; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 120.0f, 100.0f, 320.0f, 80.0f); shape->get_TextFrame()->set_Text(u"Timed animation"); auto effect = slide->get_Timeline()->get_MainSequence()->AddEffect(shape, EffectType::Fade, EffectSubtype::None, EffectTriggerType::OnClick); effect->get_Timing()->set_TriggerType(EffectTriggerType::OnClick); effect->get_Timing()->set_Duration(2.0f); effect->get_Timing()->set_TriggerDelayTime(0.5f); effect->get_Timing()->set_RepeatUntilNextClick(false); effect->get_Timing()->set_RepeatUntilEndSlide(false); effect->get_Timing()->set_RepeatCount(2.0f); effect->get_Timing()->set_Rewind(true); presentation->Save(u"shape-animation-timing.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` Use one repeat mode intentionally. Combining a repeat count with an "until" flag can produce confusing results in different viewers. When changing repeat modes, call [ITiming::set_RepeatUntilNextClick](https://reference.aspose.com/slides/cpp/aspose.slides.animation/itiming/set_repeatuntilnextclick/) and [ITiming::set_RepeatUntilEndSlide](https://reference.aspose.com/slides/cpp/aspose.slides.animation/itiming/set_repeatuntilendslide/) before [ITiming::set_RepeatCount](https://reference.aspose.com/slides/cpp/aspose.slides.animation/itiming/set_repeatcount/), because setting either flag also changes the active repeat mode. ## **Add and Extract Animation Sounds** An animation effect can reference embedded audio through [IEffect::set_Sound](https://reference.aspose.com/slides/cpp/aspose.slides.animation/ieffect/set_sound/). [IEffect::set_StopPreviousSound](https://reference.aspose.com/slides/cpp/aspose.slides.animation/ieffect/set_stopprevioussound/) tells an effect to stop audio started by an earlier effect. ### **Add a Sound to an Effect** The following example expects a local audio file named `animation-sound.wav`. It creates two effects, embeds that file as the sound for the first effect, and configures the second effect to stop the sound. It uses the objects returned by [ISequence::AddEffect](https://reference.aspose.com/slides/cpp/aspose.slides.animation/isequence/addeffect/), so no sequence index is required. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Animation; using namespace Aspose::Slides::Export; using namespace System; using namespace System::IO; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto firstShape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 80.0f, 100.0f, 240.0f, 80.0f); auto secondShape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 400.0f, 100.0f, 240.0f, 80.0f); firstShape->get_TextFrame()->set_Text(u"Starts sound"); secondShape->get_TextFrame()->set_Text(u"Stops sound"); auto sequence = slide->get_Timeline()->get_MainSequence(); auto firstEffect = sequence->AddEffect(firstShape, EffectType::Fade, EffectSubtype::None, EffectTriggerType::OnClick); auto secondEffect = sequence->AddEffect(secondShape, EffectType::Fade, EffectSubtype::None, EffectTriggerType::OnClick); auto audioData = File::ReadAllBytes(u"animation-sound.wav"); auto effectSound = presentation->get_Audios()->AddAudio(audioData); firstEffect->set_Sound(effectSound); secondEffect->set_StopPreviousSound(true); presentation->Save(u"shape-animation-sound.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ### **Extract Embedded Effect Sounds** The following example expects a local presentation named `presentation-with-animation-sounds.pptx`. It scans both main and interactive sequences and writes every embedded effect sound to the `extracted-animation-sounds` directory. The extension is selected from the audio MIME type exposed by [IAudio::get_ContentType](https://reference.aspose.com/slides/cpp/aspose.slides/iaudio/get_contenttype/). ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Animation; using namespace System; using namespace System::IO; auto getAudioExtension = [](const String& contentType) { auto normalizedType = String::IsNullOrEmpty(contentType) ? String::Empty : contentType.ToLowerInvariant(); if (normalizedType == u"audio/mpeg") return String(u".mp3"); if (normalizedType == u"audio/mp4") return String(u".m4a"); if (normalizedType == u"audio/ogg") return String(u".ogg"); if (normalizedType == u"audio/wav" || normalizedType == u"audio/x-wav") return String(u".wav"); return String(u".bin"); }; auto saveSounds = [&getAudioExtension](const SharedPtr& sequence, const String& outputDirectory, int32_t& soundIndex) { for (const auto& effect : sequence) { if (effect->get_Sound() == nullptr) continue; auto extension = getAudioExtension(effect->get_Sound()->get_ContentType()); auto outputPath = Path::Combine(outputDirectory, String::Format(u"effect-sound-{0}{1}", soundIndex, extension)); File::WriteAllBytes(outputPath, effect->get_Sound()->get_BinaryData()); soundIndex++; } }; auto inputPath = String(u"presentation-with-animation-sounds.pptx"); auto outputDirectory = String(u"extracted-animation-sounds"); Directory::CreateDirectory_(outputDirectory); auto presentation = MakeObject(inputPath); int32_t soundIndex = 1; for (const auto& slide : presentation->get_Slides()) { saveSounds(slide->get_Timeline()->get_MainSequence(), outputDirectory, soundIndex); for (const auto& sequence : slide->get_Timeline()->get_InteractiveSequences()) saveSounds(sequence, outputDirectory, soundIndex); } Console::WriteLine(String::Format(u"Extracted {0} sound file(s) to {1}.", soundIndex - 1, Path::GetFullPath(outputDirectory))); presentation->Dispose(); ``` For large audio objects, use [IAudio::GetStream](https://reference.aspose.com/slides/cpp/aspose.slides/iaudio/getstream/) and copy the stream to a file instead of loading the entire object into a byte array. ## **Set After-Animation Behavior** The **After animation** option controls what happens to a shape after its effect finishes. ![PowerPoint Effect Options dialog showing After animation settings](https://docs.aspose.com/slides/cpp/shape-animation/shape-after-animation.png) The [AfterAnimationType](https://reference.aspose.com/slides/cpp/aspose.slides.animation/afteranimationtype/) enumeration supports leaving the shape unchanged, changing its color, hiding it after the animation, or hiding it on the next click. When the type is [AfterAnimationType::Color](https://reference.aspose.com/slides/cpp/aspose.slides.animation/afteranimationtype/), call [IEffect::get_AfterAnimationColor](https://reference.aspose.com/slides/cpp/aspose.slides.animation/ieffect/get_afteranimationcolor/) to set the color as well. This independent example creates an effect, sets its after-animation behavior through the returned effect object, and saves the result. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Animation; using namespace Aspose::Slides::Export; using namespace System; using namespace System::Drawing; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 120.0f, 100.0f, 320.0f, 80.0f); shape->get_TextFrame()->set_Text(u"Dim after animation"); auto effect = slide->get_Timeline()->get_MainSequence()->AddEffect(shape, EffectType::Fade, EffectSubtype::None, EffectTriggerType::OnClick); effect->set_AfterAnimationType(AfterAnimationType::Color); effect->get_AfterAnimationColor()->set_Color(Color::get_LightGray()); presentation->Save(u"shape-animation-after-effect.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` Changing the type away from [AfterAnimationType::Color](https://reference.aspose.com/slides/cpp/aspose.slides.animation/afteranimationtype/) clears the after-animation color setting. ## **Animate Text** Text animation has two related controls: - [ITextAnimation::set_BuildType](https://reference.aspose.com/slides/cpp/aspose.slides.animation/itextanimation/set_buildtype/) controls whether paragraphs appear together or by paragraph level. - [IEffect::set_AnimateTextType](https://reference.aspose.com/slides/cpp/aspose.slides.animation/ieffect/set_animatetexttype/) controls whether text appears all at once, by word, or by letter. [IEffect::set_DelayBetweenTextParts](https://reference.aspose.com/slides/cpp/aspose.slides.animation/ieffect/set_delaybetweentextparts/) sets the delay between words or letters. A positive value is a percentage of the effect duration; a negative value is a delay in seconds. The following independent example animates the words in a text box. [BuildType::AsOneObject](https://reference.aspose.com/slides/cpp/aspose.slides.animation/buildtype/) disables paragraph-by-paragraph building so that the word setting applies to the entire text frame. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Animation; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto textBox = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 80.0f, 80.0f, 560.0f, 100.0f); textBox->get_TextFrame()->set_Text(u"Aspose.Slides animates this sentence word by word."); auto effect = slide->get_Timeline()->get_MainSequence()->AddEffect(textBox, EffectType::Fade, EffectSubtype::None, EffectTriggerType::OnClick); effect->get_TextAnimation()->set_BuildType(BuildType::AsOneObject); effect->set_AnimateTextType(AnimateTextType::ByWord); effect->set_DelayBetweenTextParts(20.0f); presentation->Save(u"animated-text.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` To build a text box by paragraph, use [ITextAnimation::set_BuildType](https://reference.aspose.com/slides/cpp/aspose.slides.animation/itextanimation/set_buildtype/) with [BuildType::ByLevelParagraphs1](https://reference.aspose.com/slides/cpp/aspose.slides.animation/buildtype/) or another paragraph level. To target a single paragraph with its own effect, use the [ISequence::AddEffect](https://reference.aspose.com/slides/cpp/aspose.slides.animation/isequence/addeffect/) overload that accepts an [IParagraph](https://reference.aspose.com/slides/cpp/aspose.slides/iparagraph/). See [Animated Text](https://docs.aspose.com/slides/cpp/animated-text/) for paragraph-level examples. ## **Export and Compatibility Notes** - Saving to PPT or PPTX preserves the animation model, but the final playback is controlled by the presentation viewer. - PDF and static images do not play animations. Use [HTML5 export](https://docs.aspose.com/slides/cpp/export-to-html5/), animated GIF, or [video conversion](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/) when the output must show motion. - For HTML5, enable [Html5Options::set_AnimateShapes](https://reference.aspose.com/slides/cpp/aspose.slides.export/html5options/set_animateshapes/) and, when needed, [Html5Options::set_AnimateTransitions](https://reference.aspose.com/slides/cpp/aspose.slides.export/html5options/set_animatetransitions/). - Video rendering supports many common entrance, emphasis, exit, and motion-path effects, but not every PowerPoint effect is supported. Check the current [supported animations and effects](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/#supported-animations-and-effects) and test critical presentations with your target Aspose.Slides version. - Advanced custom effects and effects imported from other presentation formats may be preserved in the file but render differently in PowerPoint, HTML5, or video. Validate the exported result rather than relying only on the effect name. ## **FAQ** **Why does an animation appear in PowerPoint but not in a PDF?** PDF is a static format, so animations and slide transitions do not play. Export to HTML5, animated GIF, or video when motion must be preserved. **Why does an effect play differently in a video?** Video export renders animations rather than storing the original PowerPoint behavior. Some advanced effects are unsupported or approximated. Review the supported-effects table and test the actual presentation before production use. **Does moving a shape forward or backward change its animation order?** No. Shape z-order controls overlap, while sequence order and triggers control animation playback. Change the timeline if you need a different playback order. ## Related articles - [Animate PowerPoint Text in C++](https://docs.aspose.com/slides/cpp/animated-text/) # Apply Shape Effects in Presentations Using C++ > Transform your PPT and PPTX files with advanced shape effects using Aspose.Slides for C++ — create striking, professional slides in seconds. Source: https://docs.aspose.com/slides/cpp/shape-effect/ Updated: 2026-11-04 ## **Introduction** While effects in PowerPoint can be used to make a shape stand out, they differ from [fills](https://docs.aspose.com/slides/cpp/shape-formatting/#gradient-fill) or outlines. Using PowerPoint effects, you can create convincing reflections on a shape, spread a shape's glow, etc. ![Shape effect](https://docs.aspose.com/slides/cpp/shape-effect/shape-effect.png) PowerPoint provides six effects that can be applied to shapes. You can apply one or more effects to a shape. Some combinations of effects look better than others. For this reason, PowerPoint has options under **Preset**. The Preset options are essentially a combination of two or more effects known to look good together. This way, by selecting a preset, you won't have to waste time testing or combining different effects to find a nice combination. Aspose.Slides provides properties and methods under the [EffectFormat](https://reference.aspose.com/slides/cpp/aspose.slides/effectformat/) class that allow you to apply the same effects to shapes in PowerPoint presentations. ## **Apply a Shadow Effect** Aspose.Slides for C++ supports outer and inner shadows for shapes. You can customize their color, direction, distance, and blur radius to match your presentation's design. ### **Apply an Outer Shadow** Use an outer shadow to make a card or panel stand out against the slide background. The shadow extends beyond the shape's edges, creating the impression that the shape is raised above the slide. Adjust its color, direction, distance, and blur radius to match the lighting and styling of your template. This C++ code shows how to apply the [outer shadow effect](https://reference.aspose.com/slides/cpp/aspose.slides/effectformat/get_outershadoweffect/) to a rectangle: ```cpp #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System::Drawing; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::RoundCornerRectangle, 20.0f, 20.0f, 200.0f, 100.0f); auto effectFormat = shape->get_EffectFormat(); effectFormat->EnableOuterShadowEffect(); auto outerShadowEffect = effectFormat->get_OuterShadowEffect(); outerShadowEffect->get_ShadowColor()->set_Color(Color::get_DarkGray()); outerShadowEffect->set_Distance(10); outerShadowEffect->set_Direction(45.0f); presentation->Save(u"shadow_effect.pptx", SaveFormat::Pptx); ``` ![Shadow effect](https://docs.aspose.com/slides/cpp/shape-effect/shadow_effect.png) ### **Apply an Inner Shadow** When reproducing a template's visual styling, use an inner shadow to give a card or panel a recessed appearance. An outer shadow extends outside the shape and makes it appear raised, while an inner shadow shades the inside of its edges. Call [EnableInnerShadowEffect](https://reference.aspose.com/slides/cpp/aspose.slides/effectformat/enableinnershadoweffect/), then configure [InnerShadowEffect](https://reference.aspose.com/slides/cpp/aspose.slides/effectformat/get_innershadoweffect/). Larger blur radius values produce softer edges. This C++ example creates a light blue card with a dark gray inner shadow and saves it as a PPTX file: ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System::Drawing; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 20.0f, 20.0f, 200.0f, 100.0f); shape->get_FillFormat()->set_FillType(FillType::Solid); shape->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_LightBlue()); shape->get_LineFormat()->get_FillFormat()->set_FillType(FillType::NoFill); shape->get_EffectFormat()->EnableInnerShadowEffect(); auto shadow = shape->get_EffectFormat()->get_InnerShadowEffect(); shadow->get_ShadowColor()->set_Color(Color::get_DimGray()); shadow->set_Direction(225); shadow->set_Distance(7); shadow->set_BlurRadius(6); presentation->Save(u"inner_shadow_effect.pptx", SaveFormat::Pptx); ``` ![Light blue rectangle with an inner shadow](https://docs.aspose.com/slides/cpp/shape-effect/inner_shadow_effect.png) To remove the inner shadow, call [DisableInnerShadowEffect](https://reference.aspose.com/slides/cpp/aspose.slides/effectformat/disableinnershadoweffect/) on the shape's effect format. ## **Apply a Reflection Effect** To apply a reflection effect in Aspose.Slides for C++, you can add a mirror-like reflection to shapes, adjusting parameters such as distance, transparency, and size. This effect enhances the aesthetic of your presentations by giving shapes a more polished and sophisticated look. It’s easy to implement with simple code, enabling quick application across multiple elements for a consistent design. This C++ code shows how to apply the [reflection effect](https://reference.aspose.com/slides/cpp/aspose.slides/effectformat/get_reflectioneffect/) to a shape: ```cpp #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::RoundCornerRectangle, 20.0f, 20.0f, 200.0f, 100.0f); auto effectFormat = shape->get_EffectFormat(); effectFormat->EnableReflectionEffect(); auto reflectionEffect = effectFormat->get_ReflectionEffect(); reflectionEffect->set_RectangleAlign(RectangleAlignment::Bottom); reflectionEffect->set_Direction(90.0f); reflectionEffect->set_Distance(40); reflectionEffect->set_BlurRadius(2); presentation->Save(u"reflection_effect.pptx", SaveFormat::Pptx); ``` ![Reflection effect](https://docs.aspose.com/slides/cpp/shape-effect/reflection_effect.png) ## **Apply a Glow Effect** To apply a glow effect to a shape in Aspose.Slides for C++, you can add a soft, luminous aura around shapes, adjusting properties like color and size. This effect helps make shapes stand out and adds an attractive, eye-catching visual element to your presentation. It's easy to implement with minimal code, enhancing the overall look of your slides. This C++ code shows how to apply the [glow effect](https://reference.aspose.com/slides/cpp/aspose.slides/effectformat/get_gloweffect/) to a shape: ```cpp #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System::Drawing; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::RoundCornerRectangle, 20.0f, 20.0f, 200.0f, 100.0f); auto effectFormat = shape->get_EffectFormat(); effectFormat->EnableGlowEffect(); auto glowEffect = effectFormat->get_GlowEffect(); glowEffect->get_Color()->set_Color(Color::get_Magenta()); glowEffect->set_Radius(15); presentation->Save(u"glow_effect.pptx", SaveFormat::Pptx); ``` ![Glow effect](https://docs.aspose.com/slides/cpp/shape-effect/glow_effect.png) ## **Apply a Soft Edges Effect** To apply a soft edges effect in Aspose.Slides for C++, you can create a smooth, blurred transition around the edges of a shape. This effect adds a more subtle and refined look, perfect for designs that need a gentle, softer appearance. You can easily adjust parameters like radius to achieve the desired effect across various shapes in your presentation. This C++ code shows how to apply the [soft edges](https://reference.aspose.com/slides/cpp/aspose.slides/effectformat/get_softedgeeffect/) to a shape: ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::RoundCornerRectangle, 20.0f, 20.0f, 200.0f, 150.0f); auto effectFormat = shape->get_EffectFormat(); effectFormat->EnableSoftEdgeEffect(); auto softEdgeEffect = effectFormat->get_SoftEdgeEffect(); softEdgeEffect->set_Radius(8); presentation->Save(u"soft_edges_effect.pptx", SaveFormat::Pptx); ``` ![Soft edges effect](https://docs.aspose.com/slides/cpp/shape-effect/soft_edges_effect.png) ## **Apply a Blur Effect** Use shape blur to soften a shape's fill and outline while keeping the shape editable. Call [SetBlurEffect](https://reference.aspose.com/slides/cpp/aspose.slides/ieffectformat/setblureffect/) on the shape's effect format. The radius is measured in points (1/72 inch): use a nonnegative value, with larger values producing stronger blur. A radius of zero leaves the appearance unchanged. The [Grow](https://reference.aspose.com/slides/cpp/aspose.slides.effects/iblur/get_grow/) setting controls the visible bounds of the effect. With `false`, the blur is clipped to the original painted bounds, including the outline. With `true`, the blur can extend beyond those bounds. Neither setting changes the shape's position or dimensions. The comparison below uses the same fill, outline, and shape dimensions throughout. The top row uses `grow = false`; the bottom row uses `grow = true`. ![Original rectangle compared with blur radii of 5 and 15 points, with grow disabled and enabled](https://docs.aspose.com/slides/cpp/shape-effect/shape_blur_comparison.png) This C++ example creates an orange rectangle with a dark blue outline, applies a 5-point blur, and then updates it to a 15-point blur by calling [SetBlurEffect](https://reference.aspose.com/slides/cpp/aspose.slides/ieffectformat/setblureffect/) again. It saves both blurred states, then calls [DisableBlurEffect](https://reference.aspose.com/slides/cpp/aspose.slides/ieffectformat/disableblureffect/) and saves the shape without blur. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System::Drawing; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 100.0f, 80.0f, 160.0f, 100.0f); shape->get_FillFormat()->set_FillType(FillType::Solid); shape->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Orange()); shape->get_LineFormat()->get_FillFormat()->set_FillType(FillType::Solid); shape->get_LineFormat()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_DarkBlue()); shape->get_LineFormat()->set_Width(8); shape->get_EffectFormat()->SetBlurEffect(5, false); presentation->Save(u"shape_blur_5.pptx", SaveFormat::Pptx); shape->get_EffectFormat()->SetBlurEffect(15, true); presentation->Save(u"shape_blur_15.pptx", SaveFormat::Pptx); shape->get_EffectFormat()->DisableBlurEffect(); presentation->Save(u"shape_blur_removed.pptx", SaveFormat::Pptx); ``` Shape blur affects the fill and outline together. A soft edges effect fades the shape's edges, while shadow blur softens only the shadow. Image transformation effects operate on image content; this example applies blur directly to the shape's effect format without converting the shape to an image. ## **FAQ** **Can I apply multiple effects to the same shape?** Yes, you can combine different effects, such as shadow, reflection, and glow, on a single shape to create a more dynamic appearance. **What shapes can I apply effects to?** You can apply effects to various shapes, including autoshapes, charts, tables, pictures, SmartArt objects, OLE objects, and more. **Can I apply effects to grouped shapes?** Yes, you can apply effects to grouped shapes. The effect will apply to the entire group. ## Related articles - [Create and Apply WordArt Effects in C++](https://docs.aspose.com/slides/cpp/wordart/) # Get Shape Effective Properties from Presentations in C++ > Learn how to use Aspose.Slides for C++ to distinguish local, inherited, and effective shape formatting in PowerPoint presentations. Source: https://docs.aspose.com/slides/cpp/shape-effective-properties/ Updated: 2026-11-08 ## **Understand Local, Inherited, and Effective Properties** PowerPoint formatting can come from several places. The value stored directly on an object is its **local value**. If that value is not set, PowerPoint looks at parent formatting sources, such as a paragraph default, a text style, a layout or master slide, a theme, or presentation-level defaults. Those values are **inherited values**. The value that remains after the entire hierarchy is resolved is the **effective value**—the value used to render the object. For example, a text portion may not define its own font height. Its local [font height](https://reference.aspose.com/slides/cpp/aspose.slides/ibaseportionformat/) is then `std::numeric_limits::quiet_NaN()`, which means "not set here." The portion can inherit a height from its paragraph, the presentation's default text style, or another applicable source. Calling [GetEffective](https://reference.aspose.com/slides/cpp/aspose.slides/iportionformat/) on the portion format returns the final resolved height. Use the two kinds of formatting data for different purposes: - Read or change a local format object, such as [IPortionFormat](https://reference.aspose.com/slides/cpp/aspose.slides/iportionformat/), when you need to control where a value is defined. - Read an effective data object, such as [IPortionFormatEffectiveData](https://reference.aspose.com/slides/cpp/aspose.slides/iportionformateffectivedata/), when you need the final, rendered result. Effective data is read-only. ## **Compare Local, Inherited, and Effective Values** The following complete example creates a shape and applies font heights at the presentation, paragraph, and portion levels. Each step prints the values defined at those levels and the resulting effective value for the same text portion. It also demonstrates why effective data must be read again after formatting changes. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 100.0f, 100.0f, 500.0f, 80.0f, false); auto textFrame = shape->AddTextFrame(u"Effective formatting"); auto paragraph = textFrame->get_Paragraph(0); auto portion = paragraph->get_Portion(0); // Define inherited values at two different levels. presentation->get_DefaultTextStyle()->GetLevel(0)->get_DefaultPortionFormat()->set_FontHeight(20.0f); paragraph->get_ParagraphFormat()->get_DefaultPortionFormat()->set_FontHeight(28.0f); auto formatLocalValue = [](float value) -> System::String { return std::isnan(value) ? System::String(u"") : System::ObjectExt::ToString(value); }; auto printFontHeights = [&](System::String caption) { auto presentationValue = presentation->get_DefaultTextStyle()->GetLevel(0)->get_DefaultPortionFormat()->get_FontHeight(); auto paragraphValue = paragraph->get_ParagraphFormat()->get_DefaultPortionFormat()->get_FontHeight(); auto localValue = portion->get_PortionFormat()->get_FontHeight(); // Read effective data after the preceding changes. auto effectiveValue = portion->get_PortionFormat()->GetEffective()->get_FontHeight(); System::Console::WriteLine(caption); System::Console::WriteLine(System::String(u" Presentation default: ") + formatLocalValue(presentationValue)); System::Console::WriteLine(System::String(u" Paragraph default: ") + formatLocalValue(paragraphValue)); System::Console::WriteLine(System::String(u" Portion local: ") + formatLocalValue(localValue)); System::Console::WriteLine(System::String(u" Portion effective: ") + effectiveValue); }; printFontHeights(u"The portion inherits from the paragraph"); // A local value on the portion overrides both inherited values. portion->get_PortionFormat()->set_FontHeight(36.0f); printFontHeights(u"A local value overrides inherited values"); // Changing an inherited value does not override an existing local value. paragraph->get_ParagraphFormat()->get_DefaultPortionFormat()->set_FontHeight(30.0f); printFontHeights(u"The local value still has priority"); // Clear the local value. The portion now inherits from the paragraph again. portion->get_PortionFormat()->set_FontHeight(std::numeric_limits::quiet_NaN()); printFontHeights(u"The local value is cleared"); // Clear the paragraph value. The presentation default now supplies the result. paragraph->get_ParagraphFormat()->get_DefaultPortionFormat()->set_FontHeight(std::numeric_limits::quiet_NaN()); printFontHeights(u"The paragraph value is cleared"); presentation->Save(u"effective-properties.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` The priority in this example is portion local formatting, then paragraph formatting, then the presentation default. Other objects can have different inheritance chains, but the principle is the same: a more specific explicit value wins, and [GetEffective](https://reference.aspose.com/slides/cpp/aspose.slides/iportionformat/) returns the final result. [![Five rows resolve font sizes to 28, 36, 36, 30 and 20 points as local and inherited values are set and cleared.](https://docs.aspose.com/slides/cpp/shape-effective-properties/visual-shape-effective-properties-b9645b4ca164.svg)](https://docs.aspose.com/slides/cpp/shape-effective-properties/visual-shape-effective-properties-b9645b4ca164.svg) *Verified .NET 26.11 values for the article’s sequence: 28 → 36 → 36 → 30 → 20 points. A set portion value wins over the paragraph; clearing it restores inheritance. “Unset” is not zero. Other properties can use different inheritance chains, so read their effective data after changes.* ## **Get Effective Text Properties** Text formatting is split across several objects: - [ITextFrameFormat::GetEffective](https://reference.aspose.com/slides/cpp/aspose.slides/itextframeformat/) resolves text-frame properties such as margins, anchoring, autofit, and vertical text direction. - [ITextStyle::GetEffective](https://reference.aspose.com/slides/cpp/aspose.slides/itextstyle/) resolves paragraph formatting for each text style level. - [IParagraphFormat::GetEffective](https://reference.aspose.com/slides/cpp/aspose.slides/iparagraphformat/) resolves paragraph properties such as alignment, indentation, and bullets. - [IPortionFormat::GetEffective](https://reference.aspose.com/slides/cpp/aspose.slides/iportionformat/) resolves character properties such as font height, typeface, color, bold, and italic. For the next example, `text-formatting.pptx` must contain at least one slide and one [IAutoShape](https://reference.aspose.com/slides/cpp/aspose.slides/iautoshape/) with a non-empty text frame. The IAutoShape can appear at any position in the shape collection; the code searches for a suitable object and validates it before use. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto presentation = System::MakeObject(u"text-formatting.pptx"); if (presentation->get_Slides()->get_Count() == 0) throw System::InvalidOperationException(u"The presentation contains no slides."); auto slide = presentation->get_Slide(0); System::SharedPtr shape; for (int shapeIndex = 0; shapeIndex < slide->get_Shapes()->get_Count(); ++shapeIndex) { auto candidate = slide->get_Shapes()->idx_get(shapeIndex); if (!System::ObjectExt::Is(candidate)) continue; auto autoShape = System::ExplicitCast(candidate); auto candidateTextFrame = autoShape->get_TextFrame(); if (candidateTextFrame == nullptr || candidateTextFrame->get_Paragraphs()->get_Count() == 0) continue; if (candidateTextFrame->get_Paragraph(0)->get_Portions()->get_Count() == 0) continue; shape = autoShape; break; } if (shape == nullptr) throw System::InvalidOperationException(u"The first slide must contain an IAutoShape with non-empty text."); auto textFrame = shape->get_TextFrame(); auto paragraph = textFrame->get_Paragraph(0); auto portion = paragraph->get_Portion(0); auto textFrameEffective = textFrame->get_TextFrameFormat()->GetEffective(); auto paragraphEffective = paragraph->get_ParagraphFormat()->GetEffective(); auto portionEffective = portion->get_PortionFormat()->GetEffective(); System::Console::WriteLine(u"Text frame margins:"); System::Console::WriteLine(System::String(u" Left: ") + textFrameEffective->get_MarginLeft()); System::Console::WriteLine(System::String(u" Top: ") + textFrameEffective->get_MarginTop()); System::Console::WriteLine(System::String(u" Right: ") + textFrameEffective->get_MarginRight()); System::Console::WriteLine(System::String(u" Bottom: ") + textFrameEffective->get_MarginBottom()); System::Console::WriteLine(System::String(u"Paragraph alignment: ") + System::ObjectExt::ToString(paragraphEffective->get_Alignment())); System::Console::WriteLine(System::String(u"Font height: ") + portionEffective->get_FontHeight()); System::Console::WriteLine(System::String(u"Bold: ") + System::ObjectExt::ToString(portionEffective->get_FontBold())); auto effectiveTextStyle = textFrame->get_TextFrameFormat()->get_TextStyle()->GetEffective(); for (int level = 0; level < 9; ++level) { auto levelEffective = effectiveTextStyle->GetLevel(level); System::Console::WriteLine(System::String(u"Level ") + level + u" indent: " + levelEffective->get_Indent()); } presentation->Dispose(); ``` ## **Get Effective 3D Properties** [IThreeDFormat::GetEffective](https://reference.aspose.com/slides/cpp/aspose.slides/ithreedformat/) returns one [IThreeDFormatEffectiveData](https://reference.aspose.com/slides/cpp/aspose.slides/ithreedformateffectivedata/) object that groups all resolved 3D settings. Its [camera](https://reference.aspose.com/slides/cpp/aspose.slides/icameraeffectivedata/), [light rig](https://reference.aspose.com/slides/cpp/aspose.slides/ilightrigeffectivedata/), [top bevel](https://reference.aspose.com/slides/cpp/aspose.slides/ishapebeveleffectivedata/), and [bottom bevel](https://reference.aspose.com/slides/cpp/aspose.slides/ishapebeveleffectivedata/) data expose the corresponding effective settings. Reading these related settings together makes it easier to understand the final 3D appearance of a shape. For this example, `shape-3d.pptx` must contain at least one shape on its first slide. Apply 3D camera, lighting, or bevel settings to that shape if you want the output to contain values other than the defaults. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto presentation = System::MakeObject(u"shape-3d.pptx"); if (presentation->get_Slides()->get_Count() == 0 || presentation->get_Slide(0)->get_Shapes()->get_Count() == 0) throw System::InvalidOperationException(u"The first slide must contain a shape."); auto shape = presentation->get_Slide(0)->get_Shape(0); auto threeDEffective = shape->get_ThreeDFormat()->GetEffective(); System::Console::WriteLine(u"Camera:"); System::Console::WriteLine(System::String(u" Type: ") + System::ObjectExt::ToString(threeDEffective->get_Camera()->get_CameraType())); System::Console::WriteLine(System::String(u" Field of view: ") + threeDEffective->get_Camera()->get_FieldOfViewAngle()); System::Console::WriteLine(System::String(u" Zoom: ") + threeDEffective->get_Camera()->get_Zoom()); System::Console::WriteLine(u"Light rig:"); System::Console::WriteLine(System::String(u" Type: ") + System::ObjectExt::ToString(threeDEffective->get_LightRig()->get_LightType())); System::Console::WriteLine(System::String(u" Direction: ") + System::ObjectExt::ToString(threeDEffective->get_LightRig()->get_Direction())); System::Console::WriteLine(u"Top bevel:"); System::Console::WriteLine(System::String(u" Type: ") + System::ObjectExt::ToString(threeDEffective->get_BevelTop()->get_BevelType())); System::Console::WriteLine(System::String(u" Width: ") + threeDEffective->get_BevelTop()->get_Width()); System::Console::WriteLine(System::String(u" Height: ") + threeDEffective->get_BevelTop()->get_Height()); presentation->Dispose(); ``` ## **Get Effective Table Formatting** Table formatting can come from the table style and from formats applied to the whole table, a column, a row, or an individual cell. For conflicts among explicitly defined fills, the priority is cell, row, column, and then whole table. The effective format of a cell is the final format used to draw that cell. For this example, `table-formatting.pptx` must contain at least one table on its first slide. The table must have at least one row and one column. The code searches for an [ITable](https://reference.aspose.com/slides/cpp/aspose.slides/itable/) instead of assuming that the first shape is a table. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto presentation = System::MakeObject(u"table-formatting.pptx"); if (presentation->get_Slides()->get_Count() == 0) throw System::InvalidOperationException(u"The presentation contains no slides."); auto slide = presentation->get_Slide(0); System::SharedPtr table; for (int shapeIndex = 0; shapeIndex < slide->get_Shapes()->get_Count(); ++shapeIndex) { auto candidate = slide->get_Shapes()->idx_get(shapeIndex); if (System::ObjectExt::Is(candidate)) { table = System::ExplicitCast(candidate); break; } } if (table == nullptr) throw System::InvalidOperationException(u"The first slide must contain a table."); if (table->get_Rows()->get_Count() == 0 || table->get_Columns()->get_Count() == 0) throw System::InvalidOperationException(u"The table must contain at least one cell."); auto tableEffective = table->get_TableFormat()->GetEffective(); auto rowEffective = table->get_Row(0)->get_RowFormat()->GetEffective(); auto columnEffective = table->get_Column(0)->get_ColumnFormat()->GetEffective(); auto cellEffective = table->idx_get(0, 0)->get_CellFormat()->GetEffective(); System::Console::WriteLine(System::String(u"Table fill: ") + System::ObjectExt::ToString(tableEffective->get_FillFormat()->get_FillType())); System::Console::WriteLine(System::String(u"Row fill: ") + System::ObjectExt::ToString(rowEffective->get_FillFormat()->get_FillType())); System::Console::WriteLine(System::String(u"Column fill: ") + System::ObjectExt::ToString(columnEffective->get_FillFormat()->get_FillType())); System::Console::WriteLine(System::String(u"Final cell fill: ") + System::ObjectExt::ToString(cellEffective->get_FillFormat()->get_FillType())); presentation->Dispose(); ``` If you need the color rather than only the fill type, first check the effective [FillType](https://reference.aspose.com/slides/cpp/aspose.slides/ifillformateffectivedata/), and then read the property that applies to that type—for example, [SolidFillColor](https://reference.aspose.com/slides/cpp/aspose.slides/ifillformateffectivedata/) for a solid fill. ## **Re-read Effective Data After Changes** Effective data describes the formatting hierarchy at the time it is resolved. Call `GetEffective` again after changing anything that can participate in that hierarchy, including: - the object's local formatting; - paragraph or text-frame defaults; - a table style, table, column, row, or cell format; - layout or master slide formatting; - theme data or presentation-level defaults; - the layout or master assigned to a slide. Do not keep an effective data object as a permanent snapshot. Aspose.Slides may cache some effective data internally, and a later `GetEffective` call can refresh that data. If you need to compare values before and after a change, copy the scalar values you need—such as a font height, color, alignment, or bevel width—into your own variables before making the change. To change a value, update the appropriate local format object and then call `GetEffective` to verify the result. Effective data objects themselves are read-only. ## **FAQ** **How can I tell which level supplied an effective value?** Effective data contains the final value, not its source. Inspect the applicable local objects from the most specific level outward. For text, this can include the portion, paragraph, text frame, layout, master, theme, and presentation defaults. Undefined values such as `std::numeric_limits::quiet_NaN()` or `nullptr` indicate that the search continues to another level. **What happens when no level defines a property?** Aspose.Slides resolves the appropriate PowerPoint or library default. That resolved value appears in the effective data even though no local object explicitly defines it. **Why does an effective value sometimes equal the local value?** The local value won the inheritance calculation. This is expected when the property is explicitly set on the object and no more specific rule overrides it. **When should I use local data instead of effective data?** Use local data to inspect or edit a specific formatting level. Use effective data when you need the final appearance after inheritance, theme rules, and applicable styles have been resolved. The [complete comparison example](https://docs.aspose.com/slides/cpp/shape-effective-properties/#compare-local-inherited-and-effective-values) demonstrates both in the same workflow. # Format PowerPoint Shapes in C++ > Learn how to format PowerPoint shapes in C++ using Aspose.Slides—set fill, line, and effect styles for PPT and PPTX files with precision and full control. Source: https://docs.aspose.com/slides/cpp/shape-formatting/ Updated: 2026-11-05 ## **Introduction** Format shapes in PowerPoint by adjusting their outlines, fills, and effects. Aspose.Slides for C++ lets you control these settings programmatically, including transparency, rotation, and 3D formatting. ![Shape formatting options in PowerPoint](https://docs.aspose.com/slides/cpp/shape-formatting/format-shape-powerpoint.png) Aspose.Slides for C++ provides interfaces and methods that allow you to format shapes using the same options available in PowerPoint. ## **Format Lines** Use [IShape::get_LineFormat](https://reference.aspose.com/slides/cpp/aspose.slides/ishape/get_lineformat/) to control a shape’s outline. This example creates an unfilled rectangle with a blue, dashed outline. [ILineFormat::set_Style](https://reference.aspose.com/slides/cpp/aspose.slides/ilineformat/set_style/) selects a thick-thin compound line, while [ILineFormat::set_Width](https://reference.aspose.com/slides/cpp/aspose.slides/ilineformat/set_width/) sets its width to 7 points and [ILineFormat::set_DashStyle](https://reference.aspose.com/slides/cpp/aspose.slides/ilineformat/set_dashstyle/) selects the dash pattern. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; using namespace Aspose::Slides::Export; using namespace System::Drawing; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 50, 50, 150, 75); shape->get_FillFormat()->set_FillType(FillType::NoFill); shape->get_LineFormat()->set_Style(LineStyle::ThickThin); shape->get_LineFormat()->set_Width(7); shape->get_LineFormat()->set_DashStyle(LineDashStyle::Dash); shape->get_LineFormat()->get_FillFormat()->set_FillType(FillType::Solid); shape->get_LineFormat()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Blue()); presentation->Save(u"formatted_lines.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` The result: ![The formatted lines in the presentation](https://docs.aspose.com/slides/cpp/shape-formatting/formatted-lines.png) ### **Set Custom Line Dash Patterns** Use [ILineFormat::set_CustomDashPattern](https://reference.aspose.com/slides/cpp/aspose.slides/ilineformat/set_customdashpattern/) when predefined line styles do not provide the dash lengths and gaps you need, for example for branded outlines or technical diagrams. Assigning a pattern automatically changes the dash style to [LineDashStyle::Custom](https://reference.aspose.com/slides/cpp/aspose.slides/linedashstyle/). Array entries alternate between dash and gap lengths, starting with a dash. Each value is a multiple of the line width: `{ 4, 2 }` at a width of 3 points produces a 12-point dash followed by a 6-point gap. Use pairs of finite, nonnegative values to define complete dash-and-gap segments. The example uses positive values to keep every dash and gap visible. This example creates five blue lines with the same length and flat caps. The first three compare patterns at a width of 3 points. The fourth repeats the first pattern at twice the width, doubling both the dash and gap lengths. The fifth switches from a custom pattern to a solid line. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::Drawing; auto presentation = MakeObject(); presentation->get_SlideSize()->SetSize(600, 300, SlideSizeScaleType::DoNotScale); auto slide = presentation->get_Slide(0); const auto patterns = std::array, 5>{ MakeArray({ 4, 2 }), MakeArray({ 1, 2 }), MakeArray({ 6, 2, 1, 2 }), MakeArray({ 4, 2 }), MakeArray({ 4, 2 }) }; for (auto i = 0; i < patterns.size(); i++) { auto line = slide->get_Shapes()->AddAutoShape(ShapeType::Line, 50, 50 + i * 50, 500, 0); line->get_LineFormat()->set_Width(i == 3 ? 6 : 3); line->get_LineFormat()->get_FillFormat()->set_FillType(FillType::Solid); line->get_LineFormat()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_DarkBlue()); line->get_LineFormat()->set_CapStyle(LineCapStyle::Flat); line->get_LineFormat()->set_BeginArrowheadStyle(LineArrowheadStyle::None); line->get_LineFormat()->set_EndArrowheadStyle(LineArrowheadStyle::None); line->get_LineFormat()->set_CustomDashPattern(patterns[i]); } // Return the last line to a solid style. slide->get_Shape(4)->get_LineFormat()->set_DashStyle(LineDashStyle::Solid); presentation->Save(u"custom_dash_patterns.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` To return to a predefined dashed style instead, pass [LineDashStyle::Dash](https://reference.aspose.com/slides/cpp/aspose.slides/linedashstyle/) to [ILineFormat::set_DashStyle](https://reference.aspose.com/slides/cpp/aspose.slides/ilineformat/set_dashstyle/). The selected style controls the line's appearance. The result in PowerPoint, from top to bottom: **{4, 2}, 3 pt**; **{1, 2}, 3 pt**; **{6, 2, 1, 2}, 3 pt**; **{4, 2}, 6 pt**; and **Solid, 3 pt**. ![Three custom dash patterns, a wider line using the first pattern, and a solid line in PowerPoint](https://docs.aspose.com/slides/cpp/shape-formatting/custom-dash-patterns.png) ### **Set Line Caps** Use [ILineFormat::set_CapStyle](https://reference.aspose.com/slides/cpp/aspose.slides/ilineformat/set_capstyle/) to set the ends of an open line. The [LineCapStyle](https://reference.aspose.com/slides/cpp/aspose.slides/linecapstyle/) enumeration provides three explicit cap styles: - `Flat`: The stroke stops at the endpoint. - `Round`: A semicircular cap extends beyond the endpoint by half the line width. - `Square`: A square cap extends beyond the endpoint by half the line width. The enumeration also includes `NotDefined`, which means that no cap style is explicitly assigned. Caps are different from arrowheads, which add symbols to line ends, and joins, which control corners between line segments. This example disables arrowheads through [ILineFormat::set_BeginArrowheadStyle](https://reference.aspose.com/slides/cpp/aspose.slides/ilineformat/set_beginarrowheadstyle/) and [ILineFormat::set_EndArrowheadStyle](https://reference.aspose.com/slides/cpp/aspose.slides/ilineformat/set_endarrowheadstyle/) so that only the cap shapes are compared. The following example creates three otherwise identical horizontal lines, 20 points wide. From top to bottom, they use flat, round, and square caps. Their endpoints have the same horizontal coordinates; the round and square caps extend 10 points beyond each endpoint. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::Drawing; auto presentation = MakeObject(); presentation->get_SlideSize()->SetSize(500, 240, SlideSizeScaleType::DoNotScale); auto slide = presentation->get_Slide(0); const auto capStyles = std::array{ LineCapStyle::Flat, LineCapStyle::Round, LineCapStyle::Square }; for (auto i = 0; i < capStyles.size(); i++) { auto line = slide->get_Shapes()->AddAutoShape(ShapeType::Line, 100, 50 + i * 70, 300, 0); line->get_LineFormat()->set_Width(20); line->get_LineFormat()->get_FillFormat()->set_FillType(FillType::Solid); line->get_LineFormat()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_DarkBlue()); line->get_LineFormat()->set_DashStyle(LineDashStyle::Solid); line->get_LineFormat()->set_CapStyle(capStyles[i]); line->get_LineFormat()->set_BeginArrowheadStyle(LineArrowheadStyle::None); line->get_LineFormat()->set_EndArrowheadStyle(LineArrowheadStyle::None); } presentation->Save(u"line_caps.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` The result in PowerPoint, from top to bottom: **Flat**, **Round**, and **Square**. ![Flat, round, and square caps on identical thick lines in PowerPoint](https://docs.aspose.com/slides/cpp/shape-formatting/line-caps.png) ## **Apply Sketch Effects to Shape Lines** A sketch effect makes a shape line look hand-drawn. Use [IShape::get_LineFormat](https://reference.aspose.com/slides/cpp/aspose.slides/ishape/get_lineformat/) to access the line settings, [ILineFormat::get_SketchFormat](https://reference.aspose.com/slides/cpp/aspose.slides/ilineformat/get_sketchformat/) to access the sketch settings, and [ISketchFormat::set_SketchType](https://reference.aspose.com/slides/cpp/aspose.slides/isketchformat/set_sketchtype/) to select a value from the [LineSketchType](https://reference.aspose.com/slides/cpp/aspose.slides/linesketchtype/) enumeration. The following C++ code shows how to apply a [LineSketchType::Curved](https://reference.aspose.com/slides/cpp/aspose.slides/linesketchtype/) effect, read the explicitly assigned value, and remove the effect with [LineSketchType::None](https://reference.aspose.com/slides/cpp/aspose.slides/linesketchtype/): ```cpp #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 50, 50, 200, 100); auto sketchFormat = shape->get_LineFormat()->get_SketchFormat(); sketchFormat->set_SketchType(LineSketchType::Curved); auto explicitSketchType = sketchFormat->get_SketchType(); Console::WriteLine(u"Explicit sketch type: {0}", explicitSketchType); sketchFormat->set_SketchType(LineSketchType::None); presentation->Dispose(); ``` The value returned by [ISketchFormat::get_SketchType](https://reference.aspose.com/slides/cpp/aspose.slides/isketchformat/get_sketchtype/) represents the setting assigned directly to the shape. If the line formatting can be inherited from a theme, master slide, or layout slide, use [ILineFormat::GetEffective](https://reference.aspose.com/slides/cpp/aspose.slides/ilineformat/geteffective/), access [ILineFormatEffectiveData::get_SketchFormat](https://reference.aspose.com/slides/cpp/aspose.slides/ilineformateffectivedata/get_sketchformat/), and read [ISketchFormatEffectiveData::get_SketchType](https://reference.aspose.com/slides/cpp/aspose.slides/isketchformateffectivedata/get_sketchtype/). The effective value reflects the formatting that is actually applied after inheritance is resolved. This example requires an existing presentation with at least one shape on its first slide and prints both values: ```cpp #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto presentation = MakeObject(u"presentation.pptx"); auto shape = presentation->get_Slide(0)->get_Shape(0); auto lineFormat = shape->get_LineFormat(); auto explicitSketchType = lineFormat->get_SketchFormat()->get_SketchType(); auto effectiveLineFormat = lineFormat->GetEffective(); auto effectiveSketchType = effectiveLineFormat->get_SketchFormat()->get_SketchType(); Console::WriteLine(u"Explicit sketch type: {0}", explicitSketchType); Console::WriteLine(u"Effective sketch type: {0}", effectiveSketchType); presentation->Dispose(); ``` ## **Format Join Styles** Here are the three join type options: * Round * Miter * Bevel The join style controls how two outline segments meet at a corner. Use **Round** for rounded corners, **Miter** for sharp corners, or **Bevel** for flattened corners. ![The join style in the presentation](https://docs.aspose.com/slides/cpp/shape-formatting/join-style-powerpoint.png) This example creates three black rectangles with blue outlines 15 points wide. It sets [ILineFormat::set_JoinStyle](https://reference.aspose.com/slides/cpp/aspose.slides/ilineformat/set_joinstyle/) to the miter, bevel, and round values of [LineJoinStyle](https://reference.aspose.com/slides/cpp/aspose.slides/linejoinstyle/), respectively, to compare how the corners are drawn. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; using namespace Aspose::Slides::Export; using namespace System::Drawing; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto miterShape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 20, 20, 150, 75); auto bevelShape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 210, 20, 150, 75); auto roundShape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 20, 135, 150, 75); miterShape->get_FillFormat()->set_FillType(FillType::Solid); miterShape->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Black()); bevelShape->get_FillFormat()->set_FillType(FillType::Solid); bevelShape->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Black()); roundShape->get_FillFormat()->set_FillType(FillType::Solid); roundShape->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Black()); miterShape->get_LineFormat()->set_Width(15); bevelShape->get_LineFormat()->set_Width(15); roundShape->get_LineFormat()->set_Width(15); miterShape->get_LineFormat()->get_FillFormat()->set_FillType(FillType::Solid); miterShape->get_LineFormat()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Blue()); bevelShape->get_LineFormat()->get_FillFormat()->set_FillType(FillType::Solid); bevelShape->get_LineFormat()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Blue()); roundShape->get_LineFormat()->get_FillFormat()->set_FillType(FillType::Solid); roundShape->get_LineFormat()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Blue()); miterShape->get_LineFormat()->set_JoinStyle(LineJoinStyle::Miter); bevelShape->get_LineFormat()->set_JoinStyle(LineJoinStyle::Bevel); roundShape->get_LineFormat()->set_JoinStyle(LineJoinStyle::Round); miterShape->get_TextFrame()->set_Text(u"Miter Join Style"); bevelShape->get_TextFrame()->set_Text(u"Bevel Join Style"); roundShape->get_TextFrame()->set_Text(u"Round Join Style"); presentation->Save(u"join_styles.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ### **Limit Miter Joins at Sharp Corners** Use [ILineFormat::set_MiterLimit](https://reference.aspose.com/slides/cpp/aspose.slides/ilineformat/set_miterlimit/) with [ILineFormat::set_JoinStyle](https://reference.aspose.com/slides/cpp/aspose.slides/ilineformat/set_joinstyle/) set to [LineJoinStyle::Miter](https://reference.aspose.com/slides/cpp/aspose.slides/linejoinstyle/) to limit how far a sharp corner can extend. The limit is a ratio of the distance between the inner and outer corners of the join to the line width. For example, a value of `8` permits a miter length of up to eight times the line width; it is not a measurement in points. If the corner would exceed the limit, PowerPoint uses a beveled join at that corner. A larger limit allows sharper points. The setting affects miter joins only, and changing it has no visible effect when the corner remains within both limits. This example creates two identical, unfilled triangles with outlines 20 points wide. The left triangle uses a limit of `2`, and the right uses `8`. Each triangle is 80 points wide and 160 points high, giving its top corner a miter-length-to-line-width ratio of approximately `4.12`. Consequently, PowerPoint bevels the left apex and preserves the right apex. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::Drawing; auto presentation = MakeObject(); presentation->get_SlideSize()->SetSize(500, 320, SlideSizeScaleType::DoNotScale); auto slide = presentation->get_Slide(0); const auto miterLimits = std::array{ 2.0f, 8.0f }; for (auto i = 0; i < miterLimits.size(); i++) { auto triangle = slide->get_Shapes()->AddAutoShape(ShapeType::Triangle, 90 + i * 240, 110, 80, 160); triangle->get_FillFormat()->set_FillType(FillType::NoFill); triangle->get_LineFormat()->set_Width(20); triangle->get_LineFormat()->get_FillFormat()->set_FillType(FillType::Solid); triangle->get_LineFormat()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_DarkBlue()); triangle->get_LineFormat()->set_JoinStyle(LineJoinStyle::Miter); triangle->get_LineFormat()->set_MiterLimit(miterLimits[i]); } presentation->Save(u"miter_limits.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` The result in PowerPoint: **Miter limit 2** on the left and **miter limit 8** on the right. ![A beveled apex with miter limit 2 and a pointed apex with miter limit 8 in PowerPoint](https://docs.aspose.com/slides/cpp/shape-formatting/miter-limits.png) ## **Gradient Fill** A gradient fill blends colors across a shape. This example fills an ellipse with a linear gradient at a 45-degree angle from red to purple using [IFillFormat::get_GradientFormat](https://reference.aspose.com/slides/cpp/aspose.slides/ifillformat/get_gradientformat/). The [IGradientStopCollection::Add](https://reference.aspose.com/slides/cpp/aspose.slides/igradientstopcollection/add/) method places the color stops at 0 and 1, the beginning and end of the gradient. Clearing the existing stops ensures that only these two colors are used. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; using namespace Aspose::Slides::Export; using namespace System::Drawing; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Ellipse, 50, 50, 150, 75); shape->get_FillFormat()->set_FillType(FillType::Gradient); shape->get_FillFormat()->get_GradientFormat()->set_GradientShape(GradientShape::Linear); shape->get_FillFormat()->get_GradientFormat()->set_LinearGradientAngle(45); shape->get_FillFormat()->get_GradientFormat()->get_GradientStops()->Clear(); shape->get_FillFormat()->get_GradientFormat()->get_GradientStops()->Add(1.0f, PresetColor::Purple); shape->get_FillFormat()->get_GradientFormat()->get_GradientStops()->Add(0.0f, PresetColor::Red); presentation->Save(u"gradient_fill.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` The result: ![The ellipse with gradient fill](https://docs.aspose.com/slides/cpp/shape-formatting/gradient-fill.png) If a gradient looks different in an exported image than it does in PowerPoint, see [Choose a Gradient Rendering Style](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-png/#choose-a-gradient-rendering-style). You can select a rendering style without changing the gradient fill stored in the presentation. ### **Set the Linear Gradient Angle** Use [IGradientFormat::set_LinearGradientAngle](https://reference.aspose.com/slides/cpp/aspose.slides/igradientformat/set_lineargradientangle/) to control the orientation of a [GradientShape::Linear](https://reference.aspose.com/slides/cpp/aspose.slides/gradientshape/) fill. The angle is measured in degrees and increases clockwise: `0` runs from left to right, `90` from top to bottom, `180` from right to left, and `270` from bottom to top. Fractional angles are supported. Finite angles outside `[0, 360)` are normalized to one revolution; for example, `-45` becomes `315` and `360` becomes `0`. This example creates six rectangles with identical red, green, and blue stops at positions `0`, `0.5`, and `1`. Scaling is disabled so that the angle can be compared independently of the rectangles' proportions. The angles, from left to right, are `0`, `45`, and `90` in the first row, and `135`, `180`, and `270` in the second row. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::Drawing; auto presentation = MakeObject(); presentation->get_SlideSize()->SetSize(720, 400, SlideSizeScaleType::DoNotScale); auto slide = presentation->get_Slide(0); const auto angles = std::array{ 0, 45, 90, 135, 180, 270 }; for (auto i = 0; i < angles.size(); i++) { auto x = 30 + (i % 3) * 230; auto y = 30 + (i / 3) * 190; auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, x, y, 200, 150); shape->get_LineFormat()->get_FillFormat()->set_FillType(FillType::NoFill); shape->get_FillFormat()->set_FillType(FillType::Gradient); auto gradient = shape->get_FillFormat()->get_GradientFormat(); gradient->set_GradientShape(GradientShape::Linear); gradient->get_GradientStops()->Clear(); gradient->get_GradientStops()->Add(0.0f, Color::get_Red()); gradient->get_GradientStops()->Add(0.5f, Color::get_Lime()); gradient->get_GradientStops()->Add(1.0f, Color::get_Blue()); gradient->set_LinearGradientScaled(NullableBool::False); gradient->set_LinearGradientAngle(angles[i]); } presentation->Save(u"linear_gradient_angles.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` The result in PowerPoint: ![Linear gradients at 0, 45, and 90 degrees in the top row, and 135, 180, and 270 degrees in the bottom row](https://docs.aspose.com/slides/cpp/shape-formatting/linear-gradient-angles.png) ### **Scale a Linear Gradient with the Shape** [IGradientFormat::set_LinearGradientScaled](https://reference.aspose.com/slides/cpp/aspose.slides/igradientformat/set_lineargradientscaled/) accepts a [NullableBool](https://reference.aspose.com/slides/cpp/aspose.slides/nullablebool/) value. Set it explicitly to `False` to keep the geometric gradient angle as the shape's proportions change, or to `True` to scale the gradient with the shape's width and height. With scaling enabled, the visible angle can differ from the assigned angle on a non-square shape. The following example uses a `45`-degree angle and the same color stops as the angle comparison. The left column uses `False`; the right column uses `True`. Each column contains a wide rectangle above a tall rectangle. Both start with the same wide dimensions; changing the second rectangle's width and height demonstrates how the fill responds to resizing without changing its gradient settings. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::Drawing; auto presentation = MakeObject(); presentation->get_SlideSize()->SetSize(720, 460, SlideSizeScaleType::DoNotScale); auto slide = presentation->get_Slide(0); const auto scalingOptions = std::array{ NullableBool::False, NullableBool::True }; for (auto column = 0; column < scalingOptions.size(); column++) { for (auto row = 0; row < 2; row++) { auto x = 30 + column * 360; auto y = row == 0 ? 30 : 150; auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, x, y, 300, 90); shape->get_LineFormat()->get_FillFormat()->set_FillType(FillType::NoFill); shape->get_FillFormat()->set_FillType(FillType::Gradient); auto gradient = shape->get_FillFormat()->get_GradientFormat(); gradient->set_GradientShape(GradientShape::Linear); gradient->get_GradientStops()->Clear(); gradient->get_GradientStops()->Add(0.0f, Color::get_Red()); gradient->get_GradientStops()->Add(0.5f, Color::get_Lime()); gradient->get_GradientStops()->Add(1.0f, Color::get_Blue()); gradient->set_LinearGradientAngle(45); gradient->set_LinearGradientScaled(scalingOptions[column]); if (row == 1) { shape->set_Width(90); shape->set_Height(280); } } } presentation->Save(u"linear_gradient_scaling.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` The result in PowerPoint, with scaling disabled on the left and enabled on the right: ![Wide and tall rectangles with a 45-degree gradient, comparing LinearGradientScaled False on the left with True on the right](https://docs.aspose.com/slides/cpp/shape-formatting/linear-gradient-scaling.png) With scaling disabled, the diagonal color bands keep the same orientation in both rectangles. With scaling enabled, the bands stretch with the shape's proportions. This helps reproduce a template's gradient when adapting a shape to a different size. On a square, enabling scaling does not change the appearance of this `45`-degree gradient. Both the angle and scaling settings apply to linear gradients. They do not control [GradientShape::Radial or GradientShape::Rectangle](https://reference.aspose.com/slides/cpp/aspose.slides/gradientshape/) fills. ### **Combine the Angle with Gradient Direction** [IGradientFormat::set_GradientDirection](https://reference.aspose.com/slides/cpp/aspose.slides/igradientformat/set_gradientdirection/) selects a gradient style from the [GradientDirection](https://reference.aspose.com/slides/cpp/aspose.slides/gradientdirection/) enumeration; it is not a substitute for a numeric angle. For a linear gradient, the corner styles can change the area over which the colors are distributed without changing the angle assigned through [IGradientFormat::set_LinearGradientAngle](https://reference.aspose.com/slides/cpp/aspose.slides/igradientformat/set_lineargradientangle/). Keep the direction unchanged when comparing angles or scaling. The following example applies the same settings in opposite orders. The two rectangles have the same appearance: assigning the direction before or after the angle does not change the result. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::Drawing; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); for (auto i = 0; i < 2; i++) { auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 30, 30 + i * 140, 320, 100); shape->get_LineFormat()->get_FillFormat()->set_FillType(FillType::NoFill); shape->get_FillFormat()->set_FillType(FillType::Gradient); auto gradient = shape->get_FillFormat()->get_GradientFormat(); gradient->set_GradientShape(GradientShape::Linear); gradient->get_GradientStops()->Clear(); gradient->get_GradientStops()->Add(0.0f, Color::get_Red()); gradient->get_GradientStops()->Add(0.5f, Color::get_Lime()); gradient->get_GradientStops()->Add(1.0f, Color::get_Blue()); gradient->set_LinearGradientScaled(NullableBool::True); if (i == 0) { gradient->set_GradientDirection(GradientDirection::FromCorner1); gradient->set_LinearGradientAngle(30); } else { gradient->set_LinearGradientAngle(30); gradient->set_GradientDirection(GradientDirection::FromCorner1); } } presentation->Save(u"linear_gradient_direction.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ## **Pattern Fill** A pattern fill applies a two-color design, such as dots, stripes, or checks. This example uses [IPatternFormat::set_PatternStyle](https://reference.aspose.com/slides/cpp/aspose.slides/ipatternformat/set_patternstyle/) to select a trellis pattern. [IPatternFormat::get_BackColor](https://reference.aspose.com/slides/cpp/aspose.slides/ipatternformat/get_backcolor/) supplies the light gray background, and [IPatternFormat::get_ForeColor](https://reference.aspose.com/slides/cpp/aspose.slides/ipatternformat/get_forecolor/) supplies the yellow pattern color. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; using namespace Aspose::Slides::Export; using namespace System::Drawing; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 50, 50, 150, 75); shape->get_FillFormat()->set_FillType(FillType::Pattern); shape->get_FillFormat()->get_PatternFormat()->set_PatternStyle(PatternStyle::Trellis); shape->get_FillFormat()->get_PatternFormat()->get_BackColor()->set_Color(Color::get_LightGray()); shape->get_FillFormat()->get_PatternFormat()->get_ForeColor()->set_Color(Color::get_Yellow()); presentation->Save(u"pattern_fill.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` The result: ![The rectangle with pattern fill](https://docs.aspose.com/slides/cpp/shape-formatting/pattern-fill.png) ## **Picture Fill** A picture fill uses an image inside a shape. This example requires a local image and uses [Images::FromFile](https://reference.aspose.com/slides/cpp/aspose.slides/images/fromfile/) to load it into the presentation’s image collection. Setting [IPictureFillFormat::set_PictureFillMode](https://reference.aspose.com/slides/cpp/aspose.slides/ipicturefillformat/set_picturefillmode/) to the tiled mode repeats the image within the rectangle. The source image used here is shown below: ![The lotus picture](https://docs.aspose.com/slides/cpp/shape-formatting/lotus.png) ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; using namespace Aspose::Slides::Export; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 50, 50, 255, 130); shape->get_FillFormat()->set_FillType(FillType::Picture); shape->get_FillFormat()->get_PictureFillFormat()->set_PictureFillMode(PictureFillMode::Tile); auto image = Images::FromFile(u"lotus.png"); auto presentationImage = presentation->get_Images()->AddImage(image); shape->get_FillFormat()->get_PictureFillFormat()->get_Picture()->set_Image(presentationImage); presentation->Save(u"picture_fill.pptx", SaveFormat::Pptx); image->Dispose(); presentation->Dispose(); ``` The result: ![The shape with picture fill](https://docs.aspose.com/slides/cpp/shape-formatting/picture-fill.png) ### **Tile Picture As Texture** If you want to set a tiled picture as a texture and customize the tiling behavior, you can use the following methods of the [IPictureFillFormat](https://reference.aspose.com/slides/cpp/aspose.slides/ipicturefillformat/) interface and [PictureFillFormat](https://reference.aspose.com/slides/cpp/aspose.slides/picturefillformat/) class: - [set_PictureFillMode](https://reference.aspose.com/slides/cpp/aspose.slides/ipicturefillformat/set_picturefillmode/): Sets the picture fill mode—either `Tile` or `Stretch`. - [set_TileAlignment](https://reference.aspose.com/slides/cpp/aspose.slides/ipicturefillformat/set_tilealignment/): Specifies the alignment of the tiles within the shape. - [set_TileFlip](https://reference.aspose.com/slides/cpp/aspose.slides/ipicturefillformat/set_tileflip/): Controls whether the tile is flipped horizontally, vertically, or both. - [set_TileOffsetX](https://reference.aspose.com/slides/cpp/aspose.slides/ipicturefillformat/set_tileoffsetx/): Sets the horizontal offset of the tile (in points) from the shape’s origin. - [set_TileOffsetY](https://reference.aspose.com/slides/cpp/aspose.slides/ipicturefillformat/set_tileoffsety/): Sets the vertical offset of the tile (in points) from the shape’s origin. - [set_TileScaleX](https://reference.aspose.com/slides/cpp/aspose.slides/ipicturefillformat/set_tilescalex/): Defines the horizontal scale of the tile as a percentage. - [set_TileScaleY](https://reference.aspose.com/slides/cpp/aspose.slides/ipicturefillformat/set_tilescaley/): Defines the vertical scale of the tile as a percentage. This example requires a local image and configures [IPictureFillFormat](https://reference.aspose.com/slides/cpp/aspose.slides/ipicturefillformat/) to repeat it at 50% of its original size. Offsets of −32 points shift the tiles horizontally and vertically; bottom-right alignment and flipping in both directions determine how the repeated texture is arranged. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; using namespace Aspose::Slides::Export; auto presentation = MakeObject(); auto firstSlide = presentation->get_Slide(0); auto shape = firstSlide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 50, 50, 190, 95); shape->get_FillFormat()->set_FillType(FillType::Picture); auto sourceImage = Images::FromFile(u"lotus.png"); auto presentationImage = presentation->get_Images()->AddImage(sourceImage); auto pictureFillFormat = shape->get_FillFormat()->get_PictureFillFormat(); pictureFillFormat->get_Picture()->set_Image(presentationImage); pictureFillFormat->set_PictureFillMode(PictureFillMode::Tile); pictureFillFormat->set_TileOffsetX(-32); pictureFillFormat->set_TileOffsetY(-32); pictureFillFormat->set_TileScaleX(50); pictureFillFormat->set_TileScaleY(50); pictureFillFormat->set_TileAlignment(RectangleAlignment::BottomRight); pictureFillFormat->set_TileFlip(TileFlip::FlipBoth); presentation->Save(u"tile.pptx", SaveFormat::Pptx); sourceImage->Dispose(); presentation->Dispose(); ``` The result: ![The tile options](https://docs.aspose.com/slides/cpp/shape-formatting/tile-options.png) ## **Solid Color Fill** A solid fill gives a shape a single, uniform color. This example sets [IFillFormat::set_FillType](https://reference.aspose.com/slides/cpp/aspose.slides/ifillformat/set_filltype/) to the solid fill mode and assigns yellow through [IFillFormat::get_SolidFillColor](https://reference.aspose.com/slides/cpp/aspose.slides/ifillformat/get_solidfillcolor/), then saves the rectangle in a presentation. ```cpp #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; using namespace Aspose::Slides::Export; using namespace System::Drawing; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 50, 50, 150, 75); shape->get_FillFormat()->set_FillType(FillType::Solid); shape->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Yellow()); presentation->Save(u"solid_color_fill.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` The result: ![The shape with solid color fill](https://docs.aspose.com/slides/cpp/shape-formatting/solid-color-fill.png) ### **Copy Colors While Preserving Theme References** Use [IColorFormat::CopyFrom](https://reference.aspose.com/slides/cpp/aspose.slides/icolorformat/copyfrom/) to copy a color definition, including its color type, theme reference, and transformations. This is useful when transferring a fill color between shapes that should continue to follow the presentation theme. The method copies only the color: it does not copy the fill type, outline, or other shape formatting. Set the destination's fill type explicitly with [IFillFormat::set_FillType](https://reference.aspose.com/slides/cpp/aspose.slides/ifillformat/set_filltype/). This example creates three rectangles, from left to right: the source, a theme-aware copy, and a fixed RGB copy. The source uses [IColorFormat::set_SchemeColor](https://reference.aspose.com/slides/cpp/aspose.slides/icolorformat/set_schemecolor/) to reference the first accent color and adds a tint through [IColorOperationCollection::Add](https://reference.aspose.com/slides/cpp/aspose.slides/icoloroperationcollection/add/). The RGB copy uses the source's effective fill color so all three initially look identical. Calling [IColorFormat::set_Color](https://reference.aspose.com/slides/cpp/aspose.slides/icolorformat/set_color/) sets a fixed RGB value and clears any existing color transformations. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::Drawing; auto presentation = MakeObject(); presentation->get_SlideSize()->SetSize(660, 220, SlideSizeScaleType::DoNotScale); auto slide = presentation->get_Slide(0); presentation->get_MasterTheme()->get_ColorScheme()->get_Accent1()->set_Color(Color::get_RoyalBlue()); auto source = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 30, 40, 180, 140); auto themeCopy = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 240, 40, 180, 140); auto rgbCopy = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 450, 40, 180, 140); for (auto shape : { source, themeCopy, rgbCopy }) { shape->get_FillFormat()->set_FillType(FillType::Solid); shape->get_LineFormat()->get_FillFormat()->set_FillType(FillType::NoFill); } auto sourceColor = source->get_FillFormat()->get_SolidFillColor(); sourceColor->set_SchemeColor(SchemeColor::Accent1); sourceColor->get_ColorTransform()->Add(ColorTransformOperation::Tint, 0.75f); themeCopy->get_FillFormat()->get_SolidFillColor()->CopyFrom(sourceColor); auto effectiveFill = source->get_FillFormat()->GetEffective(); rgbCopy->get_FillFormat()->get_SolidFillColor()->set_Color(effectiveFill->get_SolidFillColor()); auto before = slide->GetImage(1.0f, 1.0f); before->Save(u"color-copy-before.png", ImageFormat::Png); before->Dispose(); // Theme references follow the new accent color; the fixed RGB value does not. presentation->get_MasterTheme()->get_ColorScheme()->get_Accent1()->set_Color(Color::get_OrangeRed()); auto after = slide->GetImage(1.0f, 1.0f); after->Save(u"color-copy-after.png", ImageFormat::Png); after->Dispose(); presentation->Save(u"copied_colors.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` Before the theme change, all three fills match: ![Source, CopyFrom destination, and fixed RGB destination with identical blue fills](https://docs.aspose.com/slides/cpp/shape-formatting/color-copy-before.png) After the theme change, the source and the theme-aware copy follow the new accent color and retain their tint. The fixed RGB copy remains blue: ![Source and CopyFrom destination with orange fills, while the fixed RGB destination remains blue](https://docs.aspose.com/slides/cpp/shape-formatting/color-copy-after.png) The copied definition is independent of the source. Subsequently changing the source's theme reference, assigning another color, or adding or removing its transformations does not change the destination. A theme change still affects both shapes because each independently refers to the same theme color. Saving and reopening the PPTX preserves the copied color's type, available through [IColorFormat::get_ColorType](https://reference.aspose.com/slides/cpp/aspose.slides/icolorformat/get_colortype/), its theme reference, and the transformation collection returned by [IColorFormat::get_ColorTransform](https://reference.aspose.com/slides/cpp/aspose.slides/icolorformat/get_colortransform/); it does not flatten the definition to RGB. When copying between different theme contexts, such as presentations with different accent palettes, the copied reference resolves against the destination's theme. The same reference and transformations can therefore produce a different visible color. See [Presentation Theme](https://docs.aspose.com/slides/cpp/presentation-theme/) for more about configuring theme colors. ## **Use the Slide Background as a Shape Fill** Use [IAutoShape::set_UseBackgroundFill](https://reference.aspose.com/slides/cpp/aspose.slides/iautoshape/set_usebackgroundfill/) when a shape should match the slide background, for example in a presentation template. Set [IFillFormat::set_FillType](https://reference.aspose.com/slides/cpp/aspose.slides/ifillformat/set_filltype/) to [FillType::NotDefined](https://reference.aspose.com/slides/cpp/aspose.slides/filltype/) first to remove any explicit fill. With this combination, the shape uses the slide background instead of its style fill. Enabling the flag alone does not remove an existing explicit fill. This differs from [FillType::NoFill](https://reference.aspose.com/slides/cpp/aspose.slides/filltype/): background fill covers objects behind the shape with the corresponding area of the slide background, while no fill leaves those objects visible. A gradient remains aligned with the slide rather than restarting inside each shape. The following example creates a master background inherited by the slide and places a magenta band behind three rectangles. The left rectangle uses the background, the middle rectangle has no fill, and the right rectangle switches from background fill to an explicit orange fill. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; using namespace Aspose::Slides::Export; using namespace System::Drawing; auto presentation = MakeObject(); presentation->get_SlideSize()->SetSize(720, 400, SlideSizeScaleType::DoNotScale); auto slide = presentation->get_Slide(0); // Inherit the gradient from the master. slide->get_Background()->set_Type(BackgroundType::NotDefined); slide->get_LayoutSlide()->get_Background()->set_Type(BackgroundType::NotDefined); auto background = slide->get_LayoutSlide()->get_MasterSlide()->get_Background(); background->set_Type(BackgroundType::OwnBackground); background->get_FillFormat()->set_FillType(FillType::Gradient); auto gradient = background->get_FillFormat()->get_GradientFormat(); gradient->set_GradientShape(GradientShape::Linear); gradient->set_LinearGradientAngle(0); gradient->get_GradientStops()->Clear(); gradient->get_GradientStops()->Add(0, Color::get_DarkBlue()); gradient->get_GradientStops()->Add(1, Color::get_LightSkyBlue()); // Add this object first so it appears behind the rectangles. auto band = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 25, 150, 670, 100); band->get_FillFormat()->set_FillType(FillType::Solid); band->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Magenta()); band->get_LineFormat()->get_FillFormat()->set_FillType(FillType::NoFill); auto backgroundShape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 50, 100, 160, 200); backgroundShape->get_FillFormat()->set_FillType(FillType::NotDefined); backgroundShape->set_UseBackgroundFill(true); auto noFillShape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 280, 100, 160, 200); noFillShape->get_FillFormat()->set_FillType(FillType::NoFill); auto explicitShape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 510, 100, 160, 200); explicitShape->get_FillFormat()->set_FillType(FillType::NotDefined); explicitShape->set_UseBackgroundFill(true); // Disable background fill before applying an explicit fill. explicitShape->set_UseBackgroundFill(false); explicitShape->get_FillFormat()->set_FillType(FillType::Solid); explicitShape->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Orange()); presentation->Save(u"background_fill.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` The result, from left to right: **background fill**, **no fill**, and **explicit fill**. The magenta band is hidden by the left and right rectangles but remains visible through the middle rectangle. ![Background fill, no fill, and explicit orange fill over a magenta band](https://docs.aspose.com/slides/cpp/shape-formatting/background-fill.png) The same behavior applies to a background defined directly on the slide or inherited from a layout. The shape uses the slide's resolved background; the example leaves both the slide and layout backgrounds undefined so the master supplies it. ## **Set Transparency** For a solid fill, the color’s alpha component controls opacity: 0 is fully transparent and 255 is fully opaque. This example uses an alpha value of 128 for a yellow rectangle, making it approximately 50% transparent so the rectangle underneath remains visible. The color is assigned through [IFillFormat::get_SolidFillColor](https://reference.aspose.com/slides/cpp/aspose.slides/ifillformat/get_solidfillcolor/). ```cpp #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; using namespace Aspose::Slides::Export; using namespace System::Drawing; const int alpha = 128; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto solidShape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 50, 50, 150, 75); auto transparentShape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 80, 80, 150, 75); transparentShape->get_FillFormat()->set_FillType(FillType::Solid); transparentShape->get_FillFormat()->get_SolidFillColor()->set_Color(Color::FromArgb(alpha, Color::get_Yellow())); presentation->Save(u"shape_transparency.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` The result: ![The transparent shape](https://docs.aspose.com/slides/cpp/shape-formatting/shape-transparency.png) ## **Rotate Shapes** Use [IShape::set_Rotation](https://reference.aspose.com/slides/cpp/aspose.slides/ishape/set_rotation/) to rotate a shape in the slide plane. The angle is measured in degrees; this example rotates a rectangle 5 degrees clockwise and saves the presentation. ```cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; using namespace Aspose::Slides::Export; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 50, 50, 150, 75); shape->set_Rotation(5); presentation->Save(u"shape_rotation.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` The result: ![The shape rotation](https://docs.aspose.com/slides/cpp/shape-formatting/shape-rotation.png) ## **Add 3D Bevel Effects** Use [IShape::get_ThreeDFormat](https://reference.aspose.com/slides/cpp/aspose.slides/ishape/get_threedformat/) to give a shape depth and beveled edges. This example creates a green ellipse with an orange outline, sets [IThreeDFormat::set_Depth](https://reference.aspose.com/slides/cpp/aspose.slides/ithreedformat/set_depth/) to 4 points, and applies a circular top bevel with a width and height of 6 points through [IThreeDFormat::get_BevelTop](https://reference.aspose.com/slides/cpp/aspose.slides/ithreedformat/get_beveltop/). A front-facing orthographic camera and three-point lighting make the bevel visible. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; using namespace Aspose::Slides::Export; using namespace System::Drawing; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Ellipse, 50, 50, 100, 100); shape->get_FillFormat()->set_FillType(FillType::Solid); shape->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Green()); shape->get_LineFormat()->get_FillFormat()->set_FillType(FillType::Solid); shape->get_LineFormat()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Orange()); shape->get_LineFormat()->set_Width(2.0); shape->get_ThreeDFormat()->set_Depth(4); shape->get_ThreeDFormat()->get_BevelTop()->set_BevelType(BevelPresetType::Circle); shape->get_ThreeDFormat()->get_BevelTop()->set_Height(6); shape->get_ThreeDFormat()->get_BevelTop()->set_Width(6); shape->get_ThreeDFormat()->get_Camera()->set_CameraType(CameraPresetType::OrthographicFront); shape->get_ThreeDFormat()->get_LightRig()->set_LightType(LightRigPresetType::ThreePt); shape->get_ThreeDFormat()->get_LightRig()->set_Direction(LightingDirection::Top); presentation->Save(u"3D_bevel_effect.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` The result: ![The 3D bevel effect](https://docs.aspose.com/slides/cpp/shape-formatting/3D-bevel-effect.png) ## **Add 3D Rotation Effects** A shape’s 3D view is controlled by its camera settings. This example uses [ICamera::SetRotation](https://reference.aspose.com/slides/cpp/aspose.slides/icamera/setrotation/) with latitude, longitude, and revolution angles of 40, 35, and 20 degrees, respectively. It selects an isometric camera through [ICamera::set_CameraType](https://reference.aspose.com/slides/cpp/aspose.slides/icamera/set_cameratype/) and balanced lighting through [ILightRig::set_LightType](https://reference.aspose.com/slides/cpp/aspose.slides/ilightrig/set_lighttype/), then saves the formatted rectangle. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; using namespace Aspose::Slides::Export; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto autoShape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 50, 50, 150, 75); autoShape->get_TextFrame()->set_Text(u"Hello, Aspose!"); autoShape->get_ThreeDFormat()->get_Camera()->set_CameraType(CameraPresetType::IsometricLeftUp); autoShape->get_ThreeDFormat()->get_Camera()->SetRotation(40, 35, 20); autoShape->get_ThreeDFormat()->get_LightRig()->set_LightType(LightRigPresetType::Balanced); presentation->Save(u"3D_rotation_effect.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` The result: ![The 3D rotation effect](https://docs.aspose.com/slides/cpp/shape-formatting/3D-rotation-effect.png) ## **Control Black-and-White Rendering for Shapes** The [IShape::set_BlackWhiteMode](https://reference.aspose.com/slides/cpp/aspose.slides/ishape/set_blackwhitemode/) method specifies how an individual shape is rendered when a presentation is viewed or processed in black-and-white mode. It does not enable black-and-white display by itself, and it does not change the shape's fill, line, or other formatting in normal color mode. Use a value from the [BlackWhiteMode](https://reference.aspose.com/slides/cpp/aspose.slides/blackwhitemode/) enumeration to select the desired behavior. For example, `Automatic` lets the rendering application choose the conversion, `Gray` and `LightGray` use gray coloring, `BlackWhite` uses only black and white, `Black` and `White` force a single color, `Color` preserves normal coloring, and `Hidden` omits the shape in black-and-white mode. `NotDefined` means that no shape-level mode is assigned. This example creates an orange rectangle and sets [IShape::set_BlackWhiteMode](https://reference.aspose.com/slides/cpp/aspose.slides/ishape/set_blackwhitemode/) to gray. The saved shape retains its orange fill for normal color display and requests gray coloring from applications that honor black-and-white display settings: ```cpp #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; using namespace Aspose::Slides::Export; using namespace System::Drawing; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 50, 50, 200, 100); shape->get_FillFormat()->set_FillType(FillType::Solid); shape->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Orange()); shape->set_BlackWhiteMode(BlackWhiteMode::Gray); presentation->Save(u"shape_black_white_mode.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` In normal color mode, the rectangle retains its orange fill. In a black-and-white display workflow, it uses gray coloring because its mode is set to `Gray`. This lets you preserve a full-color slide while defining a distinct appearance for printing, previewing, or other workflows that honor the presentation's black-and-white display settings. ## **Reset Formatting** Use [ISlide::Reset](https://reference.aspose.com/slides/cpp/aspose.slides/islide/reset/) to restore the position, size, and formatting of slide placeholders from their corresponding layout placeholders. This example requires an existing presentation with layout-linked placeholders and resets every slide before saving. Shapes without corresponding layout placeholders are not reset. ```cpp #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; using namespace Aspose::Slides::Export; auto presentation = MakeObject(u"sample.pptx"); for (auto&& slide : IterateOver(presentation->get_Slides())) { slide->Reset(); } presentation->Save(u"reset_formatting.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ## **FAQ** **Does shape formatting affect the final presentation file size?** Colors, line styles, and effect settings generally add little data compared with embedded images and media. Picture fills can increase the file size because their images are stored in the presentation. **How can I detect shapes on a slide that share identical formatting so I can group them?** Compare each shape’s key formatting properties—fill, line, and effect settings. If all corresponding values match, treat their styles as identical and logically group those shapes, which simplifies later style management. **Can I save a set of custom shape styles to a separate file for reuse in other presentations?** Yes. Store sample shapes with the desired styles in a template slide deck or a .POTX template file. When creating a new presentation, open the template, clone the styled shapes you need, and reapply their formatting wherever required. ## Related articles - [Manage Presentation Backgrounds in C++](https://docs.aspose.com/slides/cpp/presentation-background/) # Manage Presentation Shapes in C++ > Learn how to identify, adjust, clone, remove, hide, reorder, export, align, and flip presentation shapes with Aspose.Slides for C++. Source: https://docs.aspose.com/slides/cpp/shape-manipulations/ Updated: 2026-09-25 ## **Overview** Aspose.Slides for C++ represents the shapes on a slide as an ordered [IShapeCollection](https://reference.aspose.com/slides/cpp/aspose.slides/ishapecollection/). The collection is both the place where you find and modify shapes and the source of their stacking order: index `0` is the backmost shape, while the last index is the frontmost shape. This article follows that model. It first explains how to identify a shape reliably and modify preset shape adjustment points, then shows how to clone, remove, hide, and reorder shapes. The final sections cover layout-level formatting, SVG export, alignment, and flip settings. Each example is independent, so you can use only the operations your workflow requires. ## **Identify and Find Shapes** Collection indexes are convenient while processing a known file, but they are not stable identifiers. Adding, removing, or reordering a shape can change its index. Choose an identifier according to how the presentation is authored and maintained: - [Name](https://reference.aspose.com/slides/cpp/aspose.slides/ishape/get_name/) is useful for developer-controlled templates and is easy to inspect in PowerPoint's Selection Pane. Names can be edited and are not guaranteed to be unique, so establish a naming convention if code depends on them. - [AlternativeText](https://reference.aspose.com/slides/cpp/aspose.slides/ishape/get_alternativetext/) is useful when an accessibility description or an author-supplied tag already identifies the shape. It is visible to users, may be localized or rewritten for accessibility, and is not guaranteed to be unique. Do not silently repurpose meaningful accessibility text as a database key. - [OfficeInteropShapeId](https://reference.aspose.com/slides/cpp/aspose.slides/ishape/get_officeinteropshapeid/) is a read-only identifier that is unique within a slide and corresponds to the shape ID used by PowerPoint interop. Use it when integrating with PowerPoint or when you need an unambiguous reference during the lifetime of a shape. A cloned or recreated shape is a different shape and receives its own ID. The related [UniqueId](https://reference.aspose.com/slides/cpp/aspose.slides/ishape/get_uniqueid/) property has presentation scope, but it is intended for add-ins and can be reassigned. It should not be treated as a permanent external key. If long-term identity is essential, keep the mapping in application data and validate that the expected shape still exists. For a practical example of reading and updating both the alternative text title and description, see [Manage Alternative Text Titles and Descriptions](https://docs.aspose.com/slides/cpp/presentation-accessibility/). Use alternative text to explain the visual's meaning to readers, and keep it separate from shape names used by code to find shapes. The following example searches by `Name` and reports the slide-scoped interop ID. When the template does not contain the expected shape, the code reports that result instead of continuing with the wrong object. ```cpp #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto presentation = MakeObject(u"input.pptx"); auto slide = presentation->get_Slide(0); SharedPtr targetShape; for (auto shape : slide->get_Shapes()) { if (shape->get_Name() == u"RevenueChart") { targetShape = shape; break; } } if (targetShape == nullptr) { Console::WriteLine(u"The shape 'RevenueChart' was not found on slide 1."); } else { Console::WriteLine(String::Format(u"Found {0}; interop ID: {1}", targetShape->get_Name(), targetShape->get_OfficeInteropShapeId())); } presentation->Dispose(); ``` When an operation is specific to a shape type, check the interface before using type-specific members. This example updates text and alternative text only if the named object is an [IAutoShape](https://reference.aspose.com/slides/cpp/aspose.slides/iautoshape/). ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(u"input.pptx"); auto slide = presentation->get_Slide(0); SharedPtr candidate; for (auto shape : slide->get_Shapes()) { if (shape->get_Name() == u"StatusLabel") { candidate = shape; break; } } if (candidate != nullptr && ObjectExt::Is(candidate)) { auto autoShape = ExplicitCast(candidate); autoShape->get_TextFrame()->set_Text(u"Approved"); autoShape->set_AlternativeText(u"Approval status: approved"); presentation->Save(u"identified-shape.pptx", SaveFormat::Pptx); } else { Console::WriteLine(u"'StatusLabel' is missing or is not an AutoShape."); } presentation->Dispose(); ``` ## **Identify and Modify Preset Shape Adjustments** Preset geometry shapes can expose adjustment points that control features such as corner size, arrow proportions, or arc angles. Access them through the read-only [IGeometryShape::get_Adjustments](https://reference.aspose.com/slides/cpp/aspose.slides/igeometryshape/get_adjustments/) collection. The collection itself is supplied by the shape, but each [IAdjustValue](https://reference.aspose.com/slides/cpp/aspose.slides/iadjustvalue/) contains a value that can be changed. Do not rely only on a fixed collection index. Iterate through the adjustments and inspect the read-only [IAdjustValue::get_Type](https://reference.aspose.com/slides/cpp/aspose.slides/iadjustvalue/get_type/) property, whose [ShapeAdjustmentType](https://reference.aspose.com/slides/cpp/aspose.slides/shapeadjustmenttype/) value describes what the adjustment controls. The read-only [IAdjustValue::get_Name](https://reference.aspose.com/slides/cpp/aspose.slides/iadjustvalue/get_name/) property provides additional identification information and is especially useful when a preset contains more than one adjustment with the same semantic type. Use the value property that matches the adjustment's meaning: | Adjustment type | Purpose | Value to change | |---|---|---| | `CornerSize` | Size of rounded corners | [RawValue](https://reference.aspose.com/slides/cpp/aspose.slides/iadjustvalue/set_rawvalue/) | | `ArrowTailThickness` | Thickness of an arrow tail | `RawValue` | | `ArrowheadLength` | Length of an arrowhead | `RawValue` | | `ArrowheadWidth` | Width of an arrowhead | `RawValue` | | `StartAngle` | Start angle of a pie or arc | [AngleValue](https://reference.aspose.com/slides/cpp/aspose.slides/iadjustvalue/set_anglevalue/) | | `EndAngle` | End angle of a pie or arc | `AngleValue` | `Type` and `Name` cannot be assigned. `RawValue` is a read/write integer in the preset's native geometry units, while `AngleValue` is a read/write angle in degrees. The number, order, meaning, and valid range of adjustments depend on the preset [ShapeType](https://reference.aspose.com/slides/cpp/aspose.slides/igeometryshape/get_shapetype/). A value that is valid for one preset may be invalid or have a different effect for another. When `Type` is `ShapeAdjustmentType::Custom`, the API does not recognize a standard semantic meaning. Inspect `Name`, the preset type, and the existing value, and leave the adjustment unchanged unless the expected meaning and range are known. Even for recognized types, check whether the same type occurs more than once before selecting a value. The [Connector](https://docs.aspose.com/slides/cpp/connector/) article shows this situation with connector bend adjustments. The following complete example creates default and modified versions of three preset shapes. It iterates through every adjustment, reports its `Name` and `Type`, changes size-related values through `RawValue`, changes angles through `AngleValue`, and saves the result. The left column retains the default geometry; the right column shows the adjusted rounded rectangle, four-way arrow, and pie. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); // Adds headers for the default and adjusted shape columns. auto defaultColumnLabel = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 40, 20, 250, 30); defaultColumnLabel->get_TextFrame()->set_Text(u"Default preset geometry"); auto adjustedColumnLabel = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 390, 20, 250, 30); adjustedColumnLabel->get_TextFrame()->set_Text(u"Modified adjustment values"); slide->get_Shapes()->AddAutoShape(ShapeType::RoundCornerRectangle, 80, 70, 160, 70); auto modifiedRoundedRectangle = slide->get_Shapes()->AddAutoShape(ShapeType::RoundCornerRectangle, 430, 70, 160, 70); modifiedRoundedRectangle->set_Name(u"ModifiedRoundedRectangle"); slide->get_Shapes()->AddAutoShape(ShapeType::QuadArrow, 80, 180, 160, 110); auto modifiedArrow = slide->get_Shapes()->AddAutoShape(ShapeType::QuadArrow, 430, 180, 160, 110); modifiedArrow->set_Name(u"ModifiedQuadArrow"); slide->get_Shapes()->AddAutoShape(ShapeType::Pie, 95, 330, 130, 130); auto modifiedPie = slide->get_Shapes()->AddAutoShape(ShapeType::Pie, 445, 330, 130, 130); modifiedPie->set_Name(u"ModifiedPie"); auto shapesToAdjust = MakeArray>({modifiedRoundedRectangle, modifiedArrow, modifiedPie}); for (auto shape : shapesToAdjust) { auto adjustments = shape->get_Adjustments(); for (int32_t adjustmentIndex = 0; adjustmentIndex < adjustments->get_Count(); ++adjustmentIndex) { auto adjustment = adjustments->idx_get(adjustmentIndex); Console::WriteLine(shape->get_Name() + u" / " + adjustment->get_Name() + u": " + ObjectExt::ToString(adjustment->get_Type())); switch (adjustment->get_Type()) { case ShapeAdjustmentType::CornerSize: adjustment->set_RawValue(5000); break; case ShapeAdjustmentType::ArrowTailThickness: adjustment->set_RawValue(25000); break; case ShapeAdjustmentType::ArrowheadLength: adjustment->set_RawValue(30000); break; case ShapeAdjustmentType::ArrowheadWidth: adjustment->set_RawValue(40000); break; case ShapeAdjustmentType::StartAngle: adjustment->set_AngleValue(30); break; case ShapeAdjustmentType::EndAngle: adjustment->set_AngleValue(300); break; case ShapeAdjustmentType::Custom: Console::WriteLine(u"Custom adjustment '" + adjustment->get_Name() + u"' was not changed."); break; } } } presentation->Save(u"preset-shape-adjustments.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` Checking the semantic type before changing a value makes the code explicit about its intent and avoids assuming that a particular collection index has the same meaning across different preset shapes. ## **Modify the Shape Collection** The add, clone, remove, and reorder methods operate on the collection immediately. If an operation changes the number or order of shapes, do not continue to rely on indexes captured before that operation. ### **Clone a Shape** [AddClone](https://reference.aspose.com/slides/cpp/aspose.slides/ishapecollection/addclone/) creates an independent copy and appends it to the target collection. [InsertClone](https://reference.aspose.com/slides/cpp/aspose.slides/ishapecollection/insertclone/) also creates a copy but places it at a specified z-order index. The overloads that accept coordinates move the clone without changing its size; overloads with width and height can resize it as well. The example creates a destination slide, clones a labeled rectangle to the front, and inserts a second clone at the back. Changes to either clone do not modify the source shape. ```cpp #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(); auto sourceSlide = presentation->get_Slide(0); auto sourceShape = sourceSlide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 40, 40, 180, 60); sourceShape->set_Name(u"SourceLabel"); sourceShape->get_TextFrame()->set_Text(u"Source"); auto blankLayout = presentation->get_LayoutSlides()->GetByType(SlideLayoutType::Blank); auto destinationSlide = presentation->get_Slides()->AddEmptySlide(blankLayout); auto frontCloneShape = destinationSlide->get_Shapes()->AddClone(sourceShape, 80, 80); frontCloneShape->set_Name(u"FrontClone"); if (ObjectExt::Is(frontCloneShape)) { auto frontClone = ExplicitCast(frontCloneShape); frontClone->get_TextFrame()->set_Text(u"Front clone"); } else { Console::WriteLine(u"The front clone is not an AutoShape; its text was not changed."); } auto backCloneShape = destinationSlide->get_Shapes()->InsertClone(0, sourceShape, 80, 180); backCloneShape->set_Name(u"BackClone"); if (ObjectExt::Is(backCloneShape)) { auto backClone = ExplicitCast(backCloneShape); backClone->get_TextFrame()->set_Text(u"Back clone"); } else { Console::WriteLine(u"The back clone is not an AutoShape; its text was not changed."); } presentation->Save(u"cloned-shapes.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` Cloning copies the shape's content and formatting, including its name and alternative text. Assign new logical identifiers to the clone when those values must be unique. Resources used by complex shapes are handled by the presentation, but a clone remains a new collection item with a new shape identity. ### **Remove Shapes** [Remove](https://reference.aspose.com/slides/cpp/aspose.slides/ishapecollection/remove/) deletes a specific shape object from its collection. When removing multiple matches during indexed iteration, traverse from the end so that each remaining index stays valid. This example removes every shape with a designated name. It reads the current indexed shape, not a fixed collection item, and it does not cast the shape unnecessarily. ```cpp #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto keepShape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 40, 40, 140, 60); keepShape->set_Name(u"Keep"); auto firstTemporaryShape = slide->get_Shapes()->AddAutoShape(ShapeType::Ellipse, 220, 40, 80, 80); firstTemporaryShape->set_Name(u"Temporary"); auto secondTemporaryShape = slide->get_Shapes()->AddAutoShape(ShapeType::Triangle, 340, 40, 100, 80); secondTemporaryShape->set_Name(u"Temporary"); for (int32_t i = slide->get_Shapes()->get_Count() - 1; i >= 0; --i) { auto shape = slide->get_Shape(i); if (shape->get_Name() == u"Temporary") { slide->get_Shapes()->Remove(shape); } } presentation->Save(u"removed-shapes.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` After removal, the shape count and the indexes of later shapes change. References to unaffected shapes remain more reliable than saved indexes. Also consider connectors, animations, and other presentation features that may refer to the removed object; removing a visible shape can change more than the slide's appearance. ### **Hide a Shape** Setting [Hidden](https://reference.aspose.com/slides/cpp/aspose.slides/ishape/set_hidden/) to `true` keeps the shape in the collection but prevents it from appearing in the normal slide show. Its index, formatting, and content remain available to code, so hiding is appropriate for optional elements that may be restored later. ```cpp #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto visibleShape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 40, 40, 160, 60); visibleShape->set_Name(u"VisibleLabel"); auto optionalShape = slide->get_Shapes()->AddAutoShape(ShapeType::Moon, 240, 40, 100, 100); optionalShape->set_Name(u"OptionalDecoration"); for (auto shape : slide->get_Shapes()) { if (shape->get_Name() == u"OptionalDecoration") { shape->set_Hidden(true); } } presentation->Save(u"hidden-shape.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` Hiding is not deletion or security. The object can still be discovered and unhidden by a user or by code, and it remains part of the presentation file. ### **Change the Z-Order** Overlapping shapes are painted in collection order. [Reorder](https://reference.aspose.com/slides/cpp/aspose.slides/ishapecollection/reorder/) moves an existing shape to a target index without cloning it. Index `0` is the back; `Count - 1` is the front. ```cpp #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::Drawing; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto blueRectangle = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 100, 100, 220, 120); blueRectangle->set_Name(u"BlueRectangle"); blueRectangle->get_FillFormat()->set_FillType(FillType::Solid); blueRectangle->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_SteelBlue()); auto orangeEllipse = slide->get_Shapes()->AddAutoShape(ShapeType::Ellipse, 180, 140, 220, 120); orangeEllipse->set_Name(u"OrangeEllipse"); orangeEllipse->get_FillFormat()->set_FillType(FillType::Solid); orangeEllipse->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Orange()); slide->get_Shapes()->Reorder(slide->get_Shapes()->get_Count() - 1, blueRectangle); presentation->Save(u"reordered-shapes.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` The rectangle is created first and initially sits behind the ellipse. Moving it to the final index puts it in front. Finalize z-order after adding or cloning all related shapes, because those operations append or insert new collection items and can alter the intended stack. ## **Inspect Shapes on Layout Slides** Normal slides, layout slides, and master slides have separate shape collections. A shape in a layout collection is not the same object as a similarly positioned shape on a normal slide. Inspect layout shapes when you need to understand or change formatting supplied by a layout. The following example reads each layout shape's [FillFormat](https://reference.aspose.com/slides/cpp/aspose.slides/ishape/get_fillformat/) and [LineFormat](https://reference.aspose.com/slides/cpp/aspose.slides/ishape/get_lineformat/) without assuming that every shape is an `AutoShape`. ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto presentation = MakeObject(u"input.pptx"); for (auto layoutSlide : presentation->get_LayoutSlides()) { for (auto shape : layoutSlide->get_Shapes()) { auto fillType = shape->get_FillFormat()->get_FillType(); auto lineWidth = shape->get_LineFormat()->get_Width(); Console::WriteLine(String::Format(u"{0} / {1}: fill={2}, line width={3}", layoutSlide->get_Name(), shape->get_Name(), fillType, lineWidth)); } } presentation->Dispose(); ``` Editing a layout can affect multiple slides that use it. Before changing a layout shape, determine whether a normal slide inherits the object or contains a local override, and test every slide that uses that layout. ## **Export a Shape to SVG** [WriteAsSvg](https://reference.aspose.com/slides/cpp/aspose.slides/ishape/writeassvg/) writes one shape's rendered content to a stream. The result contains the shape, not the entire slide background or neighboring shapes. ```cpp #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; using namespace System::IO; auto presentation = MakeObject(u"input.pptx"); auto slide = presentation->get_Slide(0); if (slide->get_Shapes()->get_Count() == 0) { Console::WriteLine(u"Slide 1 does not contain a shape to export."); } else { auto shape = slide->get_Shape(0); auto svgStream = File::Create(u"shape.svg"); shape->WriteAsSvg(svgStream); svgStream->Close(); } presentation->Dispose(); ``` Keep the presentation open while rendering. The output depends on the shape's formatting and on resources such as fonts and images. If you need the whole composition, export the slide rather than an individual shape. The caller owns the stream and must close or dispose it. ## **Align Shapes** The [SlideUtil::AlignShapes](https://reference.aspose.com/slides/cpp/aspose.slides.util/slideutil/alignshapes/) overloads align either all shapes or selected collection indexes. [ShapesAlignmentType](https://reference.aspose.com/slides/cpp/aspose.slides/shapesalignmenttype/) specifies the edge, center line, or distribution mode. Set `alignToSlide` to `true` to use the slide edges; set it to `false` to align the selected shapes relative to one another. This example aligns three shapes to the top edge of the slide. The returned shape references are converted to their current indexes immediately before alignment. ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace Aspose::Slides::Util; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto firstShape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 60, 80, 120, 50); auto secondShape = slide->get_Shapes()->AddAutoShape(ShapeType::Ellipse, 240, 160, 120, 50); auto thirdShape = slide->get_Shapes()->AddAutoShape(ShapeType::Triangle, 420, 240, 120, 50); firstShape->set_Name(u"FirstAlignedShape"); secondShape->set_Name(u"SecondAlignedShape"); thirdShape->set_Name(u"ThirdAlignedShape"); auto shapeIndexes = MakeArray({slide->get_Shapes()->IndexOf(firstShape), slide->get_Shapes()->IndexOf(secondShape), slide->get_Shapes()->IndexOf(thirdShape)}); SlideUtil::AlignShapes(ShapesAlignmentType::AlignTop, true, slide, shapeIndexes); presentation->Save(u"aligned-shapes.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` Alignment changes positions, not z-order. Relative alignment normally needs at least two shapes, while horizontal or vertical distribution needs enough shapes to define spacing. Recompute indexes if you modify the collection before calling the method. ## **Flip a Shape** The [ShapeFrame](https://reference.aspose.com/slides/cpp/aspose.slides/shapeframe/) class stores position, size, horizontal and vertical flip settings, and rotation. Its `FlipH` and `FlipV` values use [NullableBool](https://reference.aspose.com/slides/cpp/aspose.slides/nullablebool/): `True` enables the flip, `False` disables it, and `NotDefined` preserves the unspecified/default state. The input presentation below contains one unflipped shape. ![The shape before flipping](https://docs.aspose.com/slides/cpp/shape-manipulations/shape_to_be_flipped.png) The example preserves every other frame value and replaces only the two flip settings. This is important because assigning a new [Frame](https://reference.aspose.com/slides/cpp/aspose.slides/ishape/set_frame/) replaces the complete frame. ```cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(u"sample.pptx"); auto shape = presentation->get_Slide(0)->get_Shape(0); auto frame = shape->get_Frame(); Console::WriteLine(String::Format(u"Horizontal flip before change: {0}", frame->get_FlipH())); Console::WriteLine(String::Format(u"Vertical flip before change: {0}", frame->get_FlipV())); shape->set_Frame(MakeObject(frame->get_X(), frame->get_Y(), frame->get_Width(), frame->get_Height(), NullableBool::True, NullableBool::True, frame->get_Rotation())); presentation->Save(u"flipped-shape.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` The saved shape is mirrored horizontally and vertically while keeping its position, size, and rotation. ![The shape after flipping](https://docs.aspose.com/slides/cpp/shape-manipulations/flipped_shape.png) ## **FAQ** **Should I use a collection index as a shape identifier?** Only for short-lived processing when the collection will not change before the index is used. Prefer a validated `Name` or `AlternativeText` convention for authored templates, or `OfficeInteropShapeId` for slide-scoped interop work. **Does hiding a shape remove it from the z-order?** No. A hidden shape remains in the collection at the same index. It can be found, reordered, edited, or made visible again. **Why did a cloned shape appear in front of another shape?** `AddClone` appends the clone to the end of the collection, which is the front of the z-order. Use `InsertClone` to choose the initial index or `Reorder` after all shapes have been added. **Can I use a fixed index to identify a preset shape adjustment?** Only after validating the exact preset and collection layout. Prefer iterating through `IGeometryShape::get_Adjustments` and checking `IAdjustValue::get_Type`; use `IAdjustValue::get_Name` as additional information when the same semantic type appears more than once. # Create Thumbnails of Presentation Shapes in C++ > Generate high-quality shape thumbnails from PowerPoint slides with Aspose.Slides for C++ – easily create and export presentation thumbnails. Source: https://docs.aspose.com/slides/cpp/shape-thumbnails/ Updated: 2026-11-08 ## **Introduction** Aspose.Slides is used to create presentation files where each page is a slides. These slides can be viewed by opening the presentation files using Microsoft PowerPoint. But sometimes, developers may need to view the images of the shapes separately in an image viewer. In such cases, Aspose.Slides helps you generate thumbnail images of the slide shapes. How to use this feature is described in this article. This article explains how to generate slide thumbnails in different ways: - Generating a shape thumbnail inside a slide. - Generating a shape thumbnail for a slide shape with user defined dimensions. - Generating a shape thumbnail in the bounds of a shape's appearance. ## **Generate a Shape Thumbnail from a Slide** To generate a shape thumbnail from any slide using Aspose.Slides for C++: 1. Create an instance of the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) class. 1. Obtain the reference of any slide using its ID or index. 1. Get the shape thumbnail image of the referenced slide on default scale. 1. Save the thumbnail image to any desired image format. The example below generating shape thumbnail. ```cpp #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto presentation = MakeObject(u"HelloWorld.pptx"); auto shape = presentation->get_Slide(0)->get_Shape(0); auto image = shape->GetImage(); image->Save(u"Shape_thumbnail_out.png", ImageFormat::Png); image->Dispose(); presentation->Dispose(); ``` ## **Generate a User-Defined Scaling Factor Thumbnail** To generate the shape thumbnail of any slide shape using Aspose.Slides for C++: 1. Create an instance of the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) class. 1. Obtain the reference of any slide using its ID or index. 1. Get the thumbnail image of the referenced slide with shape bounds. 1. Save the thumbnail image in any desired image format. The example below generate a thumbnail with generating a thumbnail with user defined scaling factor. ```cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto bounds = ShapeThumbnailBounds::Shape; auto scale = 1; // Scaling along X and Y axes. auto presentation = MakeObject(u"HelloWorld.pptx"); auto shape = presentation->get_Slide(0)->get_Shape(0); auto image = shape->GetImage(bounds, scale, scale); image->Save(u"Scaling Factor Thumbnail_out.png", ImageFormat::Png); image->Dispose(); presentation->Dispose(); ``` ## **Create a Bounds-Based Shape Appearance Thumbnail** This method for creating thumbnails of shapes allows developers to generate a thumbnail in the bounds of the shape's appearance. It takes into account all the shape effects. The generated shape thumbnail is restricted by the slide bounds. To generate a thumbnail of any slide shape in bound of its appearance, use following sample code: 1. Create an instance of the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) class. 1. Obtain the reference of any slide using its ID or index. 1. Get the thumbnail image of the referenced slide with shape bounds as appearance. 1. Save the thumbnail image in any desired image format. The example below create a thumbnail with generating a thumbnail with user defined scaling factor. ```cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto bounds = ShapeThumbnailBounds::Appearance; auto scale = 1; // Scaling along X and Y axes. auto presentation = MakeObject(u"HelloWorld.pptx"); auto shape = presentation->get_Slide(0)->get_Shape(0); auto image = shape->GetImage(bounds, scale, scale); image->Save(u"Shape_thumbnail_Bound_Shape_out.png", ImageFormat::Png); image->Dispose(); presentation->Dispose(); ``` [![A rectangle’s shadow extends beyond the slide’s right edge. Shape and Appearance thumbnails show different crops of the rectangle and shadow.](https://docs.aspose.com/slides/cpp/shape-thumbnails/visual-shape-thumbnail-bounds-2f4141e8a2fe.svg)](https://docs.aspose.com/slides/cpp/shape-thumbnails/visual-shape-thumbnail-bounds-2f4141e8a2fe.svg) *The shadow extends past the slide’s right edge. The Appearance thumbnail is clipped at that edge.* ## **Get the Actual Visual Bounds of a Shape** The frame properties of [IShape](https://reference.aspose.com/slides/cpp/aspose.slides/ishape/)—`IShape::get_X()`, `IShape::get_Y()`, `IShape::get_Width()`, and `IShape::get_Height()`—describe the rectangle stored in the presentation model. The content that is actually rendered can extend beyond that frame or occupy a different axis-aligned rectangle. Rotation, outlines, arrowheads, text layout and overflow, generated SmartArt geometry, and other rendering effects can all change the occupied area. Use [Shape::GetVisualBounds](https://reference.aspose.com/slides/cpp/aspose.slides/shape/getvisualbounds/) to calculate that occupied area without creating an image. The method returns a [RectangleF](https://reference.aspose.com/slides/cpp/system.drawing/rectanglef/) in slide coordinates. The returned rectangle is not clipped to the slide, so its coordinates can be negative when content extends beyond the slide origin. [Shape::GetVisualBounds](https://reference.aspose.com/slides/cpp/aspose.slides/shape/getvisualbounds/) is not currently declared by the [IShape](https://reference.aspose.com/slides/cpp/aspose.slides/ishape/) interface. Therefore, keep the shape obtained from the slide's shape collection as an interface value and cast it only when calling the method. The following example gets and compares the frame and visual bounds: ```cpp #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto presentation = MakeObject(u"example.pptx"); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shape(0); auto visualBounds = System::AsCast(shape)->GetVisualBounds(); System::Drawing::RectangleF frameBounds( shape->get_X(), shape->get_Y(), shape->get_Width(), shape->get_Height()); Console::WriteLine(u"Frame bounds: {0}", frameBounds); Console::WriteLine(u"Visual bounds: {0}", visualBounds); presentation->Dispose(); ``` The same [RectangleF](https://reference.aspose.com/slides/cpp/system.drawing/rectanglef/) can be used to align nearby shapes to its `RectangleF::get_Left()`, `RectangleF::get_Right()`, `RectangleF::get_Top()`, or `RectangleF::get_Bottom()` edge; reserve enough space in a generated layout; or detect content outside a permitted region. Visual bounds are especially useful for SmartArt, text boxes, arrows, pictures, rotated shapes, and group shapes, where the stored frame may not represent the full rendered result. Use [Shape::GetVisualBounds](https://reference.aspose.com/slides/cpp/aspose.slides/shape/getvisualbounds/) when you need coordinates for layout or validation and do not need a bitmap. Use [IShape::GetImage](https://reference.aspose.com/slides/cpp/aspose.slides/ishape/getimage/) when you need to render the shape. With [ShapeThumbnailBounds](https://reference.aspose.com/slides/cpp/aspose.slides/shapethumbnailbounds/), `ShapeThumbnailBounds::Shape` sizes the image from the shape bounds, including outline settings, while `ShapeThumbnailBounds::Appearance` sizes it from the shape's appearance and restricts the result to the slide bounds. In contrast, [Shape::GetVisualBounds](https://reference.aspose.com/slides/cpp/aspose.slides/shape/getvisualbounds/) returns only the calculated rectangle and does not clip it to the slide. ## **FAQ** **What image formats can be used when saving shape thumbnails?** [PNG, JPEG, BMP, GIF, TIFF](https://reference.aspose.com/slides/cpp/aspose.slides/imageformat/), and others. Shapes can also be [exported as vector SVG](https://reference.aspose.com/slides/cpp/aspose.slides/shape/writeassvg/) by saving the shape’s content as SVG. **What is the difference between Shape and Appearance bounds when rendering a thumbnail?** `Shape` uses the shape’s geometry; `Appearance` takes [visual effects](https://docs.aspose.com/slides/cpp/shape-effect/) (shadows, glows, etc.) into account. **What happens if a shape is marked as hidden? Will it still render as a thumbnail?** A hidden shape remains part of the model and can be rendered; the hidden flag affects slideshow display but does not prevent generating the shape’s image. **Are group shapes, charts, SmartArt, and other complex objects supported?** Yes. Any object represented as [Shape](https://reference.aspose.com/slides/cpp/aspose.slides/shape/) (including [GroupShape](https://reference.aspose.com/slides/cpp/aspose.slides/groupshape/), [Chart](https://reference.aspose.com/slides/cpp/aspose.slides.charts/chart/), and [SmartArt](https://reference.aspose.com/slides/cpp/aspose.slides.smartart/smartart/)) can be saved as a thumbnail or as SVG. **Do system-installed fonts affect the quality of thumbnails for text shapes?** Yes. You should [provide the required fonts](https://docs.aspose.com/slides/cpp/custom-font/) (or [configure font substitutions](https://docs.aspose.com/slides/cpp/font-substitution/)) to avoid unwanted fallbacks and text reflow. ## Related articles - [Create a Presentation Viewer in C++](https://docs.aspose.com/slides/cpp/presentation-viewer/) # Shape Types in Aspose.Slides for C++ > Learn every shape type in Aspose.Slides for C++, with clear examples to create, format, and edit shapes in PPT and PPTX presentations. Source: https://docs.aspose.com/slides/cpp/shape-types/ Updated: 2025-11-19 --- lastmod: 2025-11-19T22:55:59+04:00 title: Shape Types in Aspose.Slides for C++ linktitle: Shape Types type: docs weight: 10 url: /cpp/shape-types/ keywords: - shape - connector - ellipse - group - line - rectangle - PowerPoint - presentation - C++ - Aspose.Slides description: "Learn every shape type in Aspose.Slides for C++, with clear examples to create, format, and edit shapes in PPT and PPTX presentations." --- ## Related articles - [Connector](https://docs.aspose.com/slides/cpp/examples/elements/connector/) - [Manage PowerPoint Shapes in C++](https://docs.aspose.com/slides/cpp/powerpoint-shapes/) - [Group Shape](https://docs.aspose.com/slides/cpp/examples/elements/group-shape/) # Apply or Change Slide Layouts in C++ > Apply, create, and modify slide layouts in Aspose.Slides for C++, add placeholders, remove unused layouts, and control footer visibility. Source: https://docs.aspose.com/slides/cpp/slide-layout/ Updated: 2026-11-08 ## **Overview** A slide layout defines the positions and formatting of placeholders such as titles, text, pictures, charts, and tables. Applying a layout gives slides a consistent structure while allowing each slide to contain its own content. The most common layouts include: - **Title Slide**: Contains title and subtitle placeholders. - **Title and Content**: Contains a title placeholder and a general-purpose content placeholder. - **Blank**: Contains no content placeholders and is useful when every shape will be positioned manually. ## **Understand Layout Inheritance** A presentation has three related levels: 1. A [master slide](https://reference.aspose.com/slides/cpp/aspose.slides/imasterslide/) defines the theme, shared formatting, backgrounds, and common objects. 1. A [layout slide](https://reference.aspose.com/slides/cpp/aspose.slides/ilayoutslide/) belongs to a master and defines a particular arrangement of placeholders. 1. A [normal slide](https://reference.aspose.com/slides/cpp/aspose.slides/islide/) uses one layout and stores the content entered for that slide. A normal slide inherits theme and formatting from its layout, and the layout inherits from its master. A value set directly on a normal slide overrides the inherited value at that level. When a normal slide is created, its placeholder shapes are generated from the selected layout, while the content entered into those placeholders belongs to the normal slide. Add required placeholders to a layout before creating slides from it. Adding another placeholder to a layout later does not automatically add a corresponding placeholder shape to existing normal slides. This relationship has two important consequences: - Changing inherited formatting or existing placeholder geometry on a layout can update every slide that depends on it. Before editing a layout that is already in use, inspect its dependent slides and review the resulting presentation. - A layout that is still used by a slide cannot be removed. Reassign its dependent slides to another layout first, or remove only unused layouts. For more information about the top level of this hierarchy, see [Slide Master](https://docs.aspose.com/slides/cpp/slide-master/). To hide inherited logos or decorative master shapes on one slide or through a shared layout, see [Control the Visibility of Master Graphics](https://docs.aspose.com/slides/cpp/slide-master/). The example compares two slides using the same master. [![A master supplies design to a layout; existing and new slides inherit settings, but only the new slide receives a newly added placeholder.](https://docs.aspose.com/slides/cpp/slide-layout/visual-master-layout-slides-68f75c126f65.svg)](https://docs.aspose.com/slides/cpp/slide-layout/visual-master-layout-slides-68f75c126f65.svg) *The master supplies shared design, the layout supplies placeholder structure, and each slide owns its content. Existing inherited settings can update dependent slides. Add required placeholders before creating slides: a placeholder added later to the layout is not automatically inserted into existing slides.* ## **Select and Apply a Slide Layout** Use a layout type when the presentation follows standard PowerPoint layout definitions. Layout names are user-editable and can be localized, so name-based selection is less reliable unless you control the source template. The following example looks for **Title and Content** on the first master. If that layout is unavailable, it deliberately falls back to **Blank**. The second null check is necessary because a presentation can contain only custom layouts. The selected layout is then applied to the first normal slide through the [ISlide::set_LayoutSlide](https://reference.aspose.com/slides/cpp/aspose.slides/islide/set_layoutslide/) method. ```cpp #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(u"input.pptx"); auto layoutSlides = presentation->get_Master(0)->get_LayoutSlides(); auto targetLayout = layoutSlides->GetByType(SlideLayoutType::TitleAndObject); if (targetLayout == nullptr) { targetLayout = layoutSlides->GetByType(SlideLayoutType::Blank); } if (targetLayout == nullptr) { throw InvalidOperationException(u"The first master does not contain a suitable layout slide."); } presentation->get_Slide(0)->set_LayoutSlide(targetLayout); presentation->Save(u"output-with-new-layout.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` Changing a slide's layout does not remove ordinary shapes added directly to the slide. However, placeholder positions, inherited formatting, and the correspondence between existing placeholders and the new layout can change, so inspect the output when switching between substantially different layouts. ## **Add a Layout Slide** Selection and creation are separate operations. The previous example selects an existing layout; it does not create one. To create a layout, call the [IMasterLayoutSlideCollection::Add](https://reference.aspose.com/slides/cpp/aspose.slides/imasterlayoutslidecollection/add/) method on the target master's layout collection. The following example always adds a new **Title and Content** layout named `Report Title and Content`, then adds a normal slide based on it. Layout names must be unique within the collection. ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(u"input.pptx"); auto masterSlide = presentation->get_Master(0); auto reportLayout = masterSlide->get_LayoutSlides()->Add(SlideLayoutType::TitleAndObject, u"Report Title and Content"); presentation->get_Slides()->AddEmptySlide(reportLayout); presentation->Save(u"output-with-report-layout.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` Add a layout only when the template genuinely needs another reusable structure. If a suitable layout already exists, select and reuse it instead of creating a duplicate. ## **Add Placeholders to a Layout Slide** The [ILayoutSlide::get_PlaceholderManager](https://reference.aspose.com/slides/cpp/aspose.slides/ilayoutslide/get_placeholdermanager/) method provides an [ILayoutPlaceholderManager](https://reference.aspose.com/slides/cpp/aspose.slides/ilayoutplaceholdermanager/) for adding placeholder shapes to a layout. | PowerPoint Placeholder | `ILayoutPlaceholderManager` Method | | ----------------------------------- | ---------------------------------- | | ![Content](https://docs.aspose.com/slides/cpp/slide-layout/content.png) | [`AddContentPlaceholder(float x, float y, float width, float height)`](https://reference.aspose.com/slides/cpp/aspose.slides/ilayoutplaceholdermanager/addcontentplaceholder/) | | ![Content (Vertical)](https://docs.aspose.com/slides/cpp/slide-layout/contentV.png) | [`AddVerticalContentPlaceholder(float x, float y, float width, float height)`](https://reference.aspose.com/slides/cpp/aspose.slides/ilayoutplaceholdermanager/addverticalcontentplaceholder/) | | ![Text](https://docs.aspose.com/slides/cpp/slide-layout/text.png) | [`AddTextPlaceholder(float x, float y, float width, float height)`](https://reference.aspose.com/slides/cpp/aspose.slides/ilayoutplaceholdermanager/addtextplaceholder/) | | ![Text (Vertical)](https://docs.aspose.com/slides/cpp/slide-layout/textV.png) | [`AddVerticalTextPlaceholder(float x, float y, float width, float height)`](https://reference.aspose.com/slides/cpp/aspose.slides/ilayoutplaceholdermanager/addverticaltextplaceholder/) | | ![Picture](https://docs.aspose.com/slides/cpp/slide-layout/picture.png) | [`AddPicturePlaceholder(float x, float y, float width, float height)`](https://reference.aspose.com/slides/cpp/aspose.slides/ilayoutplaceholdermanager/addpictureplaceholder/) | | ![Chart](https://docs.aspose.com/slides/cpp/slide-layout/chart.png) | [`AddChartPlaceholder(float x, float y, float width, float height)`](https://reference.aspose.com/slides/cpp/aspose.slides/ilayoutplaceholdermanager/addchartplaceholder/) | | ![Table](https://docs.aspose.com/slides/cpp/slide-layout/table.png) | [`AddTablePlaceholder(float x, float y, float width, float height)`](https://reference.aspose.com/slides/cpp/aspose.slides/ilayoutplaceholdermanager/addtableplaceholder/) | | ![SmartArt](https://docs.aspose.com/slides/cpp/slide-layout/smartart.png) | [`AddSmartArtPlaceholder(float x, float y, float width, float height)`](https://reference.aspose.com/slides/cpp/aspose.slides/ilayoutplaceholdermanager/addsmartartplaceholder/) | | ![Media](https://docs.aspose.com/slides/cpp/slide-layout/media.png) | [`AddMediaPlaceholder(float x, float y, float width, float height)`](https://reference.aspose.com/slides/cpp/aspose.slides/ilayoutplaceholdermanager/addmediaplaceholder/) | | ![Online Image](https://docs.aspose.com/slides/cpp/slide-layout/onlineImage.png) | [`AddOnlineImagePlaceholder(float x, float y, float width, float height)`](https://reference.aspose.com/slides/cpp/aspose.slides/ilayoutplaceholdermanager/addonlineimageplaceholder/) | The following example verifies that the **Blank** layout exists, adds four placeholders to it, and then creates a normal slide that uses the modified layout. The order is intentional: the placeholders are added before the normal slide is created, so Aspose.Slides can generate the corresponding placeholder shapes on that slide. ```cpp #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(); auto blankLayout = presentation->get_LayoutSlides()->GetByType(SlideLayoutType::Blank); if (blankLayout == nullptr) { throw InvalidOperationException(u"The presentation does not contain a Blank layout slide."); } auto placeholderManager = blankLayout->get_PlaceholderManager(); placeholderManager->AddContentPlaceholder(20.0f, 20.0f, 310.0f, 270.0f); placeholderManager->AddVerticalTextPlaceholder(350.0f, 20.0f, 350.0f, 270.0f); placeholderManager->AddChartPlaceholder(20.0f, 310.0f, 310.0f, 180.0f); placeholderManager->AddTablePlaceholder(350.0f, 310.0f, 350.0f, 180.0f); presentation->get_Slides()->AddEmptySlide(blankLayout); presentation->Save(u"output-with-placeholders.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` The result: ![The placeholders on the layout slide](https://docs.aspose.com/slides/cpp/slide-layout/add_placeholders.png) Changing inherited formatting or the geometry of existing layout placeholders can affect dependent slides. A newly added layout placeholder is not backfilled into existing normal slides. Test layout changes on a copy of the presentation and inspect every dependent slide. ## **Remove Unused Layout Slides** Use the [Compress::RemoveUnusedLayoutSlides](https://reference.aspose.com/slides/cpp/aspose.slides.lowcode/compress/removeunusedlayoutslides/) method to remove layouts that no normal slide references. The method leaves layouts that are still in use intact. ```cpp #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace Aspose::Slides::LowCode; using namespace System; auto presentation = MakeObject(u"input.pptx"); Compress::RemoveUnusedLayoutSlides(presentation); presentation->Save(u"output-without-unused-layouts.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` To remove one specific layout, first use its [get_HasDependingSlides](https://reference.aspose.com/slides/cpp/aspose.slides/ilayoutslide/get_hasdependingslides/) method or [GetDependingSlides](https://reference.aspose.com/slides/cpp/aspose.slides/ilayoutslide/getdependingslides/) method. Reassign any dependent slides before calling [ILayoutSlide::Remove](https://reference.aspose.com/slides/cpp/aspose.slides/ilayoutslide/remove/). Attempting to remove a used layout raises a [PptxEditException](https://reference.aspose.com/slides/cpp/aspose.slides/pptxeditexception/). ## **Control Footer Visibility on a Layout Slide** A layout has its own footer, slide-number, and date-time placeholders. Use the [ILayoutSlide::get_HeaderFooterManager](https://reference.aspose.com/slides/cpp/aspose.slides/ilayoutslide/get_headerfootermanager/) method to control those placeholders for one layout. This is useful when, for example, content layouts should show footers but title layouts should not. The following example selects a layout safely and makes its footer elements visible: ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(u"input.pptx"); auto layoutSlide = presentation->get_LayoutSlides()->GetByType(SlideLayoutType::TitleAndObject); if (layoutSlide == nullptr) { layoutSlide = presentation->get_LayoutSlides()->GetByType(SlideLayoutType::Blank); } if (layoutSlide == nullptr) { throw InvalidOperationException(u"The presentation does not contain a suitable layout slide."); } auto headerFooterManager = layoutSlide->get_HeaderFooterManager(); headerFooterManager->SetFooterVisibility(true); headerFooterManager->SetSlideNumberVisibility(true); headerFooterManager->SetDateTimeVisibility(true); headerFooterManager->SetFooterText(u"Footer text"); headerFooterManager->SetDateTimeText(u"Date and time text"); presentation->Save(u"output-with-layout-footers.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ## **Control Footer Visibility on a Master and Its Child Layouts** To apply consistent footer settings across a master hierarchy, use the [IMasterSlide::get_HeaderFooterManager](https://reference.aspose.com/slides/cpp/aspose.slides/imasterslide/get_headerfootermanager/) method. The propagation methods of [IMasterSlideHeaderFooterManager](https://reference.aspose.com/slides/cpp/aspose.slides/imasterslideheaderfootermanager/) operate on the master and its dependent layout slides and normal slides; they do not target just one normal slide. ```cpp #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(u"input.pptx"); auto headerFooterManager = presentation->get_Master(0)->get_HeaderFooterManager(); headerFooterManager->SetFooterAndChildFootersVisibility(true); headerFooterManager->SetSlideNumberAndChildSlideNumbersVisibility(true); headerFooterManager->SetDateTimeAndChildDateTimesVisibility(true); headerFooterManager->SetFooterAndChildFootersText(u"Footer text"); headerFooterManager->SetDateTimeAndChildDateTimesText(u"Date and time text"); presentation->Save(u"output-with-master-footers.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ## **FAQ** **What Is the Difference Between a Master Slide and a Layout Slide?** A master slide defines the presentation's theme and shared formatting. A layout slide belongs to a master and defines one reusable arrangement of placeholders. Normal slides use those layouts and store slide-specific content. **Can I Copy a Layout Slide from One Presentation to Another?** Yes. Add a copy to the destination collection with the [IGlobalLayoutSlideCollection::AddClone](https://reference.aspose.com/slides/cpp/aspose.slides/igloballayoutslidecollection/addclone/) method. When copying between presentations, also verify fonts, themes, images, and other resources used by the source layout. **What Happens When I Modify a Layout That Is Already in Use?** Dependent slides inherit the layout changes unless they override the affected formatting or objects locally. Placeholder geometry and inherited styling can therefore change on many slides at once. Use [GetDependingSlides](https://reference.aspose.com/slides/cpp/aspose.slides/ilayoutslide/getdependingslides/) to identify the affected slides before editing the layout. **What Happens If I Remove a Layout That Is Still in Use?** Aspose.Slides throws a [PptxEditException](https://reference.aspose.com/slides/cpp/aspose.slides/pptxeditexception/). Reassign the dependent slides first, or use [RemoveUnusedLayoutSlides](https://reference.aspose.com/slides/cpp/aspose.slides.lowcode/compress/removeunusedlayoutslides/) to remove only unreferenced layouts. ## Related articles - [Manage Presentation Headers and Footers in C++](https://docs.aspose.com/slides/cpp/presentation-header-and-footer/) - [Layout Slide](https://docs.aspose.com/slides/cpp/examples/elements/layout-slide/) - [Manage Presentation Slide Masters in C++](https://docs.aspose.com/slides/cpp/slide-master/) # Manage Presentation Slide Masters in C++ > Manage slide masters in Aspose.Slides for C++: access, edit, clone, compare, and remove master slides in PowerPoint and OpenDocument presentations. Source: https://docs.aspose.com/slides/cpp/slide-master/ Updated: 2026-09-28 ## **Overview** A **slide master** defines shared design settings for a group of slides. It can contain common shapes, logos, backgrounds, text styles, theme settings, and footer settings. In PowerPoint, editing a slide master is the usual way to keep a presentation consistent without repeating the same formatting on every slide. Aspose.Slides for C++ supports the same model. A presentation can contain one or more master slides, and each master slide can contain several layout slides. Normal slides do not usually refer to a master slide directly. Instead, a normal slide uses a layout slide, and that layout slide belongs to a master slide. The hierarchy is: 1. **Slide master** - defines the shared design and theme. 1. **Layout slide** - defines a specific arrangement of placeholders and layout-level formatting. 1. **Normal slide** - contains the actual presentation content and uses one layout slide. ![The hierarchy of master slides, layout slides, and normal slides](https://docs.aspose.com/slides/cpp/slide-master/slide-master_2.jpg) In Aspose.Slides, a slide master is represented by the [IMasterSlide](https://reference.aspose.com/slides/cpp/aspose.slides/imasterslide/) interface. All master slides in a presentation are available through the [Presentation::get_Masters](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/get_masters/) collection, which implements [IMasterSlideCollection](https://reference.aspose.com/slides/cpp/aspose.slides/imasterslidecollection/). When the same property is defined at more than one level, the more specific level wins. For example, if a master slide and a layout slide both define a background, slides based on that layout use the layout background. For more information about layout slides, see [Apply or Change Slide Layouts](https://docs.aspose.com/slides/cpp/slide-layout/). ## **Access Slide Masters** In PowerPoint, you can open the Slide Master view from **View** > **Slide Master**. ![The Slide Master command on the PowerPoint View tab](https://docs.aspose.com/slides/cpp/slide-master/slide-master_3.jpg) In Aspose.Slides, use the `get_Masters()` collection to access master slides: ```cpp #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto presentation = System::MakeObject(u"presentation.pptx"); auto firstMasterSlide = presentation->get_Master(0); auto masterSlideCount = presentation->get_Masters()->get_Count(); auto firstMasterLayoutSlideCount = firstMasterSlide->get_LayoutSlides()->get_Count(); System::Console::WriteLine(System::String(u"Master slides: ") + masterSlideCount); System::Console::WriteLine(System::String(u"Layouts in the first master: ") + firstMasterLayoutSlideCount); presentation->Dispose(); ``` You can also get the master slide used by a normal slide through its layout: ```cpp #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto presentation = System::MakeObject(u"presentation.pptx"); auto slide = presentation->get_Slide(0); auto layoutSlide = slide->get_LayoutSlide(); auto masterSlide = layoutSlide->get_MasterSlide(); auto masterSlideName = masterSlide->get_Name(); System::Console::WriteLine(masterSlideName); presentation->Dispose(); ``` ## **What a Slide Master Contains** A master slide is a slide-like object. It implements [IBaseSlide](https://reference.aspose.com/slides/cpp/aspose.slides/ibaseslide/), so it exposes many of the same slide properties used by normal and layout slides. Master-specific members are listed on the [IMasterSlide](https://reference.aspose.com/slides/cpp/aspose.slides/imasterslide/) API page. Commonly used master slide members include: | Member | Purpose | | --- | --- | | `get_Background()` | Sets the master-level slide background. | | `get_Shapes()` | Stores shapes placed on the master, such as logos, picture frames, and shared text. | | `get_LayoutSlides()` | Stores the layout slides that belong to the master. | | `get_ThemeManager()` | Provides access to the master theme APIs. | | `get_HeaderFooterManager()` | Controls headers, footers, dates, and slide numbers for the master and its child layouts. | | `GetDependingSlides()` | Returns normal slides that depend on the master through their layouts. | ## **Add an Image to a Slide Master** When you add an image to a master slide, it appears on slides that use layouts from that master. This is useful for logos, watermarks, decorative bands, and other repeated visual elements. The following example adds a logo to the first master slide: ```cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System::IO; auto presentation = System::MakeObject(u"presentation.pptx"); auto masterSlide = presentation->get_Master(0); auto logoBytes = System::IO::File::ReadAllBytes(u"logo.png"); auto logoImage = presentation->get_Images()->AddImage(logoBytes); masterSlide->get_Shapes()->AddPictureFrame( ShapeType::Rectangle, 20.0f, 20.0f, 80.0f, 80.0f, logoImage); presentation->Save(u"presentation-with-logo.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` For more information about picture frames, see [Picture Frame](https://docs.aspose.com/slides/cpp/picture-frame/). ## **Control the Visibility of Master Graphics** Use [IBaseSlide::set_ShowMasterShapes](https://reference.aspose.com/slides/cpp/aspose.slides/ibaseslide/set_showmastershapes/) to hide inherited master graphics, such as logos or decorative shapes, without deleting them from the master. Pass `false` to [Slide::set_ShowMasterShapes](https://reference.aspose.com/slides/cpp/aspose.slides/slide/set_showmastershapes/) on the slide that should omit those graphics and `true` on slides that should display them. The following self-contained example creates a blue decorative band on a master and two slides that use the same blank layout. The band is visible on the first slide and hidden on the second. No input presentation or image is required. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::Drawing; auto presentation = MakeObject(); auto masterSlide = presentation->get_Master(0); auto layoutSlide = masterSlide->get_LayoutSlides()->GetByType(SlideLayoutType::Blank); layoutSlide->set_ShowMasterShapes(true); auto slideHeight = presentation->get_SlideSize()->get_Size().get_Height(); auto band = masterSlide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 0.0f, 0.0f, 60.0f, slideHeight); band->get_FillFormat()->set_FillType(FillType::Solid); band->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_SteelBlue()); band->get_LineFormat()->get_FillFormat()->set_FillType(FillType::NoFill); auto visibleSlide = presentation->get_Slide(0); visibleSlide->set_LayoutSlide(layoutSlide); visibleSlide->get_Shapes()->Clear(); auto hiddenSlide = presentation->get_Slides()->AddEmptySlide(layoutSlide); visibleSlide->set_ShowMasterShapes(true); hiddenSlide->set_ShowMasterShapes(false); presentation->Save(u"master-graphics.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` The example uses the **Blank** layout supplied with a new presentation and removes the initial slide's own placeholders. ### **Choose the Scope of the Setting** A normal slide uses its master through [ISlide::get_LayoutSlide](https://reference.aspose.com/slides/cpp/aspose.slides/islide/get_layoutslide/) and [ILayoutSlide::get_MasterSlide](https://reference.aspose.com/slides/cpp/aspose.slides/ilayoutslide/get_masterslide/). Setting the property on an individual slide affects only that slide. Passing `false` to [LayoutSlide::set_ShowMasterShapes](https://reference.aspose.com/slides/cpp/aspose.slides/layoutslide/set_showmastershapes/) hides master graphics for slides that use that shared layout, even if their own setting is `true`. To hide graphics on just one slide, change the slide property and leave the shared layout unchanged. The setting is not supported as a visibility control on the master slide itself. On a master it always returns `false`, and assigning `true` raises `System::NotSupportedException`. Apply it to a normal slide or a layout instead. ### **Distinguish Graphics from the Background** | Operation | Effect | | --- | --- | | Hide master graphics | Controls the visibility of inherited master shapes without deleting them or changing the slide's own shapes. | | Change the slide background fill | Changes the background color, gradient, or image. Master graphics are separate shapes and can remain visible over that background. See [Presentation Background](https://docs.aspose.com/slides/cpp/presentation-background/). | | Delete a shape from the master | Removes the shared source shape, so it is no longer available to any slide using that master. | ## **Work with Placeholders** Placeholders are normally defined on layout slides. The master slide provides the shared style and theme that those layouts inherit, while each layout decides which placeholders are available and where they are placed. In PowerPoint, placeholder commands are available in Slide Master view. ![The Insert Placeholder command in PowerPoint Slide Master view](https://docs.aspose.com/slides/cpp/slide-master/slide-master_5.png) To add new placeholders with Aspose.Slides, work with the layout slide that belongs to the master: ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(u"presentation.pptx"); auto masterSlide = presentation->get_Master(0); auto blankLayoutSlide = masterSlide->get_LayoutSlides()->GetByType(SlideLayoutType::Blank); if (blankLayoutSlide == nullptr) { blankLayoutSlide = masterSlide->get_LayoutSlides()->Add(SlideLayoutType::Blank, u"Blank"); } blankLayoutSlide->get_PlaceholderManager()->AddTextPlaceholder( 60.0f, 120.0f, 600.0f, 80.0f); presentation->get_Slides()->AddEmptySlide(blankLayoutSlide); presentation->Save(u"presentation-with-placeholder.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` You can also format placeholder shapes that already exist on a master slide. The following example finds the title placeholder and applies a linear gradient fill: ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System::Drawing; auto presentation = System::MakeObject(u"presentation.pptx"); auto masterSlide = presentation->get_Master(0); System::SharedPtr titlePlaceholder; for (auto&& shape : masterSlide->get_Shapes()) { auto autoShape = System::AsCast(shape); if (autoShape != nullptr && autoShape->get_Placeholder() != nullptr && autoShape->get_Placeholder()->get_Type() == PlaceholderType::Title) { titlePlaceholder = autoShape; break; } } if (titlePlaceholder != nullptr) { auto fillFormat = titlePlaceholder->get_FillFormat(); fillFormat->set_FillType(FillType::Gradient); auto gradientFormat = fillFormat->get_GradientFormat(); gradientFormat->set_GradientShape(GradientShape::Linear); auto gradientStops = gradientFormat->get_GradientStops(); auto redGradientColor = System::Drawing::Color::FromArgb(255, 0, 0); auto purpleGradientColor = System::Drawing::Color::FromArgb(128, 0, 128); gradientStops->Add(0.0f, redGradientColor); gradientStops->Add(255.0f, purpleGradientColor); } presentation->Save(u"presentation-title-style.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ![Formatted title placeholder inherited by normal slides](https://docs.aspose.com/slides/cpp/slide-master/slide-master_8.png) For more placeholder and text formatting options, see [Set Prompt Text in Placeholder](https://docs.aspose.com/slides/cpp/manage-placeholder/) and [Text Formatting](https://docs.aspose.com/slides/cpp/text-formatting/). ## **Change a Slide Master Background** A master background is inherited by layouts and slides that do not override it. The following example sets a solid background color for the first master slide: ```cpp #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System::Drawing; auto presentation = System::MakeObject(u"presentation.pptx"); auto masterSlide = presentation->get_Master(0); auto masterBackgroundColor = System::Drawing::Color::get_ForestGreen(); masterSlide->get_Background()->set_Type(BackgroundType::OwnBackground); masterSlide->get_Background()->get_FillFormat()->set_FillType(FillType::Solid); masterSlide->get_Background()->get_FillFormat()->get_SolidFillColor()->set_Color(masterBackgroundColor); presentation->Save(u"presentation-master-background.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` For related topics, see [Presentation Background](https://docs.aspose.com/slides/cpp/presentation-background/) and [Presentation Theme](https://docs.aspose.com/slides/cpp/presentation-theme/). ## **Clone a Slide Master to Another Presentation** Use [IMasterSlideCollection::AddClone](https://reference.aspose.com/slides/cpp/aspose.slides/imasterslidecollection/addclone/) to copy a master slide into another presentation. The copied master can then be used by layouts and slides in the destination presentation. ```cpp #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto sourcePresentation = System::MakeObject(u"source.pptx"); auto destinationPresentation = System::MakeObject(u"destination.pptx"); auto sourceMasterSlide = sourcePresentation->get_Master(0); auto clonedMasterSlide = destinationPresentation->get_Masters()->AddClone(sourceMasterSlide); destinationPresentation->Save(u"destination-with-master.pptx", SaveFormat::Pptx); destinationPresentation->Dispose(); sourcePresentation->Dispose(); ``` If you need to clone normal slides together with their master, see [Clone Slides](https://docs.aspose.com/slides/cpp/clone-slides/). ## **Add Multiple Slide Masters** A presentation can contain multiple master slides. This is useful when different sections require different branding, page structure, or theme settings. ![PowerPoint commands for inserting and managing master slides](https://docs.aspose.com/slides/cpp/slide-master/slide-master_9.jpg) The following example clones the default master, gives the clone a different background, creates a layout under that cloned master, and adds a new slide based on that layout: ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System::Drawing; auto presentation = System::MakeObject(u"presentation.pptx"); auto defaultMasterSlide = presentation->get_Master(0); auto sectionMasterSlide = presentation->get_Masters()->AddClone(defaultMasterSlide); auto sectionMasterBackgroundColor = System::Drawing::Color::get_LightSteelBlue(); sectionMasterSlide->get_Background()->set_Type(BackgroundType::OwnBackground); sectionMasterSlide->get_Background()->get_FillFormat()->set_FillType(FillType::Solid); sectionMasterSlide->get_Background()->get_FillFormat()->get_SolidFillColor()->set_Color(sectionMasterBackgroundColor); auto sourceBlankLayout = defaultMasterSlide->get_LayoutSlides()->GetByType(SlideLayoutType::Blank); if (sourceBlankLayout == nullptr) { sourceBlankLayout = defaultMasterSlide->get_LayoutSlide(0); } auto sectionBlankLayout = sectionMasterSlide->get_LayoutSlides()->AddClone(sourceBlankLayout); presentation->get_Slides()->AddEmptySlide(sectionBlankLayout); presentation->Save(u"presentation-with-multiple-masters.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ## **Compare Slide Masters** Master slides can be compared with the `Equals` method inherited from [IBaseSlide](https://reference.aspose.com/slides/cpp/aspose.slides/ibaseslide/). The comparison checks structure and static content, such as shapes, text, formatting, animations, and other slide settings. It does not compare unique identifiers, such as slide IDs, or dynamic placeholder values, such as the current date. ```cpp #include #include #include #include using namespace Aspose::Slides; using namespace System; auto firstPresentation = System::MakeObject(u"first.pptx"); auto secondPresentation = System::MakeObject(u"second.pptx"); auto firstPresentationMasterCount = firstPresentation->get_Masters()->get_Count(); auto secondPresentationMasterCount = secondPresentation->get_Masters()->get_Count(); for (int32_t firstMasterIndex = 0; firstMasterIndex < firstPresentationMasterCount; firstMasterIndex++) { for (int32_t secondMasterIndex = 0; secondMasterIndex < secondPresentationMasterCount; secondMasterIndex++) { auto firstMasterSlide = firstPresentation->get_Master(firstMasterIndex); auto secondMasterSlide = secondPresentation->get_Master(secondMasterIndex); auto areMasterSlidesEqual = firstMasterSlide->Equals(secondMasterSlide); if (areMasterSlidesEqual) { System::Console::WriteLine( System::String::Format( u"first.pptx master #{0} equals second.pptx master #{1}", firstMasterIndex, secondMasterIndex)); } } } secondPresentation->Dispose(); firstPresentation->Dispose(); ``` For more information, see [Compare Presentation Slides](https://docs.aspose.com/slides/cpp/compare-slides/). ## **Set Slide Master View as the Default View** Use the `set_LastView` method on [ViewProperties](https://reference.aspose.com/slides/cpp/aspose.slides/viewproperties/) to control the view that PowerPoint opens first. The following example opens the presentation in Slide Master view: ```cpp #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(u"presentation.pptx"); presentation->get_ViewProperties()->set_LastView(ViewType::SlideMasterView); presentation->Save(u"presentation-master-view.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` For more view settings, see [Save Presentation](https://docs.aspose.com/slides/cpp/save-presentation/). ## **Remove Unused Master Slides** Presentations sometimes contain master slides that are no longer used by any normal slides. Removing unused masters can reduce file size and simplify template maintenance. Use [MasterSlideCollection::RemoveUnused](https://reference.aspose.com/slides/cpp/aspose.slides/masterslidecollection/removeunused/) to remove unused masters from the `get_Masters()` collection: ```cpp #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(u"presentation.pptx"); presentation->get_Masters()->RemoveUnused(true); presentation->Save(u"presentation-clean.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` You can also use the low-code [Compress::RemoveUnusedMasterSlides](https://reference.aspose.com/slides/cpp/aspose.slides.lowcode/compress/removeunusedmasterslides/) method: ```cpp #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace Aspose::Slides::LowCode; auto presentation = System::MakeObject(u"presentation.pptx"); LowCode::Compress::RemoveUnusedMasterSlides(presentation); presentation->Save(u"presentation-clean.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ## **FAQ** **What is the difference between a slide master and a layout slide?** A slide master defines shared design settings such as theme, background, common shapes, and text styles. A layout slide belongs to a master slide and defines a specific arrangement of placeholders. A normal slide uses a layout slide, so it inherits from both the layout and the master. **Can one presentation contain several slide masters?** Yes. A presentation can contain several slide masters. Use multiple masters when different sections need different visual systems or branding. **Should I add placeholders to a master slide or a layout slide?** In most cases, add placeholders to layout slides. Put shared visual elements and shared formatting on the master slide, then put content placeholders on the layouts that normal slides will use. **Can I delete a master slide that is still used?** No. A master slide that has dependent slides cannot be safely removed directly. First move those slides to layouts under another master, or use an unused-master cleanup method that removes only masters that are not in use. ## Related articles - [Master Slide](https://docs.aspose.com/slides/cpp/examples/elements/master-slide/) - [Layout Slide](https://docs.aspose.com/slides/cpp/examples/elements/layout-slide/) - [Apply or Change Slide Layouts in C++](https://docs.aspose.com/slides/cpp/slide-layout/) # Manage Slide Sections in Presentations with C++ > Manage slide sections with Aspose.Slides for C++: create, rename, reorder, retrieve, and process section slides in PPTX presentations. Source: https://docs.aspose.com/slides/cpp/slide-section/ Updated: 2026-08-25 ## **Introduction** Sections organize consecutive slides into named groups without changing the slide content. With Aspose.Slides for C++, you can create, reorder, rename, inspect, and remove sections through the [Presentation::get_Sections](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/get_sections/) method. Sections are especially useful when: - a large presentation needs to be divided into logical topics or chapters; - different groups of slides are assigned to different collaborators; - slides need to be processed, moved, or merged as groups. Choose concise section names that describe the purpose of the grouped slides. Because sections are part of the presentation structure, use the section APIs to determine membership instead of deriving it from slide positions. ## **Create and Manage Sections** Use [ISectionCollection::AddSection](https://reference.aspose.com/slides/cpp/aspose.slides/isectioncollection/addsection/) to create a section by specifying its name and starting slide. Aspose.Slides determines which slides belong to the section from the presentation's current section structure. The same [ISectionCollection](https://reference.aspose.com/slides/cpp/aspose.slides/isectioncollection/) also lets you: - move a section together with its slides by using [ISectionCollection::ReorderSectionWithSlides](https://reference.aspose.com/slides/cpp/aspose.slides/isectioncollection/reordersectionwithslides/); - remove only the section definition with [ISectionCollection::RemoveSection](https://reference.aspose.com/slides/cpp/aspose.slides/isectioncollection/removesection/), which retains its slides; - remove a section and its slides with [ISectionCollection::RemoveSectionWithSlides](https://reference.aspose.com/slides/cpp/aspose.slides/isectioncollection/removesectionwithslides/); - add an empty section at the end with [ISectionCollection::AppendEmptySection](https://reference.aspose.com/slides/cpp/aspose.slides/isectioncollection/appendemptysection/). The following example creates two sections, moves one of them, removes it together with its slides, and appends an empty section: ```cpp #include #include #include using namespace Aspose::Slides; auto presentation = System::MakeObject(); auto layoutSlide = presentation->get_LayoutSlide(0); auto titleSlide = presentation->get_Slide(0); presentation->get_Slides()->AddEmptySlide(layoutSlide); auto resultsSlide = presentation->get_Slides()->AddEmptySlide(layoutSlide); presentation->get_Slides()->AddEmptySlide(layoutSlide); auto sections = presentation->get_Sections(); sections->AddSection(u"Introduction", titleSlide); auto resultsSection = sections->AddSection(u"Results", resultsSlide); sections->ReorderSectionWithSlides(resultsSection, 0); sections->RemoveSectionWithSlides(resultsSection); sections->AppendEmptySection(u"Appendix"); ``` After these operations, the presentation contains the `Introduction` section with its slides and an empty `Appendix` section. The `Results` section and its slides have been removed. ## **Rename Sections** To rename a section, call [ISection::set_Name](https://reference.aspose.com/slides/cpp/aspose.slides/isection/set_name/). The section's slides and position remain unchanged. The following example creates a section and changes its name: ```cpp #include #include #include using namespace Aspose::Slides; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto section = presentation->get_Sections()->AddSection(u"Overview", slide); section->set_Name(u"Introduction"); ``` ## **Retrieve Slides from Sections** The [Presentation::get_Sections](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/get_sections/) method returns an [ISectionCollection](https://reference.aspose.com/slides/cpp/aspose.slides/isectioncollection/) that you can enumerate. For each [ISection](https://reference.aspose.com/slides/cpp/aspose.slides/isection/), call [ISection::GetSlidesListOfSection](https://reference.aspose.com/slides/cpp/aspose.slides/isection/getslideslistofsection/) to obtain the slides that currently belong to it. The method returns an [ISectionSlideCollection](https://reference.aspose.com/slides/cpp/aspose.slides/isectionslidecollection/), which provides a count, indexed access, and enumeration. The following example creates two populated sections and one empty section, then prints each section's [name](https://reference.aspose.com/slides/cpp/aspose.slides/isection/get_name/), [identifier](https://reference.aspose.com/slides/cpp/aspose.slides/isection/get_sectionid/), [starting slide](https://reference.aspose.com/slides/cpp/aspose.slides/isection/get_startedfromslide/), slide count, and slide numbers. It uses indexed access to read the first slide and a range-based `for` loop to process every slide. For the empty section, the returned collection has a count of zero, indexed access is not used, and enumeration performs no iterations. ```cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; auto presentation = System::MakeObject(); auto layoutSlide = presentation->get_LayoutSlide(0); auto firstSlide = presentation->get_Slide(0); presentation->get_Slides()->AddEmptySlide(layoutSlide); auto thirdSlide = presentation->get_Slides()->AddEmptySlide(layoutSlide); auto sections = presentation->get_Sections(); sections->AddSection(u"Introduction", firstSlide); sections->AddSection(u"Details", thirdSlide); sections->AppendEmptySection(u"Appendix"); for (const auto& section : sections) { auto sectionSlides = section->GetSlidesListOfSection(); auto startingSlide = section->get_StartedFromSlide(); System::Console::WriteLine(u"Section: {0}", section->get_Name()); System::Console::WriteLine(u"ID: {0}", section->get_SectionId().ToString()); if (startingSlide == nullptr) { System::Console::WriteLine(u"Starting slide: none"); } else { System::Console::WriteLine(u"Starting slide: {0}", startingSlide->get_SlideNumber()); } System::Console::WriteLine(u"Slide count: {0}", sectionSlides->get_Count()); if (sectionSlides->get_Count() > 0) { System::Console::WriteLine(u"First slide via index: {0}", sectionSlides->idx_get(0)->get_SlideNumber()); } System::Console::Write(u"Slide numbers:"); for (const auto& slide : sectionSlides) { System::Console::Write(u" {0}", slide->get_SlideNumber()); } System::Console::WriteLine(); } ``` Section membership is determined by the presentation's section structure. Do not calculate a section's range manually from [ISection::get_StartedFromSlide](https://reference.aspose.com/slides/cpp/aspose.slides/isection/get_startedfromslide/), slide indexes, and the next section's starting slide. Structural edits can change both the slides returned for a section and their slide numbers. This includes reordering slides, cloning a slide into a section, moving a section together with its slides, removing slides, and removing sections. The next example calls [ISection::GetSlidesListOfSection](https://reference.aspose.com/slides/cpp/aspose.slides/isection/getslideslistofsection/) after every such change instead of retaining assumptions about the section's former boundaries. ```cpp #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; auto presentation = System::MakeObject(); auto layoutSlide = presentation->get_LayoutSlide(0); auto firstSlide = presentation->get_Slide(0); presentation->get_Slides()->AddEmptySlide(layoutSlide); auto thirdSlide = presentation->get_Slides()->AddEmptySlide(layoutSlide); presentation->get_Slides()->AddEmptySlide(layoutSlide); auto sections = presentation->get_Sections(); auto firstSection = sections->AddSection(u"First", firstSlide); auto secondSection = sections->AddSection(u"Second", thirdSlide); auto printSectionSlides = [](const System::String& label, const System::SharedPtr& section) { auto sectionSlides = section->GetSlidesListOfSection(); System::Console::Write(u"{0} ({1} slides):", label, sectionSlides->get_Count()); for (const auto& slide : sectionSlides) { System::Console::Write(u" {0}", slide->get_SlideNumber()); } System::Console::WriteLine(); }; printSectionSlides(u"Initially", firstSection); auto slidesBeforeClone = firstSection->GetSlidesListOfSection(); presentation->get_Slides()->AddClone(slidesBeforeClone->idx_get(0), firstSection); printSectionSlides(u"After cloning into the section", firstSection); auto slidesBeforeReorder = firstSection->GetSlidesListOfSection(); auto firstSlideInSection = slidesBeforeReorder->idx_get(0); auto lastSlideInSection = slidesBeforeReorder->idx_get(slidesBeforeReorder->get_Count() - 1); auto firstSectionPosition = firstSlideInSection->get_SlideNumber() - 1; presentation->get_Slides()->Reorder(firstSectionPosition, lastSlideInSection); printSectionSlides(u"After reordering slides", firstSection); sections->ReorderSectionWithSlides(firstSection, 1); printSectionSlides(u"After moving the section", firstSection); auto slidesBeforeRemoval = firstSection->GetSlidesListOfSection(); presentation->get_Slides()->Remove(slidesBeforeRemoval->idx_get(0)); printSectionSlides(u"After removing a slide", firstSection); sections->RemoveSectionWithSlides(secondSection); for (const auto& section : sections) { printSectionSlides(u"Remaining section", section); } ``` Call [ISection::GetSlidesListOfSection](https://reference.aspose.com/slides/cpp/aspose.slides/isection/getslideslistofsection/) again whenever slides or sections are reordered, cloned, moved, or removed. This keeps subsequent processing aligned with the current presentation structure. The PPT (PowerPoint 97–2003) format does not preserve section metadata. Use this workflow with a format that supports sections, such as PPTX; converting to PPT removes the section structure needed for later enumeration. ## **FAQ** **Are sections preserved when saving to the PPT (PowerPoint 97–2003) format?** No. The PPT format does not support section metadata, so section grouping is lost when saving to .ppt. **Can an entire section be "hidden"?** No. A section has no visibility state. To hide its contents, call [ISlide::set_Hidden](https://reference.aspose.com/slides/cpp/aspose.slides/islide/set_hidden/) for each slide in the section. **How can I find the section that contains a slide?** Enumerate [Presentation::get_Sections](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/get_sections/), call [ISection::GetSlidesListOfSection](https://reference.aspose.com/slides/cpp/aspose.slides/isection/getslideslistofsection/) for each section, and compare the returned slides with the target slide. For a non-empty section, [ISection::get_StartedFromSlide](https://reference.aspose.com/slides/cpp/aspose.slides/isection/get_startedfromslide/) returns its first slide; for an empty section, it returns `nullptr`. ## Related articles - [Section](https://docs.aspose.com/slides/cpp/examples/elements/section/) # Change the Presentation Slide Size in C++ > Learn how to quickly resize slides in PPT, PPTX and ODP files with C++ and Aspose.Slides, optimize presentations for any screen without losing quality. Source: https://docs.aspose.com/slides/cpp/slide-size/ Updated: 2026-11-08 ## **Introduction** Aspose.Slides provides comprehensive tools to adjust the slide size and aspect ratio in PowerPoint presentations, critical for both printing and on-screen display. Popular Slide Sizes and Ratios: - **Standard (4:3 Aspect Ratio)**: Ideal for older screens and devices. - **Widescreen (16:9 Aspect Ratio)**: Recommended for modern projectors and displays. Ensure consistency throughout your presentation as a single slide size and aspect ratio apply to all slides. For optimal results, set your slide dimensions at the beginning of your presentation creation process to avoid complications. By default, presentations created with Aspose.Slides use the standard 4:3 aspect ratio. Notes and handout pages have separate dimensions from regular slides. See [Notes Page Size](https://docs.aspose.com/slides/cpp/notes-size/) to change their size and orientation. ## **Change the Slide Size in Presentations** This sample code shows you how to change the slide size in a presentation in C++ using Aspose.Slides: ``` cpp #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto pres = System::MakeObject(u"pres-4x3-aspect-ratio.pptx"); pres->get_SlideSize()->SetSize(SlideSizeType::OnScreen16x9, SlideSizeScaleType::DoNotScale); pres->Save(u"pres-4x3-aspect-ratio.pptx", SaveFormat::Pptx); ``` ## **Specify Custom Slide Sizes in Presentations** If you find the common slide sizes (4:3 and 16:9) unsuitable for your work, you may decide to use a specific or unique slide size. For example, if you plan to print full-size slides from your presentation on a custom page layout or if you intend to display your presentation on certain screen types, you are likely to benefit from using a custom size setting for your presentation. This sample code shows you how to use Aspose.Slides for C++ to specify a custom slide size for a presentation in C++: ``` cpp #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto pres = System::MakeObject(u"pres.pptx"); // A4 paper size pres->get_SlideSize()->SetSize(780.0f, 540.0f, SlideSizeScaleType::DoNotScale); pres->Save(u"pres-a4-slide-size.pptx", SaveFormat::Pptx); ``` ## **Handle Slide Content After Resizing** After you change the slide size for a presentation, the slides’ contents (images or objects, for example) may become distorted. By default, the objects get automatically resized to fit the new slide size. However, when changing a presentation's slide size, you can specify a setting that determines how Aspose.Slides deals with the contents on the slides. Depending on what you intend to do or achieve, you can use any of these settings: - `DoNotScale` If you do NOT want the objects on the slides to be resized, use this setting. - `EnsureFit` If you want to scale to a smaller slide size and you need Aspose.Slides to scale down the slides’ objects to ensure they all fit on slides (this way, you avoid losing content), use this setting. - `Maximize` If you want to scale to a larger slide size and you need Aspose.Slides to enlarge the slides’ objects to make them proportional to the new slide size, use this setting. This sample code shows you how to use the `Maximize` setting when changing the size of a presentation’s slide: ``` cpp #include #include #include #include using namespace Aspose::Slides; auto pres = System::MakeObject(u"pres.pptx"); pres->get_SlideSize()->SetSize(SlideSizeType::Ledger, SlideSizeScaleType::Maximize); ``` [![One shared display scale shows an original 720 by 480-point slide and three 600 by 300-point outputs. DoNotScale keeps shape sizes, EnsureFit leaves side margins, and Maximize crops edge shapes.](https://docs.aspose.com/slides/cpp/slide-size/visual-slide-size-1dbb49bb41cc.svg)](https://docs.aspose.com/slides/cpp/slide-size/visual-slide-size-1dbb49bb41cc.svg) *One .NET fixture resized to the same 600 × 300-point canvas in each mode. The figure uses one display scale throughout. Dashed marks show where shape frames extend beyond the canvas.* ## **FAQ** ### Can I set a custom slide size using units other than inches (for example, points or millimeters)? Yes. Aspose.Slides uses points internally, where 1 point equals 1/72 of an inch. You can convert any unit (such as millimeters or centimeters) to points and use the converted values to define slide width and height. ### Will a very large custom slide size affect performance and memory usage during rendering? Yes. Larger slide dimensions (in points) combined with higher rendering scale lead to increased memory consumption and longer processing times. Aim for a practical slide size and adjust rendering scale only as needed to achieve the desired output quality. ### Can I define one non-standard slide size and then merge slides from presentations that have different sizes? You can’t [merge presentations](https://docs.aspose.com/slides/cpp/merge-presentation/) while they have different slide sizes — first, resize one presentation to match the other. When changing the slide size, you can choose how existing content is handled via the [SlideSizeScaleType](https://reference.aspose.com/slides/cpp/aspose.slides/slidesizescaletype/) option. After aligning sizes, you can merge slides while preserving formatting. ### Can I generate thumbnails for individual shapes or specific regions of a slide, and will they respect the new slide size? Yes. Aspose.Slides can render thumbnails for [entire slides](https://reference.aspose.com/slides/cpp/aspose.slides/slide/getimage/) as well as for [selected shapes](https://reference.aspose.com/slides/cpp/aspose.slides/shape/getimage/). The resulting images reflect the current slide size and aspect ratio, ensuring consistent framing and geometry. # Slide Text Extraction: PPT, PPTX, ODP Essentials > Turn slides into data: extract text from PPT, PPTX, and ODP for search, automation, and accessibility, with format insights—usable in C++ and cloud platforms. Source: https://docs.aspose.com/slides/cpp/slide-text-extraction-ppt-pptx-odp-essentials/ Updated: 2025-09-30 ## **Introduction** Extracting text from presentation files is critical for **automating business processes**, **data analytics**, and **streamlining document workflows**. In today’s digital landscape, many organizations need **rapid access** to information contained in slides. Whether for **search indexing**, **content analysis**, **accessibility**, or **localization**, reliable text extraction ensures that valuable slide content can be reused, processed, and analyzed across various systems. ## **Practical Applications of Text Extraction** - **Automating Document Workflows**: Seamlessly integrate PPTX and ODP files into corporate document management systems (DMS) like SharePoint, Alfresco, or 1C:Document Management. - **Search Indexing**: Create high-speed search systems by indexing extracted text, enabling quick retrieval of pertinent data from large presentation archives. - **Content Analysis**: Automatically identify key phrases, topics, and trends to aid marketing and analytics teams in forecasting and strategic decision-making. - **Accessibility and Localization**: Generate subtitles, translate slides into multiple languages, or integrate content with screen-reading software for improved access. - **Text Positioning and Visual Analysis**: Beyond text itself, analyzing layout and positioning helps ensure proper slide structure, formatting, and alignment with corporate guidelines. This article explores several popular presentation file formats and how each affects the text extraction process. ## **Overview of Presentation Formats** ### **PPT (Legacy PowerPoint Format)** Originally used by Microsoft PowerPoint until 2007, **PPT** was prevalent in **MS Office 97–2003**. As a **binary format**, PPT is more difficult to process without specialized tools than modern XML-based formats. **Main Difficulties in Text Extraction** - Proprietary binary structure makes **data access** challenging without the official Microsoft API or specialized libraries. - **Text may appear** in multiple locations (slides, notes, comments), requiring a comprehensive approach to extraction. - **Encoding and font conflicts** can arise when dealing with custom characters. ### **PPTX (Open XML Specification)** Introduced in **PowerPoint 2007**, **PPTX** is built on **Office Open XML**, an XML-based standard that simplifies text extraction. **File Structure Basics** - PPTX files are **ZIP archives** containing multiple **XML documents**. - Slides, notes sections, and metadata each reside in separate **XML files**. **Extracting Text from Structured XML** PPTX allows more efficient text extraction due to its clear XML organization: - **Text resides in `ppt/slides/slideX.xml`** within `` tags. - **Notes and comments** are found in `ppt/notesSlides/`. - **Retaining formatting** may require parsing additional XML attributes. ### **ODP (OpenDocument Presentation)** Based on the **OpenDocument Format (ODF)**, **ODP** is commonly used in open-source office suites such as **LibreOffice Impress**. **Differences from PPTX** - Relies on **OpenDocument XML**, not Open XML. - Structurally similar but **uses different tags and a distinct hierarchy**. - Text is often stored in **content.xml** within `` elements. ## **Conclusion** A solid grasp of presentation file structures is paramount for successful text extraction. Although **PPTX and ODP** offer XML-based transparency, older **PPT** files demand additional steps due to their binary nature. Specialized tools and libraries designed for each format help automate and optimize the extraction process, ensuring that extracted data can power a broad array of use cases—from robust indexing to comprehensive accessibility solutions. # Manage Slide Transitions in Presentations Using C++ > Apply slide transitions, configure automatic slide advancement, and customize Morph and other transition effects with Aspose.Slides for C++. Source: https://docs.aspose.com/slides/cpp/slide-transition/ Updated: 2026-11-17 ## **Overview** Slide transitions control how slides appear during a slide show. With Aspose.Slides for C++, you can choose a transition effect for each slide, configure advancement by mouse click or timer, and adjust options specific to an effect. This article uses C++ examples to apply transitions, set exact transition durations, manage slide timing, and create a Morph transition between two slides. The examples also show how to save the settings to a PPTX file. ## **Add Slide Transition** To apply a transition, load a presentation with the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) class and access a slide's transition settings through [get_SlideShowTransition](https://reference.aspose.com/slides/cpp/aspose.slides/ibaseslide/get_slideshowtransition/). Call [set_Type](https://reference.aspose.com/slides/cpp/aspose.slides/islideshowtransition/set_type/) with a value from the [TransitionType](https://reference.aspose.com/slides/cpp/aspose.slides.slideshow/transitiontype/) enumeration, then save the presentation. The following example applies a Circle transition to the first slide and a Comb transition to the second. Use an `input.pptx` file with at least two slides. ```cpp #include #include #include #include #include #include #include using namespace System; using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace Aspose::Slides::SlideShow; auto presentation = MakeObject(u"input.pptx"); if (presentation->get_Slides()->get_Count() >= 2) { presentation->get_Slide(0)->get_SlideShowTransition()->set_Type(TransitionType::Circle); presentation->get_Slide(1)->get_SlideShowTransition()->set_Type(TransitionType::Comb); presentation->Save(u"slide-transitions.pptx", SaveFormat::Pptx); } else { Console::WriteLine(u"The input presentation must contain at least two slides."); } presentation->Dispose(); ``` ## **Wheel Transition** The [set_Spokes](https://reference.aspose.com/slides/cpp/aspose.slides.slideshow/iwheeltransition/set_spokes/) method of [IWheelTransition](https://reference.aspose.com/slides/cpp/aspose.slides.slideshow/iwheeltransition/) controls the number of radial sectors that reveal the destination slide. Call [set_Type](https://reference.aspose.com/slides/cpp/aspose.slides/islideshowtransition/set_type/) with Wheel from [TransitionType](https://reference.aspose.com/slides/cpp/aspose.slides.slideshow/transitiontype/) before accessing [get_Value](https://reference.aspose.com/slides/cpp/aspose.slides/islideshowtransition/get_value/) as [IWheelTransition](https://reference.aspose.com/slides/cpp/aspose.slides.slideshow/iwheeltransition/). This example creates two identical pairs of slides: a black slide followed by a slide with a gold rectangle. The destination slides use spoke counts of 1 and 8, with the same speed set through [set_Speed](https://reference.aspose.com/slides/cpp/aspose.slides/islideshowtransition/set_speed/) and an explicit duration of 8,000 milliseconds set through [set_Duration](https://reference.aspose.com/slides/cpp/aspose.slides/islideshowtransition/set_duration/) to make the difference easy to observe. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace System; using namespace System::Drawing; using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace Aspose::Slides::SlideShow; auto presentation = MakeObject(); auto slideWidth = presentation->get_SlideSize()->get_Size().get_Width(); auto slideHeight = presentation->get_SlideSize()->get_Size().get_Height(); auto blackSlide = presentation->get_Slide(0); blackSlide->get_Shapes()->Clear(); blackSlide->get_Background()->set_Type(BackgroundType::OwnBackground); blackSlide->get_Background()->get_FillFormat()->set_FillType(FillType::Solid); blackSlide->get_Background()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Black()); auto destinationSlide = presentation->get_Slides()->AddClone(blackSlide); auto rectangle = destinationSlide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 0, 0, slideWidth, slideHeight); rectangle->get_FillFormat()->set_FillType(FillType::Solid); rectangle->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Gold()); rectangle->get_TextFrame()->set_Text(u"Wheel transition"); presentation->get_Slides()->AddClone(blackSlide); presentation->get_Slides()->AddClone(destinationSlide); const uint32_t spokeCounts[] = { 1, 8 }; for (auto i = 0; i < 2; i++) { auto transition = presentation->get_Slide(i * 2 + 1)->get_SlideShowTransition(); transition->set_Type(TransitionType::Wheel); auto wheelTransition = ExplicitCast(transition->get_Value()); wheelTransition->set_Spokes(spokeCounts[i]); transition->set_Speed(TransitionSpeed::Slow); transition->set_Duration(8000); } presentation->Save(u"wheel-transitions.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` Open the output presentation in PowerPoint and run the slide show. Advance from slide 1 to slide 2, then from slide 3 to slide 4. In PowerPoint playback, the verified spoke count of 1 reveals the slide with one clockwise sweep; the verified count of 8 reveals it through eight radial sectors simultaneously. The destination content and transition timing are identical, so the difference is the number of reveal sectors. ## **Add Advanced Slide Transition** You can configure how long a slide remains on screen and whether a mouse click advances the slide show. The following methods control this behavior: - [set_AdvanceOnClick](https://reference.aspose.com/slides/cpp/aspose.slides/islideshowtransition/set_advanceonclick/) allows the viewer to advance by clicking the mouse. - [set_AdvanceAfter](https://reference.aspose.com/slides/cpp/aspose.slides/islideshowtransition/set_advanceafter/) enables automatic advancement. - [set_AdvanceAfterTime](https://reference.aspose.com/slides/cpp/aspose.slides/islideshowtransition/set_advanceaftertime/) specifies the delay before automatic advancement, in milliseconds. Enable both click and timed advancement to let the viewer move on with a click or wait for the timer. To use only the timer, call [set_AdvanceOnClick](https://reference.aspose.com/slides/cpp/aspose.slides/islideshowtransition/set_advanceonclick/) with `false`. The delay controls when the slide show advances; it does not set the duration of the visual transition effect. This example assigns different effects to the first three slides and enables automatic advancement after 3, 5, and 7 seconds, respectively. Mouse clicks can also advance these slides. Use an `input.pptx` file with at least three slides. ```cpp #include #include #include #include #include #include #include using namespace System; using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace Aspose::Slides::SlideShow; auto presentation = MakeObject(u"input.pptx"); if (presentation->get_Slides()->get_Count() >= 3) { auto firstTransition = presentation->get_Slide(0)->get_SlideShowTransition(); firstTransition->set_Type(TransitionType::Circle); firstTransition->set_AdvanceOnClick(true); firstTransition->set_AdvanceAfter(true); firstTransition->set_AdvanceAfterTime(3000); auto secondTransition = presentation->get_Slide(1)->get_SlideShowTransition(); secondTransition->set_Type(TransitionType::Comb); secondTransition->set_AdvanceOnClick(true); secondTransition->set_AdvanceAfter(true); secondTransition->set_AdvanceAfterTime(5000); auto thirdTransition = presentation->get_Slide(2)->get_SlideShowTransition(); thirdTransition->set_Type(TransitionType::Zoom); thirdTransition->set_AdvanceOnClick(true); thirdTransition->set_AdvanceAfter(true); thirdTransition->set_AdvanceAfterTime(7000); presentation->Save(u"advanced-transitions.pptx", SaveFormat::Pptx); } else { Console::WriteLine(u"The input presentation must contain at least three slides."); } presentation->Dispose(); ``` To check whether timed advancement is enabled, call [get_AdvanceAfter](https://reference.aspose.com/slides/cpp/aspose.slides/islideshowtransition/get_advanceafter/). A stored delay alone does not indicate that the timer is active. The next example opens the file saved above, reports each enabled timer, and disables automatic advancement for slides with a delay greater than two seconds. It enables mouse clicks for those slides and saves the updated settings. ```cpp #include #include #include #include #include #include using namespace System; using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = MakeObject(u"advanced-transitions.pptx"); for (auto&& slide : presentation->get_Slides()) { auto transition = slide->get_SlideShowTransition(); if (transition->get_AdvanceAfter()) { Console::WriteLine(u"Slide {0}: advance after {1} ms.", slide->get_SlideNumber(), transition->get_AdvanceAfterTime()); if (transition->get_AdvanceAfterTime() > 2000) { transition->set_AdvanceAfter(false); transition->set_AdvanceOnClick(true); } } } presentation->Save(u"adjusted-transitions.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ## **Control Transition Timing Precisely** Use [set_Duration](https://reference.aspose.com/slides/cpp/aspose.slides/islideshowtransition/set_duration/) to specify the exact length of a transition effect in milliseconds. The slide's [get_SlideShowTransition](https://reference.aspose.com/slides/cpp/aspose.slides/ibaseslide/get_slideshowtransition/) method exposes these settings through [ISlideShowTransition](https://reference.aspose.com/slides/cpp/aspose.slides/islideshowtransition/): | Method | Purpose | | --- | --- | | [set_Duration](https://reference.aspose.com/slides/cpp/aspose.slides/islideshowtransition/set_duration/) | Sets the duration of the transition effect itself, in milliseconds. | | [set_AdvanceAfterTime](https://reference.aspose.com/slides/cpp/aspose.slides/islideshowtransition/set_advanceaftertime/) | Sets the delay before the slide advances automatically, in milliseconds. Call [set_AdvanceAfter](https://reference.aspose.com/slides/cpp/aspose.slides/islideshowtransition/set_advanceafter/) with `true` to activate this timer. | | [set_Speed](https://reference.aspose.com/slides/cpp/aspose.slides/islideshowtransition/set_speed/) | Selects a predefined speed category from [TransitionSpeed](https://reference.aspose.com/slides/cpp/aspose.slides.slideshow/transitionspeed/): Slow, Medium, or Fast. It is used when an exact duration is not specified. | [set_Duration](https://reference.aspose.com/slides/cpp/aspose.slides/islideshowtransition/set_duration/) controls only the transition effect; it does not determine how long the slide remains visible. Configure the automatic advancement delay separately. When no explicit duration is set, Aspose.Slides determines the effect duration from the transition type and the value returned by [get_Speed](https://reference.aspose.com/slides/cpp/aspose.slides/islideshowtransition/get_speed/). [![Separate bars identify the 750-ms transition duration and 5,000-ms automatic advancement setting.](https://docs.aspose.com/slides/cpp/slide-transition/visual-slide-transition-1f705a740cf6.svg)](https://docs.aspose.com/slides/cpp/slide-transition/visual-slide-transition-1f705a740cf6.svg) *The shared example gives each slide a 750-ms Fade transition and separately enables automatic advancement at 5,000 ms. Transition duration controls the effect; advancement controls when to leave the slide. These bars are schematic settings, not a measured combined timeline.* ### **Apply the Same Duration to Every Slide** For consistent pacing, apply the same effect and exact duration to every slide. This example loads `input.pptx`, selects Fade from [TransitionType](https://reference.aspose.com/slides/cpp/aspose.slides.slideshow/transitiontype/), and gives each transition a duration of 750 milliseconds. It separately enables automatic advancement after 5,000 milliseconds and disables advancement by mouse click, then saves the result as PPTX. ```cpp #include #include #include #include #include #include using namespace System; using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace Aspose::Slides::SlideShow; auto presentation = MakeObject(u"input.pptx"); for (auto&& slide : presentation->get_Slides()) { auto transition = slide->get_SlideShowTransition(); transition->set_Type(TransitionType::Fade); transition->set_Duration(750); // Configure automatic advancement independently of the effect duration. transition->set_AdvanceAfter(true); transition->set_AdvanceAfterTime(5000); transition->set_AdvanceOnClick(false); } presentation->Save(u"precise-transitions.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ### **Set Different Durations for Individual Slides** Different slides can use different effect durations. For example, use a brief transition for a title slide and a longer transition for a section introduction. This example sets 500 milliseconds for the first slide and 1,200 milliseconds for the second. Use an `input.pptx` file with at least two slides. ```cpp #include #include #include #include #include #include #include using namespace System; using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace Aspose::Slides::SlideShow; auto presentation = MakeObject(u"input.pptx"); if (presentation->get_Slides()->get_Count() >= 2) { auto firstTransition = presentation->get_Slide(0)->get_SlideShowTransition(); firstTransition->set_Type(TransitionType::Fade); firstTransition->set_Duration(500); auto secondTransition = presentation->get_Slide(1)->get_SlideShowTransition(); secondTransition->set_Type(TransitionType::Push); secondTransition->set_Duration(1200); presentation->Save(u"individual-transition-durations.pptx", SaveFormat::Pptx); } else { Console::WriteLine(u"The input presentation must contain at least two slides."); } presentation->Dispose(); ``` ### **Coordinate Transitions with Animated Output** When preparing an [animated GIF](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-animated-gif/), [HTML5 presentation](https://docs.aspose.com/slides/cpp/export-to-html5/), or [video](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-video/), set exact transition durations before export to match the intended pacing. For example, use a 600-millisecond fade between scenes, and adjust each slide's advancement delay separately to allow time for its narration or content. For GIF and video, coordinate the output frame rate with the effect duration: 600 milliseconds corresponds to 18 frames at 30 frames per second. In HTML5, enable animated transitions in the export settings. Check the chosen export format's supported effects and timing options, and preview the output to confirm synchronization. ### **Read an Existing Transition Duration** Call [get_Duration](https://reference.aspose.com/slides/cpp/aspose.slides/islideshowtransition/get_duration/) before modifying the transition to determine whether an explicit value is stored. A value of `-1` means no explicit duration is set; a nonnegative value specifies the stored duration in milliseconds. The unset value is not the calculated playback duration: Aspose.Slides uses the transition type and the value returned by [get_Speed](https://reference.aspose.com/slides/cpp/aspose.slides/islideshowtransition/get_speed/) to determine that duration. Setting a transition type can initialize a duration, so inspect the original settings first. ```cpp #include #include #include #include #include #include #include using namespace System; using namespace Aspose::Slides; auto presentation = MakeObject(u"input.pptx"); for (auto&& slide : presentation->get_Slides()) { auto transition = slide->get_SlideShowTransition(); auto duration = transition->get_Duration(); if (duration >= 0) { Console::WriteLine(u"Slide {0}: stored transition duration is {1} ms.", slide->get_SlideNumber(), duration); } else { Console::WriteLine(u"Slide {0}: no explicit duration; timing depends on {1} and {2}.", slide->get_SlideNumber(), transition->get_Type(), transition->get_Speed()); } } presentation->Dispose(); ``` ## **Morph Transition** The Morph transition animates changes between objects on consecutive slides. To create a simple Morph effect, clone a slide, move or resize an object on the clone, and apply the Morph transition to the second slide. This gives the transition corresponding objects to animate between their original and modified states. The following example creates a slide with a text rectangle, clones the slide, and changes the rectangle's position and size on the clone. It then selects Morph from the [TransitionType](https://reference.aspose.com/slides/cpp/aspose.slides.slideshow/transitiontype/) enumeration for the second slide. Open the saved file in a presentation viewer that supports Morph to see the effect during a slide show. ```cpp #include #include #include #include #include #include #include #include #include #include #include using namespace System; using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace Aspose::Slides::SlideShow; auto presentation = MakeObject(); auto firstSlide = presentation->get_Slide(0); auto rectangle = firstSlide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 100, 100, 400, 100); rectangle->get_TextFrame()->set_Text(u"Morph transition"); auto secondSlide = presentation->get_Slides()->AddClone(firstSlide); auto movedRectangle = secondSlide->get_Shape(0); movedRectangle->set_X(movedRectangle->get_X() + 100); movedRectangle->set_Y(movedRectangle->get_Y() + 50); movedRectangle->set_Width(movedRectangle->get_Width() - 200); movedRectangle->set_Height(movedRectangle->get_Height() - 10); secondSlide->get_SlideShowTransition()->set_Type(TransitionType::Morph); presentation->Save(u"morph-transition.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ## **Morph Transition Types** The [TransitionMorphType](https://reference.aspose.com/slides/cpp/aspose.slides.slideshow/transitionmorphtype/) enumeration controls how Morph matches and animates content: - [ByObject](https://reference.aspose.com/slides/cpp/aspose.slides.slideshow/transitionmorphtype/) treats each shape as a whole object. - [ByWord](https://reference.aspose.com/slides/cpp/aspose.slides.slideshow/transitionmorphtype/) animates text by matching words where possible. - [ByChar](https://reference.aspose.com/slides/cpp/aspose.slides.slideshow/transitionmorphtype/) animates text by matching characters where possible. Call [set_Type](https://reference.aspose.com/slides/cpp/aspose.slides/islideshowtransition/set_type/) with Morph before accessing [get_Value](https://reference.aspose.com/slides/cpp/aspose.slides/islideshowtransition/get_value/). The value then provides the [IMorphTransition](https://reference.aspose.com/slides/cpp/aspose.slides.slideshow/imorphtransition/) interface, whose [set_MorphType](https://reference.aspose.com/slides/cpp/aspose.slides.slideshow/imorphtransition/set_morphtype/) method selects the matching mode. This example opens the presentation created in the previous section and configures the second slide to use word-based Morph animation. ```cpp #include #include #include #include #include #include #include #include #include #include #include using namespace System; using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace Aspose::Slides::SlideShow; auto presentation = MakeObject(u"morph-transition.pptx"); if (presentation->get_Slides()->get_Count() >= 2) { auto transition = presentation->get_Slide(1)->get_SlideShowTransition(); transition->set_Type(TransitionType::Morph); auto morphTransition = AsCast(transition->get_Value()); if (morphTransition != nullptr) { morphTransition->set_MorphType(TransitionMorphType::ByWord); presentation->Save(u"morph-by-word.pptx", SaveFormat::Pptx); } else { Console::WriteLine(u"Morph transition options are unavailable."); } } else { Console::WriteLine(u"The input presentation must contain at least two slides."); } presentation->Dispose(); ``` ## **Set Transition Effects** Some transitions expose additional options, such as direction or whether the effect starts from a black screen. The available options depend on the selected transition type. Set the type first, then use the appropriate interface returned by [get_Value](https://reference.aspose.com/slides/cpp/aspose.slides/islideshowtransition/get_value/). The following example applies a Cut transition to the first slide of `input.pptx`. It calls [set_FromBlack](https://reference.aspose.com/slides/cpp/aspose.slides.slideshow/ioptionalblacktransition/set_fromblack/) with `true` through [IOptionalBlackTransition](https://reference.aspose.com/slides/cpp/aspose.slides.slideshow/ioptionalblacktransition/) so that the transition starts from a black screen. ```cpp #include #include #include #include #include #include #include #include #include #include using namespace System; using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace Aspose::Slides::SlideShow; auto presentation = MakeObject(u"input.pptx"); auto transition = presentation->get_Slide(0)->get_SlideShowTransition(); transition->set_Type(TransitionType::Cut); auto cutTransition = AsCast(transition->get_Value()); if (cutTransition != nullptr) { cutTransition->set_FromBlack(true); presentation->Save(u"cut-from-black.pptx", SaveFormat::Pptx); } else { Console::WriteLine(u"Cut transition options are unavailable."); } presentation->Dispose(); ``` ## **FAQ** **Can I control the playback speed of a slide transition?** Yes. Prefer [set_Duration](https://reference.aspose.com/slides/cpp/aspose.slides/islideshowtransition/set_duration/) when you need an exact effect duration in milliseconds. Use [set_Speed](https://reference.aspose.com/slides/cpp/aspose.slides/islideshowtransition/set_speed/) when a predefined [TransitionSpeed](https://reference.aspose.com/slides/cpp/aspose.slides.slideshow/transitionspeed/) category—Slow, Medium, or Fast—is sufficient and no explicit duration is set. These settings control the transition effect independently of the automatic advancement delay. **Can I attach audio to a transition and make it loop?** Yes. Assign embedded audio with [set_Sound](https://reference.aspose.com/slides/cpp/aspose.slides/islideshowtransition/set_sound/), call [set_SoundMode](https://reference.aspose.com/slides/cpp/aspose.slides/islideshowtransition/set_soundmode/) with StartSound from the [TransitionSoundMode](https://reference.aspose.com/slides/cpp/aspose.slides.slideshow/transitionsoundmode/) enumeration, and enable looping with [set_SoundLoop](https://reference.aspose.com/slides/cpp/aspose.slides/islideshowtransition/set_soundloop/). The audio loops until the next sound event in the slide show. **What's the fastest way to apply the same transition to every slide?** Loop through the collection returned by the presentation's [get_Slides](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/get_slides/) method and call [set_Type](https://reference.aspose.com/slides/cpp/aspose.slides/islideshowtransition/set_type/) with the same value for each slide's transition. Set any timing and effect options in the same loop to keep the behavior consistent across slides. **How can I check which transition is currently set on a slide?** Call [get_Type](https://reference.aspose.com/slides/cpp/aspose.slides/islideshowtransition/get_type/) on the transition returned by the slide's [get_SlideShowTransition](https://reference.aspose.com/slides/cpp/aspose.slides/ibaseslide/get_slideshowtransition/) method. It returns a value from the [TransitionType](https://reference.aspose.com/slides/cpp/aspose.slides.slideshow/transitiontype/) enumeration; None means that no transition effect is applied. ## Related articles - [Slide Transition](https://docs.aspose.com/slides/cpp/examples/elements/slide-transition/) # Slides on Cloud Platforms > See how Aspose.Slides runs on major cloud platforms, with deployment tips, scaling guidance, and best practices for processing PowerPoint and OpenDocument. Source: https://docs.aspose.com/slides/cpp/slides-on-cloud-platforms/ Updated: 2025-11-19 --- lastmod: 2025-11-19T22:55:59+04:00 title: Slides on Cloud Platforms type: docs weight: 40 url: /cpp/slides-on-cloud-platforms/ keywords: - cloud platforms - cloud integration - PowerPoint automation - text extraction - Google integration - PowerPoint - OpenDocument - presentation - C++ - Aspose.Slides description: "See how Aspose.Slides runs on major cloud platforms, with deployment tips, scaling guidance, and best practices for processing PowerPoint and OpenDocument." --- # Manage Superscript and Subscript in Presentations Using C++ > Master superscript and subscript in Aspose.Slides for C++ and elevate your presentations with professional text formatting for maximum impact. Source: https://docs.aspose.com/slides/cpp/superscript-and-subscript/ Updated: 2026-08-02 ## **Overview** Aspose.Slides provides features for integrating superscript and subscript text into your PowerPoint (PPT, PPTX) and OpenDocument (ODP) presentations. Whether you need to highlight chemical formulas, mathematical equations, or annotate content with footnotes, these specialized formatting options help maintain clarity and precision. In this article, you'll learn how to seamlessly apply superscript and subscript styles and ensure professional results in every slide. ## **Manage Superscript and Subscript Text** You can add super script and sub script text inside any paragraph portion. For adding Superscript or Subscript text in Aspose.Slides text frame one must use **Escapement** properties of PortionFormat class. This property returns or sets the superscript or subscript text (value from -100% (subscript) to 100% (superscript). For example : - Create an instance of [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) class. - Obtain the reference of a slide by using its Index. - Add an IAutoShape of Rectangle type to the slide. - Access the ITextFrame associated with the IAutoShape. - Clear existing Paragraphs - Create a new paragraph object for holding super script text and add it to the IParagraphs collection of the ITextFrame. - Create a new portion object - Set Escapement property for the portion between 0 to 100 for adding super script. (0 mean no super script) - Set some text for Portion and then add that in portion collection of paragraph. - Create a new paragraph object for holding sub script text and add it to the IParagraphs collection of the ITextFrame. - Create a new portion object - Set Escapement property for portion between 0 to -100 for adding super script. (0 mean no sub script) - Set some text for Portion and then add that in portion collection of paragraph. - Save the presentation as a PPTX file. The implementation of the above steps is given below. ```cpp // The path to the documents directory. const String outPath = u"../out/AddingSuperscriptAndSubscriptTextInTextFrame_out.pptx"; //const String templatePath = u"../templates/DefaultFonts.pptx"; // Load the desired the presentation SharedPtr pres = MakeObject(); // Access first slide SharedPtr sld = pres->get_Slides()->idx_get(0); // Add an AutoShape of Rectangle type SharedPtr ashp = sld->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 100, 100, 300, 300); // Add TextFrame to the Rectangle SharedPtr tf = ashp->AddTextFrame(String::Empty); tf->get_Paragraphs()->Clear(); // Adding the first Paragraph SharedPtr superPar = MakeObject(); SharedPtr portion1 = MakeObject(u"SlideTitle"); superPar->get_Portions()->Add(portion1); SharedPtr superPortion = MakeObject(); superPortion->get_PortionFormat()->set_Escapement(30); superPortion->set_Text(u"TM"); superPar->get_Portions()->Add(superPortion); // Adding the first Paragraph SharedPtr subPar = MakeObject(); SharedPtr portion2 = MakeObject(u"a"); subPar->get_Portions()->Add(portion2); SharedPtr subPortion = MakeObject(); subPortion->get_PortionFormat()->set_Escapement(-25); subPortion->set_Text(u"i"); subPar->get_Portions()->Add(subPortion); //Adding to text frame ashp->get_TextFrame()->get_Paragraphs()->Add(superPar); ashp->get_TextFrame()->get_Paragraphs()->Add(subPar); // Save PPTX to Disk pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx); ``` [Source: Examples-SlidesCPP-AddingSuperscriptAndSubscriptTextInTextFrame-AddingSuperscriptAndSubscriptTextInTextFrame.cpp](https://gist.githubusercontent.com/aspose-com-gists/81aeb05e6d3a070aa76fdea22ed53bc7/raw/cc64ae824cdcac0d3c88275c041ce0d94f985577/Examples-SlidesCPP-AddingSuperscriptAndSubscriptTextInTextFrame-AddingSuperscriptAndSubscriptTextInTextFrame.cpp) ## **FAQ** ### Will superscript and subscript be preserved when exporting to PDF or other formats? Yes, Aspose.Slides properly retains superscript and subscript formatting when exporting presentations to PDF, PPT/PPTX, images, and other supported formats. The specialized formatting remains intact in all output files. ### Can superscript and subscript be combined with other formatting styles such as bold or italics? Yes, Aspose.Slides allows you to mix various text styles within a single portion of text. You can enable bold, italics, underline, and simultaneously apply superscript or subscript by configuring the corresponding properties in [PortionFormat](https://reference.aspose.com/slides/cpp/aspose.slides/portionformat/). ### Do superscript and subscript formatting work for text inside tables, charts, or SmartArt? Yes, Aspose.Slides supports formatting within most objects, including tables and chart elements. When working with SmartArt, you need to access the appropriate elements (such as [SmartArtNode](https://reference.aspose.com/slides/cpp/aspose.slides.smartart/smartartnode/)) and their text containers, and then configure the [PortionFormat](https://reference.aspose.com/slides/cpp/aspose.slides/portionformat/) properties in a similar manner. # Support For Interruptable Library > Make long-running tasks cancelable with Aspose.Slides for C++. Interrupt rendering and conversions for PowerPoint and OpenDocument safely, with examples. Source: https://docs.aspose.com/slides/cpp/support-for-interruptable-library/ Updated: 2026-08-05 ## **Overview** Aspose.Slides provides an interruptible processing mechanism for long-running presentation tasks, such as deserialization, serialization, and rendering. This mechanism is based on the `InterruptionToken` and `InterruptionTokenSource` classes. An `InterruptionToken` can be assigned to `LoadOptions` and passed to the `Presentation` constructor. When `InterruptionTokenSource::Interrupt()` is called, the associated long-running task is interrupted. ## **Interruptable Library** In [Aspose.Slides 18.4](https://releases.aspose.com/slides/cpp/release-notes/2018/aspose-slides-for-cpp-18-4-release-notes/), we introduced the [InterruptionToken](https://reference.aspose.com/slides/cpp/aspose.slides/interruptiontoken/) and [InterruptionTokenSource](https://reference.aspose.com/slides/cpp/aspose.slides/interruptiontokensource/) classes. They allow you to interrupt long-running tasks such as deserialization, serialization, and rendering. - [InterruptionTokenSource](https://reference.aspose.com/slides/cpp/aspose.slides/interruptiontokensource/) is the source of the token(s) passed to [ILoadOptions::set_InterruptionToken](https://reference.aspose.com/slides/cpp/aspose.slides/loadoptions/set_interruptiontoken/). - When [ILoadOptions::set_InterruptionToken](https://reference.aspose.com/slides/cpp/aspose.slides/loadoptions/set_interruptiontoken/) is set and the [LoadOptions](https://reference.aspose.com/slides/cpp/aspose.slides/loadoptions/) instance is passed to the [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) constructor, invoking [InterruptionTokenSource::Interrupt()](https://reference.aspose.com/slides/cpp/aspose.slides/interruptiontokensource/interrupt/) interrupts any long-running task associated with that [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/). The following code snippet demonstrates interrupting a running task: ```cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto tokenSource = MakeObject(); SharedPtr token = tokenSource->get_Token(); // The conversion runs in a separate thread so that it can be interrupted. auto threadFunction = Threading::ThreadStart([token]() -> void { auto options = MakeObject(); options->set_InterruptionToken(token); auto presentation = MakeObject(u"sample.pptx", options); presentation->Save(u"sample.ppt", Export::SaveFormat::Ppt); }); auto thread = MakeObject(threadFunction); thread->Start(); Threading::Thread::Sleep(10000); // timeout tokenSource->Interrupt(); // stop the conversion ``` ## **FAQ** ### What is the purpose of the Aspose.Slides interrupt library? It provides a mechanism to interrupt long-running operations—such as loading, saving, or rendering presentations—before they complete. This is useful when processing time must be limited or the task is no longer needed. ### What is the difference between [InterruptionToken](https://reference.aspose.com/slides/cpp/aspose.slides/interruptiontoken/) and [InterruptionTokenSource](https://reference.aspose.com/slides/cpp/aspose.slides/interruptiontokensource/)? - `InterruptionToken` is passed to the Aspose.Slides API and checked during long-running operations. - `InterruptionTokenSource` is used in your code to create tokens and trigger interruptions by calling `Interrupt()`. ### What tasks can be interrupted? Any Aspose.Slides task that accepts an [InterruptionToken](https://reference.aspose.com/slides/cpp/aspose.slides/interruptiontoken/)—such as loading a presentation with `Presentation(path, loadOptions)` or saving with `Presentation::Save(...)`—can be interrupted. ### Does interruption happen immediately? No. Interruption is cooperative: the operation periodically checks the token and stops as soon as it detects that [Interrupt()](https://reference.aspose.com/slides/cpp/aspose.slides/interruptiontokensource/interrupt/) has been called. ### What happens if I call [Interrupt()](https://reference.aspose.com/slides/cpp/aspose.slides/interruptiontokensource/interrupt/) after a task has already completed? Nothing—the call has no effect if the corresponding task has already completed. ### Can I reuse the same [InterruptionTokenSource](https://reference.aspose.com/slides/cpp/aspose.slides/interruptiontokensource/) for multiple tasks? Yes—but after you call [Interrupt()](https://reference.aspose.com/slides/cpp/aspose.slides/interruptiontokensource/interrupt/) on that source, all tasks using its tokens will be interrupted. Use separate token sources to manage tasks independently. # Supported File Formats > Discover all file formats Aspose.Slides for C++ can open, save, and convert — including PPT, PPTX and ODP — with clear import/export support notes. Source: https://docs.aspose.com/slides/cpp/supported-file-formats/ Updated: 2026-08-02 ## **Overview** Aspose.Slides supports presentation files from Microsoft PowerPoint 97 through Office 365, including Microsoft PowerPoint for Mac. This article lists the PowerPoint versions supported by the library and provides a table of file formats that can be loaded, saved, or both. The article also answers common questions about PDF compliance, font embedding, password-protected files, custom fonts, font fallback, and XPS export options. ## **Supported Microsoft PowerPoint Versions** - Microsoft PowerPoint 97 - Microsoft PowerPoint 2000 - Microsoft PowerPoint XP - Microsoft PowerPoint 2003 - Microsoft PowerPoint 2007 - Microsoft PowerPoint 2010 - Microsoft PowerPoint 2013 - Microsoft PowerPoint 2016 - Microsoft PowerPoint 2019 - Microsoft PowerPoint for MAC - Office 365 ## **Supported File Formats** This table contains the file formats that Aspose.Slides for C++ can load and save: |**Format**|**Description**|**Load**|**Save**|**Remarks**| | :- | :- | :- | :- | :- | |[PPT](https://docs.fileformat.com/presentation/ppt/)|PowerPoint 97-2003 Presentation|✓|✓| | |[POT](https://docs.fileformat.com/presentation/pot/)|PowerPoint 97-2003 Template|✓|✓| | |[PPS](https://docs.fileformat.com/presentation/pps/)|PowerPoint 97-2003 Show|✓|✓| | |[PPTX](https://docs.fileformat.com/presentation/pptx/)|PowerPoint Presentation|✓|✓| | |[POTX](https://docs.fileformat.com/presentation/potx/)|PowerPoint Template|✓|✓| | |[PPSX ](https://docs.fileformat.com/presentation/ppsx/)|PowerPoint Show|✓|✓| | |[PPTM](https://docs.fileformat.com/presentation/pptm/)|PowerPoint Macro-Enabled Presentation|✓|✓| | |[PPSM](https://docs.fileformat.com/presentation/ppsm/)|PowerPoint Macro-Enabled Show|✓|✓| | |[POTM](https://docs.fileformat.com/presentation/potm/)|PowerPoint Macro-Enabled Template|✓|✓| | |[ODP/FODP](https://docs.fileformat.com/presentation/odp/)|OpenDocument Presentation|✓|✓| | |[OTP](https://docs.fileformat.com/presentation/otp/)|OpenDocument Presentation Template|✓|✓| | |[TIFF](https://docs.fileformat.com/image/tiff/)|Tag Image File Format| |✓| | |[EMF](https://docs.fileformat.com/image/emf/)|Enhanced Metafile Format| |✓| | |[PDF](https://docs.fileformat.com/pdf/)|Portable Document Format|✓|✓| | |[XPS](https://docs.fileformat.com/page-description-language/xps/)|XML Paper Specification| |✓| | |[JPEG](https://docs.fileformat.com/image/jpeg/)|Joint Photographic Experts Group| |✓| | |[PNG](https://docs.fileformat.com/image/png/)|Portable Network Graphics| |✓| | |[GIF](https://docs.fileformat.com/image/gif/)|Graphics Interchange Format| |✓| | |[BMP](https://docs.fileformat.com/image/bmp/)|Device Independent Bitmap| |✓| | |[SVG](https://docs.fileformat.com/page-description-language/svg/)|Scalable Vector Graphics| |✓| | |[SWF](https://docs.fileformat.com/page-description-language/swf/)|Small Web Format| |✓| | |[HTML](https://docs.fileformat.com/web/html/)|Hypertext Markup Language|✓|✓| | |[XAML](https://docs.fileformat.com/web/xaml/)|Extensible Application Markup Language| |✓| | |[MD](https://docs.fileformat.com/word-processing/md/)|Markdown| |✓| | |[XML](https://docs.fileformat.com/web/xml/)|PowerPoint XML Presentation| |✓| | ## **FAQ** ### Can I save presentations to PDF that meet archival and accessibility standards (PDF/A and PDF/UA)? Yes. Aspose.Slides supports exporting to PDF with compliance levels such as PDF/A-2a, PDF/A-2b, PDF/A-2u, PDF/A-3a, PDF/A-3b, as well as PDF/UA through the [compliance](https://reference.aspose.com/slides/cpp/aspose.slides.export/pdfoptions/set_compliance/) setting in [PDF export options](https://reference.aspose.com/slides/cpp/aspose.slides.export/pdfoptions/). ### Does the library support font embedding when exporting to PDF, with fine-grained control over what gets embedded? Yes. You can control whether fonts are fully embedded or subsetted (only used glyphs), specify how common system fonts are treated, and configure behavior for ASCII text through [PDF export options](https://reference.aspose.com/slides/cpp/aspose.slides.export/pdfoptions/). ### Can I detect whether a file is password-protected before actually loading it? Yes. Using the [factory-based inspection API](https://reference.aspose.com/slides/cpp/aspose.slides/presentationfactory/), you can query a presentation file to determine if it is password-protected without opening it fully. ### Are there font fallback mechanisms and support for custom fonts? Yes. The library supports [loading](https://docs.aspose.com/slides/cpp/custom-font/) and [embedding](https://docs.aspose.com/slides/cpp/embedded-font/) custom fonts and provides font [fallback rules](https://docs.aspose.com/slides/cpp/fallback-font/) to prevent missing glyphs during rendering and conversion. ### Can I export slides to XPS, and are there options to tune the XPS output? Yes. [Export to XPS](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-xps/) is supported, and you can adjust relevant [save options](https://reference.aspose.com/slides/cpp/aspose.slides.export/xpsoptions/) to control the output quality and content of the XPS document. ## Related articles - [Convert Presentations to Multiple Formats in C++](https://docs.aspose.com/slides/cpp/convert-presentation/) # System Requirements > Discover Aspose.Slides for C++ system requirements. Ensure seamless PowerPoint and OpenDocument support on Windows, Linux, and macOS. Source: https://docs.aspose.com/slides/cpp/system-requirements/ Updated: 2026-08-02 ## **Introduction** Aspose.Slides does not require Microsoft PowerPoint to be installed because Aspose.Slides is an independent Microsoft PowerPoint document creation, conversion, page layout, and rendering engine. ## **Supported Operating Systems** Aspose.Slides for C++ is a native C++ library. Aspose.Slides for C++ supports the following 64-bit and 32-bit operating system and platforms: ### **Windows** - Microsoft Windows Server 2008 (x64, x86) - Microsoft Windows Server 2012 (x64, x86) - Microsoft Windows Server 2012 R2 (x64, x86) - Microsoft Windows Server 2016 (x64, x86) - Microsoft Windows Server 2019 (x64, x86) - Microsoft Windows XP (x64, x86) - Microsoft Windows 7 (x64, x86) - Microsoft Windows 8, 8.1 (x64, x86) - Microsoft Windows 10 (x64, x86) ### **Linux** - OS Ubuntu 16.04 or later. - CentOS 8 or later. - Fedora 24 or later. - And other Linux x86_64 with glibc 2.23 or later. ### **macOS** - macOS Monterey 12.1 or later. ## **Development Environments** You can use Aspose.Slides for C++ when developing applications for Windows, Linux or macOS. ### **Windows** - Microsoft Visual Studio 2017 or later. - CMake 3.18 or later. ### **Linux** - Clang 3.9 or later. - GCC 6.1 or later. - CMake 3.18 or later. ### **macOS** - Xcode 13.4 or later. ## **FAQ** ### Do I need Microsoft PowerPoint installed for conversions and rendering? No, PowerPoint is not required; Aspose.Slides is a standalone engine for [creating](https://docs.aspose.com/slides/cpp/create-presentation/), modifying, [converting](https://docs.aspose.com/slides/cpp/convert-presentation/), and [rendering](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-png/) presentations. ### Which fonts are needed for correct rendering? In practice, the fonts used in the presentation or proper [substitutes](https://docs.aspose.com/slides/cpp/font-substitution/) must be available. To ensure consistent rendering on Linux/macOS, it is advisable to install common font packages. ### Why does a custom font render as a fallback or missing text on Linux? If the font file has inconsistent or corrupted name-table entries, the Linux font-matching stack (FreeType/fontconfig) may select an invalid record, causing the font to be unresolved. Using a font version with corrected name-table records or installing a consistent replacement resolves the issue. # Technical Articles > Technical articles for Aspose.Slides for C++: OLE, chart, HTML export, threading, and more—best practices for the PPT, PPTX and ODP formats. Source: https://docs.aspose.com/slides/cpp/technical-articles/ Updated: 2025-11-19 --- lastmod: 2025-11-19T22:55:59+04:00 title: Technical Articles type: docs weight: 270 url: /cpp/technical-articles/ keywords: - technical article - OLE object - worksheet resizing - embed Excel cnart - chart resizing - prevent editing - shape lock - extract image - slide backgroud - export presentation - externally linked image - warning callback - font substitution - resize shape - interruptable library - background task - multithreading - API limitations - integrate Excel data - PowerPoint - OpenDocument - presentation - C++ - Aspose.Slides description: "Technical articles for Aspose.Slides for C++: OLE, chart, HTML export, threading, and more—best practices for the PPT, PPTX and ODP formats." --- # Manage Text Fields in PowerPoint Presentations in C++ > Create, inspect, modify, and remove text fields in PowerPoint presentations with Aspose.Slides for C++. Preserve formatting and check saved PPTX and PPT files. Source: https://docs.aspose.com/slides/cpp/text-fields/ Updated: 2026-09-21 ## **Overview** A text paragraph consists of portions. An ordinary [IPortion](https://reference.aspose.com/slides/cpp/aspose.slides/iportion/) contains literal text; a field portion also has an [IField](https://reference.aspose.com/slides/cpp/aspose.slides/ifield/) whose type identifies an automatically updated value, such as a slide number or date. Two portions can display the same characters while only one contains a field. Use [IPortion::get_Field](https://reference.aspose.com/slides/cpp/aspose.slides/iportion/get_field/) to distinguish them: it returns `nullptr` for ordinary text. [IPortion::AddField](https://reference.aspose.com/slides/cpp/aspose.slides/iportion/addfield/) converts an existing portion into a field. Keep a label and its dynamic value in separate portions so that converting the value does not also replace the label. This guide covers fields inside text, their formatting, and saving them in PPTX and PPT. For text frames and paragraphs, see [Manage Text](https://docs.aspose.com/slides/cpp/manage-text/). ## **Create a Slide Number Field** The following example creates a text box containing a literal `Slide ` label followed by an automatically updated number. It sets the number's size, weight, and color before adding the field, then reopens the saved presentation and checks the field type, text, and formatting. No input file is required. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 40, 40, 240, 50); shape->AddTextFrame(u"Slide "); auto paragraph = shape->get_TextFrame()->get_Paragraph(0); auto numberPortion = System::MakeObject(); numberPortion->get_PortionFormat()->set_FontHeight(24); numberPortion->get_PortionFormat()->set_FontBold(NullableBool::True); numberPortion->get_PortionFormat()->get_FillFormat()->set_FillType(FillType::Solid); numberPortion->get_PortionFormat()->get_FillFormat()->get_SolidFillColor()->set_Color(System::Drawing::Color::get_DarkBlue()); paragraph->get_Portions()->Add(numberPortion); numberPortion->AddField(FieldType::get_SlideNumber()); presentation->Save(u"slide_number.pptx", SaveFormat::Pptx); presentation->Dispose(); auto reopened = System::MakeObject(u"slide_number.pptx"); auto savedShape = System::ExplicitCast(reopened->get_Slide(0)->get_Shape(0)); auto savedNumber = savedShape->get_TextFrame()->get_Paragraph(0)->get_Portion(1); auto field = savedNumber->get_Field(); auto hasNumberField = field != nullptr && field->get_Type()->get_InternalString() == FieldType::get_SlideNumber()->get_InternalString(); auto format = savedNumber->get_PortionFormat(); auto formattingPreserved = format->get_FontHeight() == 24 && format->get_FontBold() == NullableBool::True; formattingPreserved &= format->get_FillFormat()->get_SolidFillColor()->get_Color().ToArgb() == System::Drawing::Color::get_DarkBlue().ToArgb(); System::Console::WriteLine(u"Text: {0}", savedShape->get_TextFrame()->get_Text()); System::Console::WriteLine(u"Slide number field: {0}", hasNumberField); System::Console::WriteLine(u"Formatting preserved: {0}", formattingPreserved); reopened->Dispose(); ``` The new presentation starts with slide number 1, so the expected text is `Slide 1`, and both checks should print `True`. The number remains a field after reopening; it is not a literal `1`. The cast and indices in the verification refer to the shape and portions created by this example. ## **Choose a Field Type** [FieldType](https://reference.aspose.com/slides/cpp/aspose.slides/fieldtype/) implements [IFieldType](https://reference.aspose.com/slides/cpp/aspose.slides/ifieldtype/) and provides the following predefined values. Pass the appropriate value to [AddField](https://reference.aspose.com/slides/cpp/aspose.slides/iportion/addfield/). | Accessor | Purpose | |---|---| | [get_SlideNumber](https://reference.aspose.com/slides/cpp/aspose.slides/fieldtype/get_slidenumber/) | The current slide number. | | [get_DateTime](https://reference.aspose.com/slides/cpp/aspose.slides/fieldtype/get_datetime/) | Date/time in the rendering application's default format. | | [get_DateTime1](https://reference.aspose.com/slides/cpp/aspose.slides/fieldtype/get_datetime1/)–[get_DateTime9](https://reference.aspose.com/slides/cpp/aspose.slides/fieldtype/get_datetime9/) | Predefined date or combined date/time formats. | | [get_DateTime10](https://reference.aspose.com/slides/cpp/aspose.slides/fieldtype/get_datetime10/)–[get_DateTime13](https://reference.aspose.com/slides/cpp/aspose.slides/fieldtype/get_datetime13/) | Predefined time formats, with options for seconds and a 12-hour clock. | | [get_Header](https://reference.aspose.com/slides/cpp/aspose.slides/fieldtype/get_header/) | A header field; see the placeholder and format limitations below. | | [get_Footer](https://reference.aspose.com/slides/cpp/aspose.slides/fieldtype/get_footer/) | A footer field. | For example, [get_DateTime3](https://reference.aspose.com/slides/cpp/aspose.slides/fieldtype/get_datetime3/) provides a day, full month name, and year in English. These are predefined field formats, not arbitrary date-format strings. The portion's language, set with [IBasePortionFormat::set_LanguageId](https://reference.aspose.com/slides/cpp/aspose.slides/ibaseportionformat/set_languageid/), and the application processing the presentation can affect the displayed result. ## **Create a Field from an Internal String** The string overload of [AddField](https://reference.aspose.com/slides/cpp/aspose.slides/iportion/addfield/) accepts an internal field identifier. Use it when preserving an identifier supplied by another application that has no predefined value. You can also construct a [FieldType](https://reference.aspose.com/slides/cpp/aspose.slides/fieldtype/fieldtype/) from the identifier. [IFieldType::get_InternalString](https://reference.aspose.com/slides/cpp/aspose.slides/ifieldtype/get_internalstring/) exposes that identifier for inspection. This example stores an application-specific `custom-report-id` field with the fallback text `Report-042`. No input file is required. The identifier does not register a calculation: Aspose.Slides does not generate report IDs for an unknown type. The application that understands this identifier must supply its meaning and update its value. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(); auto shape = presentation->get_Slide(0)->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 40, 40, 300, 50); shape->AddTextFrame(u"Report-042"); auto portion = shape->get_TextFrame()->get_Paragraph(0)->get_Portion(0); portion->AddField(u"custom-report-id"); presentation->Save(u"custom_field.pptx", SaveFormat::Pptx); presentation->Dispose(); auto reopened = System::MakeObject(u"custom_field.pptx"); auto savedShape = System::ExplicitCast(reopened->get_Slide(0)->get_Shape(0)); auto savedPortion = savedShape->get_TextFrame()->get_Paragraph(0)->get_Portion(0); auto field = savedPortion->get_Field(); auto typeName = field != nullptr ? field->get_Type()->get_InternalString() : u"ordinary text"; System::Console::WriteLine(u"Type: {0}", typeName); System::Console::WriteLine(u"Text: {0}", savedPortion->get_Text()); reopened->Dispose(); ``` After this PPTX round trip, the expected type is `custom-report-id` and the expected text is `Report-042`. Passing a string such as `yyyy-MM-dd` would name a field type; it would not configure a custom date format. For a fixed date in an arbitrary format, use ordinary text. ## **Inspect, Modify, and Remove Date/Time Fields** Read an existing field type through [IField::get_Type](https://reference.aspose.com/slides/cpp/aspose.slides/ifield/get_type/) and change it through [IField::set_Type](https://reference.aspose.com/slides/cpp/aspose.slides/ifield/set_type/). Check that the field exists before accessing its type. To stop automatic updates, call [IPortion::RemoveField](https://reference.aspose.com/slides/cpp/aspose.slides/iportion/removefield/). This keeps the portion and its current text while removing the field association. If you need a specific fixed value, assign that text after removing the field. For the API setting associated with date/time field processing, see [Presentation::set_CurrentDateTime](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/set_currentdatetime/). The example below uses an explicit approval date when converting a field to ordinary text. Download [sample.pptx](https://docs.aspose.com/slides/cpp/text-fields/sample.pptx) and place it in the working directory. It contains two named text shapes, `UpdatedAt` and `ApprovedDate`, each with a date/time field, plus ordinary text labels. The following example walks top-level text shapes on regular slides. It changes date/time fields to a long-date format and makes them italic, while preserving their other formatting. Only fields in `ApprovedDate` become fixed text. The sample recognizes the built-in internal identifiers `datetime` and `datetime1` through `datetime13`. Groups, tables, notes, layouts, and masters require traversal of their own text containers and are outside this example's scope. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(u"sample.pptx"); auto approvalDate = System::DateTime(2030, 4, 5); auto culture = System::Globalization::CultureInfo::GetCultureInfo(u"en-US"); for (auto slide : presentation->get_Slides()) { for (auto shape : slide->get_Shapes()) { auto textShape = System::DynamicCast(shape); if (textShape == nullptr || textShape->get_TextFrame() == nullptr) continue; for (auto paragraph : textShape->get_TextFrame()->get_Paragraphs()) { for (auto portion : paragraph->get_Portions()) { auto field = portion->get_Field(); if (field == nullptr) continue; auto typeName = field->get_Type()->get_InternalString(); auto isDateTime = typeName == u"datetime"; for (auto formatNumber = 1; formatNumber <= 13; ++formatNumber) { auto identifier = System::String::Format(u"datetime{0}", formatNumber); isDateTime |= typeName == identifier; } if (!isDateTime) continue; field->set_Type(FieldType::get_DateTime3()); portion->get_PortionFormat()->set_LanguageId(u"en-US"); portion->get_PortionFormat()->set_FontItalic(NullableBool::True); if (textShape->get_Name() == u"ApprovedDate") { portion->RemoveField(); auto fixedDate = approvalDate.ToString(u"dd MMMM yyyy", culture); portion->set_Text(fixedDate); } } } } } presentation->Save(u"updated_dates.pptx", SaveFormat::Pptx); presentation->Dispose(); auto reopened = System::MakeObject(u"updated_dates.pptx"); for (auto shape : reopened->get_Slide(0)->get_Shapes()) { auto textShape = System::DynamicCast(shape); if (textShape == nullptr || textShape->get_TextFrame() == nullptr) continue; if (textShape->get_Name() != u"UpdatedAt" && textShape->get_Name() != u"ApprovedDate") continue; auto portion = textShape->get_TextFrame()->get_Paragraph(0)->get_Portion(0); auto field = portion->get_Field(); auto typeName = field != nullptr ? field->get_Type()->get_InternalString() : u"ordinary text"; System::Console::WriteLine(u"{0}: {1}; {2}", textShape->get_Name(), typeName, portion->get_Text()); auto isItalic = portion->get_PortionFormat()->get_FontItalic() == NullableBool::True; System::Console::WriteLine(u"Italic: {0}", isItalic); } reopened->Dispose(); ``` After reopening, `UpdatedAt` should have type `datetime3` and remain dynamic. `ApprovedDate` should have no field and contain `05 April 2030`. Both date portions are italic, and their original font size, bold setting, and color remain intact. The ordinary text labels are unchanged. The verification reads the first portion of the two known shapes in the supplied sample. ## **Preserve Text Formatting** Work with the existing portion when adding a field, changing its type, or removing it. These operations retain that portion's formatting. Use [IPortion::get_PortionFormat](https://reference.aspose.com/slides/cpp/aspose.slides/iportion/get_portionformat/) to change only the required properties, as the examples do for color or italics. Avoid rebuilding an entire text frame just to update one field: doing so can lose the original portion boundaries and their individual formatting. Also distinguish explicitly set formatting from formatting inherited from the paragraph, layout, or theme. See [Text Formatting](https://docs.aspose.com/slides/cpp/text-formatting/) for broader formatting options. ## **Fields and Header/Footer Placeholders** A field is part of a text portion. A placeholder is a shape with a presentation role, such as a footer or slide number. Adding a field to an ordinary text box does not turn that shape into a placeholder. The header/footer managers control placeholder text and visibility on slides, layouts, and masters, including propagation to dependent slides. A number field in a custom text box can therefore be useful even when you are not using the slide-number placeholder. Conversely, changing placeholder visibility does not remove a field from an unrelated text box. The predefined header and footer types do not create the corresponding placeholders or supply their content. In particular, a regular PowerPoint slide has no header placeholder; headers belong to notes pages and handouts. Do not assume that a header or footer field in an arbitrary shape will automatically obtain the text configured through a placeholder manager. For that workflow, see [Presentation Headers and Footers](https://docs.aspose.com/slides/cpp/presentation-header-and-footer/). ## **PPTX and PPT Limitations** Check both the field type and its resulting text after saving and reopening. Preserving an identifier does not prove that an application can calculate or display its value. | Format | Field behavior and limitations | |---|---| | PPTX | Stores internal field identifiers alongside field text. Use the examples above to check predefined types and custom identifiers after saving and reopening. An unknown custom type does not acquire automatic calculation logic. Another application may treat unsupported identifiers differently. | | PPT | Uses legacy field representations and has more limited compatibility. Slide-number and predefined date/time fields have legacy representations. Unsupported custom fields or header fields in an ordinary slide text box can produce `*` as their text. Do not rely on custom fields or unsupported field contexts retaining their visible text. | For portable, fixed output, convert unsupported fields to ordinary text and explicitly assign the value you want before saving. This preserves the chosen text but intentionally stops automatic updates. Test the target application as well when its own field recalculation is part of your workflow. ## **FAQ** **How can I tell whether a displayed number or date is a field?** Inspect [IPortion::get_Field](https://reference.aspose.com/slides/cpp/aspose.slides/iportion/get_field/). A non-null value identifies a field; the displayed text alone cannot tell you. **Does removing a field remove its text or formatting?** No. [RemoveField](https://reference.aspose.com/slides/cpp/aspose.slides/iportion/removefield/) converts the existing portion to ordinary text. Assign an explicit value afterward if you need a particular frozen date or fallback value. **Can an internal string define a new date format or formula?** No. It identifies a field type. An unknown identifier does not provide an evaluator or a date-format pattern. Use a supported predefined type or format a value yourself as ordinary text. **Why check a presentation again after saving it?** Field identifiers, calculated text, and formatting are separate things to verify. Format conversion can change the visible result even when the field identifier is still present. # Format Presentation Text in C++ > Format and style text in PowerPoint and OpenDocument presentations using Aspose.Slides for C++. Customize fonts, colors, alignment, and more. Source: https://docs.aspose.com/slides/cpp/text-formatting/ Updated: 2026-11-05 ## **Overview** This article shows how to format text in PowerPoint and OpenDocument presentations using Aspose.Slides for C++. It covers background colors, transparency, character spacing, font properties, rotation, paragraph spacing, autofit behavior, text anchoring, tab stops, and language settings. Unless stated otherwise, the examples use [sample.pptx](https://docs.aspose.com/slides/cpp/text-formatting/sample.pptx). The first shape on its first slide is a text box, and its first paragraph contains the text shown below. Both slide and shape indices are zero-based. Examples that select bold portions use effective formatting, including inherited bold formatting: ![Sample text](https://docs.aspose.com/slides/cpp/text-formatting/sample_text.png) To find and highlight literal text or regular-expression matches, see [Search and Replace Text](https://docs.aspose.com/slides/cpp/search-and-replace-text/). ## **Set Text Background Color** Use [IParagraphFormat::get_DefaultPortionFormat](https://reference.aspose.com/slides/cpp/aspose.slides/iparagraphformat/get_defaultportionformat/) to set the default highlight color for a paragraph, or use [IBasePortionFormat::get_HighlightColor](https://reference.aspose.com/slides/cpp/aspose.slides/ibaseportionformat/get_highlightcolor/) for individual text portions. The following example sets a light gray highlight as the default for the first paragraph. Explicit highlight colors on individual portions take precedence over this default: ```cpp #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(u"sample.pptx"); auto firstShape = presentation->get_Slide(0)->get_Shape(0); auto autoShape = System::ExplicitCast(firstShape); auto paragraph = autoShape->get_TextFrame()->get_Paragraph(0); auto defaultPortionFormat = paragraph->get_ParagraphFormat()->get_DefaultPortionFormat(); auto highlightColor = System::Drawing::Color::get_LightGray(); // Set the highlight color for the entire paragraph. defaultPortionFormat->get_HighlightColor()->set_Color(highlightColor); presentation->Save(u"gray_paragraph.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` The result: ![The gray paragraph](https://docs.aspose.com/slides/cpp/text-formatting/gray_paragraph.png) The code example below demonstrates how to set the background color for **text portions with a bold font**: ```cpp #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(u"sample.pptx"); auto firstShape = presentation->get_Slide(0)->get_Shape(0); auto autoShape = System::ExplicitCast(firstShape); auto paragraph = autoShape->get_TextFrame()->get_Paragraph(0); auto portions = paragraph->get_Portions(); int portionCount = portions->get_Count(); auto highlightColor = System::Drawing::Color::get_LightGray(); for (int portionIndex = 0; portionIndex < portionCount; portionIndex++) { auto portion = paragraph->get_Portion(portionIndex); auto portionFormat = portion->get_PortionFormat(); if (portionFormat->GetEffective()->get_FontBold()) { // Set the highlight color for the text portion. portionFormat->get_HighlightColor()->set_Color(highlightColor); } } presentation->Save(u"gray_text_portions.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` The result: ![The gray text portions](https://docs.aspose.com/slides/cpp/text-formatting/gray_text_portions.png) ## **Align Text Paragraphs** Use [IParagraphFormat::set_Alignment](https://reference.aspose.com/slides/cpp/aspose.slides/iparagraphformat/set_alignment/) to set paragraph alignment within a text frame. The value can be centered, left-aligned, right-aligned, justified, and so on. The following code example shows how to align the paragraph to the **center**: ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(u"sample.pptx"); auto firstShape = presentation->get_Slide(0)->get_Shape(0); auto autoShape = System::ExplicitCast(firstShape); auto paragraph = autoShape->get_TextFrame()->get_Paragraph(0); // Set the alignment of the paragraph to center. paragraph->get_ParagraphFormat()->set_Alignment(TextAlignment::Center); presentation->Save(u"aligned_paragraph.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` The result: ![The aligned paragraph](https://docs.aspose.com/slides/cpp/text-formatting/aligned_paragraph.png) ## **Align Fonts Within a Line** Use [IParagraphFormat::set_FontAlignment](https://reference.aspose.com/slides/cpp/aspose.slides/iparagraphformat/set_fontalignment/) to vertically align text portions of different font sizes within a line. This setting applies to the entire paragraph and controls alignment within each of its lines. The following self-contained example creates four labeled text boxes on one slide. Each paragraph contains the same text at 18, 36, and 54 points, with a different font alignment. It uses Arial, disables autofit and wrapping, and keeps the text frames large enough for a single line. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::Drawing; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); FontAlignment alignments[] = { FontAlignment::Baseline, FontAlignment::Top, FontAlignment::Center, FontAlignment::Bottom }; String labels[] = { u"Baseline", u"Top", u"Center", u"Bottom" }; float fontSizes[] = { 18.0f, 36.0f, 54.0f }; auto font = MakeObject(u"Arial"); for (auto i = 0; i < 4; i++) { auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 30, 20 + i * 130, 660, 120); shape->get_FillFormat()->set_FillType(FillType::NoFill); shape->get_LineFormat()->get_FillFormat()->set_FillType(FillType::NoFill); auto textFrame = shape->get_TextFrame(); textFrame->get_TextFrameFormat()->set_AnchoringType(TextAnchorType::Top); textFrame->get_TextFrameFormat()->set_AutofitType(TextAutofitType::None); textFrame->get_TextFrameFormat()->set_WrapText(NullableBool::False); auto label = textFrame->get_Paragraph(0); label->set_Text(labels[i]); label->get_ParagraphFormat()->set_Alignment(TextAlignment::Left); auto labelFormat = label->get_ParagraphFormat()->get_DefaultPortionFormat(); labelFormat->set_FontHeight(14); labelFormat->set_LatinFont(font); labelFormat->get_FillFormat()->set_FillType(FillType::Solid); labelFormat->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Gray()); auto paragraph = MakeObject(); paragraph->get_ParagraphFormat()->set_FontAlignment(alignments[i]); paragraph->get_ParagraphFormat()->set_Alignment(TextAlignment::Left); auto portionFormat = paragraph->get_ParagraphFormat()->get_DefaultPortionFormat(); portionFormat->set_LatinFont(font); portionFormat->get_FillFormat()->set_FillType(FillType::Solid); portionFormat->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Black()); for (auto fontSize : fontSizes) { auto portion = MakeObject(u"Ag "); portion->get_PortionFormat()->set_FontHeight(fontSize); paragraph->get_Portions()->Add(portion); } textFrame->get_Paragraphs()->Add(paragraph); } presentation->Save(u"font_alignment.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` The result: ![Comparison of Baseline, Top, Center, and Bottom font alignment with mixed font sizes](https://docs.aspose.com/slides/cpp/text-formatting/font_alignment.png) Font alignment uses font metrics, so the visible edges of individual letters do not necessarily line up exactly. The example includes both an uppercase letter and a descender to help show the difference between baseline and bottom alignment. Font availability and substitution, the characters used, and the difference in font sizes affect the result. Frame dimensions, margins, line spacing, wrapping, and autofit also affect layout; use the same fonts and layout settings when comparing modes. This setting differs from [IParagraphFormat::set_Alignment](https://reference.aspose.com/slides/cpp/aspose.slides/iparagraphformat/set_alignment/), which controls horizontal paragraph alignment, and [ITextFrameFormat::set_AnchoringType](https://reference.aspose.com/slides/cpp/aspose.slides/itextframeformat/set_anchoringtype/), which positions the text block vertically within its shape. Superscript and subscript formatting through [IBasePortionFormat::set_Escapement](https://reference.aspose.com/slides/cpp/aspose.slides/ibaseportionformat/set_escapement/) shifts individual portions relative to the baseline instead of setting font alignment for the paragraph's lines. ## **Set Transparency for Text** Text transparency is controlled through the alpha component of the color assigned through [IBasePortionFormat::get_FillFormat](https://reference.aspose.com/slides/cpp/aspose.slides/ibaseportionformat/get_fillformat/). In the examples below, `alpha = 50` is an ARGB alpha-channel value on the 0–255 scale, not a transparency percentage. The code example below shows how to apply transparency to the **entire paragraph**: ```cpp #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; int alpha = 50; auto presentation = System::MakeObject(u"sample.pptx"); auto firstShape = presentation->get_Slide(0)->get_Shape(0); auto autoShape = System::ExplicitCast(firstShape); auto paragraph = autoShape->get_TextFrame()->get_Paragraph(0); auto defaultPortionFormat = paragraph->get_ParagraphFormat()->get_DefaultPortionFormat(); // Set the fill color of the text to transparent color. defaultPortionFormat->get_FillFormat()->set_FillType(FillType::Solid); auto baseColor = System::Drawing::Color::get_Black(); auto transparentColor = System::Drawing::Color::FromArgb(alpha, baseColor); defaultPortionFormat->get_FillFormat()->get_SolidFillColor()->set_Color(transparentColor); presentation->Save(u"transparent_paragraph.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` The result: ![The transparent paragraph](https://docs.aspose.com/slides/cpp/text-formatting/transparent_paragraph.png) The following code example shows how to apply transparency to **text portions with a bold font**: ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; int alpha = 50; auto presentation = System::MakeObject(u"sample.pptx"); auto firstShape = presentation->get_Slide(0)->get_Shape(0); auto autoShape = System::ExplicitCast(firstShape); auto paragraph = autoShape->get_TextFrame()->get_Paragraph(0); auto portions = paragraph->get_Portions(); int portionCount = portions->get_Count(); for (int portionIndex = 0; portionIndex < portionCount; portionIndex++) { auto portion = paragraph->get_Portion(portionIndex); auto portionFormat = portion->get_PortionFormat(); if (portionFormat->GetEffective()->get_FontBold()) { // Set the transparency of the text portion. portionFormat->get_FillFormat()->set_FillType(FillType::Solid); auto baseColor = System::Drawing::Color::get_Black(); auto transparentColor = System::Drawing::Color::FromArgb(alpha, baseColor); portionFormat->get_FillFormat()->get_SolidFillColor()->set_Color(transparentColor); } } presentation->Save(u"transparent_text_portions.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` The result: ![The transparent text portions](https://docs.aspose.com/slides/cpp/text-formatting/transparent_text_portions.png) ## **Set Character Spacing for Text** Use [IBasePortionFormat::set_Spacing](https://reference.aspose.com/slides/cpp/aspose.slides/ibaseportionformat/set_spacing/) to expand or condense spacing between characters in a text box. The examples add 3 points of spacing; negative values condense the text. The following C++ code shows how to expand the character spacing in the **entire paragraph**: ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(u"sample.pptx"); auto firstShape = presentation->get_Slide(0)->get_Shape(0); auto autoShape = System::ExplicitCast(firstShape); auto paragraph = autoShape->get_TextFrame()->get_Paragraph(0); // Note: Use negative values to compress the character spacing. paragraph->get_ParagraphFormat()->get_DefaultPortionFormat()->set_Spacing(3.0f); // Expand character spacing. presentation->Save(u"character_spacing_in_paragraph.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` The result: ![The character spacing in the paragraph](https://docs.aspose.com/slides/cpp/text-formatting/character_spacing_in_paragraph.png) The code example below shows how to expand the character spacing in **text portions with a bold font**: ```cpp #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(u"sample.pptx"); auto firstShape = presentation->get_Slide(0)->get_Shape(0); auto autoShape = System::ExplicitCast(firstShape); auto paragraph = autoShape->get_TextFrame()->get_Paragraph(0); auto portions = paragraph->get_Portions(); int portionCount = portions->get_Count(); for (int portionIndex = 0; portionIndex < portionCount; portionIndex++) { auto portion = paragraph->get_Portion(portionIndex); auto portionFormat = portion->get_PortionFormat(); if (portionFormat->GetEffective()->get_FontBold()) { // Note: Use negative values to compress the character spacing. portionFormat->set_Spacing(3.0f); // Expand character spacing. } } presentation->Save(u"character_spacing_in_text_portions.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` The result: ![The character spacing in the text portions](https://docs.aspose.com/slides/cpp/text-formatting/character_spacing_in_text_portions.png) ### **Disable Kerning for Specific Fonts** In some cases, text rendered by Aspose.Slides may look slightly tighter than the same text displayed in PowerPoint. This can happen because PowerPoint may ignore kerning data for certain fonts, even when the font contains valid kerning information and kerning is enabled in PowerPoint settings. To make the rendered output closer to PowerPoint in such cases, you can disable kerning for text portions that use the affected font. Use [IBasePortionFormat::set_KerningMinimalSize](https://reference.aspose.com/slides/cpp/aspose.slides/ibaseportionformat/set_kerningminimalsize/) to set a value larger than the actual font size. This example requires "presentation.pptx" with a text box as the first shape on the first slide. It checks effective font names, including inherited fonts, and sets a 100-point threshold for portions that use Roboto. This disables kerning for matching portions with a font size below 100 points: ```cpp #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(u"presentation.pptx"); auto firstShape = presentation->get_Slide(0)->get_Shape(0); auto autoShape = System::ExplicitCast(firstShape); System::String targetFont = u"Roboto"; auto textFrame = autoShape->get_TextFrame(); auto paragraphs = textFrame->get_Paragraphs(); int paragraphCount = paragraphs->get_Count(); for (int paragraphIndex = 0; paragraphIndex < paragraphCount; paragraphIndex++) { auto paragraph = textFrame->get_Paragraph(paragraphIndex); auto portions = paragraph->get_Portions(); int portionCount = portions->get_Count(); for (int portionIndex = 0; portionIndex < portionCount; portionIndex++) { auto portion = paragraph->get_Portion(portionIndex); auto portionFormat = portion->get_PortionFormat(); auto textFormat = portionFormat->GetEffective(); auto latinFont = textFormat->get_LatinFont(); auto eastAsianFont = textFormat->get_EastAsianFont(); auto complexScriptFont = textFormat->get_ComplexScriptFont(); bool isLatinFont = latinFont != nullptr && latinFont->get_FontName() == targetFont; bool isEastAsianFont = eastAsianFont != nullptr && eastAsianFont->get_FontName() == targetFont; bool isComplexScriptFont = complexScriptFont != nullptr && complexScriptFont->get_FontName() == targetFont; if (isLatinFont || isEastAsianFont || isComplexScriptFont) { portionFormat->set_KerningMinimalSize(100.0f); } } } presentation->Save(u"output.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` For matching text below the threshold, this setting prevents kerning and can help align Aspose.Slides rendering with PowerPoint’s visual output for fonts affected by this PowerPoint-specific behavior. ## **Manage Text Font Properties** Font properties can be set at the paragraph level through [IParagraphFormat::get_DefaultPortionFormat](https://reference.aspose.com/slides/cpp/aspose.slides/iparagraphformat/get_defaultportionformat/) or on individual portions through [IPortionFormat](https://reference.aspose.com/slides/cpp/aspose.slides/iportionformat/). The following example sets the first paragraph’s default font to 12-point Times New Roman with bold, italic, and dotted underline formatting. Explicit formatting on individual portions takes precedence over these defaults. ```cpp #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(u"sample.pptx"); auto firstShape = presentation->get_Slide(0)->get_Shape(0); auto autoShape = System::ExplicitCast(firstShape); auto paragraph = autoShape->get_TextFrame()->get_Paragraph(0); auto defaultPortionFormat = paragraph->get_ParagraphFormat()->get_DefaultPortionFormat(); // Set the font properties for the paragraph. defaultPortionFormat->set_FontHeight(12.0f); defaultPortionFormat->set_FontBold(NullableBool::True); defaultPortionFormat->set_FontItalic(NullableBool::True); defaultPortionFormat->set_FontUnderline(TextUnderlineType::Dotted); auto font = System::MakeObject(u"Times New Roman"); defaultPortionFormat->set_LatinFont(font); presentation->Save(u"font_properties_for_paragraph.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` The result: ![The font properties for the paragraph](https://docs.aspose.com/slides/cpp/text-formatting/font_properties_for_paragraph.png) The following example applies 13-point Times New Roman, italic formatting, and a dotted underline to portions whose effective formatting is bold: ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(u"sample.pptx"); auto firstShape = presentation->get_Slide(0)->get_Shape(0); auto autoShape = System::ExplicitCast(firstShape); auto paragraph = autoShape->get_TextFrame()->get_Paragraph(0); auto portions = paragraph->get_Portions(); int portionCount = portions->get_Count(); auto font = System::MakeObject(u"Times New Roman"); for (int portionIndex = 0; portionIndex < portionCount; portionIndex++) { auto portion = paragraph->get_Portion(portionIndex); auto portionFormat = portion->get_PortionFormat(); if (portionFormat->GetEffective()->get_FontBold()) { // Set the font properties for the text portion. portionFormat->set_FontHeight(13.0f); portionFormat->set_FontItalic(NullableBool::True); portionFormat->set_FontUnderline(TextUnderlineType::Dotted); portionFormat->set_LatinFont(font); } } presentation->Save(u"font_properties_for_text_portions.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` The result: ![The font properties for text portions](https://docs.aspose.com/slides/cpp/text-formatting/font_properties_for_text_portions.png) ## **Control Text Height Normalization** Use [IBasePortionFormat::set_NormaliseHeight](https://reference.aspose.com/slides/cpp/aspose.slides/ibaseportionformat/set_normaliseheight/) when reproducing template typography or investigating differences in character height. In PowerPoint, enabling normalization stretches or compresses individual characters vertically to give them a uniform visible height within the text portion. It does not guarantee equal text heights across different fonts. Set the property to [NullableBool::True or False](https://reference.aspose.com/slides/cpp/aspose.slides/nullablebool/) to explicitly enable or disable normalization. `NullableBool::NotDefined` leaves the local setting unset so that the portion inherits its value, for example, from the paragraph's [IParagraphFormat::get_DefaultPortionFormat](https://reference.aspose.com/slides/cpp/aspose.slides/iparagraphformat/get_defaultportionformat/). It does not mean `False`. Use [IPortionFormat::GetEffective](https://reference.aspose.com/slides/cpp/aspose.slides/iportionformat/geteffective/) and read [IBasePortionFormatEffectiveData::get_NormaliseHeight](https://reference.aspose.com/slides/cpp/aspose.slides/ibaseportionformateffectivedata/get_normaliseheight/) to obtain the resolved Boolean value. The following self-contained example requires **Arial** to be installed. It creates two text blocks containing the same uppercase letters, lowercase letters, descenders, and accented characters at 54 points. Both paragraphs enable normalization by default. The top portion explicitly disables it; the bottom portion inherits it. The frame sizes, margins, and paragraph spacing are identical, with wrapping and autofit disabled to keep the comparison consistent. The example prints `False: False` and `NotDefined: True`, then saves "text_height_normalization.pptx". ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::Drawing; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); NullableBool settings[] = { NullableBool::False, NullableBool::NotDefined }; for (auto i = 0; i < 2; i++) { auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 30, 60 + i * 200, 660, 150); shape->get_FillFormat()->set_FillType(FillType::NoFill); shape->get_LineFormat()->get_FillFormat()->set_FillType(FillType::NoFill); auto textFrame = shape->get_TextFrame(); textFrame->set_Text(u"Hxgjpq ÅÉ 0123"); textFrame->get_TextFrameFormat()->set_AutofitType(TextAutofitType::None); textFrame->get_TextFrameFormat()->set_WrapText(NullableBool::False); textFrame->get_TextFrameFormat()->set_AnchoringType(TextAnchorType::Top); textFrame->get_TextFrameFormat()->set_MarginTop(0); textFrame->get_TextFrameFormat()->set_MarginLeft(0); auto paragraph = textFrame->get_Paragraph(0); paragraph->get_ParagraphFormat()->set_Alignment(TextAlignment::Left); paragraph->get_ParagraphFormat()->set_SpaceBefore(0); paragraph->get_ParagraphFormat()->set_SpaceAfter(0); paragraph->get_ParagraphFormat()->set_SpaceWithin(100); paragraph->get_ParagraphFormat()->get_DefaultPortionFormat()->set_NormaliseHeight(NullableBool::True); auto portion = paragraph->get_Portion(0); auto font = MakeObject(u"Arial"); portion->get_PortionFormat()->set_LatinFont(font); portion->get_PortionFormat()->set_FontHeight(54); portion->get_PortionFormat()->get_FillFormat()->set_FillType(FillType::Solid); portion->get_PortionFormat()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Black()); portion->get_PortionFormat()->set_NormaliseHeight(settings[i]); Console::WriteLine(u"{0}: {1}", settings[i], portion->get_PortionFormat()->GetEffective()->get_NormaliseHeight()); } presentation->Save(u"text_height_normalization.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` The comparison below was exported from the saved presentation. The top row has normalization disabled (`False`); the bottom row inherits the enabled setting (`NotDefined` → `True`). Keep Arial installed to reproduce this appearance. ![Arial 54-point text with normalization disabled above and inherited normalization enabled below](https://docs.aspose.com/slides/cpp/text-formatting/text_height_normalization.png) Normalization changes character height without changing the assigned [IBasePortionFormat::get_FontHeight](https://reference.aspose.com/slides/cpp/aspose.slides/ibaseportionformat/get_fontheight/) value, which specifies the font size in points. Paragraph [IParagraphFormat::set_SpaceWithin](https://reference.aspose.com/slides/cpp/aspose.slides/iparagraphformat/set_spacewithin/) controls line spacing, while text-frame [ITextFrameFormat::set_AutofitType](https://reference.aspose.com/slides/cpp/aspose.slides/itextframeformat/set_autofittype/) controls how text or its container adjusts to fit. These settings serve different purposes and can affect the overall layout independently. For more on paragraph formatting and inheritance, see [Manage Paragraph](https://docs.aspose.com/slides/cpp/manage-paragraph/). ## **Apply and Remove Strikethrough** Use [IBasePortionFormat::set_StrikethroughType](https://reference.aspose.com/slides/cpp/aspose.slides/ibaseportionformat/set_strikethroughtype/) on a text portion to display corrections, cancelled terms, or previous prices without deleting the original text. Set it to [TextStrikethroughType::Single or Double](https://reference.aspose.com/slides/cpp/aspose.slides/textstrikethroughtype/) for one or two lines through the text. To remove strikethrough, assign `TextStrikethroughType::None`. This explicitly disables the effect, even if the surrounding formatting specifies strikethrough. By contrast, `TextStrikethroughType::NotDefined` leaves the local setting undefined, allowing the portion to inherit formatting, for example, from the paragraph. It does not guarantee that strikethrough is removed. Use [IPortionFormat::GetEffective](https://reference.aspose.com/slides/cpp/aspose.slides/iportionformat/geteffective/) to read the resulting formatting, including inherited values. The following self-contained example creates three price comparisons. Each paragraph has separate portions for the label, previous price, and current price, so only the previous price is affected. The first row applies and then removes strikethrough; the other rows retain single and double strikethrough. Changing this property preserves the text and its other formatting, including the bold previous price. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::Drawing; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 50, 50, 620, 220); shape->get_FillFormat()->set_FillType(FillType::NoFill); shape->get_LineFormat()->get_FillFormat()->set_FillType(FillType::NoFill); auto textFrame = shape->get_TextFrame(); textFrame->get_Paragraphs()->Clear(); String labels[] = { u"None: ", u"Single: ", u"Double: " }; for (auto label : labels) { auto paragraph = MakeObject(); paragraph->get_ParagraphFormat()->set_Alignment(TextAlignment::Left); paragraph->get_ParagraphFormat()->set_SpaceAfter(20); auto format = paragraph->get_ParagraphFormat()->get_DefaultPortionFormat(); format->set_FontHeight(28); auto font = MakeObject(u"Arial"); format->set_LatinFont(font); format->get_FillFormat()->set_FillType(FillType::Solid); format->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Black()); auto labelPortion = MakeObject(label); paragraph->get_Portions()->Add(labelPortion); auto previousPrice = MakeObject(u"$100"); previousPrice->get_PortionFormat()->set_FontBold(NullableBool::True); paragraph->get_Portions()->Add(previousPrice); auto currentPrice = MakeObject(u" → $80"); paragraph->get_Portions()->Add(currentPrice); textFrame->get_Paragraphs()->Add(paragraph); } // Apply strikethrough, then explicitly remove it from the first previous price. auto firstPriceFormat = textFrame->get_Paragraph(0)->get_Portion(1)->get_PortionFormat(); firstPriceFormat->set_StrikethroughType(TextStrikethroughType::Single); firstPriceFormat->set_StrikethroughType(TextStrikethroughType::None); textFrame->get_Paragraph(1)->get_Portion(1)->get_PortionFormat()->set_StrikethroughType(TextStrikethroughType::Single); textFrame->get_Paragraph(2)->get_Portion(1)->get_PortionFormat()->set_StrikethroughType(TextStrikethroughType::Double); presentation->Save(u"strikethrough.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` The result, from top to bottom: no strikethrough, single strikethrough, and double strikethrough. ![Previous prices without strikethrough, with single strikethrough, and with double strikethrough](https://docs.aspose.com/slides/cpp/text-formatting/strikethrough.png) ## **Set Text Rotation** Use [ITextFrameFormat::set_TextVerticalType](https://reference.aspose.com/slides/cpp/aspose.slides/itextframeformat/set_textverticaltype/) to set a predefined text orientation within a shape. The following code example sets the text orientation in the shape to [TextVerticalType::Vertical270](https://reference.aspose.com/slides/cpp/aspose.slides/textverticaltype/), which rotates the text **90 degrees counterclockwise**: ```cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(u"sample.pptx"); auto firstShape = presentation->get_Slide(0)->get_Shape(0); auto autoShape = System::ExplicitCast(firstShape); autoShape->get_TextFrame()->get_TextFrameFormat()->set_TextVerticalType(TextVerticalType::Vertical270); presentation->Save(u"text_rotation.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` The result: ![The text rotation](https://docs.aspose.com/slides/cpp/text-formatting/text_rotation.png) ## **Set Custom Rotation for Text Frames** Use [ITextFrameFormat::set_RotationAngle](https://reference.aspose.com/slides/cpp/aspose.slides/itextframeformat/set_rotationangle/) to set a custom rotation angle for an [ITextFrame](https://reference.aspose.com/slides/cpp/aspose.slides/itextframe/). The code example below rotates the text frame by 3 degrees clockwise within the shape: ```cpp #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(u"sample.pptx"); auto firstShape = presentation->get_Slide(0)->get_Shape(0); auto autoShape = System::ExplicitCast(firstShape); autoShape->get_TextFrame()->get_TextFrameFormat()->set_RotationAngle(3.0f); presentation->Save(u"custom_text_rotation.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` The result: ![The custom text rotation](https://docs.aspose.com/slides/cpp/text-formatting/custom_text_rotation.png) ## **Set Line Spacing of Paragraphs** Aspose.Slides provides [IParagraphFormat::set_SpaceAfter](https://reference.aspose.com/slides/cpp/aspose.slides/iparagraphformat/set_spaceafter/), [IParagraphFormat::set_SpaceBefore](https://reference.aspose.com/slides/cpp/aspose.slides/iparagraphformat/set_spacebefore/), and [IParagraphFormat::set_SpaceWithin](https://reference.aspose.com/slides/cpp/aspose.slides/iparagraphformat/set_spacewithin/) to control paragraph spacing. These methods are used as follows: * Use a positive value to specify line spacing as a percentage of the line height. * Use a negative value to specify line spacing in points. The following example sets spacing within the first paragraph to 200% of the line height (double spacing): ```cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(u"sample.pptx"); auto firstShape = presentation->get_Slide(0)->get_Shape(0); auto autoShape = System::ExplicitCast(firstShape); auto paragraph = autoShape->get_TextFrame()->get_Paragraph(0); paragraph->get_ParagraphFormat()->set_SpaceWithin(200.0f); presentation->Save(u"line_spacing.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` The result: ![The line spacing within the paragraph](https://docs.aspose.com/slides/cpp/text-formatting/line_spacing.png) ## **Control Line Breaking** Paragraph line-breaking rules are useful in narrow text blocks and presentations that mix Latin and East Asian text. The following methods belong to [IParagraphFormat](https://reference.aspose.com/slides/cpp/aspose.slides/iparagraphformat/), so they apply to an entire paragraph: - [IParagraphFormat::set_LatinLineBreak](https://reference.aspose.com/slides/cpp/aspose.slides/iparagraphformat/set_latinlinebreak/) controls Latin line-breaking rules. In mixed text, changing it can also change where adjacent East Asian text and punctuation wrap. - [IParagraphFormat::set_EastAsianLineBreak](https://reference.aspose.com/slides/cpp/aspose.slides/iparagraphformat/set_eastasianlinebreak/) controls East Asian line-breaking rules, including restrictions on characters at the beginning and end of a line. These rules do not replace [ITextFrameFormat::set_WrapText](https://reference.aspose.com/slides/cpp/aspose.slides/itextframeformat/set_wraptext/), which enables automatic wrapping within a text frame. They influence the layout when wrapping occurs; they do not insert line-break characters. An explicit line break forces a new line within the paragraph independently of the available width. The following self-contained example creates a narrow text block containing Chinese and Latin text. It sets both line-breaking rules explicitly and saves "line_breaking.pptx". To experiment with either rule, change the value passed to its setter while keeping the other settings fixed. The example uses 24-point Arial and SimSun with a 160-point frame width and zero horizontal text-frame margins. [ITextFrameFormat::set_AutofitType](https://reference.aspose.com/slides/cpp/aspose.slides/itextframeformat/set_autofittype/) is called with [TextAutofitType::None](https://reference.aspose.com/slides/cpp/aspose.slides/textautofittype/) so that text size and frame dimensions remain fixed. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 50.0f, 50.0f, 160.0f, 300.0f); shape->get_FillFormat()->set_FillType(FillType::NoFill); auto textFrame = shape->get_TextFrame(); textFrame->get_TextFrameFormat()->set_WrapText(NullableBool::True); textFrame->get_TextFrameFormat()->set_AutofitType(TextAutofitType::None); textFrame->get_TextFrameFormat()->set_MarginLeft(0); textFrame->get_TextFrameFormat()->set_MarginRight(0); auto paragraph = textFrame->get_Paragraph(0); paragraph->set_Text(u"中文排版测试,PowerPoint 中文演示。"); auto format = paragraph->get_ParagraphFormat(); format->set_Alignment(TextAlignment::Left); auto portionFormat = format->get_DefaultPortionFormat(); portionFormat->set_FontHeight(24.0f); auto latinFont = System::MakeObject(u"Arial"); portionFormat->set_LatinFont(latinFont); auto eastAsianFont = System::MakeObject(u"SimSun"); portionFormat->set_EastAsianFont(eastAsianFont); portionFormat->get_FillFormat()->set_FillType(FillType::Solid); portionFormat->get_FillFormat()->get_SolidFillColor()->set_Color(System::Drawing::Color::get_Black()); format->set_LatinLineBreak(NullableBool::False); format->set_EastAsianLineBreak(NullableBool::True); presentation->Save(u"line_breaking.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ## **Control Hanging Punctuation** [IParagraphFormat::set_HangingPunctuation](https://reference.aspose.com/slides/cpp/aspose.slides/iparagraphformat/set_hangingpunctuation/) allows eligible punctuation to extend beyond the text line's right edge instead of occupying the next line. It applies to the entire paragraph and is different from a hanging indent. The following self-contained example enables hanging punctuation in a 100-point-wide text frame and saves "hanging_punctuation.pptx". With 24-point Arial and zero horizontal text-frame margins, the final period stays after "sentence" and extends beyond the right text edge. Pass [NullableBool::False](https://reference.aspose.com/slides/cpp/aspose.slides/nullablebool/) to the setter to compare: with these settings, the period occupies a separate line. Wrapping is enabled and autofit is disabled to keep the available width fixed. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 50.0f, 50.0f, 100.0f, 200.0f); shape->get_FillFormat()->set_FillType(FillType::NoFill); auto textFrame = shape->get_TextFrame(); textFrame->get_TextFrameFormat()->set_WrapText(NullableBool::True); textFrame->get_TextFrameFormat()->set_AutofitType(TextAutofitType::None); textFrame->get_TextFrameFormat()->set_MarginLeft(0); textFrame->get_TextFrameFormat()->set_MarginRight(0); auto paragraph = textFrame->get_Paragraph(0); paragraph->set_Text(u"Simple text, next sentence."); auto format = paragraph->get_ParagraphFormat(); format->set_Alignment(TextAlignment::Left); auto portionFormat = format->get_DefaultPortionFormat(); portionFormat->set_FontHeight(24.0f); auto latinFont = System::MakeObject(u"Arial"); portionFormat->set_LatinFont(latinFont); portionFormat->get_FillFormat()->set_FillType(FillType::Solid); portionFormat->get_FillFormat()->get_SolidFillColor()->set_Color(System::Drawing::Color::get_Black()); format->set_HangingPunctuation(NullableBool::True); presentation->Save(u"hanging_punctuation.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` Not every punctuation mark can hang. The [font and layout conditions described above](https://docs.aspose.com/slides/cpp/text-formatting/#control-line-breaking) also apply to this comparison: changing the font, available width, margins, or autofit settings can remove the visible difference. ## **Set Autofit Type for Text Frames** [ITextFrameFormat::set_AutofitType](https://reference.aspose.com/slides/cpp/aspose.slides/itextframeformat/set_autofittype/) determines how text behaves when it exceeds the boundaries of its container. Use it to control whether the text shrinks, overflows, or resizes the shape automatically. The following example configures the shape to resize to fit its text and saves the result to "autofit_type.pptx". ```cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(u"sample.pptx"); auto firstShape = presentation->get_Slide(0)->get_Shape(0); auto autoShape = System::ExplicitCast(firstShape); autoShape->get_TextFrame()->get_TextFrameFormat()->set_AutofitType(TextAutofitType::Shape); presentation->Save(u"autofit_type.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` To count lines after automatic wrapping and see how text or shape width changes the result, see [Count Rendered Lines](https://docs.aspose.com/slides/cpp/manage-paragraph/). Line count alone does not indicate whether text overflows its container. ## **Set Anchor of Text Frames** [ITextFrameFormat::set_AnchoringType](https://reference.aspose.com/slides/cpp/aspose.slides/itextframeformat/set_anchoringtype/) defines how text is positioned vertically inside a shape, for example, at the top, middle, or bottom. The following example anchors the text to the bottom of the first shape and saves the result to "text_anchor.pptx". ```cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(u"sample.pptx"); auto firstShape = presentation->get_Slide(0)->get_Shape(0); auto autoShape = System::ExplicitCast(firstShape); autoShape->get_TextFrame()->get_TextFrameFormat()->set_AnchoringType(TextAnchorType::Bottom); presentation->Save(u"text_anchor.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ## **Set Text Tabulation** Use [IParagraphFormat::set_DefaultTabSize](https://reference.aspose.com/slides/cpp/aspose.slides/iparagraphformat/set_defaulttabsize/) and [IParagraphFormat::get_Tabs](https://reference.aspose.com/slides/cpp/aspose.slides/iparagraphformat/get_tabs/) to configure tab stops in a paragraph. The following example sets the default tab interval to 100 points and adds a left-aligned tab stop at 30 points. These settings affect text containing tab characters. ```cpp #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(u"sample.pptx"); auto firstShape = presentation->get_Slide(0)->get_Shape(0); auto autoShape = System::ExplicitCast(firstShape); auto paragraph = autoShape->get_TextFrame()->get_Paragraph(0); paragraph->get_ParagraphFormat()->set_DefaultTabSize(100.0f); paragraph->get_ParagraphFormat()->get_Tabs()->Add(30.0f, TabAlignment::Left); presentation->Save(u"paragraph_tabs.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` The result: ![The paragraph tabs](https://docs.aspose.com/slides/cpp/text-formatting/paragraph_tabs.png) ## **Set Proofing Language** Aspose.Slides provides [IBasePortionFormat::set_LanguageId](https://reference.aspose.com/slides/cpp/aspose.slides/ibaseportionformat/set_languageid/), which allows you to set the proofing language for a text portion. The proofing language determines the language used for spelling and grammar checks in PowerPoint. The following example requires "presentation.pptx" with a text box as the first shape on the first slide and at least one paragraph. It replaces the first paragraph’s contents with "1。", sets SimSun as its font, and assigns the Simplified Chinese proofing language (`zh-CN`). It saves the result to "proofing_language.pptx": ```cpp #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(u"presentation.pptx"); auto firstShape = presentation->get_Slide(0)->get_Shape(0); auto autoShape = System::ExplicitCast(firstShape); auto paragraph = autoShape->get_TextFrame()->get_Paragraph(0); paragraph->get_Portions()->Clear(); auto font = System::MakeObject(u"SimSun"); auto textPortion = System::MakeObject(); auto portionFormat = textPortion->get_PortionFormat(); portionFormat->set_ComplexScriptFont(font); portionFormat->set_EastAsianFont(font); portionFormat->set_LatinFont(font); // Set the proofing language to Simplified Chinese. portionFormat->set_LanguageId(u"zh-CN"); textPortion->set_Text(u"1。"); paragraph->get_Portions()->Add(textPortion); presentation->Save(u"proofing_language.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ## **Set Default Language** Use [LoadOptions::set_DefaultTextLanguage](https://reference.aspose.com/slides/cpp/aspose.slides/loadoptions/set_defaulttextlanguage/) to define the default language for text created while loading or creating a presentation. The following example creates a presentation with US English as the default text language, adds a text box, and prints `en-US` for its first text portion. ```cpp #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; auto loadOptions = System::MakeObject(); loadOptions->set_DefaultTextLanguage(u"en-US"); auto presentation = System::MakeObject(loadOptions); auto slide = presentation->get_Slide(0); // Add a new rectangle shape with text. auto shape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 20.0f, 20.0f, 150.0f, 50.0f); shape->get_TextFrame()->set_Text(u"Sample text"); // Check the first portion language. auto portion = shape->get_TextFrame()->get_Paragraph(0)->get_Portion(0); auto languageId = portion->get_PortionFormat()->get_LanguageId(); System::Console::WriteLine(languageId); presentation->Dispose(); ``` ## **Set Default Text Style** To apply default text formatting at the presentation level, use [IPresentation::get_DefaultTextStyle](https://reference.aspose.com/slides/cpp/aspose.slides/ipresentation/get_defaulttextstyle/). The following example sets a 14-point bold font as the default for top-level paragraphs in a new presentation and saves it to "default_text_style.pptx". Text can inherit these defaults unless more specific formatting overrides them. ```cpp #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(); // Get the top level paragraph format. auto paragraphFormat = presentation->get_DefaultTextStyle()->GetLevel(0); if (paragraphFormat != nullptr) { auto defaultPortionFormat = paragraphFormat->get_DefaultPortionFormat(); defaultPortionFormat->set_FontHeight(14.0f); defaultPortionFormat->set_FontBold(NullableBool::True); } presentation->Save(u"default_text_style.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ## **Extract Text with the All-Caps Effect** In PowerPoint, applying the **All Caps** font effect makes text appear in uppercase on the slide even when it was originally typed in lowercase. When you retrieve such a text portion with Aspose.Slides, the library returns the text exactly as it was entered. To match the displayed text, check [TextCapType](https://reference.aspose.com/slides/cpp/aspose.slides/textcaptype/) and convert the returned string to uppercase when the value is [TextCapType::All](https://reference.aspose.com/slides/cpp/aspose.slides/textcaptype/). This example requires "sample2.pptx" with a text box as the first shape on the first slide. Its first paragraph’s first portion contains "Hello, Aspose!" with the All Caps effect applied, as shown below. ![The All Caps effect](https://docs.aspose.com/slides/cpp/text-formatting/all_caps_effect.png) The code example below shows how to extract the text with the **All Caps** effect applied: ```cpp #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; auto presentation = System::MakeObject(u"sample2.pptx"); auto firstShape = presentation->get_Slide(0)->get_Shape(0); auto autoShape = System::ExplicitCast(firstShape); auto textPortion = autoShape->get_TextFrame()->get_Paragraph(0)->get_Portion(0); auto originalText = textPortion->get_Text(); System::Console::WriteLine(u"Original text: " + originalText); auto textFormat = textPortion->get_PortionFormat()->GetEffective(); if (textFormat->get_TextCapType() == TextCapType::All) { auto uppercaseText = originalText.ToUpper(); System::Console::WriteLine(u"All-Caps effect: " + uppercaseText); } presentation->Dispose(); ``` Output: ```text Original text: Hello, Aspose! All-Caps effect: HELLO, ASPOSE! ``` ## **FAQ** **How do I modify text in a table on a slide?** To modify text in a table on a slide, use [ITable](https://reference.aspose.com/slides/cpp/aspose.slides/itable/). Iterate through the cells and update each cell through [ICell::get_TextFrame](https://reference.aspose.com/slides/cpp/aspose.slides/icell/get_textframe/) and paragraph formatting through [IParagraph::get_ParagraphFormat](https://reference.aspose.com/slides/cpp/aspose.slides/iparagraph/get_paragraphformat/). **How do I apply a gradient color to text on a PowerPoint slide?** To apply a gradient color to text, use [IBasePortionFormat::get_FillFormat](https://reference.aspose.com/slides/cpp/aspose.slides/ibaseportionformat/get_fillformat/). Set [IFillFormat::set_FillType](https://reference.aspose.com/slides/cpp/aspose.slides/ifillformat/set_filltype/) to [FillType::Gradient](https://reference.aspose.com/slides/cpp/aspose.slides/filltype/) and configure the gradient stops, direction, and transparency. Related feature: [Format text within slides](https://docs.aspose.com/slides/features/text-formatting/). # Add Trend Lines to Presentation Charts in C++ > Quickly add and customize trend lines in PowerPoint charts with Aspose.Slides for C++ — a practical guide to engage your audience. Source: https://docs.aspose.com/slides/cpp/trend-line/ Updated: 2026-10-16 ## **Overview** This article explains how to add trend lines to presentation charts by using Aspose.Slides. It shows how to create a chart, add trend lines to chart series, and work with several trend line types, including exponential, linear, logarithmic, moving average, polynomial, and power. It also describes how to add a custom line to a chart by inserting a line shape, and includes a short FAQ about forward and backward trend line projection values and whether trend lines are preserved during export to PDF or SVG and when rendering charts as images. ## **Add a Trend Line** Use [ITrendlineCollection::Add](https://reference.aspose.com/slides/cpp/aspose.slides.charts/itrendlinecollection/add/) to add a trend line to a chart series, selecting its type with [TrendlineType](https://reference.aspose.com/slides/cpp/aspose.slides.charts/trendlinetype/). The example creates a clustered column chart with default data and adds two trend lines to each of its three series. The exponential trend line hides its equation and R-squared value through [ITrendline::set_DisplayEquation](https://reference.aspose.com/slides/cpp/aspose.slides.charts/itrendline/set_displayequation/) and [ITrendline::set_DisplayRSquaredValue](https://reference.aspose.com/slides/cpp/aspose.slides.charts/itrendline/set_displayrsquaredvalue/), while the linear trend line is red. The logarithmic trend line uses [IOverridableText::AddTextFrameForOverriding](https://reference.aspose.com/slides/cpp/aspose.slides.charts/ioverridabletext/addtextframeforoverriding/) for a custom label. The moving average uses [ITrendline::set_Period](https://reference.aspose.com/slides/cpp/aspose.slides.charts/itrendline/set_period/) to average three data points and [ITrendline::set_TrendlineName](https://reference.aspose.com/slides/cpp/aspose.slides.charts/itrendline/set_trendlinename/) for a custom name. The polynomial trend line uses [ITrendline::set_Order](https://reference.aspose.com/slides/cpp/aspose.slides.charts/itrendline/set_order/) to set its degree to three and extends one category forward through [ITrendline::set_Forward](https://reference.aspose.com/slides/cpp/aspose.slides.charts/itrendline/set_forward/). The power trend line extends one category backward through [ITrendline::set_Backward](https://reference.aspose.com/slides/cpp/aspose.slides.charts/itrendline/set_backward/). ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace System; using namespace System::Drawing; using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::ClusteredColumn, 20, 20, 500, 400); auto firstSeries = chart->get_ChartData()->get_Series()->idx_get(0); auto exponentialTrendline = firstSeries->get_TrendLines()->Add(TrendlineType::Exponential); exponentialTrendline->set_DisplayEquation(false); exponentialTrendline->set_DisplayRSquaredValue(false); auto linearTrendline = firstSeries->get_TrendLines()->Add(TrendlineType::Linear); linearTrendline->get_Format()->get_Line()->get_FillFormat()->set_FillType(FillType::Solid); linearTrendline->get_Format()->get_Line()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Red()); auto secondSeries = chart->get_ChartData()->get_Series()->idx_get(1); auto logarithmicTrendline = secondSeries->get_TrendLines()->Add(TrendlineType::Logarithmic); logarithmicTrendline->AddTextFrameForOverriding(u"New log trend line"); auto movingAverageTrendline = secondSeries->get_TrendLines()->Add(TrendlineType::MovingAverage); movingAverageTrendline->set_Period(3); movingAverageTrendline->set_TrendlineName(u"New TrendLine Name"); auto thirdSeries = chart->get_ChartData()->get_Series()->idx_get(2); auto polynomialTrendline = thirdSeries->get_TrendLines()->Add(TrendlineType::Polynomial); polynomialTrendline->set_Forward(1); polynomialTrendline->set_Order(3); auto powerTrendline = thirdSeries->get_TrendLines()->Add(TrendlineType::Power); powerTrendline->set_Backward(1); presentation->Save(u"ChartTrendLines.pptx", SaveFormat::Pptx); ``` ## **Set a Trend Line Intercept** Use [ITrendline::set_Intercept](https://reference.aspose.com/slides/cpp/aspose.slides.charts/itrendline/set_intercept/) to fix a trend line's Y value at X = 0. This setting is supported for linear, exponential, and polynomial trend lines. For example, a production cost model may need to start at known fixed costs of 100, even when measurements at nonzero production volumes suggest a different baseline. For a linear trend line, fixing the intercept constrains the equation `y = ax + b` to `b = 100`; the slope is fitted to the data under that constraint. It does not simply move an already fitted line. Axis crossing settings control where the chart axes meet, not the coefficients of the fitted trend line. The following example creates a scatter (XY) chart with production volumes from 1 to 4 and costs of 170, 200, 230, and 260. It saves the chart with the default automatic intercept, sets the intercept to 100, and saves a second PPTX. The two files differ only in the intercept setting. The trend line displays its equation and extends back to X = 0. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace System; using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::ScatterWithMarkers, 20, 20, 480, 210); chart->set_HasLegend(false); chart->get_ChartData()->get_Series()->Clear(); chart->get_ChartData()->get_Categories()->Clear(); auto workbook = chart->get_ChartData()->get_ChartDataWorkbook(); workbook->Clear(0); auto nameCell = workbook->GetCell(0, 0, 1, ObjectExt::Box(u"Production cost")); auto series = chart->get_ChartData()->get_Series()->Add(nameCell, ChartType::ScatterWithMarkers); const double costs[] = { 170, 200, 230, 260 }; for (auto i = 0; i < 4; i++) { auto xCell = workbook->GetCell(0, i + 1, 0, ObjectExt::Box(i + 1)); auto yCell = workbook->GetCell(0, i + 1, 1, ObjectExt::Box(costs[i])); series->get_DataPoints()->AddDataPointForScatterSeries(xCell, yCell); } auto trendline = series->get_TrendLines()->Add(TrendlineType::Linear); trendline->set_DisplayEquation(true); trendline->set_Backward(1); presentation->Save(u"AutomaticIntercept.pptx", SaveFormat::Pptx); trendline->set_Intercept(100); presentation->Save(u"FixedIntercept.pptx", SaveFormat::Pptx); ``` With automatic calculation, these data produce `y = 30x + 140`. Setting the intercept to 100 instead produces approximately `y = 43.33x + 100`: the fitted value at zero matches the known baseline, while the line no longer passes through every data point. | Automatic intercept | Fixed intercept of 100 | | --- | --- | | ![Linear trend line with an automatically calculated intercept of 140](https://docs.aspose.com/slides/cpp/trend-line/intercept-automatic.png) | ![Linear trend line with a fixed intercept of 100](https://docs.aspose.com/slides/cpp/trend-line/intercept-fixed.png) | Both images use the same data and axis scales. The trend lines are extended back to X = 0 to show their intercepts. By default, the property contains `std::numeric_limits::quiet_NaN()`, which represents an unspecified intercept rather than zero. The intercept is then calculated automatically from the data. ## **Add a Custom Line** A custom line is a shape drawn over the chart rather than a trend line calculated from series data. This example uses [IShapeCollection::AddAutoShape](https://reference.aspose.com/slides/cpp/aspose.slides/ishapecollection/addautoshape/) to add a horizontal line to the slide over the chart. The line's position is specified in slide coordinates, measured in points, so it starts at the chart's left edge and sits halfway down the chart. Its width matches the chart's width. The line format returned by [IShape::get_LineFormat](https://reference.aspose.com/slides/cpp/aspose.slides/ishape/get_lineformat/) gives the line a solid red color. ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace System; using namespace System::Drawing; using namespace Aspose::Slides; using namespace Aspose::Slides::Charts; using namespace Aspose::Slides::Export; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto chart = slide->get_Shapes()->AddChart(ChartType::ClusteredColumn, 100, 100, 500, 400); auto line = slide->get_Shapes()->AddAutoShape(ShapeType::Line, chart->get_X(), chart->get_Y() + chart->get_Height() / 2, chart->get_Width(), 0); line->get_LineFormat()->get_FillFormat()->set_FillType(FillType::Solid); line->get_LineFormat()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Red()); presentation->Save(u"AddCustomLines.pptx", SaveFormat::Pptx); ``` ## **FAQ** **What do 'forward' and 'backward' mean for a trend line?** They are the lengths of the trend line projected forward/backward: for scatter (XY) charts — in axis units; for non-scatter charts — in number of categories. Only non-negative values are allowed. **Will the trend line be preserved when exporting the presentation to PDF or SVG, or when rendering a slide to an image?** Yes. Aspose.Slides converts presentations to [PDF](https://docs.aspose.com/slides/cpp/convert-powerpoint-to-pdf/) or [SVG](https://docs.aspose.com/slides/cpp/render-a-slide-as-an-svg-image/) and renders charts to images; trend lines, as part of the chart, are preserved during these operations. A method is also available to [export an image of the chart](https://docs.aspose.com/slides/cpp/shape-thumbnails/) itself. # Manage Video Frames in Presentations Using C++ > Learn to programmatically add and extract video frames in PowerPoint and OpenDocument slides using Aspose.Slides for C++. Fast how-to guide. Source: https://docs.aspose.com/slides/cpp/video-frame/ Updated: 2026-10-09 ## **Introduction** Videos can help explain ideas and engage an audience. Aspose.Slides for C++ lets you add video frames to slides, adjust playback settings, manage captions, and extract embedded video data. PowerPoint supports local videos and links to online videos, such as YouTube videos. To represent video data and video frames, Aspose.Slides provides the [IVideo](https://reference.aspose.com/slides/cpp/aspose.slides/ivideo/) interface, [IVideoFrame](https://reference.aspose.com/slides/cpp/aspose.slides/ivideoframe/) interface, and other relevant types. ## **Create an Embedded Video Frame** If the video file you want to add to your slide is stored locally, you can create a video frame to embed the video in your presentation. This example embeds a local video on the first slide of an existing presentation and saves the result. Frame coordinates and dimensions are in points. The stream stays open until saving finishes because [LoadingStreamBehavior::KeepLocked](https://reference.aspose.com/slides/cpp/aspose.slides/loadingstreambehavior/) keeps it locked while the presentation uses it. ```cpp #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::IO; auto presentation = MakeObject(u"presentation.pptx"); auto slide = presentation->get_Slide(0); auto videoStream = File::OpenRead(u"video.mp4"); auto video = presentation->get_Videos()->AddVideo(videoStream, LoadingStreamBehavior::KeepLocked); slide->get_Shapes()->AddVideoFrame(10, 10, 150, 250, video); presentation->Save(u"embedded_video.pptx", SaveFormat::Pptx); presentation->Dispose(); videoStream->Dispose(); ``` You can also pass a local video path directly to [AddVideoFrame](https://reference.aspose.com/slides/cpp/aspose.slides/ishapecollection/addvideoframe/). This example embeds the video on the first slide of a new presentation. The video must remain accessible until the presentation is saved. ```cpp #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); slide->get_Shapes()->AddVideoFrame(50, 150, 300, 150, u"video.avi"); presentation->Save(u"video_from_path.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ## **Create a Video Frame with Video from a Web Source** Microsoft [PowerPoint](https://support.microsoft.com/en-us/powerpoint/training/insert-a-video-from-youtube-or-another-site) supports online videos in presentations. You can create a video frame that links to an online video, such as a YouTube video. This example adds a YouTube video link and thumbnail to the first slide. Replace the video identifier to use another video. The [set_PlayMode](https://reference.aspose.com/slides/cpp/aspose.slides/ivideoframe/set_playmode/) method requests automatic playback. Downloading the thumbnail and playing the video require internet access. The presentation viewer must also support online video playback. ```cpp #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto webClient = MakeObject(); String videoId = u"aqz-KE-bpKQ"; auto videoUrl = String::Format(u"https://www.youtube.com/embed/{0}", videoId); auto videoFrame = slide->get_Shapes()->AddVideoFrame(10, 10, 427, 240, videoUrl); videoFrame->set_PlayMode(VideoPlayModePreset::Auto); auto thumbnailUrl = String::Format(u"https://img.youtube.com/vi/{0}/hqdefault.jpg", videoId); auto thumbnailData = webClient->DownloadData(thumbnailUrl); auto thumbnail = presentation->get_Images()->AddImage(thumbnailData); videoFrame->get_PictureFormat()->get_Picture()->set_Image(thumbnail); presentation->Save(u"online_video.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` ## **Play a Video in Full-Screen Mode** In a training presentation, you can play a software demonstration in full-screen mode so the audience can see the details. [set_FullScreenMode](https://reference.aspose.com/slides/cpp/aspose.slides/videoframe/set_fullscreenmode/) accepts `true` to enable this behavior during playback. This example opens a presentation, finds the first [IVideoFrame](https://reference.aspose.com/slides/cpp/aspose.slides/ivideoframe/) on the first slide, and enables full-screen playback. The input presentation must contain at least one slide with an existing video frame on the first slide. ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(u"training.pptx"); auto slide = presentation->get_Slide(0); for (auto&& shape : IterateOver(slide->get_Shapes())) { if (ObjectExt::Is(shape)) { auto videoFrame = ExplicitCast(shape); videoFrame->set_FullScreenMode(true); break; } } presentation->Save(u"full_screen_video.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` Full-screen playback controls how the video is displayed. Independently, [set_PlayMode](https://reference.aspose.com/slides/cpp/aspose.slides/videoframe/set_playmode/) controls whether it starts automatically or on click, and [set_PlayLoopMode](https://reference.aspose.com/slides/cpp/aspose.slides/videoframe/set_playloopmode/) controls whether it repeats. To choose the start behavior, set the playback mode to [VideoPlayModePreset::Auto or VideoPlayModePreset::OnClick](https://reference.aspose.com/slides/cpp/aspose.slides/videoplaymodepreset/). The example preserves the existing start and loop settings. ## **Rewind a Video After Playback** In a training presentation, returning a demonstration video to its beginning makes it ready for the presenter to play again. Call [set_RewindVideo](https://reference.aspose.com/slides/cpp/aspose.slides/videoframe/set_rewindvideo/) with `true` to return the video to the beginning after playback finishes. This example opens a presentation, finds the first [IVideoFrame](https://reference.aspose.com/slides/cpp/aspose.slides/ivideoframe/) on the first slide, and enables rewinding. It disables looping so playback can finish and sets playback to start on click. The input presentation must contain at least one slide with an existing video frame on the first slide. ```cpp #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(u"training.pptx"); auto slide = presentation->get_Slide(0); for (auto&& shape : IterateOver(slide->get_Shapes())) { if (ObjectExt::Is(shape)) { auto videoFrame = ExplicitCast(shape); videoFrame->set_RewindVideo(true); videoFrame->set_PlayLoopMode(false); videoFrame->set_PlayMode(VideoPlayModePreset::OnClick); break; } } presentation->Save(u"rewind_video.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` Rewinding returns the video to its beginning without starting it again. In contrast, enabling [set_PlayLoopMode](https://reference.aspose.com/slides/cpp/aspose.slides/videoframe/set_playloopmode/) repeats playback automatically. Keep looping disabled when you want the video to finish and remain ready to replay. [set_PlayMode](https://reference.aspose.com/slides/cpp/aspose.slides/videoframe/set_playmode/) independently controls automatic or on-click startup; this example uses [VideoPlayModePreset::OnClick](https://reference.aspose.com/slides/cpp/aspose.slides/videoplaymodepreset/) so the presenter controls when playback starts. Set the playback mode after the loop setting, as shown in the example. Rewinding works independently of [set_FullScreenMode](https://reference.aspose.com/slides/cpp/aspose.slides/videoframe/set_fullscreenmode/). ## **Trim a Video Frame** Use [IVideoFrame::set_TrimFromStart](https://reference.aspose.com/slides/cpp/aspose.slides/ivideoframe/set_trimfromstart/) and [IVideoFrame::set_TrimFromEnd](https://reference.aspose.com/slides/cpp/aspose.slides/ivideoframe/set_trimfromend/) to skip part of the beginning or end of a video during playback. Both values are in milliseconds. Trimming changes playback settings without modifying the embedded video data. **Set Trim Settings** This example embeds a local video and skips the first 2.5 seconds and the last second during playback. Use a video longer than 3.5 seconds so a playable segment remains. ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::IO; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto videoData = File::ReadAllBytes(u"video.mp4"); auto video = presentation->get_Videos()->AddVideo(videoData); auto videoFrame = slide->get_Shapes()->AddVideoFrame(50, 50, 640, 360, video); videoFrame->set_TrimFromStart(2500.0f); videoFrame->set_TrimFromEnd(1000.0f); presentation->Save(u"video_with_trim.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` **Read Trim Settings** This example prints the trim values of the first video frame on the first slide in milliseconds. The presentation must contain at least one slide. If that slide has no video frame, nothing is printed. The preceding example produces values of 2500 and 1000. ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto presentation = MakeObject(u"video_with_trim.pptx"); auto slide = presentation->get_Slide(0); for (auto&& shape : IterateOver(slide->get_Shapes())) { if (ObjectExt::Is(shape)) { auto videoFrame = ExplicitCast(shape); Console::WriteLine(String::Format(u"Trim from start: {0} ms", videoFrame->get_TrimFromStart())); Console::WriteLine(String::Format(u"Trim from end: {0} ms", videoFrame->get_TrimFromEnd())); break; } } presentation->Dispose(); ``` ## **Manage Video Captions** Aspose.Slides allows you to manage closed captions for video frames in PowerPoint presentations. Captions are stored in WebVTT format and are exposed through the [IVideoFrame::get_CaptionTracks](https://reference.aspose.com/slides/cpp/aspose.slides/ivideoframe/get_captiontracks/) method. **Add Captions to a Video Frame** This example embeds a local video and adds a WebVTT caption track labeled English. The caption timestamps should match the video. The saved presentation includes both the video and its captions. ```cpp #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; using namespace System::IO; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto videoData = File::ReadAllBytes(u"video.mp4"); auto video = presentation->get_Videos()->AddVideo(videoData); auto videoFrame = slide->get_Shapes()->AddVideoFrame(0, 0, 100, 100, video); videoFrame->get_CaptionTracks()->Add(u"English", u"track.vtt"); presentation->Save(u"video_with_captions.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` The [ICaptionsCollection](https://reference.aspose.com/slides/cpp/aspose.slides/icaptionscollection/) interface also provides an overload that lets you add captions from a stream. **Extract Captions from a Video Frame** This example saves all caption tracks from video frames on the first slide as separate WebVTT files. Sequential numbers keep the output files distinct. The console reports the number of extracted tracks. The presentation must contain at least one slide. ```cpp #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; using namespace System::IO; auto presentation = MakeObject(u"video_with_captions.pptx"); auto slide = presentation->get_Slide(0); auto trackCount = 0; for (auto&& shape : IterateOver(slide->get_Shapes())) { if (ObjectExt::Is(shape)) { auto videoFrame = ExplicitCast(shape); for (auto&& captionTrack : IterateOver(videoFrame->get_CaptionTracks())) { trackCount++; auto outputPath = String::Format(u"captions_{0}.vtt", trackCount); File::WriteAllBytes(outputPath, captionTrack->get_BinaryData()); } } } Console::WriteLine(String::Format(u"Caption tracks extracted: {0}", trackCount)); presentation->Dispose(); ``` Each [ICaptions](https://reference.aspose.com/slides/cpp/aspose.slides/icaptions/) object exposes the caption identifier, label, binary data, and caption text as a UTF-8 string. **Remove Captions from a Video Frame** This example removes all captions from the video frame at the first shape position on the first slide and saves the result. It assumes that the slide and shape exist and that the shape is a video frame. ```cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; using namespace System; auto presentation = MakeObject(u"video_with_captions.pptx"); auto slide = presentation->get_Slide(0); auto videoFrame = ExplicitCast(slide->get_Shape(0)); videoFrame->get_CaptionTracks()->Clear(); presentation->Save(u"video_without_captions.pptx", SaveFormat::Pptx); presentation->Dispose(); ``` If you need to remove only one caption track, use the [Remove](https://reference.aspose.com/slides/cpp/aspose.slides/captionscollection/remove/) or [RemoveAt](https://reference.aspose.com/slides/cpp/aspose.slides/captionscollection/removeat/) methods instead of [Clear](https://reference.aspose.com/slides/cpp/aspose.slides/captionscollection/clear/). ## **Extract Video from a Slide** Besides adding videos to slides, Aspose.Slides allows you to extract videos embedded in presentations. This example extracts embedded videos from every slide into separate, numbered binary files. Linked videos are skipped because they have no embedded data. The console prints each video’s MIME type and the total count. Output uses the generic `.bin` extension; change it to match the reported media type when needed. ```cpp #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; using namespace System::IO; auto presentation = MakeObject(u"presentation_with_videos.pptx"); auto videoCount = 0; for (auto&& slide : IterateOver(presentation->get_Slides())) { for (auto&& shape : IterateOver(slide->get_Shapes())) { if (ObjectExt::Is(shape)) { auto videoFrame = ExplicitCast(shape); auto video = videoFrame->get_EmbeddedVideo(); if (video == nullptr) { Console::WriteLine(u"Skipped a linked video: no embedded data is available."); continue; } videoCount++; auto outputPath = String::Format(u"extracted_video_{0}.bin", videoCount); File::WriteAllBytes(outputPath, video->get_BinaryData()); Console::WriteLine(String::Format(u"Video {0}: {1}", videoCount, video->get_ContentType())); } } } Console::WriteLine(String::Format(u"Embedded videos extracted: {0}", videoCount)); presentation->Dispose(); ``` ## **FAQ** **Which video playback parameters can be changed for a video frame?** You can control the [playback mode](https://reference.aspose.com/slides/cpp/aspose.slides/videoframe/set_playmode/) (auto or on click) and [looping](https://reference.aspose.com/slides/cpp/aspose.slides/videoframe/set_playloopmode/). These options are available via the [VideoFrame](https://reference.aspose.com/slides/cpp/aspose.slides/videoframe/) object's methods. **Does adding a video affect the PPTX file size?** Yes. When you embed a local video, the binary data is included in the document, so the presentation size grows in proportion to the file size. When you link to an online video and add a thumbnail, the presentation stores the link and preview image rather than the video data, so the size increase is usually smaller. **Can I replace the video in an existing video frame without changing its position and size?** Yes. You can swap the [video content](https://reference.aspose.com/slides/cpp/aspose.slides/videoframe/set_embeddedvideo/) within the frame while preserving the shape's geometry; this is a common scenario for updating media in an existing layout. **Can the content type (MIME) of an embedded video be determined?** Yes. An embedded video has a [content type](https://reference.aspose.com/slides/cpp/aspose.slides/video/get_contenttype/) that you can read and use, for example when saving it to disk. ## Related articles - [Manage Audio in Presentations Using C++](https://docs.aspose.com/slides/cpp/audio-frame/) - [Video](https://docs.aspose.com/slides/cpp/examples/elements/video/) # Add Watermarks to Presentations in C++ > Manage text and image watermarks in PowerPoint and OpenDocument presentations in C++ to indicate a draft, confidential information, copyright, and more. Source: https://docs.aspose.com/slides/cpp/watermark/ Updated: 2026-08-13 ## **Introduction** **A watermark** in a presentation is a text or image stamp used on a slide or throughout all presentation slides. Usually, a watermark is used to indicate that the presentation is a draft (e.g., a "Draft" watermark), that it contains confidential information (e.g., a "Confidential" watermark), to specify which company it belongs to (e.g., a "Company Name" watermark), to identify the presentation author, etc. A watermark helps to prevent copyright violations by indicating that the presentation should not be copied. Watermarks are used in both PowerPoint and OpenOffice presentation formats. In Aspose.Slides, you can add a watermark to PowerPoint PPT, PPTX, and OpenOffice ODP file formats. In [**Aspose.Slides**](https://products.aspose.com/slides/cpp/), there are various ways you can create watermarks in PowerPoint or OpenOffice documents and modify their design and behavior. The common aspect is that to add text watermarks, you should use the [ITextFrame](https://reference.aspose.com/slides/cpp/aspose.slides/itextframe/) interface, and to add image watermarks, use the [PictureFrame](https://reference.aspose.com/slides/cpp/aspose.slides/pictureframe/) class or fill a watermark shape with an image. `PictureFrame` implements the [IShape](https://reference.aspose.com/slides/cpp/aspose.slides/ishape/) interface, allowing you to use all the flexible settings of the shape object. Since `ITextFrame` is not a shape and its settings are limited, it is wrapped into an [IShape](https://reference.aspose.com/slides/cpp/aspose.slides/ishape/) object. There are two ways a watermark can be applied: to a single slide or to all presentation slides. The Slide Master is used to apply a watermark to all presentation slides — the watermark is added to the Slide Master, fully designed there, and applied to all slides without affecting the permission to modify the watermark on individual slides. A watermark is usually considered to be unavailable for editing by other users. To prevent the watermark (or rather the watermark's parent shape) from being edited, Aspose.Slides provides shape locking functionality. A specific shape can be locked on a normal slide or on a Slide Master. When the watermark shape is locked on the Slide Master, it will be locked on all presentation slides. You can set a name for the watermark so that in the future, if you want to delete it, you can find it in the slide's shapes by name. You can design the watermark in any way; however, there are usually common features in watermarks, such as center alignment, rotation, front position, etc. We will consider how to use these in the examples below. ## **Text Watermark** ### **Add a Text Watermark to a Slide** To add a text watermark in PPT, PPTX, or ODP, you can first add a shape to the slide, then add a text frame to this shape. The text frame is represented by the [ITextFrame](https://reference.aspose.com/slides/cpp/aspose.slides/itextframe/) interface. This type is not inherited from [IShape](https://reference.aspose.com/slides/cpp/aspose.slides/ishape/), which has a wide set of properties for positioning the watermark in a flexible way. Therefore, the [ITextFrame](https://reference.aspose.com/slides/cpp/aspose.slides/itextframe/) object is wrapped in an [IAutoShape](https://reference.aspose.com/slides/cpp/aspose.slides/iautoshape/) object. To add watermark text to the shape, use the [AddTextFrame](https://reference.aspose.com/slides/cpp/aspose.slides/iautoshape/addtextframe/) method as shown below. ```cpp #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto watermarkText = u"CONFIDENTIAL"; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto watermarkShape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 100, 100, 400, 40); auto watermarkFrame = watermarkShape->AddTextFrame(watermarkText); presentation->Dispose(); ``` - [How to Use the TextFrame Class](https://docs.aspose.com/slides/cpp/text-formatting/) ### **Add a Text Watermark to a Presentation** If you want to add a text watermark to the entire presentation (i.e., all slides at once), add it to the [MasterSlide](https://reference.aspose.com/slides/cpp/aspose.slides/masterslide/). The rest of the logic is the same as when adding a watermark to a single slide — create an [IAutoShape](https://reference.aspose.com/slides/cpp/aspose.slides/iautoshape/) object and then add the watermark to it using the [AddTextFrame](https://reference.aspose.com/slides/cpp/aspose.slides/iautoshape/addtextframe/) method. ```cpp #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto watermarkText = u"CONFIDENTIAL"; auto presentation = MakeObject(); auto masterSlide = presentation->get_Master(0); auto watermarkShape = masterSlide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 100, 100, 400, 40); auto watermarkFrame = watermarkShape->AddTextFrame(watermarkText); presentation->Dispose(); ``` - [How to Use the Slide Master](https://docs.aspose.com/slides/cpp/slide-master/) ### **Set Watermark Shape Transparency** By default, the rectangle shape is styled with fill and line colors. The following lines of code make the shape transparent. ```cpp #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto watermarkShape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 100, 100, 400, 40); watermarkShape->get_FillFormat()->set_FillType(FillType::NoFill); watermarkShape->get_LineFormat()->get_FillFormat()->set_FillType(FillType::NoFill); ``` ### **Set the Font for a Text Watermark** You can change the font of the text watermark as shown below. ```cpp #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto watermarkShape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 100, 100, 400, 40); auto watermarkFrame = watermarkShape->AddTextFrame(u"CONFIDENTIAL"); auto textFormat = watermarkFrame->get_Paragraph(0)->get_ParagraphFormat()->get_DefaultPortionFormat(); textFormat->set_LatinFont(MakeObject(u"Arial")); textFormat->set_FontHeight(50); ``` ### **Set the Watermark Text Color** To set the color of the watermark text, use this code: ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; using namespace System::Drawing; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto watermarkShape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 100, 100, 400, 40); auto watermarkFrame = watermarkShape->AddTextFrame(u"CONFIDENTIAL"); auto alpha = 150, red = 200, green = 200, blue = 200; auto fillFormat = watermarkFrame->get_Paragraph(0)->get_ParagraphFormat()->get_DefaultPortionFormat()->get_FillFormat(); fillFormat->set_FillType(FillType::Solid); fillFormat->get_SolidFillColor()->set_Color(Color::FromArgb(alpha, red, green, blue)); ``` ### **Center a Text Watermark** It is possible to center the watermark on a slide, and for that, you can do the following: ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto watermarkText = u"CONFIDENTIAL"; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto slideSize = presentation->get_SlideSize()->get_Size(); auto watermarkWidth = 400; auto watermarkHeight = 40; auto watermarkX = (slideSize.get_Width() - watermarkWidth) / 2; auto watermarkY = (slideSize.get_Height() - watermarkHeight) / 2; auto watermarkShape = slide->get_Shapes()->AddAutoShape( ShapeType::Rectangle, watermarkX, watermarkY, watermarkWidth, watermarkHeight); auto watermarkFrame = watermarkShape->AddTextFrame(watermarkText); ``` The image below shows the final result. ![The text watermark](https://docs.aspose.com/slides/cpp/watermark/text_watermark.png) ## **Image Watermark** ### **Add an Image Watermark to a Presentation** To add an image watermark to a presentation slide, you can do the following: ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; using namespace System::IO; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto watermarkShape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 100, 100, 400, 40); auto imageStream = File::ReadAllBytes(u"watermark.png"); auto image = presentation->get_Images()->AddImage(imageStream); watermarkShape->get_FillFormat()->set_FillType(FillType::Picture); watermarkShape->get_FillFormat()->get_PictureFillFormat()->get_Picture()->set_Image(image); watermarkShape->get_FillFormat()->get_PictureFillFormat()->set_PictureFillMode(PictureFillMode::Stretch); ``` ## **Lock a Watermark from Editing** If it is necessary to prevent a watermark from being edited, use the [IAutoShape::get_AutoShapeLock](https://reference.aspose.com/slides/cpp/aspose.slides/iautoshape/get_autoshapelock/) method on the shape. With this property, you can protect the shape from being selected, resized, repositioned, grouped with other elements, lock its text from editing, and much more: ```cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto watermarkShape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 100, 100, 400, 40); // Lock the watermark shape from modifying watermarkShape->get_AutoShapeLock()->set_SelectLocked(true); watermarkShape->get_AutoShapeLock()->set_SizeLocked(true); watermarkShape->get_AutoShapeLock()->set_TextLocked(true); watermarkShape->get_AutoShapeLock()->set_PositionLocked(true); watermarkShape->get_AutoShapeLock()->set_GroupingLocked(true); ``` ## **Bring a Watermark to Front** In Aspose.Slides, the Z-order of shapes can be set via the [IShapeCollection::Reorder](https://reference.aspose.com/slides/cpp/aspose.slides/ishapecollection/reorder/) method. To do this, you need to call this method from the presentation slides list and pass the shape reference and its order number into the method. This way, it is possible to bring a shape to the front or send it to the back of the slide. This feature is especially useful if you need to place a watermark in front of the presentation: ```cpp #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto watermarkShape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 100, 100, 400, 40); auto shapeCount = slide->get_Shapes()->get_Count(); slide->get_Shapes()->Reorder(shapeCount - 1, watermarkShape); ``` ## **Set Watermark Rotation** Here is a code example of how to adjust the rotation of the watermark so that it is positioned diagonally across the slide: ```cpp #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto watermarkShape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 100, 100, 400, 40); auto slideSize = presentation->get_SlideSize()->get_Size(); auto diagonalAngle = Math::Atan((slideSize.get_Height() / slideSize.get_Width())) * 180 / Math::PI; watermarkShape->set_Rotation((float)diagonalAngle); ``` ## **Set a Name for a Watermark** Aspose.Slides allows you to set the name of a shape. By using the shape name, you can access it in the future to modify or delete it. To set the name of the watermark shape, assign it to the [IAutoShape::set_Name](https://reference.aspose.com/slides/cpp/aspose.slides/ishape/set_name/) method: ```cpp #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); auto watermarkShape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 100, 100, 400, 40); watermarkShape->set_Name(u"watermark"); ``` ## **Remove a Watermark** To remove the watermark shape, use the [IAutoShape::get_Name](https://reference.aspose.com/slides/cpp/aspose.slides/ishape/get_name/) method to find it in the slide shapes. Then, pass the watermark shape into the [IShapeCollection::Remove](https://reference.aspose.com/slides/cpp/aspose.slides/ishapecollection/remove/) method: ```cpp #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System; auto presentation = MakeObject(u"presentation_with_watermark.pptx"); auto slide = presentation->get_Slide(0); auto slideShapes = slide->get_Shapes()->ToArray(); for(auto shape : slideShapes) { if (String::Compare(shape->get_Name(), u"watermark", StringComparison::Ordinal) == 0) { slide->get_Shapes()->Remove(shape); } } ``` ## **A Live Example** You may want to check out the **Aspose.Slides free** [Add Watermark](https://products.aspose.app/slides/watermark) and [Remove Watermark](https://products.aspose.app/slides/watermark/remove-watermark) online tools. ![Online tools to add and remove watermarks](https://docs.aspose.com/slides/cpp/watermark/online_tools.png) ## **FAQ** ### What is a watermark and why should I use it? A watermark is a text or image overlay applied to slides that helps protect intellectual property, enhance brand recognition, or prevent unauthorized use of presentations. ### Can I add a watermark to all slides in a presentation? Yes, Aspose.Slides allows you to programmatically add a watermark to every slide in a presentation. You can iterate through all the slides and apply the watermark settings individually. ### How can I adjust the transparency of the watermark? You can adjust the transparency of the watermark by modifying the fill settings ([FillFormat](https://reference.aspose.com/slides/cpp/aspose.slides/shape/get_fillformat/)) of the shape. This ensures that the watermark is subtle and does not distract from the slide content. ### What image formats are supported for watermarks? Aspose.Slides supports various image formats such as PNG, JPEG, GIF, BMP, SVG, and more. ### Can I customize the font and style of a text watermark? Yes, you can choose any font, size, and style to match the design of your presentation and maintain brand consistency. ### How do I change the position or orientation of a watermark? You can adjust the position and orientation of the watermark programmatically by modifying the shape's coordinates, size, and rotation properties. # Why Not Automation > Discover why Office automation is risky for servers and services, and see how Aspose.Slides offers safer, faster presentation processing for PowerPoint and OpenDocument. Source: https://docs.aspose.com/slides/cpp/why-not-automation/ Updated: 2026-08-13 ## **Introduction** There are several reasons Aspose components are a better alternative to automation. Some of the key reasons are: - Security - Stability - Scalability/Speed - Price - Features Below is a more detailed explanation of each key point. ## **Important Questions** - Why are Aspose components a much better option than Microsoft Office Automation? There are two questions that we hear most often here at Aspose : - Do your products require that Microsoft Office be installed in order for them to run? The short simple answer is **NO**. Aspose and Aspose components are totally independent and are not affiliated with, nor authorized, sponsored or otherwise approved by Microsoft Corporation. - Why should we use Aspose products rather than utilizing Microsoft Office Automation? The shortest answer we could give is that there are many reasons with the top one being that *Microsoft itself strongly recommends against Office Automation from software solutions: [Microsoft Article ## **Security** The following is a direct quote from the above referenced Microsoft Article :  *"Office Applications were never intended for use server-side, and therefore do not take into consideration the security problems that are faced by distributed components. Office does not authenticate incoming requests, and does not protect you from unintentionally running macros, or starting another server that might run macros, from your server-side code. Do not open files that are uploaded to the server from an anonymous Web! Based on the security settings that were last set, the server can run macros under an Administrator or System context with full privileges and compromise your network! In addition, Office uses many client-side components (such as Simple MAPI, WinInet, MSDAIPP) that can cache client authentication information in order to speed up processing. If Office is being automated server-side, one instance may service more than one client, and because authentication information has been cached for that session, it is possible that one client can use the cached credentials of another client, and thereby gain non-granted access permissions by impersonating other users."* Aspose products are very secure. Therefore, Aspose components do not pose a potential risk to vital system resources. Furthermore, when a document is opened by an Aspose component, macros are not automatically run. Aspose components were built with the goal of allowing developers to create, manipulate and save Office files. None of the risks associated with the Microsoft Office package are inherent to Aspose components . ## **Stability** The following is a direct quote from the above referenced Microsoft Article :  *"Office 2000, Office XP and Office 2003 use Microsoft Windows Installer (MSI) technology to make installation and self-repair easier for an end user. MSI introduces the concept of "install on first use", which allows features to be dynamically installed or configured at runtime (for the system, or more often for a particular user). In a server-side environment this both slows down performance and increases the likelihood that a dialog box may appear that asks for the user to approve the install or provide an appropriate install disk. Although it is designed to increase the resiliency of Office as an end-user product, Office's implementation of MSI capabilities is counterproductive in a server-side environment. Furthermore, the stability of Office in general cannot be assured when run server-side because it has not been designed or tested for this type of use. Using Office as a service component on a network server may reduce the stability of that machine and as a consequence your network as a whole. If you plan to automate Office server-side, attempt to isolate the program to a dedicated computer that cannot affect critical functions, and that can be restarted as needed."* Since Aspose components are packaged into a single DLL, there will never be a need to install any additional parts or pieces for them to function. Aspose components are only utilized by C++ applications and there is no portion of the component code designed to wait on a human response. Aspose components have been thoroughly tested and are extremely stable. Aspose components are used by [Companies](https://about.aspose.com/customers) such as: **IBM**, **Hilton**, **Reader's Digest**, **Bank of America** and many many more. ## **Scalability/Speed** The following is a direct quote from the above referenced Microsoft Article : *"Server-side components need to be highly reentrant, multi-threaded COM components with minimum overhead and high throughput for multiple clients. Office Applications are in almost all respects the exact opposite. They are non-reentrant, STA-based Automation servers that are designed to provide diverse but resource-intensive functionality for a single client. They offer little scalability as a server-side solution, and have fixed limits to important elements, such as memory, which cannot be changed through configuration. More importantly, they use global resources (such as memory mapped files, global add-ins or templates, and shared Automation servers), which can limit the number of instances that can run concurrently and lead to race conditions if they are configured in a multi-client environment. Developers who plan to run more then one instance of any Office Application at the same time need to consider Pooling or Serializing Access to the Office Application for avoiding potential Deadlocks or Data Corruption”.* Aspose components are highly scalable and lightening fast. Office applications were not designed to be simultaneously used by 100s and 1000s of users. However, Aspose components are designed for just that. Our components are a true C++ solution and perform flawlessly whether on a single server, powering a single application or on a load balanced Web Form powering an enterprise wide application. ## **Price** When an application utilizes Microsoft Office Automation, a copy of Microsoft Office must be purchased for each machine that runs the application. There are many times that an application may need to create or manipulate an office file but does not require the user to have Microsoft Office. Aspose offers a very [Cost Effective](https://purchase.aspose.com/) and royalty free redistribution license that will allow deployment to an unlimited number of users with no licensing worries.When creating web based applications it is important to know that Microsoft Office Automation components are not priced nor licensed for server side solutions; therefore, there is no good, licensing solution for deploying web applications that utilize the Microsoft Office components. Aspose offers a very [Cost Effective](https://purchase.aspose.com/) solution for server based applications as well. ## **Features** Aspose components provide everything needed for managing Office files plus much more. They are designed with the philosophy of allowing developers to accomplish the greatest results with the least amount of work. Unlike Office Automation, Aspose components provide many powerful and time saving functions. For instance, [Aspose.Cells](https://products.aspose.com/cells/cpp/) offers developers the ability to import data from a **DataTable**or **DataView** directly into an Excel file. [Aspose.Words](https://products.aspose.com/words/net/) offers a similar feature that allows developers to populate a Word (that is Mail Merge) document directly from any C++ data object. [Every Component](https://products.aspose.com/total/cpp/) in the Aspose family offers their own set of unique and powerful features.The best part of purchasing an Aspose component is having access to our development teams. Our development teams realize that if there is a feature that your company needs, more than likely other companies will need it as well. While not every feature request can be added, our teams try to be very open-minded and flexible when providing assistance. That mind set is what has helped Aspose components to become as powerful as they are. If there are additional features that you need from Office Automation objects, your chances of having them added are very, very low. ## **Conclusion** While this article has covered many of the key points why Aspose components are a better choice than Office Automation, there are many, many more. This article primarily addresses only the most key points. All of the different Aspose components offer a risk free, no obligation [Evaluation Version](https://downloads.aspose.com/slides/cpp). We encourage you to take advantage of that [Evaluation](https://downloads.aspose.com/slides/cpp) in order to better see what Aspose can do for your applications. # Why Not Open XML SDK > See why Aspose.Slides is a better choice than the free Open XML SDK: compare features, automation-free conversion, and broad support for PPT, PPTX and ODP. Source: https://docs.aspose.com/slides/cpp/why-not-open-xml-sdk/ Updated: 2026-08-31 ## **Overview** This article explains when developers might choose Open XML SDK or Aspose.Slides for working with presentation documents. It describes Open XML SDK as a library for manipulating OOXML packages and their underlying XML elements, while Aspose.Slides is presented as a presentation processing library with a high-level object model and support for many PowerPoint-related tasks. The article compares both options by supported formats, programming model, rendering, platform support, and common use cases. It also clarifies that Open XML SDK may be suitable for basic PPTX operations or direct access to OOXML elements, while Aspose.Slides is more appropriate for complex presentation tasks such as working with multiple PowerPoint formats, copying or cloning shapes, replacing text, applying animations, and converting presentations to PDF, TIFF, or XPS. ## **What Is Open XML SDK?** We sometimes hear this question: Why should we use Aspose products rather than the free Open XML SDK? This question is easy to answer: features and functionality. According to the[MSDN Library](https://docs.microsoft.com/en-us/office/open-xml/open-xml-sdk), Open XML SDK is defined as: The Open XML SDK 2.0 simplifies the task of manipulating Open XML packages and the underlying Open XML schema elements within a package. The Open XML SDK 2.0 encapsulates many common tasks that developers perform on Open XML packages, so that you can perform complex operations with just a few lines of code. OOXML documents are essentially zipped XML files and Open XML SDK is a collection of classes that allows you to work with the content of OOXML documents in a strongly-typed way. That is instead of unzipping a file to extract XML, loading that XML into a DOM tree and working with XML elements and attributes directly, Open XML SDK provides classes to do that. ## **What Is Aspose.Slides?** Aspose.Slides is a class library that allows your application to perform the following presentation processing tasks: - Programming with a **Presentation** object model. - High Quality conversions among all popular supported PowerPoint presentation formats, including conversion to PDF and XPS. - Ability to generate slide thumbnails in well known formats like PNG, JPEG and BMP along with slide export to SVG. - Ability to build presentations from scratch or by combining from one or multiple documents. - Support for adding animations, Ole Frames, Tables, creating and managing charts. - Availability of extensive control for Managing the text formatting on TextFrames, Paragraphs and Portions levels. For more details about the features supported, please visit [Aspose.Slides Features](https://docs.aspose.com/slides/cpp/product-overview/). ## **Compare Open XML SDK and Aspose.Slides** The following table compares Open XML SDK and Aspose.Slides features. |**Feature or Feature Category**|**Open XML SDK**|**Aspose.Slides**| | :- | :- | :- | |Supported Presentations formats|PPTX|PPT, POT, PPS, PPTX, POTX, PPSX, ODP| |Conversion from PPT to PPTX|No|Yes| |

High-level programming with a Presentation Document Object Model (DOM):

- Find and replace text.

- Assemble slides in presentations.

|No|Yes| |Detailed programming with a document object model, access to individual elements and formatting such as TextHolders, TextFrames, Paragraphs and Portions.|Yes|Yes| |Low-level direct and full access to the underlying XML elements and attributes such as relationship identifiers, list identifiers of an OOXML document.|Yes|No| |

Rendering:

- Render presentations to PDF, PDF Notes, XPS, TIFF images.

- Render slide thumbnails to PNG, JPEG, BMP, SVG and TIFF.

- Specify image resolution, quality, compression and other options.

|No|Yes| ## **Conclusion** Open XML SDK and Aspose.Slides do not compete head to head because they address quite different needs and audiences. Open XML SDK is a class library to provide a strong-typed way to work with OOXML documents. Aspose.Slides is a very useful presentations processing library that provides great support for nearly all Microsoft PowerPoint file formats. If all you need to do is a fairly basic programming operation on a PPTX document, then Open XML SDK might be a suitable choice. With Open XML SDK, you will be fairly comfortable doing simple tasks like generating a simple PPTX document or removing comments, headers/footers, extracting images or others. Some tasks can be achieved with Open XML SDK, but cannot be achieved with Aspose.Slides. For example, if you need to directly access the XML elements and attributes of an OOXML document, then you should use Open XML SDK. However, if you need to perform complex operations on documents, such as some of the following tasks, then using Aspose.Slides is your best option: - Support older PowerPoint formats in addition to PPTX. - Copy or clone shapes within slides in a way that combines objects, styles and other formatting in an appropriate manner. - Replace formatted or unformatted text. - Applying Animations and use of connectors with shapes used. - Convert a document to PDF or XPS so it appears exactly like Microsoft PowerPoint would have converted it. - Develop a C++ application in both desktop and console based environments. # Create and Apply WordArt Effects in C++ > Create and customize WordArt effects in Aspose.Slides for C++. This step-by-step guide helps developers enhance presentations with professional text in C++. Source: https://docs.aspose.com/slides/cpp/wordart/ Updated: 2026-09-25 ## **Overview** WordArt effects let you style text with fills, outlines, shadows, reflections, glow, transformations, and 3D formatting. This article explains how to create and customize these effects in PowerPoint presentations using Aspose.Slides for C++, without Microsoft Office installed. ## **Create a Simple WordArt Template and Apply It to Text** The following examples build a simple WordArt style by setting the text, font, pattern fill, and outline. Each example creates a new presentation and adds a rectangle to its first slide; no input file is required. The first example sets the text to "Aspose.Slides". The shape position and dimensions are measured in points: ```cpp #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto autoShape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 20.0f, 20.0f, 400.0f, 200.0f); auto textFrame = autoShape->get_TextFrame(); auto portion = textFrame->get_Paragraphs()->idx_get(0)->get_Portions()->idx_get(0); portion->set_Text(u"Aspose.Slides"); ``` Set the font to Arial Black at 36 points to make the formatting more noticeable: ```cpp #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto autoShape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 20.0f, 20.0f, 400.0f, 200.0f); auto textFrame = autoShape->get_TextFrame(); auto portion = textFrame->get_Paragraphs()->idx_get(0)->get_Portions()->idx_get(0); portion->set_Text(u"Aspose.Slides"); auto fontData = System::MakeObject(u"Arial Black"); portion->get_PortionFormat()->set_LatinFont(fontData); portion->get_PortionFormat()->set_FontHeight(36.0f); ``` Apply a [SmallGrid](https://reference.aspose.com/slides/cpp/aspose.slides/patternstyle/) pattern with a dark orange foreground and a white background, then add a black text outline with a width of 1 point: ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System::Drawing; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto autoShape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 20.0f, 20.0f, 400.0f, 200.0f); auto textFrame = autoShape->get_TextFrame(); auto portion = textFrame->get_Paragraphs()->idx_get(0)->get_Portions()->idx_get(0); portion->set_Text(u"Aspose.Slides"); auto fontData = System::MakeObject(u"Arial Black"); portion->get_PortionFormat()->set_LatinFont(fontData); portion->get_PortionFormat()->set_FontHeight(36.0f); auto fillFormat = portion->get_PortionFormat()->get_FillFormat(); fillFormat->set_FillType(FillType::Pattern); fillFormat->get_PatternFormat()->get_ForeColor()->set_Color(Color::get_DarkOrange()); fillFormat->get_PatternFormat()->get_BackColor()->set_Color(Color::get_White()); fillFormat->get_PatternFormat()->set_PatternStyle(PatternStyle::SmallGrid); portion->get_PortionFormat()->get_LineFormat()->set_Width(1); auto lineFillFormat = portion->get_PortionFormat()->get_LineFormat()->get_FillFormat(); lineFillFormat->set_FillType(FillType::Solid); lineFillFormat->get_SolidFillColor()->set_Color(Color::get_Black()); ``` The resulting text: ![The simple WordArt template](https://docs.aspose.com/slides/cpp/wordart/WordArt_template.png) ## **Apply Other WordArt Effects** The following examples demonstrate how to apply shadows, reflections, glow, transformations, and 3D effects to text. ### **Apply Outer Shadow Effects** An outer shadow adds depth by placing a shadow behind the text. You can customize its color, direction, distance, blur radius, scale, and skew. This example calls [EnableOuterShadowEffect](https://reference.aspose.com/slides/cpp/aspose.slides/ieffectformat/enableoutershadoweffect/) and sets a black shadow with a 4-point blur radius, a 230-degree direction, and a 30-point distance. Scale values of 100 preserve the shadow size, while horizontal skew tilts it by 20 degrees. The alpha transform sets its opacity to 32%: ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System::Drawing; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto autoShape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 20.0f, 20.0f, 400.0f, 200.0f); auto textFrame = autoShape->get_TextFrame(); auto portion = textFrame->get_Paragraphs()->idx_get(0)->get_Portions()->idx_get(0); portion->set_Text(u"Aspose.Slides"); auto fontData = System::MakeObject(u"Arial Black"); portion->get_PortionFormat()->set_LatinFont(fontData); portion->get_PortionFormat()->set_FontHeight(36.0f); auto effectFormat = portion->get_PortionFormat()->get_EffectFormat(); effectFormat->EnableOuterShadowEffect(); auto outerShadowEffect = effectFormat->get_OuterShadowEffect(); outerShadowEffect->get_ShadowColor()->set_Color(Color::get_Black()); outerShadowEffect->set_ScaleHorizontal(100); outerShadowEffect->set_ScaleVertical(100); outerShadowEffect->set_BlurRadius(4); outerShadowEffect->set_Direction(230.0f); outerShadowEffect->set_Distance(30); outerShadowEffect->set_SkewHorizontal(20); outerShadowEffect->set_SkewVertical(0); outerShadowEffect->get_ShadowColor()->get_ColorTransform()->Add(ColorTransformOperation::SetAlpha, 0.32f); ``` The resulting text: ![The Outer Shadow effect](https://docs.aspose.com/slides/cpp/wordart/outer_shadow_effect.png) - When outer and preset shadows are used together, only the outer shadow is applied. - If outer and inner shadows are used simultaneously, the resulting effect depends on the PowerPoint version. For example, in PowerPoint 2013, the effect is doubled, whereas in PowerPoint 2007, only the outer shadow is applied. ### **Apply Reflection Effects** A reflection creates a mirrored copy of the text. Adjust its position, scale, blur, and opacity to control its appearance. This example calls [EnableReflectionEffect](https://reference.aspose.com/slides/cpp/aspose.slides/ieffectformat/enablereflectioneffect/) and flips the reflection vertically with a scale of -100%. It uses a 0.5-point blur radius and a 4.72-point distance. Opacity decreases from 60% to 0.9% between positions 0% and 60% along the reflection: ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto autoShape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 20.0f, 20.0f, 400.0f, 200.0f); auto textFrame = autoShape->get_TextFrame(); auto portion = textFrame->get_Paragraphs()->idx_get(0)->get_Portions()->idx_get(0); portion->set_Text(u"Aspose.Slides"); auto fontData = System::MakeObject(u"Arial Black"); portion->get_PortionFormat()->set_LatinFont(fontData); portion->get_PortionFormat()->set_FontHeight(36.0f); auto effectFormat = portion->get_PortionFormat()->get_EffectFormat(); effectFormat->EnableReflectionEffect(); auto reflectionEffect = effectFormat->get_ReflectionEffect(); reflectionEffect->set_BlurRadius(0.5); reflectionEffect->set_Distance(4.72); reflectionEffect->set_StartPosAlpha(0.f); reflectionEffect->set_EndPosAlpha(60.f); reflectionEffect->set_Direction(90.0f); reflectionEffect->set_ScaleHorizontal(100); reflectionEffect->set_ScaleVertical(-100); reflectionEffect->set_StartReflectionOpacity(60.f); reflectionEffect->set_EndReflectionOpacity(0.9f); reflectionEffect->set_RectangleAlign(RectangleAlignment::BottomLeft); ``` The resulting text: ![The Reflection effect](https://docs.aspose.com/slides/cpp/wordart/reflection_effect.png) ### **Apply Glow Effects** A glow adds a soft colored outline around the text. Adjust its color, opacity, and radius to control the effect. This example calls [EnableGlowEffect](https://reference.aspose.com/slides/cpp/aspose.slides/ieffectformat/enablegloweffect/) and applies a red glow with 54% opacity and a radius of 7 points: ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System::Drawing; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto autoShape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 20.0f, 20.0f, 400.0f, 200.0f); auto textFrame = autoShape->get_TextFrame(); auto portion = textFrame->get_Paragraphs()->idx_get(0)->get_Portions()->idx_get(0); portion->set_Text(u"Aspose.Slides"); auto fontData = System::MakeObject(u"Arial Black"); portion->get_PortionFormat()->set_LatinFont(fontData); portion->get_PortionFormat()->set_FontHeight(36.0f); auto effectFormat = portion->get_PortionFormat()->get_EffectFormat(); effectFormat->EnableGlowEffect(); auto glowEffect = effectFormat->get_GlowEffect(); glowEffect->get_Color()->set_Color(Color::get_Red()); glowEffect->get_Color()->get_ColorTransform()->Add(ColorTransformOperation::SetAlpha, 0.54f); glowEffect->set_Radius(7); ``` The resulting text: ![The Glow effect](https://docs.aspose.com/slides/cpp/wordart/glow_effect.png) ### **Apply WordArt Transformations** WordArt transformations bend, stretch, or warp a block of text. Set [ITextFrameFormat::set_Transform](https://reference.aspose.com/slides/cpp/aspose.slides/itextframeformat/set_transform/) to [ArchUpPour](https://reference.aspose.com/slides/cpp/aspose.slides/textshapetype/) to curve the entire text frame upward: ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto autoShape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 20.0f, 20.0f, 400.0f, 200.0f); auto textFrame = autoShape->get_TextFrame(); textFrame->set_Text(u"Aspose.Slides"); textFrame->get_TextFrameFormat()->set_Transform(TextShapeType::ArchUpPour); ``` The resulting text: ![The WordArt transformation](https://docs.aspose.com/slides/cpp/wordart/transform_effect.png) Aspose.Slides for C++ provides a set of predefined [transformation types](https://reference.aspose.com/slides/cpp/aspose.slides/textshapetype/). ### **Apply 3D Effects to Shapes and Text** You can apply 3D effects to a shape or to its text. Bevels, extrusion, lighting, and camera settings control the resulting appearance. The following example uses [IThreeDFormat](https://reference.aspose.com/slides/cpp/aspose.slides/ithreedformat/) to add circular bevels, orange extrusion, and a dark red contour to the rectangle. Bevel dimensions, extrusion height, contour width, and depth are measured in points. A plastic material, balanced lighting rotated by 40 degrees around the Z axis, and a perspective camera define its appearance: ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System::Drawing; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto autoShape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 20.0f, 20.0f, 400.0f, 200.0f); autoShape->get_TextFrame()->set_Text(u"Aspose.Slides"); auto threeDFormat = autoShape->get_ThreeDFormat(); threeDFormat->get_BevelBottom()->set_BevelType(BevelPresetType::Circle); threeDFormat->get_BevelBottom()->set_Height(10.5); threeDFormat->get_BevelBottom()->set_Width(10.5); threeDFormat->get_BevelTop()->set_BevelType(BevelPresetType::Circle); threeDFormat->get_BevelTop()->set_Height(12.5); threeDFormat->get_BevelTop()->set_Width(11); threeDFormat->get_ExtrusionColor()->set_Color(Color::get_Orange()); threeDFormat->set_ExtrusionHeight(6); threeDFormat->get_ContourColor()->set_Color(Color::get_DarkRed()); threeDFormat->set_ContourWidth(1.5); threeDFormat->set_Depth(3); threeDFormat->set_Material(MaterialPresetType::Plastic); threeDFormat->get_LightRig()->set_Direction(LightingDirection::Top); threeDFormat->get_LightRig()->set_LightType(LightRigPresetType::Balanced); threeDFormat->get_LightRig()->SetRotation(0.0f, 0.0f, 40.0f); threeDFormat->get_Camera()->set_CameraType(CameraPresetType::PerspectiveContrastingRightFacing); ``` The resulting shape: ![The shape 3D effect](https://docs.aspose.com/slides/cpp/wordart/shape_3D_effect.png) This example applies similar 3D formatting to the text through [ITextFrameFormat::get_ThreeDFormat](https://reference.aspose.com/slides/cpp/aspose.slides/itextframeformat/get_threedformat/). Smaller bevels shape the letter edges, while extrusion and lighting give the text depth: ```cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace System::Drawing; auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); auto autoShape = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 20.0f, 20.0f, 400.0f, 200.0f); auto textFrame = autoShape->get_TextFrame(); textFrame->set_Text(u"Aspose.Slides"); auto threeDFormat = textFrame->get_TextFrameFormat()->get_ThreeDFormat(); threeDFormat->get_BevelBottom()->set_BevelType(BevelPresetType::Circle); threeDFormat->get_BevelBottom()->set_Height(3.5); threeDFormat->get_BevelBottom()->set_Width(3.5); threeDFormat->get_BevelTop()->set_BevelType(BevelPresetType::Circle); threeDFormat->get_BevelTop()->set_Height(4); threeDFormat->get_BevelTop()->set_Width(4); threeDFormat->get_ExtrusionColor()->set_Color(Color::get_Orange()); threeDFormat->set_ExtrusionHeight(6); threeDFormat->get_ContourColor()->set_Color(Color::get_DarkRed()); threeDFormat->set_ContourWidth(1.5); threeDFormat->set_Depth(3); threeDFormat->set_Material(MaterialPresetType::Plastic); threeDFormat->get_LightRig()->set_Direction(LightingDirection::Top); threeDFormat->get_LightRig()->set_LightType(LightRigPresetType::Balanced); threeDFormat->get_LightRig()->SetRotation(0.0f, 0.0f, 40.0f); threeDFormat->get_Camera()->set_CameraType(CameraPresetType::PerspectiveContrastingRightFacing); ``` The resulting text: ![The text 3D effect](https://docs.aspose.com/slides/cpp/wordart/text_3D_effect.png) The application of 3D effects to text or their shapes—and the interaction between these effects—is governed by specific rules. Consider a scene involving both text and the shape containing it. A 3D effect includes the object's 3D representation and the scene in which it is placed. - If a scene is set for both the shape and the text, the shape’s scene takes priority and the text’s scene is ignored. - If the shape lacks its own scene but has a 3D representation, the text’s scene is used. - If the shape has no 3D effect at all, it is treated as flat, and the 3D effect is applied only to the text. These behaviors relate to the [IThreeDFormat::get_LightRig](https://reference.aspose.com/slides/cpp/aspose.slides/ithreedformat/get_lightrig/) and [IThreeDFormat::get_Camera](https://reference.aspose.com/slides/cpp/aspose.slides/ithreedformat/get_camera/) methods. To keep text flat and readable while retaining its shape's 3D formatting, see [Keep Text Flat on a 3D Shape](https://docs.aspose.com/slides/cpp/3d-presentation/) for a comparison of both settings and a complete C++ example. ## **FAQ** **Can I use WordArt effects with different fonts or scripts (e.g., Arabic, Chinese)?** Yes, Aspose.Slides for C++ supports Unicode and works with all major fonts and scripts. WordArt effects such as shadow, fill, and outline can be applied regardless of the language, although font availability and rendering may depend on the system fonts. **Can I apply WordArt effects to slide master elements?** Yes, you can apply WordArt effects to shapes on master slides, including title placeholders, footers, or background text. Changes made to the master layout will be reflected across all associated slides. **Do WordArt effects affect presentation file size?** Slightly. WordArt effects like shadows, glows, and gradient fills may slightly increase the file size due to added formatting metadata, but the difference is usually negligible. **Can I preview the result of WordArt effects without saving the presentation?** Yes, you can render slides containing WordArt to images (e.g., PNG, JPEG) using [ISlide::GetImage](https://reference.aspose.com/slides/cpp/aspose.slides/islide/getimage/), or render individual shapes using [IShape::GetImage](https://reference.aspose.com/slides/cpp/aspose.slides/ishape/getimage/). This lets you preview the result in memory or on screen before saving or exporting the full presentation. ## Related articles - [Apply Shape Effects in Presentations Using C++](https://docs.aspose.com/slides/cpp/shape-effect/) # Work with PowerPoint Documents in Qt > Use Aspose.Slides for C++ with Qt Creator and Visual Studio to create, load, and edit PowerPoint and OpenDocument presentations in cross-platform apps. Source: https://docs.aspose.com/slides/cpp/work-with-powerpoint-documents-in-qt/ Updated: 2026-08-13 ## **Introduction** Qt is a C++ based cross-platform application development framework which is widely used to develop a variety of desktop, mobile, and embedded system applications. Aspose.Slides for C++ can be integrated within Qt in order to create and manipulate PowerPoint documents in your Qt applications. ## **Using Aspose.Slides for C++ within Qt Creator** In order to use Aspose.Slides for C++ in your Qt application download the latest version of the API from the [downloads](https://downloads.aspose.com/slides/cpp) section. Once the API is downloaded, you can integrate the C++ library within Qt Creator or Visual Studio. In order to integrate and use Aspose.Slides for C++ library within a Qt Console Application developed in Qt Creator, please follow the steps given below: - Open Qt Creator and create a new *Qt Console Application*. ![qt_console_application](https://docs.aspose.com/slides/cpp/work-with-powerpoint-documents-in-qt/qt-console-application.png) - Select the QMake option from the *Build System* dropdown list. ![qt_console_application_qmake](https://docs.aspose.com/slides/cpp/work-with-powerpoint-documents-in-qt/qt-console-application-qmake.png) - Select the appropriate kit and finish the wizard. - Copy aspose-slides-cpp-21.02 folder from the extracted package of Aspose.Slides for C++ into the root of the project. ![lib_files](https://docs.aspose.com/slides/cpp/work-with-powerpoint-documents-in-qt/aspose.slides-lib-files.png) - In order to add paths to lib and include folders, right-click on the project in the LHS panel and select *Add Library*. ![qt_add_library](https://docs.aspose.com/slides/cpp/work-with-powerpoint-documents-in-qt/qt_add_library.png) - Select the External Library option and browse paths to include lib folders one by one. ![todo:image_alt_text](https://docs.aspose.com/slides/cpp/work-with-powerpoint-documents-in-qt/qt-add-external-library.png) - Once done, your .pro project file will contain the following entries: ![qt_pro_file.png](https://docs.aspose.com/slides/cpp/work-with-powerpoint-documents-in-qt/qt-pro-file.png) - Build the application and you are done with the integration. Note: See the [full demo project](https://github.com/aspose-slides/Aspose.Slides-for-C/tree/master/QtDemos/QtCreator/Qt_AsposeSlides_QMake) for more information. ## **Using Aspose.Slides for C++ in Qt Applications within Visual Studio** In order to develop a Qt application using Visual Studio, you need to install [Qt Visual Studio Tools](https://marketplace.visualstudio.com/items?itemName=TheQtCompany.QtVisualStudioTools-19123). Once you have the installation, download the latest version of the API from the [downloads](https://downloads.aspose.com/slides/cpp) section and follow the steps given below: - Open Microsoft Visual Studio and create a new *Qt Console Application*. ![VS_Console_Application.png](https://docs.aspose.com/slides/cpp/work-with-powerpoint-documents-in-qt/vs-console-application.png) - Select the appropriate kit and finish the wizard. - In order to integrate and use Aspose.Slides for C++ library, right-click on the project and select *Manage NuGet Packages...*. ![VS_Manage_NuGet_Package.png](https://docs.aspose.com/slides/cpp/work-with-powerpoint-documents-in-qt/vs-manage-nuget-package.png) - Find and install the required *Aspose.Slides.Cpp* package. ![VS_Find_Nuget.png](https://docs.aspose.com/slides/cpp/work-with-powerpoint-documents-in-qt/vs-find-nuget.png) - Build the project and you are done with the integration. Note: See the [full demo project](https://github.com/aspose-slides/Aspose.Slides-for-C/tree/master/QtDemos/Visual%20Studio/Qt_AsposeSlides_VS) for more information. ## Related articles - [Installation](https://docs.aspose.com/slides/cpp/installation/) # Working Solution for Chart Resizing in PPTX > Fix unexpected chart resizing in PPTX when using embedded Excel OLE objects with Aspose.Slides for C++. Set fixed chart dimensions to keep the chart and OLE frame sizes consistent. Source: https://docs.aspose.com/slides/cpp/working-solution-for-chart-resizing-in-pptx/ Updated: 2026-11-08 ## **Background** Excel charts embedded as OLE objects in PowerPoint presentations using Aspose components can change size after their first activation. This can cause a noticeable difference in the chart's appearance before and after activation. This article explains why resizing occurs and shows how to prevent it by matching fixed chart dimensions to the OLE frame. In [Create Excel Charts and Embed Them as OLE Objects in Presentations](https://docs.aspose.com/slides/cpp/creating-excel-chart-and-embedding-it-in-presentation-as-ole-object/), we explained how to create an Excel chart with Aspose.Cells for C++ and embed it in a PowerPoint presentation using Aspose.Slides for C++. To address the [object preview issue](https://docs.aspose.com/slides/cpp/object-preview-issue-when-adding-oleobjectframe/), we assigned the chart image to the chart’s OLE object frame. In the output presentation, when you double-click the OLE object frame displaying the chart image, the Excel chart is activated. Users can edit the embedded Excel workbook and then return to the slide by clicking outside the activated workbook. The size of the OLE object frame changes when the user returns to the slide, and the resizing factor varies depending on the original sizes of both the OLE object frame and the embedded Excel workbook. ## **Cause of Resizing** The embedded Excel workbook has its own window dimensions, which Excel tries to retain when the object is first activated. The OLE frame on the slide has independently defined dimensions. When the Excel workbook is activated, Excel and PowerPoint negotiate the object's size to maintain its proportions as part of the embedding process. Differences between the workbook window and the OLE frame can therefore cause the object to resize. ## **Working Solution** Match the chart size to the OLE frame on the slide and keep the chart dimensions independent of the workbook window. This solution works with a new presentation or an existing template. The example requires Aspose.Cells for C++ and Aspose.Slides for C++. It creates a simple column chart on an active chart sheet and embeds the workbook in XLS format. No chart preview image is assigned; the chart becomes visible when the OLE object is activated in PowerPoint. Place the example code in your application entry point, with the include declarations at file scope. Initialize Aspose.Cells before creating its objects and release its resources after those objects have been destroyed. The example copies the workbook byte vector returned by Aspose.Cells into the array type accepted by Aspose.Slides. The example creates a new presentation with a 9.5 × 4-inch OLE frame positioned 0.5 inches from the left edge and 1 inch from the top. Slide coordinates and dimensions are in points (72 points per inch). For an existing presentation, see [Use a Template](https://docs.aspose.com/slides/cpp/working-solution-for-chart-resizing-in-pptx/#use-a-template). ## **Set a Fixed Chart Size** Set [Chart::SetSizeWithWindow](https://reference.aspose.com/cells/cpp/aspose.cells.charts/chart/setsizewithwindow/) to false so that the chart dimensions are independent of the workbook window. Set the [Chart::GetChartObject](https://reference.aspose.com/cells/cpp/aspose.cells.charts/chart/getchartobject/) dimensions through [Shape::SetWidth](https://reference.aspose.com/cells/cpp/aspose.cells.drawing/shape/setwidth/) and [Shape::SetHeight](https://reference.aspose.com/cells/cpp/aspose.cells.drawing/shape/setheight/), converting points to pixels using 96 pixels per inch: a frame measuring 684 × 288 points corresponds to a chart measuring 912 × 384 pixels. Set [Chart::SetPrintSize](https://reference.aspose.com/cells/cpp/aspose.cells.charts/chart/setprintsize/) to the Custom value of [PrintSizeType](https://reference.aspose.com/cells/cpp/aspose.cells/printsizetype/). The example embeds the workbook with [IShapeCollection::AddOleObjectFrame](https://reference.aspose.com/slides/cpp/aspose.slides/ishapecollection/addoleobjectframe/) and saves a presentation with a 9.5 × 4-inch OLE frame. ```cpp #include "Aspose.Cells/Cell.h" #include "Aspose.Cells/Cells.h" #include "Aspose.Cells/Chart.h" #include "Aspose.Cells/ChartCollection.h" #include "Aspose.Cells/ChartShape.h" #include "Aspose.Cells/ChartType.h" #include "Aspose.Cells/Initializer.h" #include "Aspose.Cells/PrintSizeType.h" #include "Aspose.Cells/SaveFormat.h" #include "Aspose.Cells/SeriesCollection.h" #include "Aspose.Cells/SheetType.h" #include "Aspose.Cells/Vector.h" #include "Aspose.Cells/Workbook.h" #include "Aspose.Cells/Worksheet.h" #include "Aspose.Cells/WorksheetCollection.h" #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::DOM::Ole; Aspose::Cells::Startup(); { Aspose::Cells::Workbook workbook; auto dataSheet = workbook.GetWorksheets().Get(0); dataSheet.SetName(u"Data"); dataSheet.GetCells().Get(u"A1").PutValue(10); dataSheet.GetCells().Get(u"A2").PutValue(20); auto chartSheetIndex = workbook.GetWorksheets().Add(Aspose::Cells::SheetType::Chart); auto chartSheet = workbook.GetWorksheets().Get(chartSheetIndex); auto chartIndex = chartSheet.GetCharts().Add(Aspose::Cells::Charts::ChartType::Column, 0, 0, 20, 10); auto chart = chartSheet.GetCharts().Get(chartIndex); chart.GetNSeries().Add(u"Data!A1:A2", true); workbook.GetWorksheets().SetActiveSheetIndex(chartSheetIndex); auto presentation = System::MakeObject(); auto slide = presentation->get_Slide(0); // Slide coordinates and dimensions are in points (72 points per inch). auto width = 684.f; // 9.5 inches. auto height = 288.f; // 4 inches. chart.SetSizeWithWindow(false); // Convert points to chart pixels using 96 pixels per inch. chart.GetChartObject().SetWidth(static_cast(width / 72.f * 96.f)); chart.GetChartObject().SetHeight(static_cast(height / 72.f * 96.f)); chart.SetPrintSize(Aspose::Cells::PrintSizeType::Custom); auto workbookData = workbook.Save(Aspose::Cells::SaveFormat::Excel97To2003); // Copy the Cells byte vector into the array type accepted by Slides. auto workbookBytes = System::MakeArray(workbookData.GetLength(), 0); std::copy(workbookData.GetData(), workbookData.GetData() + workbookData.GetLength(), workbookBytes->data_ptr()); auto dataInfo = System::MakeObject(workbookBytes, u"xls"); slide->get_Shapes()->AddOleObjectFrame(36, 72, width, height, dataInfo); presentation->Save(u"chart-fixed-size.pptx", Aspose::Slides::Export::SaveFormat::Pptx); presentation->Dispose(); } Aspose::Cells::Cleanup(); ``` [![A 684 by 288 point OLE frame matches a 912 by 384 pixel chart at 96 DPI, with chart size independent of its window.](https://docs.aspose.com/slides/cpp/working-solution-for-chart-resizing-in-pptx/visual-working-solution-for-chart-resizing-in-pptx-62dff4f20ea9.svg)](https://docs.aspose.com/slides/cpp/working-solution-for-chart-resizing-in-pptx/visual-working-solution-for-chart-resizing-in-pptx-62dff4f20ea9.svg) *Use the same physical dimensions for the fixed chart and OLE frame: 684 × 288 points equals 912 × 384 pixels at 96 DPI. This diagram explains the configuration; it does not show a measured first-activation result.* ## **Use a Template** The sizing logic is the same for an existing presentation. To adapt the example: 1. Load the template presentation instead of creating an empty presentation. 1. Check that the first slide contains at least three shapes, then use the shape at index 2 as the placeholder. 1. Take the frame width and height from that shape instead of using the fixed values 684 and 288. Keep the sizing calculations unchanged. 1. Add the OLE frame at the placeholder's position instead of the fixed coordinates 36 and 72. 1. Remove the placeholder before saving the presentation. ## **FAQ** **Why does my embedded Excel chart change size after activating it in PowerPoint?** This happens because Excel tries to restore the original window size when first activated, whereas the OLE object frame in PowerPoint has its own dimensions. PowerPoint and Excel negotiate the size to maintain the aspect ratio, which can cause the resizing. **How can I keep the chart and OLE frame sizes consistent?** Set fixed chart dimensions that match the OLE frame and use a custom chart print size before embedding the workbook. The example above shows the required settings and unit conversions. **Is matching the workbook window size sufficient?** Matching the workbook window size alone does not reliably prevent the OLE frame from changing size after activation. Use fixed chart dimensions as shown in the example. **Does this solution work with both template-based presentations and new presentations?** Yes. For a template, use the placeholder's dimensions and position. For a new presentation, specify the frame dimensions and position directly. **Can I use this example with charts created in other spreadsheet programs?** The example uses an Excel workbook created with Aspose.Cells. It does not demonstrate activation behavior for other spreadsheet programs. ## **Related Sections** - [Create Excel Charts and Embed Them as OLE Objects in Presentations](https://docs.aspose.com/slides/cpp/creating-excel-chart-and-embedding-it-in-presentation-as-ole-object/) ## Related articles - [Working Solution for Worksheet Resizing](https://docs.aspose.com/slides/cpp/working-solution-for-worksheet-resizing/) - [Create Excel Charts and Embed Them in Presentations as OLE Objects](https://docs.aspose.com/slides/cpp/creating-excel-chart-and-embedding-it-in-presentation-as-ole-object/) # Working Solution for Worksheet Resizing > Working solution for worksheet resizing in PowerPoint presentations using C++ Source: https://docs.aspose.com/slides/cpp/working-solution-for-worksheet-resizing/ Updated: 2026-11-08 Excel worksheets embedded as OLE objects in a PowerPoint presentation using Aspose components may resize unexpectedly after their first activation. This behavior creates a noticeable visual difference between the OLE object before and after activation. This article explains the issue and describes two ways to address it. ## **Background** In the article [Manage OLE](https://docs.aspose.com/slides/cpp/manage-ole/), we explained how to add an OLE frame to a PowerPoint presentation using Aspose.Slides for C++. To address the [object preview issue](https://docs.aspose.com/slides/cpp/object-preview-issue-when-adding-oleobjectframe/), we assigned an image of the selected worksheet area to the OLE object frame. In the output presentation, when you double-click the OLE object frame displaying the worksheet image, the Excel workbook is activated. End users can make any desired changes to the actual Excel workbook and then return to the slide by clicking outside the activated Excel workbook. The size of the OLE object frame will change when the user returns to the slide. The resizing factor will vary depending on the size of the OLE object frame and the embedded Excel workbook. ## **Cause of Resizing** Since the Excel workbook has its own window size, it tries to retain its original size upon first activation. On the other hand, the OLE object frame has its own size. According to Microsoft, when the Excel workbook is activated, Excel and PowerPoint negotiate the size to ensure it maintains the correct proportions as part of the embedding process. The resizing occurs based on the differences between the Excel window size and the OLE object frame's size and position. ## **Working Solution** There are two possible solutions to avoid the resizing effect. - Scale the OLE frame in the PowerPoint presentation to match the total height and width of the selected rows and columns. - Keep the OLE frame size constant and scale the selected rows and columns to fit within it. ### **Scale the OLE Frame Size** This approach sets the OLE frame size to match the total height and width of the selected rows and columns in the embedded Excel worksheet. The example loads an existing Excel workbook and selects the first 10 rows and 13 columns of its first worksheet using zero-based indices. [WorksheetCollection::SetOleSize](https://reference.aspose.com/cells/cpp/aspose.cells/worksheetcollection/setolesize/) defines the displayed range. The preview is rendered at 96 DPI, and its pixel dimensions are converted to points using 72 points per inch. [ShapeCollection::AddOleObjectFrame](https://reference.aspose.com/slides/cpp/aspose.slides/shapecollection/addoleobjectframe/) embeds the modified workbook in a frame with those dimensions. The preview is assigned through [OleObjectFrame::get_SubstitutePictureFormat](https://reference.aspose.com/slides/cpp/aspose.slides/oleobjectframe/get_substitutepictureformat/) to replace the "EMBEDDED OLE OBJECT" placeholder in the saved presentation. ```cpp #include #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::DOM::Ole; using namespace Aspose::Slides::Export; using namespace System; using namespace System::Drawing; Aspose::Cells::Startup(); int startRow = 0, rowCount = 10; int startColumn = 0, columnCount = 13; int worksheetIndex = 0; int imageResolution = 96; Aspose::Cells::Workbook workbook(u"sample.xlsx"); auto worksheet = workbook.GetWorksheets().Get(worksheetIndex); // Set the displayed size when the workbook file is used as an OLE object in PowerPoint. auto lastRow = startRow + rowCount - 1; auto lastColumn = startColumn + columnCount - 1; workbook.GetWorksheets().SetOleSize(startRow, lastRow, startColumn, lastColumn); auto cellRange = worksheet.GetCells().CreateRange(startRow, startColumn, rowCount, columnCount); auto imageStream = CreateOleImage(cellRange, imageResolution); // Get the width and height of the OLE image in points. auto image = Image::FromStream(imageStream); auto imageWidth = image->get_Width() * 72.0f / imageResolution; auto imageHeight = image->get_Height() * 72.0f / imageResolution; // We need to use the modified workbook. auto oleStream = workbook.Save(Aspose::Cells::SaveFormat::Xlsx); auto oleData = MakeArray(oleStream.GetLength(), oleStream.GetData()); workbook.Dispose(); auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); // Add the OLE image to the presentation resources. auto oleImage = presentation->get_Images()->AddImage(image); image->Dispose(); // Create the OLE object frame. auto dataInfo = MakeObject(oleData, u"xlsx"); auto oleFrame = slide->get_Shapes()->AddOleObjectFrame(10, 10, imageWidth, imageHeight, dataInfo); oleFrame->get_SubstitutePictureFormat()->get_Picture()->set_Image(oleImage); oleFrame->set_IsObjectIcon(false); presentation->Save(u"output.pptx", SaveFormat::Pptx); presentation->Dispose(); Aspose::Cells::Cleanup(); ``` The preview helper uses [PageSetup::SetPrintArea](https://reference.aspose.com/cells/cpp/aspose.cells/pagesetup/setprintarea/) to select the range and removes margins, headers, and footers. With [ImageOrPrintOptions::SetOnlyArea](https://reference.aspose.com/cells/cpp/aspose.cells.rendering/imageorprintoptions/setonlyarea/) enabled, [SheetRender::ToImage](https://reference.aspose.com/cells/cpp/aspose.cells.rendering/sheetrender/toimage/) renders the range as a PNG image. The helper copies the rendered image data into a new memory stream positioned at its beginning for use in the presentation. ```cpp #include #include #include #include "Aspose.Cells/ImageOrPrintOptions.h" #include "Aspose.Cells/ImageType.h" #include "Aspose.Cells/PageSetup.h" #include "Aspose.Cells/Range.h" #include "Aspose.Cells/SheetRender.h" #include "Aspose.Cells/Worksheet.h" using namespace System; using namespace System::IO; SharedPtr CreateOleImage(Aspose::Cells::Range cellRange, int imageResolution) { auto pageSetup = cellRange.GetWorksheet().GetPageSetup(); pageSetup.SetPrintArea(cellRange.GetAddress()); pageSetup.SetLeftMargin(0); pageSetup.SetRightMargin(0); pageSetup.SetTopMargin(0); pageSetup.SetBottomMargin(0); pageSetup.ClearHeaderFooter(); Aspose::Cells::ImageOrPrintOptions imageOptions; imageOptions.SetImageType(Aspose::Cells::ImageType::Png); imageOptions.SetVerticalResolution(imageResolution); imageOptions.SetHorizontalResolution(imageResolution); imageOptions.SetOnePagePerSheet(true); imageOptions.SetOnlyArea(true); Aspose::Cells::SheetRender sheetRender(cellRange.GetWorksheet(), imageOptions); auto renderData = sheetRender.ToImage(0); auto imageData = MakeObject>(renderData.GetLength(), renderData.GetData()); auto imageStream = MakeObject(imageData); sheetRender.Dispose(); return imageStream; } ``` [![Approach A resizes the OLE frame to an unchanged range; approach B scales the range to a fixed 400 by 100 point frame.](https://docs.aspose.com/slides/cpp/working-solution-for-worksheet-resizing/visual-working-solution-for-worksheet-resizing-37277e3a014f.svg)](https://docs.aspose.com/slides/cpp/working-solution-for-worksheet-resizing/visual-working-solution-for-worksheet-resizing-37277e3a014f.svg) *The selected section uses approach A: preserve the selected cells and size the OLE frame to match their range. Approach B is a separate alternative. Convert 96-DPI preview pixels to slide points using 72 ÷ 96.* ### **Scale the Cell Range Size** This approach scales the heights of the selected rows and the widths of the selected columns to match a custom OLE frame size. The example loads an existing Excel workbook and selects the first 10 rows and 13 columns of its first worksheet using zero-based indices. [WorksheetCollection::SetOleSize](https://reference.aspose.com/cells/cpp/aspose.cells/worksheetcollection/setolesize/) defines the displayed range, and the helper below scales that range to fit a frame 400 points wide and 100 points high. After saving the modified workbook to a byte array, [ShapeCollection::AddOleObjectFrame](https://reference.aspose.com/slides/cpp/aspose.slides/shapecollection/addoleobjectframe/) embeds it at the specified size. A preview rendered at 96 DPI is assigned through [OleObjectFrame::get_SubstitutePictureFormat](https://reference.aspose.com/slides/cpp/aspose.slides/oleobjectframe/get_substitutepictureformat/), so the saved presentation displays the selected cells instead of the default placeholder. ```cpp #include #include #include #include #include #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::DOM::Ole; using namespace Aspose::Slides::Export; using namespace System; Aspose::Cells::Startup(); int startRow = 0, rowCount = 10; int startColumn = 0, columnCount = 13; int worksheetIndex = 0; int imageResolution = 96; float frameWidth = 400, frameHeight = 100; Aspose::Cells::Workbook workbook(u"sample.xlsx"); auto worksheet = workbook.GetWorksheets().Get(worksheetIndex); // Set the displayed size when the workbook file is used as an OLE object in PowerPoint. auto lastRow = startRow + rowCount - 1; auto lastColumn = startColumn + columnCount - 1; workbook.GetWorksheets().SetOleSize(startRow, lastRow, startColumn, lastColumn); // Scale the cell range to fit the frame size. auto cellRange = worksheet.GetCells().CreateRange(startRow, startColumn, rowCount, columnCount); ScaleCellRange(cellRange, frameWidth, frameHeight); auto imageStream = CreateOleImage(cellRange, imageResolution); // We need to use the modified workbook. auto oleStream = workbook.Save(Aspose::Cells::SaveFormat::Xlsx); auto oleData = MakeArray(oleStream.GetLength(), oleStream.GetData()); workbook.Dispose(); auto presentation = MakeObject(); auto slide = presentation->get_Slide(0); // Add the OLE image to the presentation resources. auto oleImage = presentation->get_Images()->AddImage(imageStream); imageStream->Dispose(); // Create the OLE object frame. auto dataInfo = MakeObject(oleData, u"xlsx"); auto oleFrame = slide->get_Shapes()->AddOleObjectFrame(10, 10, frameWidth, frameHeight, dataInfo); oleFrame->get_SubstitutePictureFormat()->get_Picture()->set_Image(oleImage); oleFrame->set_IsObjectIcon(false); presentation->Save(u"output.pptx", SaveFormat::Pptx); presentation->Dispose(); Aspose::Cells::Cleanup(); ``` The scaling helper calculates separate width and height ratios for the selected range, preserving the relative widths of its columns and the relative heights of its rows. It converts the calculated dimensions from points to inches before applying them with [Cells::SetColumnWidthInch](https://reference.aspose.com/cells/cpp/aspose.cells/cells/setcolumnwidthinch/) and [Cells::SetRowHeightInch](https://reference.aspose.com/cells/cpp/aspose.cells/cells/setrowheightinch/). The selected range must have nonzero width and height. ```cpp #include "Aspose.Cells/Cells.h" #include "Aspose.Cells/CellsUnitType.h" #include "Aspose.Cells/Range.h" #include "Aspose.Cells/Worksheet.h" /// The expected width of the cell range in points. /// The expected height of the cell range in points. void ScaleCellRange(Aspose::Cells::Range cellRange, float width, float height) { auto rangeWidth = cellRange.GetWidth(); auto rangeHeight = cellRange.GetHeight(); for (int i = 0; i < cellRange.GetColumnCount(); i++) { auto columnIndex = cellRange.GetFirstColumn() + i; auto columnWidth = cellRange.GetWorksheet().GetCells().GetColumnWidth(columnIndex, false, Aspose::Cells::CellsUnitType::Point); auto newColumnWidth = columnWidth * width / rangeWidth; auto widthInInches = newColumnWidth / 72; cellRange.GetWorksheet().GetCells().SetColumnWidthInch(columnIndex, widthInInches); } for (int i = 0; i < cellRange.GetRowCount(); i++) { auto rowIndex = cellRange.GetFirstRow() + i; auto rowHeight = cellRange.GetWorksheet().GetCells().GetRowHeight(rowIndex, false, Aspose::Cells::CellsUnitType::Point); auto newRowHeight = rowHeight * height / rangeHeight; auto heightInInches = newRowHeight / 72; cellRange.GetWorksheet().GetCells().SetRowHeightInch(rowIndex, heightInInches); } } ``` This preview helper renders the resized range using [SheetRender::ToImage](https://reference.aspose.com/cells/cpp/aspose.cells.rendering/sheetrender/toimage/). It uses [PageSetup::SetPrintArea](https://reference.aspose.com/cells/cpp/aspose.cells/pagesetup/setprintarea/) to restrict printing to that range, removes margins, headers, and footers, and returns a PNG stream positioned at its beginning. ```cpp #include #include #include #include "Aspose.Cells/ImageOrPrintOptions.h" #include "Aspose.Cells/ImageType.h" #include "Aspose.Cells/PageSetup.h" #include "Aspose.Cells/Range.h" #include "Aspose.Cells/SheetRender.h" #include "Aspose.Cells/Worksheet.h" using namespace System; using namespace System::IO; SharedPtr CreateOleImage(Aspose::Cells::Range cellRange, int imageResolution) { auto pageSetup = cellRange.GetWorksheet().GetPageSetup(); pageSetup.SetPrintArea(cellRange.GetAddress()); pageSetup.SetLeftMargin(0); pageSetup.SetRightMargin(0); pageSetup.SetTopMargin(0); pageSetup.SetBottomMargin(0); pageSetup.ClearHeaderFooter(); Aspose::Cells::ImageOrPrintOptions imageOptions; imageOptions.SetImageType(Aspose::Cells::ImageType::Png); imageOptions.SetVerticalResolution(imageResolution); imageOptions.SetHorizontalResolution(imageResolution); imageOptions.SetOnePagePerSheet(true); imageOptions.SetOnlyArea(true); Aspose::Cells::SheetRender sheetRender(cellRange.GetWorksheet(), imageOptions); auto renderData = sheetRender.ToImage(0); auto imageData = MakeObject>(renderData.GetLength(), renderData.GetData()); auto imageStream = MakeObject(imageData); sheetRender.Dispose(); return imageStream; } ``` ## **Conclusion** There are two approaches to fix the worksheet resizing issue. Choose the approach that best fits your requirements and use case. Both approaches work the same way, whether the presentations are created from a template or from scratch. Additionally, there is no limit on the size of the OLE object frame in this solution. ## **FAQ** **Why does an embedded Excel worksheet change size when first activated in PowerPoint?** This happens because Excel tries to maintain the original window size when activated, while the OLE object frame in PowerPoint has its own dimensions. PowerPoint and Excel negotiate the size to maintain the aspect ratio, which can cause the resizing. **Is it possible to prevent this resizing issue entirely?** Yes. By scaling the OLE frame to fit the Excel cell range size or scaling the cell range to fit the desired OLE frame size, you can prevent unwanted resizing. **Which scaling method should I use, OLE frame scaling or cell range scaling?** Select **OLE frame scaling** if you want to maintain the original Excel row and column sizes. Select **cell range scaling** if you want a fixed size for the OLE frame in your presentation. **Will these solutions work if my presentation is based on a template?** Yes. Both solutions work for presentations created from templates and from scratch. **Is there a limit to the size of the OLE frame when using these methods?** No. You can make the OLE object frame any size as long as you set the scale appropriately. **Is there a way to avoid the "EMBEDDED OLE OBJECT" placeholder text in PowerPoint?** Yes. By taking a snapshot of the target Excel cell range and setting it as the OLE frame's placeholder image, you can display a custom preview image in place of the default placeholder. ## **Related Articles** [Creating an Excel Chart and Embedding It in a Presentation as an OLE Object](https://docs.aspose.com/slides/cpp/creating-excel-chart-and-embedding-it-in-presentation-as-ole-object/) ## Related articles - [Working Solution for Chart Resizing in PPTX](https://docs.aspose.com/slides/cpp/working-solution-for-chart-resizing-in-pptx/) # Write-Protect Presentations in C++ > Set, detect, validate, and remove write-protection passwords in PowerPoint PPT and PPTX presentations using Aspose.Slides for C++. Source: https://docs.aspose.com/slides/cpp/write-protected-presentation/ Updated: 2026-08-26 ## **Introduction** A write-protection password restricts modification of a presentation but does not encrypt its content. Users can load and view a write-protected presentation without the password. Depending on the application, they may also be able to edit the content and save it under a different name, so write protection should not be treated as a confidentiality mechanism. An opening password serves a different purpose: it encrypts the presentation and is required to load its content. To encrypt a presentation or validate an opening password, see [Password-Protect Presentations](https://docs.aspose.com/slides/cpp/password-protected-presentation/). The workflows in this article apply to both PPT and PPTX presentations. The examples use PPTX files; when saving to PPT, use the `.ppt` extension and the corresponding PPT save format. ## **Set Write Protection on a Presentation** Use [IProtectionManager::SetWriteProtection](https://reference.aspose.com/slides/cpp/aspose.slides/iprotectionmanager/setwriteprotection/) to assign a password for modifying a presentation. Saving the presentation persists the protection setting. The following example sets write protection on a PPTX presentation: ```cpp #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(u"pres.pptx"); presentation->get_ProtectionManager()->SetWriteProtection(u"modify_password"); presentation->Save(u"write-protected-pres.pptx", SaveFormat::Pptx); ``` ## **Load a Write-Protected Presentation** Because write protection does not encrypt presentation content, no password is required to load the presentation. The password is relevant only when validating authorization to modify the protected presentation. ```cpp #include #include #include using namespace Aspose::Slides; using namespace System; auto presentation = MakeObject(u"write-protected-pres.pptx"); Console::WriteLine(u"Slide count: {0}", presentation->get_Slides()->get_Count()); ``` Do not pass a write-protection password to [LoadOptions::set_Password](https://reference.aspose.com/slides/cpp/aspose.slides/loadoptions/set_password/). That property accepts an opening password for encrypted content. If a presentation has both protection types, supply the opening password to load it and handle the write-protection password separately. ## **Remove Write Protection from a Presentation** Use [IProtectionManager::RemoveWriteProtection](https://reference.aspose.com/slides/cpp/aspose.slides/iprotectionmanager/removewriteprotection/) to remove the modification restriction, then save the presentation. ```cpp #include #include #include using namespace Aspose::Slides; using namespace Aspose::Slides::Export; auto presentation = System::MakeObject(u"write-protected-pres.pptx"); presentation->get_ProtectionManager()->RemoveWriteProtection(); presentation->Save(u"write-protection-removed.pptx", SaveFormat::Pptx); ``` ## **Check Whether a Presentation Is Write Protected** To inspect a file without creating a complete [Presentation](https://reference.aspose.com/slides/cpp/aspose.slides/presentation/) instance, call [IPresentationFactory::GetPresentationInfo](https://reference.aspose.com/slides/cpp/aspose.slides/ipresentationfactory/getpresentationinfo/) and inspect [IPresentationInfo::get_IsWriteProtected](https://reference.aspose.com/slides/cpp/aspose.slides/ipresentationinfo/get_iswriteprotected/). The property uses [NullableBool](https://reference.aspose.com/slides/cpp/aspose.slides/nullablebool/) and returns `NullableBool::True` when write protection is detected. ```cpp #include #include #include #include using namespace Aspose::Slides; using namespace System; auto presentationInfo = PresentationFactory::get_Instance()->GetPresentationInfo(u"write-protected-pres.pptx"); if (presentationInfo->get_IsWriteProtected() == NullableBool::True) { Console::WriteLine(u"The presentation is write protected."); } else { Console::WriteLine(u"Write protection was not detected."); } ``` The stream overload of [IPresentationFactory::GetPresentationInfo](https://reference.aspose.com/slides/cpp/aspose.slides/ipresentationfactory/getpresentationinfo/) provides the same information for a presentation supplied as a stream. ## **Validate a Write-Protection Password** Use [IPresentationInfo::CheckWriteProtection](https://reference.aspose.com/slides/cpp/aspose.slides/ipresentationinfo/checkwriteprotection/) to validate a modification password without loading the complete presentation. Check [IPresentationInfo::get_IsWriteProtected](https://reference.aspose.com/slides/cpp/aspose.slides/ipresentationinfo/get_iswriteprotected/) first so that the application requests or validates a password only when write protection is present. ```cpp #include #include #include #include using namespace Aspose::Slides; using namespace System; auto presentationInfo = PresentationFactory::get_Instance()->GetPresentationInfo(u"write-protected-pres.pptx"); if (presentationInfo->get_IsWriteProtected() != NullableBool::True) { Console::WriteLine(u"The presentation is not write protected."); } else if (presentationInfo->CheckWriteProtection(u"modify_password")) { Console::WriteLine(u"The write-protection password is correct."); } else { Console::WriteLine(u"The write-protection password is incorrect."); } ``` [IPresentationInfo::CheckWriteProtection](https://reference.aspose.com/slides/cpp/aspose.slides/ipresentationinfo/checkwriteprotection/) validates only the write-protection password. It does not validate an opening password or determine whether encrypted content can be loaded. Conversely, [IPresentationInfo::CheckPassword](https://reference.aspose.com/slides/cpp/aspose.slides/ipresentationinfo/checkpassword/) validates only an opening password. If a complete presentation has already been loaded, [IProtectionManager::CheckWriteProtection](https://reference.aspose.com/slides/cpp/aspose.slides/iprotectionmanager/checkwriteprotection/) provides the equivalent write-protection check through its protection manager. In production applications, do not log passwords or include them in diagnostic messages. Avoid unnecessary repeated validation attempts, and retain passwords in memory only as long as needed. - [Password-Protect Presentations](https://docs.aspose.com/slides/cpp/password-protected-presentation/) - [Read-Only Presentations](https://docs.aspose.com/slides/cpp/read-only-presentation/) - [Digital Signature in PowerPoint](https://docs.aspose.com/slides/cpp/digital-signature-in-powerpoint/) ## **FAQ** **Does write protection encrypt a presentation?** No. It restricts modification but leaves the presentation content available for loading and viewing. **Is the write-protection password required to open a presentation?** No. Only an opening password is required to load encrypted presentation content. **Can a presentation have both an opening password and a write-protection password?** Yes. Supply the opening password through the load options to open the encrypted presentation, and validate the write-protection password separately when modification authorization is required. # XML Parser Specification (XPS) > Source: https://docs.aspose.com/slides/cpp/xml-parser-specification-xps/ Updated: 2024-11-01 ## **About XPS** The [XML Parser Specification](https://en.wikipedia.org/wiki/Open_XML_Paper_Specification) is a page description language and a fixed-document format originally developed by Microsoft. Like PDF, XPS is a fixed-layout document format designed to preserve document fidelity and provide device-independent document appearance. ## **XPS in Aspose.Slides for C++** Any presentation document that can be loaded by Aspose.Slides for C++ can be converted to XPS format. Aspose.Slides for C++ uses the high-fidelity page layout and rendering engine to produce output in fixed-layout XPS document format. It is worth-mentioning that Aspose.Slides for C++ directly generates XPS without depending upon the Windows Presentation Foundation (WPF) classes that are packaged with C++ Framework 3.5 hence allowing Aspose.Slides for C++ to produce XPS documents on machines running C++ Framework versions earlier than version 3.5. You can learn about exporting the presentation documents to XPS documents through Aspose.Slides for C++ in [this topic](https://docs.aspose.com/slides/net/). ## Related articles - [Different File Formats and Conversions](https://docs.aspose.com/slides/cpp/different-file-formats-and-conversions/)