I am trying to set background of cell to solid red. Leaving the foreground color as it is.
Hi,
Thanks for your posting and using Aspose.Cells.
Please use the Style.ForegroundColor property instead. Please see the following code. I have attached the output xlsx file generated by it for your reference.
C#
Workbook wb = new Workbook(@“Test.xlsx”);
var style = wb.Worksheets[0].Cells[“A2”].GetStyle();
style.Pattern = BackgroundType.Solid;
style.ForegroundColor = System.Drawing.Color.Red;
wb.Worksheets[0].Cells[“A2”].SetStyle(style);
wb.Save(@“Test2.xlsx”);