PowerPoint supports a range of themes that you can use in the presentations. In addition, you can define your themes as per your requirements. In this article, you will learn how to use themes in PowerPoint presentations dynamically, Particularly, the article will cover how to apply themes in PowerPoint presentations programmatically using Java.

Java API to Apply Themes in PowerPoint PPT

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

<repository>
    <id>AsposeJavaAPI</id>
    <name>Aspose Java API</name>
    <url>http://repository.aspose.com/repo/</url>
</repository>
<dependency>
    <groupId>com.aspose</groupId>
    <artifactId>aspose-slides</artifactId>
    <version>21.8</version>
    <classifier>jdk16</classifier>
</dependency>

Apply Theme in a PowerPoint Presentation in Java

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.

Apply PowerPoint Theme in Java - Set Theme Color

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

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

Set PowerPoint PPT Theme Font in Java

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 the theme font in a PowerPoint presentation using Java.

Change PPT Theme Background Style using Java

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 the theme background style in a presentation.

Work with PowerPoint Themes in Java - Get a Free License

You can work with themes in PowerPoint presentations without evaluation limitations by getting a free temporary license.

Conclusion

In this article, you have learned how to apply theme color, font, and background style in PowerPoint presentations using Java. You can simply install the API and integrate the provided code into your applications. In addition, you can visit the documentation to explore more about Aspose.Slides for Java. Also, you can post your queries to our forum.

See Also