Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin
Description

Excerpt

This class is used to store the styles of a document. It is essentially a collection of named styles.

Signature
C#
C#
[DefaultMember("Item")]
 public sealed class Styles
Signature
vb.net
vb.net
<DefaultMember("Item")> _
	Public NotInheritable Class Styles
Remarks

You cannot create styles programmatically. You can only access Named Styles from an existing document. At this time, styles are read-only, but in the future you will be able to modify Named Styles using WordWriter.

The following example demonstrates how to get the styles from a document.

Example
Code Block
csharp
csharp
titleC#

          WordApplication app = new WordApplication();
          Document doc = app.Open(@"C:\sample.doc");
          Styles styls = doc.Styles;
        
Code Block
vb.net
vb.net
titlevb.net

          Dim app As New WordApplication()
          Dim doc As Document = app.Open("C:\sample.doc")
          Dim styls As Styles = doc.Styles
        
Indexers

Name

Description

Item(Int32)

Excerpt Include
Styles.Item(Int32)
Styles.Item(Int32)
nopaneltrue

Item(NamedStyle.BuiltIn)

Excerpt Include
Styles.Item(NamedStyle.BuiltIn)
Styles.Item(NamedStyle.BuiltIn)
nopaneltrue

Item(String)

Excerpt Include
Styles.Item(String)
Styles.Item(String)
nopaneltrue
Methods

Name

Description

Length()

Excerpt Include
Styles.Length()
Styles.Length()
nopaneltrue