Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0
Description

...

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.

...

Signature
C#C#
{excerpt}
{signature:C#}
 public sealed class NamedStyle
Signature
{signature}{signature:vb.net
vb.net
}
Public NotInheritable Class NamedStyle
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.

{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)
        
Example
Code Block
csharpcsharp
titleC#
Code Block
vb.nettitle
Properties

...

Name

...

Description

...

BuiltInStyleName

...

{code}

{example}
{properties}
||Name||Description||
|[BuiltInStyleName|NamedStyle.BuiltInStyleName]|{excerpt-include:NamedStyle.BuiltInStyleName

...

Font

|nopanel=true}|
|[Font|NamedStyle.Font]|{excerpt-include

...

:NamedStyle.Font

...

Name

|nopanel=true}|
|[Name|NamedStyle.Name]|{excerpt-include

...

:NamedStyle.Name

...

ParagraphFormatting

|nopanel=true}|
|[ParagraphFormatting|NamedStyle.ParagraphFormatting]|{excerpt-include

...

:NamedStyle.ParagraphFormatting

...

StyleType

|nopanel=true}|
|[StyleType|NamedStyle.StyleType]|{excerpt-include

...

:NamedStyle.StyleType

...

TableFormatting

|nopanel=true}|
|[TableFormatting|NamedStyle.TableFormatting]|{excerpt-include

...

:NamedStyle.TableFormatting

...

Classes

...

Name

...

Description

...

BuiltIn

...

Type

...

|nopanel=true}|
{classes}
||Name||Description||
|[BuiltIn|NamedStyle.BuiltIn]|{excerpt-include:NamedStyle.BuiltIn|nopanel=true}|
|[Type|NamedStyle.Type]|{excerpt-include:NamedStyle.Type|nopanel=true}|