This content is for v4.x (Alpha). Switch to the Stable version.
Style is instance object per excel created to maintain for performance of the document creation process. This instance provides a common handle to set a style combination once refer it across the spreadsheet.
It is highly recommended to use this strategy and reduce the number of cycle the openXMLOffice.Excel
cell row insert life take to find the style id for the repeated setting you are making using the cell style property. Use the styleId thats given as response from this object to optimize the document creation process.
Sample Code
Section titled βSample Codeβ// To Get the style Iduint styleId = excel.GetStyleId(new CellStyleSetting() { isBold = true, borderLeft = new() { style = BorderSetting.StyleValues.THICK }, backgroundColor = "112233" });// Use the Style Idworksheet.SetRow("A1", new DataCell[6]{ new(){ cellValue = "test1", dataType = CellDataType.STRING, styleId = styleId }, new RowProperties()})
CellStyleSetting
Options
Section titled βCellStyleSetting OptionsβProperty | Type | Details |
---|---|---|
backgroundColor | string? | Cell background color |
borderBottom | BorderSetting | Bottom Border Setting |
borderLeft | BorderSetting | Left Border Setting |
borderRight | BorderSetting | Right Border Setting |
borderTop | BorderSetting | Top Border Setting |
fontFamily | string | Font family of the cell content |
fontSize | uint | Font size of the cell content |
foregroundColor | string | Cell foreground color |
isBold | bool | Set cell content bold |
isDoubleUnderline | bool | Set cell content underline |
isItalic | bool | Set cell content italic |
isUnderline | bool | Set cell content underline |
isWrapText | bool | Set cell content auto wrap |
numberFormat | string | Number formating for the cell content |
textColor | string | Cell Text Color |
horizontalAlignment | horizontalAlignment | Cell content horizontal alignment |
verticalAlignment | VerticalAlignmentValues | Cell content vertical alignment |
BorderSetting
Options
Section titled βBorderSetting OptionsβProperty | Type | Details |
---|---|---|
color | string | Boder Color |
style | StyleValues | Border Line Style |