Page tree
Skip to end of metadata
Go to start of metadata

Description

The NamedStyle class represents a named style, such as "Normal", "Heading 1", etc., that is embedded in a Word document.
C#
vb.net

Remarks

You cannot create a new named style programmatically. You can only work with Named Styles that are in an existing document. You can obtain an instance of this class from the Document.Styles collection. You can apply a style to different sections and elements within your document. You cannot, however, modify a named style using WordWriter.

The following sample retrieves a copy of the Heading 1 style and applies it to a new paragraph.

Examples

C#
vb.net

Properties

Name

Description

BuiltInStyleName

Returns a NamedStyle.BuiltIn object that represents the culture-independent name of this style. This is only useful for built-in styles that come with Word. Any custom styles will return UserDefined.

Font

Returns a Font object that is a copy of this style's font. Some style types do not have character formatting. In these cases, this method returns null.

Name

Returns a String representing the name of this NamedStyle.

ParagraphFormatting

Returns a ParagraphFormatting object that is a copy of this style's paragraph formatting. Some style types do not have paragraph formatting. In these cases, this method returns null.

StyleType

Returns a NamedStyle.Type object that represents the type of this style. Word 2003 supports four style types: Character, Paragraph, Table, and List. Older versions support fewer than this.

TableFormatting

Returns a TableFormatting object that is a copy of this style's table formatting. Some style types do not have table formatting. In these cases, this method returns null.

Nested Classes

Name

Description

BuiltIn

Named styles that are built-in to Word.

Type

Types of named styles.
  • No labels