I am trying to read BackColor
of cells with the below function,that returns me double type values. I need to read the values for 25 Cells, but it takes too much time to read all these cells (to exclude the code). And then I need to set that color as BackColor
of TextBoxes. I am using Interop Library. Is it possible to reduce this delay of reading the BackColor of the cells?
The problem is accessing the cell. GetColor()
its not the problem. Its just that it takes too much time to read values from the cell.
var colorCode = ws.Cells[i, objectHeading].Interior.Color;
public Color GetColor(int i, double colorCode)
{
if (colorCode == 12566463)
return Color.LightGray;
else if (colorCode == 65535)
return Color.Yellow;
else if (colorCode == 3394611 || colorCode == 5296274)
return Color.LightGreen;
else if (colorCode == 49407)
return Color.Orange;
else if (colorCode == 15773696)
return Color.LightBlue;
else
return Color.White;
}