WorkbookBase.Theme 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取应用于工作簿的主题。
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