NPOI Excel设置样式

在表格导出时,会碰到样式修改的问题,作如下简单归纳:

//创建行样式
ICellStyle style = workbook.CreateCellStyle();
//前景色                       
style.FillForegroundColor = NPOI.HSSF.Util.HSSFColor.Red.Index;
//填充样式
style.FillPattern = FillPattern.SolidForeground;
//背景色
style.FillBackgroundColor = NPOI.HSSF.Util.HSSFColor.Red.Index;

//对单元格使用该样式
row.Cells[5].CellStyle = style;

参考地址:http://blog.csdn.net/chensirbbk/article/details/52189985

原文地址:https://www.cnblogs.com/zhucheng88/p/8193029.html