Suryakavitha Suryakavitha - 1 year ago 88
C# Question

Cell color changing In Excel using C#

I am using a Windows application for exporting a data table to Excel. It's working. Now I want to give some color for particular text in the cell. How shall I do this?

Answer Source

For text:

[RangeObject].Font.Color = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.Red);

For cell background

[RangeObject].Interior.Color = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.Red);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download