Compartilhar via


DocumentBase.ActiveTheme Property

Gets the name of the active theme plus the theme formatting options for the document.

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

Syntax

'Declaration
Public ReadOnly Property ActiveTheme As String
public string ActiveTheme { get; }

Property Value

Type: System.String
The name of the active theme plus the theme formatting options for the document.

Remarks

This property returns "none" if the document does not have an active theme.

For an explanation of the value returned by this property, see the Name argument of the ApplyTheme method. The value returned by this property might not correspond to the theme's display name. To return a theme's display name, use the ActiveThemeDisplayName property.

Examples

The following code example applies a theme called Afternoon to the document and then displays a message that shows the name of the active theme. To use this example, run it from the ThisDocument class in a document-level project.

Private Sub DocumentActiveTheme()
        Me.ApplyTheme("AFTRNOON 011")
        MessageBox.Show("The " & Me.ActiveTheme.ToString() & " theme has been" _
            & " applied to this document." & vbLf & "The display name is " _
            & Me.ActiveThemeDisplayName & ".")
    End Sub
private void DocumentActiveTheme()
{
    this.ApplyTheme("AFTRNOON 011");
    MessageBox.Show ("The " + this.ActiveTheme.ToString() + " theme has been"
        + " applied to this document." + "\n" + "The display name is " 
        + this.ActiveThemeDisplayName + ".");
}

.NET Framework Security

See Also

Reference

DocumentBase Class

Microsoft.Office.Tools.Word Namespace