如何使用 xssfworkbook npoi 在字体中设置 RGB 颜色

PPa*_*mar 5 c# rgb background colors npoi

如何使用 npoi在cell backgroudn使用类中设置 RGB 颜色xssfworkbook

byte[] rgb = new byte[3] { 192, 50, 90 };
XSSFCellStyle HeaderCellStyle1 = (XSSFCellStyle)wb.CreateCellStyle();
HeaderCellStyle1.SetFillForegroundColor(new XSSFColor(new Color(255, 255, 255)));
Run Code Online (Sandbox Code Playgroud)

我不想使用这种模式:

titlestyle.BottomBorderColor = IndexedColors.Grey25Percent.Index;
Run Code Online (Sandbox Code Playgroud)

Jas*_*nki 5

    solution of your problem is here

    here simply define new xssfcolor and assign it to xssfcellstyle     


 var color = new XSSFColor(new byte[] { 0,255, 0 });
 var rowstyle =(XSSFCellStyle)wb.CreateCellStyle();
 rowstyle.SetFillForegroundColor(color)
Run Code Online (Sandbox Code Playgroud)