create powerpoint presentations C++

MS PowerPoint is a feature-rich application that lets you create appealing presentations having text, graphics, animations, charts, and several other elements. In this post, you will learn how to implement the basic PowerPoint automation features within the C++ applications. Particularly, you will come to know how to create PowerPoint presentations and add text, images, charts, and tables to the slides using C++.

C++ PowerPoint API

Aspose.Slides for C++ is designed to automate PowerPoint presentation manipulation features within C++ applications. Using the API, you can create, edit, or convert the PowerPoint presentations seamlessly. You can download the complete package of the API files or get it from NuGet.

Create a PowerPoint Presentation in C++

Let’s start by creating an empty PowerPoint presentation using Aspose.Slides for C++. The following are the steps to perform this operation.

The following code sample shows how to create a PowerPoint presentation using C++.

Add Slide to a Presentation in C++

Once you have created the PowerPoint presentation, you can insert slides into it. The following are the steps to add slides to a PowerPoint presentation:

The following code sample shows how to add slides to a PowerPoint presentation using C++.

To learn more about manipulating slides, visit Adding, Formatting and Manipulating Slides.

Add Text to a PowerPoint Slide using C++

Now, let’s add text to a slide in the PowerPoint presentation. For this, you need to insert a textbox to the slide. Below are the steps to perform this operation.

The following code sample shows how to add text to slides in a PowerPoint presentation using C++.

To learn more about manipulating text in presentations, visit Adding, Formatting, and Manipulating Text.

Create a Table in Presentation using C++

The following are the steps to add a table in a PowerPoint presentation’s slide using Aspose.Slides for C++.

  • Create an instance of a Presentation class.
  • Obtain the reference of a slide into an ISlide object.
  • Define arrays of columns and rows by providing the width.
  • Add a table to the slide using ISlide->get_Shapes()->AddTable() method.
  • Iterate through each cell to apply formatting to the top, bottom, right, and left borders.
  • Merge cells if required.
  • Access the text frame of a cell to add some text.
  • Save the presentation as a PPTX file.

The following code sample shows how to create table in PowerPoint presentation using C++.

To learn more about manipulating the tables, visit Adding, Updating and Manipulating Tables.

Create a Chart in Presentation using C++

Aspose.Slides for C++ supports various types of charts such as scattered, treemap, histogram, and etc. For the demonstration, let’s create a normal chart. Below are the steps to perform this operation.

  • Create an instance of the Presentation class.
  • Obtain the reference of a slide you want to add the chart on.
  • Add chart with default data along with desired type using ISlide->get_Shapes()->AddChart() method.
  • Get the reference of the chart in the IChart object.
  • Clear the chart data and add new series and categories.
  • Add new chart data for chart series.
  • Set fill color for chart series.
  • Add chart series labels.
  • Save the presentation as a PPTX file.

The following code sample shows how to insert a chart in a PowerPoint presentation using C++.

Learn more about manipulating charts from Adding, Formatting, and Manipulating Charts.

Open a PowerPoint Presentation in C++

You can also open an existing PowerPoint presentations in order to edit the content. For this, you can follow the below steps:

The following code sample shows how to open an existing PowerPoint presentation using C++.

Get a Free License

You can get a free temporary license in order to try the API without evaluation limitations.

Conclusion

In this article, you have learned how to create PowerPoint presentations from within the C++ applications. The step-by-step guide and code samples along with API references have shown how to create a presentation from scratch and insert slides, text, tables, and charts into it. You can explore more about the API using the documentation.

See Also