Document.ActiveWritingStyle Property

 

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

Namespace:   Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word (in Microsoft.Office.Tools.Word.dll)

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.

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 P:Microsoft.Office.Interop.Word.Language.WritingStyleList property.

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());
}
Return to top
Show: