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}The [NamedStyle|NamedStyle] class represents a named style, such as "Normal", "Heading 1", etc., that is embedded in a Word document.{excerpt}
{signature:C#}
 public sealed class NamedStyle
{signature}{signature:vb.net}
Public NotInheritable Class NamedStyle
{signature}
{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|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.

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

          NamedStyle heading1Style = doc.Styles[NamedStyle.BuiltIn.Heading1];
          Paragraph p = doc.InsertParagraphAfter(heading1Style);
        {code}
{code:vb.net|title=vb.net}

          Dim heading1Style As NamedStyle = doc.Styles(NamedStyle.BuiltIn.Heading1)
          Dim p As Paragraph = doc.InsertParagraphAfter(heading1Style)
        {code}

{example}
{properties}
||Name||Description||
|[BuiltInStyleName|NamedStyle.BuiltInStyleName]|{excerpt-include:NamedStyle.BuiltInStyleName|nopanel=true}|
|[Font|NamedStyle.Font]|{excerpt-include:NamedStyle.Font|nopanel=true}|
|[Name|NamedStyle.Name]|{excerpt-include:NamedStyle.Name|nopanel=true}|
|[ParagraphFormatting|NamedStyle.ParagraphFormatting]|{excerpt-include:NamedStyle.ParagraphFormatting|nopanel=true}|
|[StyleType|NamedStyle.StyleType]|{excerpt-include:NamedStyle.StyleType|nopanel=true}|
|[TableFormatting|NamedStyle.TableFormatting]|{excerpt-include:NamedStyle.TableFormatting|nopanel=true}|
{classes}
||Name||Description||
|[BuiltIn|NamedStyle.BuiltIn]|{excerpt-include:NamedStyle.BuiltIn|nopanel=true}|
|[Type|NamedStyle.Type]|{excerpt-include:NamedStyle.Type|nopanel=true}|