Partilhar via


Document.ActiveWritingStyle Property

Gets the writing style for a specified language in the document.

Namespace:  Microsoft.Office.Tools.Word
Assemblies:   Microsoft.Office.Tools.Word.v4.0.Utilities (in Microsoft.Office.Tools.Word.v4.0.Utilities.dll)
  Microsoft.Office.Tools.Word (in Microsoft.Office.Tools.Word.dll)

Syntax

'Declaration
ReadOnly Property ActiveWritingStyle As Document_ActiveWritingStyleType
Document_ActiveWritingStyleType ActiveWritingStyle { get; }

Property Value

Type: Microsoft.Office.Tools.Word.Document_ActiveWritingStyleType
A string that specifies the writing style for a specified language in the document.

Remarks

The ActiveWritingStyle property is intended to be used with the following parameter.

Parameter

Description

LanguageID

One of the WdLanguageID values that specifies the language to set the writing style for in the specified document.

If you use the ActiveWritingStyle property without specifying a parameter, it returns a Document_ActiveWritingStyleType object that is is not intended to be used directly from your code.

To get a list of the available writing styles, use the WritingStyleList property.

Examples

The following code example displays the writing style of the text in the current selection. This example is for an application-level add-in.

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 Security

See Also

Reference

Document Interface

Microsoft.Office.Tools.Word Namespace