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

Free Support Forum - aspose.com

Aspose.Style.ForegroundColor

Foreground color I am trying to set appear in shades of gray. I have done this before and had worked well. Cant figure out whats the problem

Hi,


It works fine, I could not find any issue. Here is my sample code and please find attached the output file.
Sample code:
Workbook wb = new Workbook();

Cells cells = wb.Worksheets[0].Cells;
Aspose.Cells.Cell cell = cells[0, 0];
cell.PutValue(“Testing”);

StyleCollection styles = wb.Styles;
int index = styles.Add();
Style style = styles[index];
style.ForegroundColor = Color.LightGreen;
style.Pattern = BackgroundType.Solid;
style.Font.Color = Color.Red;
style.HorizontalAlignment = TextAlignmentType.Center;

cell.SetStyle(style);
wb.Save(@“e:\test2\forecolorchecking.xlsx”);

If you still find any issue, kindly attach your template file(s) and paste sample code (as mine), we will check it soon.

Thank you.