Search code examples
c#colorscell

excel cell coloring


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?


Solution

  • Try something like that

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