我们刚开始使用 NPOI 组件。
我们在设置 ICellStyle 属性的 FillForegroundColor 时遇到问题。
ICellStyle HeaderCellStyle = xssfworkbook.CreateCellStyle();
HeaderCellStyle.FillForegroundColor = NPOI.HSSF.Util.HSSFColor.RED.index;
FillForegroundColor 需要short 类型。
我们如何设置不同的颜色而不是使用 HSSFColor 中的颜色。
我们需要设置为"RGB192:0:0"
我们如何为 ICellStyle 属性 FillForegroundColor 做到这一点
有人可以通过一些例子帮助我们吗?
我自己找到了解决方案。请参考下面的代码
byte[] rgb = new byte[3] { 192, 0, 0 };
XSSFCellStyle HeaderCellStyle1 = (XSSFCellStyle)xssfworkbook.CreateCellStyle();
HeaderCellStyle1.SetFillForegroundColor(new XSSFColor(rgb));
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)