package ${basePackage}.frame.excel.style;

import org.apache.poi.hssf.util.HSSFColor;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.Workbook;

public class DataCellStyle extends BaseCellStyle {

    public DataCellStyle(Workbook workbook, short align, boolean error) {
        super(workbook);
        style.setAlignment(align);
        if (error) {
            style.setFillForegroundColor(HSSFColor.RED.index); //背景颜色红色
            style.setFillPattern(CellStyle.SOLID_FOREGROUND);   //设置单元格填充样式
        }
    }

    public DataCellStyle(Workbook workbook, short align) {
        this(workbook, align, false);
    }

    public DataCellStyle(Workbook workbook, boolean error) {
        this(workbook, CellStyle.ALIGN_LEFT, error);
    }

    public DataCellStyle(Workbook workbook) {
        this(workbook, CellStyle.ALIGN_LEFT, false);
    }
}
