Message-ID: <2135777555.10225.1711718135529.JavaMail.web05$@web05> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_10224_1469390744.1711718135529" ------=_Part_10224_1469390744.1711718135529 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html NamedStyle

NamedStyle

Description

The=20 NamedStyle class represents a named style, such as "Norma= l", "Heading 1", etc., that is embedded in a Word document.= =20
C#
=20
public sealed class NamedStyle
=20
=20
vb.net
=20
Public NotInheritable Class NamedStyle
=20
=20

Remarks

=20

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 insta= nce of this class from the Document.Styles collection. You can apply a style to differe= nt 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.

=20

Examples

=20
C#
=20
=09=09  //Set Named Style when element is created
          NamedStyle heading1Style =3D doc.Styles[NamedStyle.BuiltIn.Headin=
g1];
          Paragraph p =3D doc.InsertParagraphAfter(heading1Style);
 
=09=09  //Set style of existing element
          p.Style =3D oDocument.Styles[NamedStyle.BuiltIn.Heading1];
= =20
vb.net
=20
          //Set named style when element is created
          Dim heading1Style As NamedStyle =3D doc.Styles(NamedStyle.BuiltIn=
.Heading1)
          Dim p As Paragraph =3D doc.InsertParagraphAfter(heading1Style)
 
          //Set style of existing element
          p.Style =3D oDocument.Styles(NamedStyle.BuilIn.Heading1)
        
=20

Properties

Name

Description

BuiltInStyleName

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

Fon= t

Returns a Font object that is a copy of this style's font. Some style types d= o not have character formatting. In these cases, this method returns null.<= /td>

Nam= e

Returns a String representing the n= ame of this NamedStyle.

ParagraphFormatting

Returns a ParagraphFormatting object that is a copy of this style's parag= raph formatting. Some style types do not have paragraph formatting. In thes= e 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. Old= er versions support fewer than this.

TableFormatting

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

Nested Classes

Name

Description

= BuiltIn

Named styles that are built-in to Word.

Typ= e

Types of named styles.
------=_Part_10224_1469390744.1711718135529--