ICellStyle FillForegroundColor的自定义颜色比提供的命名颜色 [英] Custom color for ICellStyle FillForegroundColor than provided named colors
本文介绍了ICellStyle FillForegroundColor的自定义颜色比提供的命名颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我们刚开始使用NPOI组件.
We are newly started using NPOI components.
我们在设置ICellStyle属性的FillForegroundColor时遇到问题.
We are having issues to set FillForegroundColor of ICellStyle property.
ICellStyle HeaderCellStyle = xssfworkbook.CreateCellStyle();
HeaderCellStyle.FillForegroundColor = NPOI.HSSF.Util.HSSFColor.RED.index;
FillForegroundColor的类型为short.
FillForegroundColor expects of type short.
我们如何设置其他颜色而不是在HSSFColor中使用颜色.
How do we set a different color rather than using colors in HSSFColor.
我们需要设置为"RGB192:0:0"
,以及如何针对ICellStyle属性FillForegroundColor
We need to set to "RGB192:0:0"
and how do we do that for ICellStyle property FillForegroundColor
可以通过某些示例帮助别人吗?
Colud someone help us by some example?
推荐答案
我自己找到了解决方案.请参考下面的代码
I found the solution my self. Please refer below code
byte[] rgb = new byte[3] { 192, 0, 0 };
XSSFCellStyle HeaderCellStyle1 = (XSSFCellStyle)xssfworkbook.CreateCellStyle();
HeaderCellStyle1.SetFillForegroundColor(new XSSFColor(rgb));
这篇关于ICellStyle FillForegroundColor的自定义颜色比提供的命名颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文