Document.ActiveWritingStyle 屬性

取得所指定語言在文件中的撰寫樣式。

命名空間:  Microsoft.Office.Tools.Word
組件:   Microsoft.Office.Tools.Word.v4.0.Utilities (在 Microsoft.Office.Tools.Word.v4.0.Utilities.dll 中)
  Microsoft.Office.Tools.Word (在 Microsoft.Office.Tools.Word.dll 中)

語法

'宣告
ReadOnly Property ActiveWritingStyle As Document_ActiveWritingStyleType
Document_ActiveWritingStyleType ActiveWritingStyle { get; }

屬性值

型別:Microsoft.Office.Tools.Word.Document_ActiveWritingStyleType
字串,指定所指定語言在文件中的撰寫樣式。

備註

ActiveWritingStyle 屬性必須與下列參數一起使用。

參數

描述

LanguageID

其中一個 WdLanguageID 值,指定語言以設定在指定文件中的撰寫樣式。

如果使用未指定參數的 ActiveWritingStyle 屬性,則它會傳回 Document_ActiveWritingStyleType 物件,該物件並不適合直接從您的程式碼使用。

若要取得可用寫作樣式清單,使用 WritingStyleList 屬性。

範例

下列程式碼範例會顯示目前選取範圍中文字的撰寫樣式。 這是應用程式層級增益集的範例。

Private Sub DocumentActiveWritingStyle()
    Dim vstoDoc As Document = Globals.Factory.GetVstoObject(Me.Application.ActiveDocument)
    System.Windows.Forms.MessageBox.Show(vstoDoc.ActiveWritingStyle( _
        vstoDoc.Application.Selection. _
        LanguageID).ToString())
End Sub
private void DocumentActiveWritingStyle()
{
    Document vstoDoc = Globals.Factory.GetVstoObject(this.Application.ActiveDocument);
    System.Windows.Forms.MessageBox.Show(vstoDoc.ActiveWritingStyle[vstoDoc.Application. 
        Selection.LanguageID].ToString());
}

.NET Framework 安全性

請參閱

參考

Document 介面

Microsoft.Office.Tools.Word 命名空間