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

posted on 2018-02-12 14:08  zhucheng88  阅读(227)  评论(0编辑  收藏  举报

导航

Document