共用方式為


DocumentBase.ApplyDocumentTheme Method

Applies a document theme to a 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 Sub ApplyDocumentTheme ( _
    fileName As String _
)
public void ApplyDocumentTheme(
    string fileName
)

Parameters

  • fileName
    Type: System.String

    The full path of the theme to apply.

Examples

The following code example switches the document theme to the Foundry theme. To use this example, run it from the ThisDocument class in a document-level project.

Private Sub SwitchToFoundryTheme()
    Me.ApplyDocumentTheme("C:\Program Files\Microsoft Office\" + _
                          "Document Themes 12\Foundry.thmx")
End Sub
private void SwitchToFoundryTheme()
{
    this.ApplyDocumentTheme(@"C:\Program Files\Microsoft Office\" + 
                      @"Document Themes 12\Foundry.thmx");
}

.NET Framework Security

See Also

Reference

DocumentBase Class

Microsoft.Office.Tools.Word Namespace