Export (0) Print
Expand All
Expand Minimize

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)

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 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());
}

Show:
© 2014 Microsoft