Hi,
I am trying to change the color of a font when creating a worksheet and am using the command
cell(x).cellformat.font.color = color.red, which results in a warning but seems to work.
Warning 2 'Public Property Color As System.Drawing.Color' is obsolete: 'The IWorkbookFont.Color is deprecated. It has been replaced by IWorkbookFont.ColorInfo.'.
changing to
cell(x).cellformat.font.colorinfo.color = color.ref gives the error
Property Color is read only.
Anyone know how to fix this? I've tried creating a colorinfo object but cannot assign to the color property here either.
You must assign the WorkbookColorInfo object to the ColorInfo property, like so:
cell(x).CellFormat.Font.ColorInfo = new WorkbookColorInfo(Color.Red)
Thanks Mike, I thought I had tried that but obviously not. Working fine now.