Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I set the RGB Color in font Using xssfworkbook npoi

How can I set the RGB color in cell backgroudn using class xssfworkbook using npoi?

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

I don't want to use this pattern:

titlestyle.BottomBorderColor = IndexedColors.Grey25Percent.Index;
like image 307
PParmar Avatar asked Jul 06 '16 11:07

PParmar


1 Answers

    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)
like image 90
Jasmin Solanki Avatar answered Sep 24 '22 17:09

Jasmin Solanki