Working with Themes

How to Apply a Preset theme to a Page or a Shape

This article can be useful to anyone who wants to modify the theme of a giving VSDX file using Aspose.Diagram. We use a test file Themes1.vsdx, look like below.

Theme1.vsdx
Theme1.vsdx

Apply a Preset Theme to a Page

Aspose.Diagram APIs allows to apply a preset theme to get a uniform look and feel to shapes within a page, and across multiple documents. Perform the following steps in order to do this:

  • Create an instance of Diagram class to load a diagram
  • Get an instance of Page class to be set theme
  • Assign a Preset value to the PresetTheme property of the Page instance

Apply a Preset Theme to a Page Programming Sample

Result of Apply a Preset Theme to a Page
SetTheme_out.vsdx

Apply a Preset Theme Variant to a Page

Aspose.Diagram APIs allows to apply a preset theme variant to get a uniform look and feel to shapes within a page, and across multiple documents. Perform the following steps in order to do this:

  • Create an instance of Diagram class to load a diagram
  • Get an instance of Page class to be set theme
  • Assign a Preset value to the PresetTheme property of the Page instance
  • Assign a Preset value to the PresetThemeVariant property of the Page instance

Apply a Preset Theme Variant to a Page Programming Sample

Result of Apply a Preset Theme Variant to a Page
SetTheme_out.vsdx

Apply a Preset Theme to a Shape

Aspose.Diagram APIs allows to apply a preset theme to a shape within a page. Perform the following steps in order to do this:

  • Create an instance of Diagram class to load a diagram
  • Get an instance of Shape class to be set theme
  • Assign a Preset value to the PresetTheme property of the Shape instance

Apply a Preset Theme to a Shape Programming Sample

Result of Apply a Preset Theme to a Shape
SetTheme_out.vsdx

Apply a Preset Theme Variant to a Shape

Aspose.Diagram APIs allows to apply a preset theme variant to a shape within a page. Perform the following steps in order to do this:

  • Create an instance of Diagram class to load a diagram
  • Get an instance of Shape class to be set theme
  • Assign a Preset value to the PresetTheme property of the Shape instance
  • Assign a Preset value to the PresetThemeVariant property of the Shape instance

Apply a Preset Theme Variant to a Shape Programming Sample

Result of Apply a Preset Theme Variant to a Shape
SetTheme_out.vsdx

Apply a Preset Theme Variant Quickstyle to a Shape

Aspose.Diagram APIs allows to apply a preset theme quickstyle to a shape within a page. Perform the following steps in order to do this:

  • Create an instance of Diagram class to load a diagram
  • Get an instance of Shape class to be set theme
  • Assign a Preset value to the PresetTheme property of the Shape instance
  • Assign a Preset value to the PresetThemeVariant property of the Shape instance
  • Assign a Preset value to the PresetThemeQuickStyle property of the Shape instance

Apply a Preset Theme Variant Quickstyle to a Shape Programming Sample

Result of Apply a Preset Theme Variant Quickstyle to a Shape
SetTheme_out.vsdx

Apply a Preset Theme Style to a Shape Using SetPresetThemeStyleMatrics Method

Aspose.Diagram APIs allows to apply a preset theme quickstyle to a shape within a page. Perform the following steps in order to do this:

  • Create an instance of Diagram class to load a diagram
  • Get an instance of Shape class to be set theme
  • Assign a Preset value to the PresetTheme property of the Shape instance
  • Assign a Preset value to the PresetThemeVariant property of the Shape instance
  • Assign a theme style by setting style value and color value of the Shape instance using SetPresetThemeStyleMatrics Method

Apply a Preset Theme Style to a Shape Using SetPresetThemeStyleMatrics Method Programming Sample

Result of Apply a Preset Theme Style to a Shape Using SetPresetThemeStyleMatrics Method
SetTheme_out.vsdx