Example #1
0
        public void Format(ICell cell, IHeadCell headCell)
        {
            var font = headCell.Font;

            font.IsBold = true;
            headCell.CellStyle.SetFont(font);
            cell.CellStyle = headCell.CellStyle;
        }
Example #2
0
        public void Format(ICell cell, IHeadCell headCell)
        {
            var font = headCell.Font;

            if (font is XSSFFont)
            {
                (font as XSSFFont).SetColor(new XSSFColor(RGB));
            }
            else
            {
                font.Color = HSSFColor.LightGreen.Index;
            }
            headCell.CellStyle.SetFont(font);
            cell.CellStyle = headCell.CellStyle;
        }
Example #3
0
 public static void BackgroundFormat(ICell cell, IHeadCell headCell, byte[] rgb)
 {
     if (cell.Sheet.Workbook is HSSFWorkbook)
     {
         HSSFPalette palette = (cell.Sheet.Workbook as HSSFWorkbook).GetCustomPalette();
         palette.SetColorAtIndex(HSSFColor.Black.Index, rgb[0], rgb[1], rgb[2]);
         var style = headCell.CellStyle as HSSFCellStyle;
         style.FillForegroundColor = HSSFColor.Black.Index;
         style.FillPattern         = FillPattern.SolidForeground;
         cell.CellStyle            = style;
     }
     else
     {
         var style = (headCell.CellStyle as XSSFCellStyle);
         style.SetFillForegroundColor(new XSSFColor(rgb));
         style.FillPattern = FillPattern.SolidForeground;
         cell.CellStyle    = style;
     }
 }
Example #4
0
 public void Format(ICell cell, IHeadCell headCell)
 {
     FormatHelper.BackgroundFormat(cell, headCell, RGB);
 }