Wiki Markup |
---|
{description} {excerpt}ExcelWriter has three style types: [CellStyle|CellStyle], [GlobalStyle|GlobalStyle], and [NamedStyle|NamedStyle].{excerpt} {signature:C#} public class Style {signature}{signature:vb.net} Public Class Style {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()|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") {code} {example} {properties} ||Name||Description|| |[BackgroundColor|Style.BackgroundColor]|{excerpt-include:Style.BackgroundColor|nopanel=true}| |[Border|Style.Border]|{excerpt-include:Style.Border|nopanel=true}| |[CellLocked|Style.CellLocked]|{excerpt-include:Style.CellLocked|nopanel=true}| |[Font|Style.Font]|{excerpt-include:Style.Font|nopanel=true}| |[ForegroundColor|Style.ForegroundColor]|{excerpt-include:Style.ForegroundColor|nopanel=true}| |[HideFormulas|Style.HideFormulas]|{excerpt-include:Style.HideFormulas|nopanel=true}| |[HorizontalAlignment|Style.HorizontalAlignment]|{excerpt-include:Style.HorizontalAlignment|nopanel=true}| |[IndentLevel|Style.IndentLevel]|{excerpt-include:Style.IndentLevel|nopanel=true}| |[JustifyDistributed|Style.JustifyDistributed]|{excerpt-include:Style.JustifyDistributed|nopanel=true}| |[NumberFormat|Style.NumberFormat]|{excerpt-include:Style.NumberFormat|nopanel=true}| |[Orientation|Style.Orientation]|{excerpt-include:Style.Orientation|nopanel=true}| |[Pattern|Style.Pattern]|{excerpt-include:Style.Pattern|nopanel=true}| |[ShrinkToFit|Style.ShrinkToFit]|{excerpt-include:Style.ShrinkToFit|nopanel=true}| |[TextDirection|Style.TextDirection]|{excerpt-include:Style.TextDirection|nopanel=true}| |[VerticalAlignment|Style.VerticalAlignment]|{excerpt-include:Style.VerticalAlignment|nopanel=true}| |[WrapText|Style.WrapText]|{excerpt-include:Style.WrapText|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}| |
Page History
Overview
Content Tools