Cells - Pattern Background type

When filling the cells with Background with color gray, we need to set the pattern to Solid. But Solid is not effecting the cells with solid pattern.

sheet.Cells[5, 0].Style.BackgroundColor = System.Drawing.Color.Gray;

sheet.Cells[5, 0].Style.Pattern = BackgroundType.Solid;

Kindly help !

Hi,

Please use ForegroundColor instead of BackgroundColor for setting shading color of a cell.

i.e..,

sheet.Cells[5, 0].Style.ForegroundColor = System.Drawing.Color.Gray;

sheet.Cells[5, 0].Style.Pattern = BackgroundType.Solid;

For further referenc about setting foreground / background colors of the cells, please check the thread if it may give your some insight: <A href="</A></P> <P>Thank you.</P>