We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Foreground Color Change To Cell Not Working

Here is the code that I'm using and it doesn't seem to work

set colorStyle = oXLW.CreateStyle

colorStyle.ForegroundColor = RGB(204,255,204)

oXLW.Worksheets(1).Cells(row, col).Style = colorStyle

What am I doing wrong??????

Hi Michelle,

Please share some more details about this issue. For example, You are facing this issue on which version of Aspose.Cells.Also, If you could send us the template file etc. This will help us to drill down the issue more effectively.


Sincere Regards,

Salman Shakeel
Support Developer,
Aspose Sialkot Team
Contact Us

I'm sending the excel template file and the asp code that is being used.

I tried using the backgroundtype.solid and the program will bomb when using it. I guess the version I'm using doesn't support it.

Hi Michelle,

Thank you for providing us the details. Please use the code snippet below to set the foreground color of the cell.
Please use the updated version Aspose.Cells5.1.4.5.zip attached, for more options.

Code snippet:
Workbook workbook = new Workbook(sFilePath);
Style colorStyle = workbook.CreateStyle();
colorStyle.ForegroundColor = Color.FromArgb(204, 255, 204);
colorStyle.Pattern = BackgroundType.Solid;
workbook.Worksheets[1].Cells[1, 1].SetStyle(colorStyle);
workbook.Save(sSavePath, SaveFormat.Xlsm);