Partager via


DocumentBase.StyleSheets Property

Definition

Gets a StyleSheets object that represents the Web style sheets attached to the document.

public:
 property Microsoft::Office::Interop::Word::StyleSheets ^ StyleSheets { Microsoft::Office::Interop::Word::StyleSheets ^ get(); };
public Microsoft.Office.Interop.Word.StyleSheets StyleSheets { get; }
member this.StyleSheets : Microsoft.Office.Interop.Word.StyleSheets
Public ReadOnly Property StyleSheets As StyleSheets

Property Value

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 void DocumentStyleSheets()
{
    this.StyleSheets.Add("c:\\WebSite.css", Microsoft.Office.
        Interop.Word.WdStyleSheetLinkType.wdStyleSheetLinkTypeLinked, 
        "myStyleSheet", Word.WdStyleSheetPrecedence.
        wdStyleSheetPrecedenceHighest);

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

Applies to