问题:
我正在使用 EEPlus。
我坚持应用十六进制颜色代码,例如#B7DEE8
,对于我的 Excel 工作表中的一个单元格。
我得到以下(工作)代码:
ws.Cells["A1:B1"].Style.Fill.PatternType = ExcelFillStyle.Solid;
ws.Cells["A1:B1"].Style.Fill.BackgroundColor.SetColor(Color.Gray);
但我需要类似以下内容:
ws.Cells["A1:B1"].Style.Fill.BackgroundColor.SetColor("#B7DEE8");
所以我的问题是:是否可以在 EEPlus 中使用十六进制颜色代码?如果是这样,我该怎么做?
Try this
Color colFromHex = System.Drawing.ColorTranslator.FromHtml("#B7DEE8");
ws.Cells["A1:B1"].Style.Fill.PatternType = ExcelFillStyle.Solid;
ws.Cells["A1:B1"].Style.Fill.BackgroundColor.SetColor(colFromHex);
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)