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
Wiki Markup
{description}
{excerpt}This class is used to store the styles of a document. It is essentially a collection of named styles.{excerpt}
{signature:C#}
[DefaultMember("Item")]
 public sealed class Styles
{signature}{signature:vb.net}
<DefaultMember("Item")> _
	Public NotInheritable Class Styles
{signature}
{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.

{remarks}
{example}{code:csharp|title=C#}

          WordApplication app = new WordApplication();
          Document doc = app.Open(@"C:\sample.doc");
          Styles styls = doc.Styles;
        {code}
{code:vb.net|title=vb.net}

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

{example}
{indexers}
||Name||Description||
|[Item(Int32)|Styles.Item(Int32)]|{excerpt-include:Styles.Item(Int32)|nopanel=true}|
|[Item(NamedStyle.BuiltIn)|Styles.Item(NamedStyle.BuiltIn)]|{excerpt-include:Styles.Item(NamedStyle.BuiltIn)|nopanel=true}|
|[Item(String)|Styles.Item(String)]|{excerpt-include:Styles.Item(String)|nopanel=true}|
{methods}
||Name||Description||
|[Length()|Styles.Length()]|{excerpt-include:Styles.Length()|nopanel=true}|