Partager via


DocumentBase.Styles Property

Gets a Styles collection for the document.

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

Syntax

'Declaration
Public ReadOnly Property Styles As Styles
public Styles Styles { get; }

Property Value

Type: Microsoft.Office.Interop.Word.Styles
A Styles collection for the document.

Examples

The following code example creates a new style named "myStyle" and sets its font size to 26 points. To use this example, run it from the ThisDocument class in a document-level project.

Private Sub DocumentStyles()
    Dim Indexes As Object = "myStyle" 
    Dim type As Object = Word.WdStyleType.wdStyleTypeParagraph
    Me.Styles.Add("myStyle", type)
    Me.Styles.Item(Indexes).Font.Size = 26
End Sub
private void DocumentStyles()
{
    this.Styles.Add("myStyle", Word.WdStyleType.wdStyleTypeParagraph);
    this.Styles["myStyle"].Font.Size = 26;
}

.NET Framework Security

See Also

Reference

DocumentBase Class

Microsoft.Office.Tools.Word Namespace