1

I want to color some particular cells of an Excel sheet in C#. I am using this code:

((Range)worksheet.Cells[2, 1]).Interior.Color = XlRgbColor.rgbDarkRed;

But it's throwing an exception:

Exception from HRESULT: 0x800A03EC

How can I resolve this?

Michael Petrotta
  • 59,888
  • 27
  • 145
  • 179

1 Answers1

1

try this it will solve your problem

 ((Range)worksheet.Cells[i + 2, j + 1]).Interior.Color = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.Red);
sanjeev
  • 590
  • 1
  • 11
  • 21