Share via


Document.ActiveWritingStyle Property

Definition

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

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

Property Value

A string that specifies the writing style for a specified language in the document.

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 void DocumentActiveWritingStyle()
{
    Document vstoDoc = Globals.Factory.GetVstoObject(this.Application.ActiveDocument);
    System.Windows.Forms.MessageBox.Show(vstoDoc.ActiveWritingStyle[vstoDoc.Application. 
        Selection.LanguageID].ToString());
}
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

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.

Applies to