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

 public class Style
Public Class Style

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 Workbook.CreateStyle(). To create a NamedStyle, use Workbook.CreateNamedStyle(). To get a NamedStyle from an existing document, use Workbook.GetNamedStyle().


          //--- 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");
        

          '--- 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")
        

Name

Description

BackgroundColor

Border

CellLocked

Font

ForegroundColor

HideFormulas

HorizontalAlignment

IndentLevel

JustifyDistributed

NumberFormat

Orientation

Pattern

ShrinkToFit

TextDirection

VerticalAlignment

WrapText

Name

Description

ColumnInsertBehavior

HAlign

RowInsertBehavior

TextDir

VAlign