Cell background is not changing color

As a test I tried to change a background cell color with the following code.

sheet.Cells["G2"].Style.Pattern = BackgroundType.Solid;

sheet.Cells["G2"].Style.BackgroundColor = Color.Yellow;

but the cell does not change color. Everything else works, e.g. font, & border.


This message was posted using Page2Forum from Aspose.Cells for .NET - Documentation

Hi,

Thank you for considering Aspose.

As you are using Style.Pattern = BackgroundType.Solid, so foreground color (or fill color) will take effect and background color will not be applied (as MS Excel does when Style.Pattern is set as Solid). Please set Style.ForegroundColor option instead of Style.BackgroundColor incase the Background Pattern is solid. Please see the following documentation link for further details on Colors & background Patterns:

Thank You & Best Regards,