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

public sealed class NamedStyle
Public NotInheritable Class NamedStyle

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.

		  //Set Named Style when element is created
          NamedStyle heading1Style = doc.Styles[NamedStyle.BuiltIn.Heading1];
          Paragraph p = doc.InsertParagraphAfter(heading1Style);
 
		  //Set style of existing element
          p.Style = oDocument.Styles[NamedStyle.BuiltIn.Heading1];
          //Set named style when element is created
          Dim heading1Style As NamedStyle = doc.Styles(NamedStyle.BuiltIn.Heading1)
          Dim p As Paragraph = doc.InsertParagraphAfter(heading1Style)
 
          //Set style of existing element
          p.Style = oDocument.Styles(NamedStyle.BuilIn.Heading1)
        

Name

Description

BuiltInStyleName

Font

Name

ParagraphFormatting

StyleType

TableFormatting

Name

Description

BuiltIn

Type