简体   繁体   English

如何从EPPlus的ExcelColor中获取System.Drawing.Color

[英]How to get System.Drawing.Color from EPPlus's ExcelColor

ExcelColor.LookupColor() return string like this: ExcelColor.LookupColor()返回如下字符串:

#FF000000

or 要么

#FF000

One of them Black, second - White. 其中一个黑色,第二个-白色。 I did not understand how to translate them into System.Drawinf.Color 我不明白如何将它们转换为System.Drawinf.Color

You can use System.Drawing.ColorTranslator.FromHtml() . 您可以使用System.Drawing.ColorTranslator.FromHtml() You pass the #FF000000 or #FF000 string and it will return the System.Drawing.Color value. 您传递#FF000000或#FF000字符串,它将返回System.Drawing.Color值。

System.Drawing.Color CurrentCellColor = System.Drawing.ColorTranslator.FromHtml("#FF000000");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM