Document.ActiveWritingStyle Property (2007 System)

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

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

Syntax

'Declaration
<BrowsableAttribute(False)> _
Public Overridable ReadOnly Property ActiveWritingStyle As Document._ActiveWritingStyleType
'Usage
Dim instance As Document 
Dim value As Document._ActiveWritingStyleType 

value = instance.ActiveWritingStyle
[BrowsableAttribute(false)]
public virtual Document._ActiveWritingStyleType ActiveWritingStyle { get; }
[BrowsableAttribute(false)]
public:
virtual property Document._ActiveWritingStyleType^ ActiveWritingStyle {
    Document._ActiveWritingStyleType^ get ();
}
public function get ActiveWritingStyle () : Document._ActiveWritingStyleType

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 attempt to use ActiveWritingStyle without specifying a parameter, ActiveWritingStyle will get a Document._ActiveWritingStyleType object that is part of the Visual Studio Tools for Office infrastructure and is not intended to be used directly from your code.

The WritingStyleList property returns an array of the names of the available writing styles.

Examples

The following code example displays the writing style of the text in the current selection.

This version is for a document-level customization.

Private Sub DocumentActiveWritingStyle()
    MessageBox.Show(Me.ActiveWritingStyle(Me.Application.Selection. _
        LanguageID).ToString())
End Sub
private void DocumentActiveWritingStyle()
{
    MessageBox.Show(this.ActiveWritingStyle[this.Application. 
        Selection.LanguageID].ToString());
}

This version is for an application-level add-in.

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

.NET Framework Security

See Also

Reference

Document Class

Document Members

Microsoft.Office.Tools.Word Namespace

Change History

Date

History

Reason

July 2008

Added a version of the code example for an application-level add-in.

SP1 feature change.