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.
Hi Graham,
It sounds like you’ve got the idea, you will need to first create an instance of the ColorInfo object and then pass this to the ColorInfo property of a cell(s).
An example of this procedure would be a derivative of,
//Create an instance of the WorkbookColorInfo object, pass in a desired Color as its parameter WorkbookColorInfo ci = new WorkbookColorInfo(Color.Green); //Set this instance as the ColorInfo object for a cell(s) wb.Worksheets[0].Rows[1].Cells[0].CellFormat.Font.ColorInfo = ci;
I have also constructed and attached a sample where this approach is implemented, for further context as well as the following link to our online documentation, which details this and other changes to the Excel engine for 12.1, for reference.
http://help.infragistics.com/NetAdvantage/WinForms/2012.1/CLR2.0/?page=Win_Breaking_Changes_in_2012_Volume_1.html
Please find the sample attached.
If you have any questions at all regarding this approach, please let me know.
Sincerely,Chris KDeveloper Support EngineerInfragistics, Inc.www.infragistics.com/support
Thanks Chris, and thanks for the link helped solve a couple of other nigles.