Apply Theme in PowerPoint Presentations using C++

Microsoft PowerPoint provides a wide variety of themes that you can use in your PowerPoint presentations. These themes improve the look and feel of the presentations and make them perfect for modern and sophisticated pitches. You can also apply themes to PowerPoint files dynamically within your C++ applications. To that end, this article will teach you how to apply themes in PowerPoint presentations programmatically using C++.

C++ API for Applying Theme in PowerPoint Presentations

Aspose.Slides for C++ is a C++ API for working with PowerPoint files. It enables you to create, read and update PPT and PPTX files without needing additional software. Furthermore, the API allows you to apply themes to PowerPoint presentations. You can either install the API through NuGet or download it directly from the Downloads section.

PM> Install-Package Aspose.Slides.Cpp

Apply Theme to PowerPoint Presentations using C++

A PowerPoint theme is a set of colors, font family, font size, background style, etc., that can be applied to different elements. In the following sections, we will explore how to set the theme color, font, and background style in PowePoint presentations.

Set Theme Color in PowerPoint Presentation using C++

The following are the steps to set the theme color for a shape in a PowerPoint presentation.

The following sample code shows how to set the theme color for a shape in a PowerPoint presentation using C++.

Set Theme Font in PowerPoint Presentation using C++

Similar to Microsoft PowerPoint, Aspose.Slides for C++ API provides the following identifiers to set the font from the font scheme.

  • +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“: Body Font East Asian (Minor East Asian Font)

The following are the steps to create a text element and assign the Latin font to it.

The following sample code shows how to set the theme font in a PowerPoint presentation using C++.

Change Theme Background Style in PowerPoint Presentation using C++

The following are the steps to set the theme background style in a PowerPoint presentation.

The following sample code demonstrates how to set the theme background style in a PowerPoint presentation using C++.

Get a Free License

In order to try the API without evaluation limitations, you can request a free temporary license.

Conclusion

In this article, you have learned how to apply themes in PowerPoint presentations using C++. Specifically, you have learned how to set the theme color, font, and background style of PowerPoint presentations. Aspose.Slides for C++ is a robust API that provides many additional features for working with PPTX/PPT files. You can explore the API in detail by visiting the official documentation. In case of any queries, please feel free to reach us at our free support forum.

See Also