Reputation:
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?
Upvotes: 1
Views: 1437
Reputation: 600
try this it will solve your problem
((Range)worksheet.Cells[i + 2, j + 1]).Interior.Color = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.Red);
Upvotes: 1