How To Set Background Color Of Excel Cell Using C#
Good evening!
Here's how to set MS Excel cell or cells background color using C# Excel.Range class in two different solutions.
or using get_Range() function and ColorTranslator.ToOle() to set the background color.
Where chartRange is a RangeObject.
Here's how to set MS Excel cell or cells background color using C# Excel.Range class in two different solutions.
chartRange = sheet.Cells[1, i + 1]; chartRange.Interior.Color = Color.LightBlue;
Excel.Range chartRange; chartRange = xlWorkSheet.get_Range("b1", "b3"); chartRange.Interior.Color = ColorTranslator.ToOle(Color.Red);
reference?
ReplyDeleteMSDN Range Object...
ReplyDeleteGud Job.. it z working . Thank u
ReplyDeleteYour welcome! :)
Deletetry this...
ReplyDeleteExcel.Range formatRange;
formatRange = xlWorkSheet.get_Range("b1", "b1");
formatRange.Interior.Color = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.Red);
More info....Excel Cell Formatting
Ling