Partager via


DocumentBase.StyleSheets Property

Gets a StyleSheets object that represents the Web style sheets attached 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)

Syntax

'Declaration
Public ReadOnly Property StyleSheets As StyleSheets
public StyleSheets StyleSheets { get; }

Property Value

Type: Microsoft.Office.Interop.Word.StyleSheets
A StyleSheets object that represents the Web style sheets attached to the document.

Examples

The following code example adds a style sheet to the document. The code example assumes that a style sheet called WebSite.css exists at the root of the C directory. To use this example, run it from the ThisDocument class in a document-level project.

Private Sub DocumentStyleSheets()
    Me.StyleSheets.Add("c:\WebSite.css", Microsoft.Office.Interop.Word. _
        WdStyleSheetLinkType.wdStyleSheetLinkTypeLinked, "myStyleSheet", _
        Word.WdStyleSheetPrecedence.wdStyleSheetPrecedenceHighest)
End Sub
private void DocumentStyleSheets()
{
    this.StyleSheets.Add("c:\\WebSite.css", Microsoft.Office.
        Interop.Word.WdStyleSheetLinkType.wdStyleSheetLinkTypeLinked, 
        "myStyleSheet", Word.WdStyleSheetPrecedence.
        wdStyleSheetPrecedenceHighest);

}

.NET Framework Security

See Also

Reference

DocumentBase Class

Microsoft.Office.Tools.Word Namespace