Apply Theme in PowerPoint Presentations using C#

PowerPoint provides a wide range of themes that you can apply in the presentations. In addition, you can define your own custom themes as per your requirements. In this article, you will learn how to work with themes of PowerPoint presentations dynamically, Particularly, the article will cover how to apply themes in the PowerPoint presentations programmatically using C#.

.NET API to Apply Themes in PowerPoint Presentations

In order to apply themes in PowerPoint presentations, we will use Aspose.Slides for .NET. It is a powerful and feature-rich API to create and manipulate presentations from within .NET applications. You can either download the API or install it using NuGet.

PM> Install-Package Aspose.Slides.NET

Apply Theme in a PowerPoint Presentation using C#

A PowerPoint theme represents a set of colors, font size, font family, background style, etc. that you can apply to different elements. In the below sections, we will explicitly cover how to set theme color, font, and background in a PowerPoint presentation.

Set Theme Color in PowerPoint Presentation using C#

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

The following code sample shows how to set a theme color in PowerPoint presentation using C#.

Set Theme Font in the Presentation using C#

Aspose.Slides provides special identifiers to set font from the font scheme. These identifiers are as follows:

  • +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 an element with the text and assign the Latin font from the font scheme.

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

Change Theme Background Style in Presentation using C#

The presentation themes also contain the background styles that you can set in a PowerPoint presentation. The following are the steps to perform this operation.

The following code sample shows how to set theme background style in a presentation.

Get a Free API License

You can use Aspose.Slides for .NET without evaluation limitations by requesting a temporary license.

Conclusion

In this article, you have learned how to apply theme color, font and background style in PowerPoint presentations using C#. Moreover, you can install the API and integrate the provided code or customize it as per your requirements. In addition, you can visit the documentation to explore more about Aspose.Slides for .NET. Also, you can post your queries to our forum.

See Also