所谓的潇洒

导航

报表相关

DataGridView设置列头颜色:

dbGrid.EnablHeadersVisualStyles=false;

dbGrid.Columns[0].HeaderCell.Style.BackColor = System.Drawing.Color.Orange;

 

NPOI导出Excel单元格格式:

ICellStyle s = workbook.CreateCellStyle();

//背景色
s.FillForegroundColor = HSSFColor.Orange.Index;
s.FillPattern = FillPattern.SolidForeground;

//边框颜色
s.BottomBorderColor = HSSFColor.Grey50Percent.Index;
s.LeftBorderColor = HSSFColor.Grey50Percent.Index;
s.TopBorderColor = HSSFColor.Grey50Percent.Index;
s.RightBorderColor = HSSFColor.Grey50Percent.Index;

//边框样式
s.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
s.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
s.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
s.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;

//文本自动换行
s.WrapText = true;

posted on 2021-07-28 15:20  所谓的潇洒  阅读(29)  评论(0编辑  收藏  举报