Cell background not being set

I am trying to setup a style to change the fill color of a cell. Not matter what I try the cell is always set as no color in Excel.


Here is the code that I use to create the style:

protected Aspose.Cells.Style CreateTableHeaderStyle(Aspose.Cells.Workbook workbook)
{
var style = workbook.Styles[workbook.Styles.Add()];

style.Font.IsBold = true;
style.IsTextWrapped = true;
style.Pattern = Aspose.Cells.BackgroundType.Solid;
style.BackgroundColor = workbook.Colors[12];

var borderType = Aspose.Cells.CellBorderType.Thin;
var borderColor = System.Drawing.Color.FromArgb(229, 229, 229);
style.SetBorder(Aspose.Cells.BorderType.BottomBorder, borderType, borderColor);
style.SetBorder(Aspose.Cells.BorderType.TopBorder, borderType, borderColor);
style.SetBorder(Aspose.Cells.BorderType.LeftBorder, borderType, borderColor);
style.SetBorder(Aspose.Cells.BorderType.RightBorder, borderType, borderColor);

return style;
}

And then I use SetStyle on the specific cells I want to set it on. What am I missing?

Hi,


Please use ForegroundColor attribute instead to apply fill color / shading color of a cell, kindly replace the line of code i.e.

style.BackgroundColor = workbook.Colors[12];
to:
style.ForegroundColor = workbook.Colors[12];