Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

excel cell coloring

Tags:

c#

colors

cell

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?

like image 848
bill Avatar asked May 05 '11 11:05

bill


1 Answers

If you want to set color by color index, you need to use this method:

    Cells[row, col].Interior.ColorIndex = 36;
like image 144
Khanh Avatar answered Sep 29 '22 23:09

Khanh