Theme Class
Gets or sets the theme associated with the master element.
Declaration
public class Theme extends ThemeBase
Remarks
Themes define the overall visual appearance of a presentation. A theme consists of a coordinated set of colors, fonts, and formatting effects used throughout slides, layouts, and masters.
The Theme class defines the master theme for a presentation. Slide masters and notes masters inherit this theme and expose it through the getTheme() method.
The following code snippet retrieves the theme associated with the second slide:
import com.devexpress.docs.presentation.*;
import java.nio.file.*;
// Load a presentation.
try(Presentation presentation = new Presentation(
Files.readAllBytes(Path.of("presentation.pptx")))) {
// Access the second slide.
Slide slide = presentation.getSlides().get(1);
// Find the slide master associated with the slide layout.
SlideMaster slideMaster = null;
SlideLayout targetLayout = slide.getLayout();
for (SlideMaster master : presentation.getSlideMasters()) {
for(SlideLayout layout : master.getLayouts()) {
if (layout == targetLayout) {
slideMaster = master;
break;
}
}
if(slideMaster != null) {
break;
}
}
// Access the master theme associated with the slide.
Theme theme = slideMaster != null ? slideMaster.getTheme() : null;
// Perform additional presentation processing logic.
}
Refer to the following help topic for additional information: Customize Presentation Themes.
Inherited Members
Inheritance
Theme()
Initializes a new instance of the Theme class.
Declaration
public Theme()
Methods
deepClone() Method
Clones the current Theme instance.
Declaration
public Theme deepClone()
Returns
| Type | Description |
|---|---|
Theme |
The cloned |
getName() Method
Returns the theme name.
Declaration
public String getName()
Returns
| Type | Description |
|---|---|
| String | The theme name. |
setName(String value) Method
Sets the theme name.
Declaration
public void setName(String value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | String | The theme name. |