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

Free Support Forum - aspose.com

I would like to know if the current Aspose.Cell works on .Net 2.0 Framework?

I would like to know if the current Aspose.Cell works on .Net 2.0 Framework?

Yes. Aspose.Cells can work on .NET 2.0.

I would like to know how would we change the background color of cell. Seems like the code in the examples are not working.


Thanks for considering Aspose.

Well, the color (LightGray) your want to apply is not present on the Standard Color Palette, so you have to add it first into the palette before setting it as a fill color of the cell. Since MS Excel (Excel97-Excel2003) Color Palette has only 56 colors (0-55 indexed) on it, so if a color is not there, you will have to add the color to the palette replacing any existing color on a specified index position.

Here is a sample code for your need:

//Instantiating a Workbook object
Workbook workbook = new Workbook();
// Add Light Gray color to the palette.
workbook.ChangePalette(System.Drawing.Color.LightGray, 55);
//Obtaining the first worksheet by passing its sheet index
Worksheet worksheet = workbook.Worksheets[0];
//Now setting the foreground color of the "A1" cell to light gray.
worksheet.Cells["A1"].Style.ForegroundColor = Color.LightGray;
//Setting the background pattern of the "A1" cell to solid
worksheet.Cells["A1"].Style.Pattern = BackgroundType.Solid;
//Saving the Excel file

For further reference, please check the thread:

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