excel cell coloring

bill picture bill · May 5, 2011 · Viewed 55.1k times · Source

I am using c# to color particular cells of excel file. I am using:

Application excel = new Application();
Workbook wb = excel.Workbooks.Open(destPath);
 Worksheet ws = wb.Worksheets[1];
 ws.get_Range(ws.Cells[row, clmn]).Cells.Interior.Color = 36;

...to color cells, but this is not working. Can anyone help me out?

Answer

Stecya picture Stecya · May 5, 2011

Try something like that

ws.Cells[row, clmn].Interior.Color = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.Red)