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

Free Support Forum - aspose.com

Cell background colour

sir i am trying to put color in the cell so i tried

cells1(0, 1).Style.BackgroundColor = Color.Blue

but it is not working

then i tried cells1(0, 1).Style.ForegroundColor = Color.Blue

but it is also not working i can just the the white background

i can only put the font color by using

cells1(0, 1).Style.Font.Color = Color.Blue but i want backgroung

i am hereby attaching a excel file to reference you the kind of output i am expecting

Kindly help

i am currently using

aspose.cell V

waiting for your reply



Hi Zaid,

Thank you for considering Aspose.

Well, you need to specify Pattern type if you are setting background/fill color for the cells. When you use Style.ForegroundColor, you need to specify the pattern as “BackgroundType.Solid” for a cell’s shading color. You can also apply a cell’s background color, for Style.BackgroundColor you will select any pattern type other than “BackgroundType.Solid” or “BackgroundType.None”. Please see the following documentation link for more details,


You can add a line of code to your code, e.g
cells1(0, 1).Style.ForegroundColor = Color.Blue
cells1(0, 1).Style.Pattern = BackgroundType.Solid

Thank you.