简体   繁体   English

Microsoft.Office.Interop.Excel 读取假色?

[英]Microsoft.Office.Interop.Excel reading false color?

tmp.Color = xlRange.Cells[i, j].Interior.Color.ToString();

I read the Cellcolor of an excel document like this, but I get not the color I expect: 16777215 for aquamarine for example but it´s not the value for aquamarine, it´s the value for yellow.我阅读了这样的 Excel 文档的 Cellcolor,但我得到的不是我期望的颜色:例如,海蓝宝石的颜色为 16777215,但这不是海蓝宝石的值,而是黄色的值。 Am I reading the cellcolor not right?我读的细胞颜色不正确吗?

I have just found solution for you, And hope this will work for you.我刚刚为您找到了解决方案,希望这对您有用。

int colorNumber = System.Convert.ToInt32(((Range) worksheet.Cells[rowNumber,columnNumber]).Interior.Color);
Color color = System.Drawing.ColorTranslator.FromOle(colorNumber);

Refrence link : https://stackoverflow.com/a/1867695/6923146参考链接: https : //stackoverflow.com/a/1867695/6923146

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

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