user2454365
user2454365

Reputation:

How to resolve "Exception from HRESULT: 0x800A03EC" while coloring specific cells of an Excel sheet?

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

Answers (1)

sanjeev
sanjeev

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

Related Questions