DocumentBase.StyleSheets 属性

定义

获取一个 StyleSheets 对象,该对象表示附加到文档的 Web 样式表。

public Microsoft.Office.Interop.Word.StyleSheets StyleSheets { get; }

属性值

StyleSheets

一个 StyleSheets 对象,表示附加到文档的 Web 样式表。

示例

下面的代码示例将样式表添加到文档中。 此代码示例假定名为 "网站" 的样式表位于 C 目录的根目录中。 若要使用此示例,请在 ThisDocument 文档级项目的类中运行它。

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 

适用于