WorkbookBase.Theme Property

Definition

Gets the theme that is applied to the workbook.

public:
 property Microsoft::Office::Core::OfficeTheme ^ Theme { Microsoft::Office::Core::OfficeTheme ^ get(); };
public Microsoft.Office.Core.OfficeTheme Theme { get; }
member this.Theme : Microsoft.Office.Core.OfficeTheme
Public ReadOnly Property Theme As OfficeTheme

Property Value

A Microsoft.Office.Core.OfficeTheme that represents the theme that is applied to the workbook.

Examples

The following code example retrieves the theme of the current workbook. The example then displays the names of the major font and minor font found in the font scheme of the workbook theme.

This example is for a document-level customization.

private void GetDocumentTheme()
{
    Office.OfficeTheme theme = this.Theme;
    Office.ThemeFontScheme fontScheme = theme.ThemeFontScheme;
    Office.ThemeFont majorFont = fontScheme.MajorFont.Item(
        Microsoft.Office.Core.MsoFontLanguageIndex.msoThemeLatin);
    Office.ThemeFont minorFont = fontScheme.MinorFont.Item(
        Microsoft.Office.Core.MsoFontLanguageIndex.msoThemeLatin);
    MessageBox.Show("Name of major font in current document theme: "
                    + majorFont.Name);
    MessageBox.Show("Name of minor font in current document theme: "
                    + minorFont.Name);
}
Private Sub GetDocumentTheme()
    Dim theme As Office.OfficeTheme = Me.Theme
    Dim fontScheme As Office.ThemeFontScheme = theme.ThemeFontScheme
    Dim majorFont As Office.ThemeFont = fontScheme.MajorFont.Item( _
        Microsoft.Office.Core.MsoFontLanguageIndex.msoThemeLatin)
    Dim minorFont As Office.ThemeFont = fontScheme.MinorFont.Item( _
        Microsoft.Office.Core.MsoFontLanguageIndex.msoThemeLatin)
    MessageBox.Show("Name of major font in current document theme: " _
                    + majorFont.Name)
    MessageBox.Show("Name of minor font in current document theme: " _
                    + minorFont.Name)
End Sub

Applies to