Document.DocumentTheme Property (2007 System)
Gets the Microsoft Office theme that is applied to the document.
Namespace: Microsoft.Office.Tools.Word
Assembly: Microsoft.Office.Tools.Word.v9.0 (in Microsoft.Office.Tools.Word.v9.0.dll)
Syntax
'Declaration
<BrowsableAttribute(False)> _
Public ReadOnly Property DocumentTheme As OfficeTheme
'Usage
Dim instance As Document
Dim value As OfficeTheme
value = instance.DocumentTheme
[BrowsableAttribute(false)]
public OfficeTheme DocumentTheme { get; }
[BrowsableAttribute(false)]
public:
property OfficeTheme^ DocumentTheme {
OfficeTheme^ get ();
}
public function get DocumentTheme () : OfficeTheme
Property Value
Type: OfficeTheme
A OfficeTheme object that represents the Microsoft Office theme that is applied to the document.
Remarks
Use the ApplyDocumentTheme method to apply a Microsoft Office theme to the document.
Examples
The following code example retrieves the current document theme and its corresponding font scheme. The code then retrieves and displays the names of the major font and the minor font of the Latin font face in a message box.
This example is for a document-level customization.
Private Sub GetDocumentTheme()
Dim theme As Office.OfficeTheme = Me.DocumentTheme
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
private void GetDocumentTheme()
{
Office.OfficeTheme theme = this.DocumentTheme;
Office.ThemeFontScheme fontScheme = theme.ThemeFontScheme;
Office.ThemeFont majorFont = fontScheme.MajorFont.Item(
Office.MsoFontLanguageIndex.msoThemeLatin);
Office.ThemeFont minorFont = fontScheme.MinorFont.Item(
Office.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);
}
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.