BackgroundType.Solid does not seem to work to set background color via style

Below is a c# method I used to build the style. I am trying to set the cells that use this style to have a yellow solid background. I know for the Background color to work, you need to set the pattern. My sample here is using Gray6. That and others seem to work fine, BUT if I use BackgroundType.Solid, I no longer get the yellow color. It is as if Solid is working the same as None.



Any ideas?



public static Aspose.Cells.Style GetIntegerStyleHighlighted(Workbook workbook) {

Aspose.Cells.Style intStyle = workbook.Styles[workbook.Styles.Add()];

intStyle.Font.Name = “Arial”;

intStyle.Font.Size = 10;

intStyle.Font.IsBold = true;

intStyle.Font.Color = Color.Black;

intStyle.BackgroundColor = System.Drawing.Color.Yellow;

intStyle.Pattern = BackgroundType.Gray6; //For the BackgroundColor to work, you MUST have a Pattern set

intStyle.IsTextWrapped = true;

intStyle.Number = 1;

intStyle.HorizontalAlignment = TextAlignmentType.Center;



return intStyle;



}

Hi,


If you want to set the cell’s shading color with solid background, please use ForegroundColor attribute instead. Please change your code as following:
e.g
Sample code:

public static Aspose.Cells.Style GetIntegerStyleHighlighted(Workbook workbook) {
Aspose.Cells.Style intStyle = workbook.Styles[workbook.Styles.Add()];
intStyle.Font.Name = “Arial”;
intStyle.Font.Size = 10;
intStyle.Font.IsBold = true;
intStyle.Font.Color = Color.Black;
intStyle.ForegroundColor = System.Drawing.Color.Yellow;
intStyle.Pattern = BackgroundType.Solid; //For the BackgroundColor to work, you MUST have a Pattern set

intStyle.IsTextWrapped = true;
intStyle.Number = 1;
intStyle.HorizontalAlignment = TextAlignmentType.Center;

return intStyle;

}

Let us know if you still have any issue.

Thank you.