NPOI自定义单元格RGB背景色
作者:互联网
cell.CellStyle.FillPattern = FillPattern.SolidForeground;
byte r = (byte)226;
byte g = (byte)239;
byte b = (byte)218;
if (workbook is XSSFWorkbook)
{
cell.CellStyle.FillForegroundColor = 0;
((XSSFColor)cell.CellStyle.FillForegroundColorColor).SetRgb(new byte[] { r, g, b });
}
else
{
cell.CellStyle.FillForegroundColor = (((HSSFWorkbook)workbook).GetCustomPalette().FindSimilarColor(r, g, b)).Indexed;
}
标签:CellStyle,自定义,单元格,FillForegroundColor,cell,RGB,FillPattern,workbook,byte 来源: https://blog.csdn.net/zhu7478848/article/details/122537797