Style

Style is instance object per excel created to maintain for performance of the document creation process. This istance provides a common handle to set a style combination once refer it across the spreadsheet.

It is highly recomended to use this stratgy 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 makking using the cell style property. Use the styleId thats given as response from this object to optimise the document creation process.

Sample Code

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

CellStyleSetting Options

PropertyTypeDetails

backgroundColor

string?

Cell background color

borderBottom

Bottom Border Setting

borderLeft

Left Border Setting

borderRight

Right Border Setting

borderTop

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

PropertyTypeDetails

color

string

Boder Color

style

StyleValues

Border Line Style

Last updated