Skip to content

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.

// To Get the style Id
uint styleId = excel.GetStyleId(new CellStyleSetting()
{
isBold = true,
borderLeft = new()
{
style = BorderSetting.StyleValues.THICK
},
backgroundColor = "112233"
});
// Use the Style Id
worksheet.SetRow("A1", new DataCell[6]{
new(){
cellValue = "test1",
dataType = CellDataType.STRING,
styleId = styleId
}, new RowProperties()
})
PropertyTypeDetails
backgroundColorstring?Cell background color
borderBottomBorderSettingBottom Border Setting
borderLeftBorderSettingLeft Border Setting
borderRightBorderSettingRight Border Setting
borderTopBorderSettingTop Border Setting
fontFamilystringFont family of the cell content
fontSizeuintFont size of the cell content
foregroundColorstringCell foreground color
isBoldboolSet cell content bold
isDoubleUnderlineboolSet cell content underline
isItalicboolSet cell content italic
isUnderlineboolSet cell content underline
isWrapTextboolSet cell content auto wrap
numberFormatstringNumber formating for the cell content
textColorstringCell Text Color
horizontalAlignmenthorizontalAlignmentCell content horizontal alignment
verticalAlignmentVerticalAlignmentValuesCell content vertical alignment
PropertyTypeDetails
colorstringBoder Color
styleStyleValuesBorder Line Style