You need to get the βInteriorβ object of the cell or range and set the color on it.
Range cellRange = (Range)wsheet.Cells[rowCount, i]; cellRange.Interior.Color = 255;
Excel colors are a whole sequence, so you need to calculate the value of the color you want. You may find this method useful:
public static int ConvertColour(Color colour) { int r = colour.R; int g = colour.G * 256; int b = colour.B * 65536; return r + g + b; }
Then you can simply do this:
cellRange.Interior.Color = ConvertColour(Color.Green);
You can set the text style using the .font property:
cellRange.Font.Size = "20"; cellRange.Font.Bold = true;
There are other properties like Color , Italic and Underline that you can use to get the style you want.
source share