반응형
XSSFCellStyle style = (XSSFCellStyle)workbook.CreateCellStyle();
//셀 배경색 지정 (FillPattern, SetFillForegroundColor)
style.FillPattern = FillPattern.SolidForeground;
byte[] rgb = new byte[]{255,255,255}; //셀색상 RGB로 설정
style.SetFillForegroundColor(new XSSFColor(rgb));
//셀 align, verticalAlign
style.Alignment = HorizontalAlignment.Center;
style.VerticalAlignment = VerticalAlignment.Center;
//셀 테두리 UP,BOTTOM,LEFT,RIGHT
style.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
style.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
style.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
style.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
cell.CellStyle = style; //cell => ICell