Can't set a backgroundcolor

Hello,

I try to apply a backgroundcolor to some cells by using the solid pattern, but the result is always the same, no color is applied. It’s possible to to apply one of the other patterns but there’s no chance to use the solid pattern.

I use this code snippet:

cell = worksheet.Cells[0, 0];
cell.Style.BackgroundColor = Color.Red;
cell.Style.Pattern = BackgroundType.Solid;

I’ve installed the latest hotfix and use Excel 2007.

After I’ve executed the code and opened the cell format dialog in Excel I can see the pattern format is solid and the pattern color is red but the backgroundcolor ist set to no color.
The assignment of all other patterns is working well except for the solid pattern.

What I’m doing wrong?

Greetings

Hi,

Please change your code to:

cell = worksheet.Cells[0, 0];
cell.Style.ForegroundColor = Color.Red;
cell.Style.Pattern = BackgroundType.Solid;

For further reference, please check the following:

http://www.aspose.com/documentation/file-format-components/aspose.cells-for-.net-and-java/colors-background-patterns.html

http://www.aspose.com/documentation/file-format-components/aspose.cells-for-.net-and-java/colors-and-palette.html

Thank you.

Now it works fine.
Why didn’t I try that?

Thank you.