DocumentBase.DocumentTheme Property


Gets the Microsoft Office theme that is applied to the document.

Namespace:   Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word.v4.0.Utilities (in Microsoft.Office.Tools.Word.v4.0.Utilities.dll)

public OfficeTheme DocumentTheme { get; }

Property Value

Type: Microsoft.Office.Core.OfficeTheme

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

Use the ApplyDocumentTheme method to apply a Microsoft Office theme to the document.

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. To use this example, run it from the ThisDocument class in a document-level project.

private void GetDocumentTheme()
    Office.OfficeTheme theme = this.DocumentTheme;            
    Office.ThemeFontScheme fontScheme = theme.ThemeFontScheme;            
    Office.ThemeFont majorFont = fontScheme.MajorFont.Item(
    Office.ThemeFont minorFont = fontScheme.MinorFont.Item(
    MessageBox.Show("Name of major font in current document theme: "
        + majorFont.Name);
    MessageBox.Show("Name of minor font in current document theme: "
        + minorFont.Name);
Return to top