Share via


DocumentBase.Styles Property

Definition

Gets a Styles collection for the document.

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

Property Value

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 void DocumentStyles()
{
    this.Styles.Add("myStyle", Word.WdStyleType.wdStyleTypeParagraph);
    this.Styles["myStyle"].Font.Size = 26;
}
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 

Applies to