WorkbookBase.Theme プロパティ

定義

ブックに適用されているテーマを取得します。

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

プロパティ値

ブックに適用されるテーマを表す Microsoft.Office.Core.OfficeTheme。

次のコード例では、現在のブックのテーマを取得します。 次に、ブック テーマのフォント パターンで見つかったメジャー フォントとマイナー フォントの名前を表示します。

この例は、ドキュメント レベルのカスタマイズ用です。

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

適用対象