User-1511216082 posted
hi,
i want to change the cell color of the excel sheet according to the values we are getting from dataTable in C#....so my code goes here.....
Microsoft.Office.Interop.Excel.Worksheet ws = (Microsoft.Office.Interop.Excel.Worksheet)wb.Worksheets[1];
ws.Name = conntype;
wb.Worksheets.Add(Type.Missing,
Type.Missing,
Type.Missing, Type.Missing);
int startRow = 1;
for (i = 0; i < dtMain.Rows.Count; i++)
{
for (j = 0; j < dtMain.Columns.Count; j++)
{
string comp1=dtMain.Rows[i][j].ToString();if(comp1> 30 && comp1<40) // i have to change color of
the values between 30 and 40 to yellow ......
ws.Cells.
ws.Cells[startRow, j + 1] = dtMain.Rows[i][j].ToString();
}
startRow++;
}
how can i change the color...?
thanks,
rajiv