Setting background color of cell

Viewed 39

To set cell backgound color to RGB = 198, 224, 180 (a green tonality) I am using this:

            ICellStyle style = wb.CreateCellStyle();
            var font = (XSSFFont)GetGroupFont(wb);
            style.SetFont(font);

            var backColor = new XSSFColor(new byte[] { 198, 224, 180 });
            style.FillForegroundColor = backColor.Index;
            style.FillPattern = FillPattern.SolidForeground;
            style.Alignment = HorizontalAlignment.Left;
            style.VerticalAlignment = VerticalAlignment.Center;

            ICell cellGroup = row.CreateCell(0);
            cellGroup.CellStyle = style;
            cellGroup.SetCellValue(value);

With the above, the resulting Excel shows a cell with black background. What's wrong?

0 Answers
Related