Style.BackgroundColor doesn't show

Setting the background color of a style doesn’t seem to work. It doesn’t give me an error/exception, but the color isn’t there either.



I tried the following ways as recommended in the API documentation examples:





#1

Aspose.Cells.Workbook wb = new Aspose.Cells.Workbook();



Aspose.Cells.Style style = wb.Styles[wb.Styles.Add()];

style.Name = “Header”;

style.BackgroundColor = System.Drawing.Color.Red;



Aspose.Cells.Worksheet ws = wb.Worksheets[0];

ws.Cells[0,0].Style = wb.Styles[“Header”];

ws.Cells[0,0].PutValue(“Hello, world”);



#2

Aspose.Cells.Workbook wb = new Aspose.Cells.Workbook();

Aspose.Cells.Worksheet ws = wb.Worksheets[0];

ws.Cells[0,0].Style.BackgroundColor = Color.Red;

ws.Cells[0,0].PutValue(“Hello, world”);



Used version: 4.4.0.0 for .net

Hi,

Thanks for considering Aspose.

Please change your code to:

#1

Aspose.Cells.Workbook wb = new Aspose.Cells.Workbook();
Aspose.Cells.Style style = wb.Styles[wb.Styles.Add()];
style.Name = "Header";
style.ForegroundColor = System.Drawing.Color.Red;
style.Pattern = BackgroundType.Solid;
Aspose.Cells.Worksheet ws = wb.Worksheets[0];
ws.Cells[0,0].Style = wb.Styles["Header"];
ws.Cells[0,0].PutValue("Hello, world");

#2

Aspose.Cells.Workbook wb = new Aspose.Cells.Workbook();
Aspose.Cells.Worksheet ws = wb.Worksheets[0];
ws.Cells[0,0].Style.ForegroundColor = Color.Red;
ws.Cells[0,0].Style.Pattern = BackgroundType.Solid;
ws.Cells[0,0].PutValue("Hello, world");

For further reference please do check the following thread:

<A href="</A></P> <P>Thank you.</P> <P> </P>

Thanks for your fast reply, works perfectly.