Page tree

Versions Compared

Key

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

Excerpt

ExcelWriter has three style types: CellStyle, GlobalStyle, and NamedStyle.

|Workbook.GetNamedStyle(String)].

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

          //--- Open existing spreadsheet
          ExcelApplication xla = new ExcelApplication();
          Workbook wb = xla.Open(@"C:\MySpreadsheet.xls");

          //--- Create GlobalStyle
          Style global = wb.CreateStyle();

          //--- Create NamedStyle
          Style newNamed = wb.CreateNamedStyle("MyStyle");

          //--- Get NamedStyle
          Style existingNamed = wb.GetNamedStyle("ExistingStyle");
        
{code}
{code:vbnet|title=vb.net
}

          '--- Open existing spreadsheet
          Dim xla As New ExcelApplication()
          Dim wb As Workbook = xla.Open("C:\MySpreadsheet")

          '--- Create GlobalStyle
          Dim global As Style = wb.CreateStyle()

          '--- Create NamedStyle
          Dim newNamed As Style = wb.CreateNamedStyle("MyStyle")

          '--- Get NamedStyle
          Dim existingNamed As Style = wb.GetNamedStyle("ExistingStyle")
        
Signature
C#C#
Wiki Markup
{description}
{excerpt}ExcelWriter has three style types: [CellStyle|CellStyle], [GlobalStyle|GlobalStyle], and [NamedStyle|NamedStyle].{excerpt}
{signature:C#}
 public class Style
Signature
{signature}{signature:vb.net
vb.net
}
Public Class Style
Remarks

All three types derive from the Style class, and NamedStyle derives from GlobalStyle.

You cannot create a CellStyle, only manipulate existing ones as part of the objects they apply to. To create a GlobalStyle, use
{signature}
{remarks}
All three types derive from the [Style|Style] class, and {{NamedStyle}} derives from {{GlobalStyle}}.

You cannot create a CellStyle, only manipulate existing ones as part of the objects they apply to.  To create a {{GlobalStyle}}, use [Workbook.CreateStyle()|Workbook.CreateStyle()]. To create a {{NamedStyle}}, use [Workbook.CreateNamedStyle()|Workbook.CreateNamedStyle(String)]. To get a {{NamedStyle}} from an existing document, use [Workbook.GetNamedStyle()
.
Example
Code Block
csharpcsharp
titleC#
Code Block
vbnetvbnettitle
Properties

...

Name

...

Description

...

BackgroundColor

...

{code}

{example}
{properties}
||Name||Description||
|[BackgroundColor|Style.BackgroundColor]|{excerpt-include:Style.BackgroundColor

...

Border

|nopanel=true}|
|[Border|Style.Border]|{excerpt-include

...

:Style.Border

...

CellLocked

|nopanel=true}|
|[CellLocked|Style.CellLocked]|{excerpt-include

...

:Style.CellLocked

...

Font

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

...

:Style.Font

...

ForegroundColor

|nopanel=true}|
|[ForegroundColor|Style.ForegroundColor]|{excerpt-include

...

:Style.ForegroundColor

...

HideFormulas

|nopanel=true}|
|[HideFormulas|Style.HideFormulas]|{excerpt-include

...

:Style.HideFormulas

...

HorizontalAlignment

|nopanel=true}|
|[HorizontalAlignment|Style.HorizontalAlignment]|{excerpt-include

...

:Style.HorizontalAlignment

...

IndentLevel

|nopanel=true}|
|[IndentLevel|Style.IndentLevel]|{excerpt-include

...

:Style.IndentLevel

...

JustifyDistributed

|nopanel=true}|
|[JustifyDistributed|Style.JustifyDistributed]|{excerpt-include

...

:Style.JustifyDistributed

...

NumberFormat

|nopanel=true}|
|[NumberFormat|Style.NumberFormat]|{excerpt-include

...

:Style.NumberFormat

...

Orientation

|nopanel=true}|
|[Orientation|Style.Orientation]|{excerpt-include

...

:Style.Orientation

...

Pattern

|nopanel=true}|
|[Pattern|Style.Pattern]|{excerpt-include

...

:Style.Pattern

...

ShrinkToFit

|nopanel=true}|
|[ShrinkToFit|Style.ShrinkToFit]|{excerpt-include

...

:Style.ShrinkToFit

...

TextDirection

|nopanel=true}|
|[TextDirection|Style.TextDirection]|{excerpt-include

...

:Style.TextDirection

...

VerticalAlignment

|nopanel=true}|
|[VerticalAlignment|Style.VerticalAlignment]|{excerpt-include

...

:Style.VerticalAlignment

...

WrapText

|nopanel=true}|
|[WrapText|Style.WrapText]|{excerpt-include

...

:Style.WrapText

...

Classes

...

Name

...

Description

...

ColumnInsertBehavior

...

HAlign

...

RowInsertBehavior

...

TextDir

...

VAlign

...

|nopanel=true}|
{classes}
||Name||Description||
|[ColumnInsertBehavior|Style.ColumnInsertBehavior]|{excerpt-include:Style.ColumnInsertBehavior|nopanel=true}|
|[HAlign|Style.HAlign]|{excerpt-include:Style.HAlign|nopanel=true}|
|[RowInsertBehavior|Style.RowInsertBehavior]|{excerpt-include:Style.RowInsertBehavior|nopanel=true}|
|[TextDir|Style.TextDir]|{excerpt-include:Style.TextDir|nopanel=true}|
|[VAlign|Style.VAlign]|{excerpt-include:Style.VAlign|nopanel=true}|