Java 类org.apache.poi.ss.usermodel.FillPatternType 实例源码

项目:vaadin-gridexport    文件:ExcelExport.java   
/**
 * Returns the default header style. Obtained from:
 * http://svn.apache.org/repos/asf/poi
 * /trunk/src/examples/src/org/apache/poi/ss/examples/TimesheetDemo.java
 *
 * @param wb the wb
 * @return the cell style
 */
protected CellStyle defaultHeaderCellStyle(final Workbook wb) {
    CellStyle style;
    final Font monthFont = wb.createFont();
    monthFont.setFontHeightInPoints((short) 11);
    monthFont.setColor(IndexedColors.WHITE.getIndex());
    style = wb.createCellStyle();
    style.setAlignment(HorizontalAlignment.CENTER);
    style.setVerticalAlignment(VerticalAlignment.CENTER);
    style.setFillForegroundColor(IndexedColors.GREY_50_PERCENT.getIndex());
    style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
    style.setFont(monthFont);
    style.setWrapText(true);
    return style;
}
项目:bdf2    文件:GridStyleBuilder.java   
public CellStyle createIndentationCellStyle(Workbook workbook, int s) {
    CellStyle dataStyle1 = this.createBorderCellStyle(workbook, true);
    Font dataFont = workbook.createFont();
    dataFont.setColor((short) 12);
    dataFont.setFontHeightInPoints((short) 10);
    dataStyle1.setFillPattern(FillPatternType.SOLID_FOREGROUND);
    dataStyle1.setFillForegroundColor((short) 11);
    dataStyle1.setFont(dataFont);
    dataStyle1.setVerticalAlignment(VerticalAlignment.CENTER);
    dataStyle1.setAlignment(HorizontalAlignment.LEFT);
    dataStyle1.setIndention(Short.valueOf(String.valueOf((s))));
    return dataStyle1;
}
项目:bdf2    文件:TitleStyleBuilder.java   
private HSSFCellStyle createHSSFCellStyle(Workbook wb, int[] bgColor, int[] fontColor, int fontSize) {
    HSSFWorkbook workbook = (HSSFWorkbook) wb;
    HSSFPalette palette = workbook.getCustomPalette();

    palette.setColorAtIndex((short) 9, (byte) fontColor[0], (byte) fontColor[1], (byte) fontColor[2]);
    palette.setColorAtIndex((short) 10, (byte) bgColor[0], (byte) bgColor[1], (byte) bgColor[2]);

    HSSFFont titleFont = workbook.createFont();
    titleFont.setCharSet(HSSFFont.DEFAULT_CHARSET);
    titleFont.setFontName("宋体");
    titleFont.setColor((short) 9);
    titleFont.setBold(true); 
    titleFont.setFontHeightInPoints((short) fontSize);

    HSSFCellStyle titleStyle = (HSSFCellStyle) createBorderCellStyle(workbook, true);
    titleStyle.setFont(titleFont);
    titleStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
    titleStyle.setFillForegroundColor((short) 10);
    titleStyle.setAlignment(HorizontalAlignment.CENTER);
    titleStyle.setVerticalAlignment(VerticalAlignment.CENTER);

    return titleStyle;
}
项目:jasperreports    文件:JRXlsExporter.java   
@Override
protected void initReport()
{
    super.initReport();

    XlsReportConfiguration configuration = getCurrentItemConfiguration();

    if (!configuration.isWhitePageBackground())
    {
        backgroundMode = FillPatternType.NO_FILL;
    }

    nature = 
        new JRXlsExporterNature(
            jasperReportsContext, 
            filter, 
            configuration.isIgnoreGraphics(), 
            configuration.isIgnorePageMargins()
            );
}
项目:jasperreports    文件:JRXlsExporter.java   
protected HSSFCellStyle getLoadedCellStyle(
    FillPatternType mode,
    short backcolor,
    HorizontalAlignment horizontalAlignment,
    VerticalAlignment verticalAlignment,
    short rotation,
    HSSFFont font,
    BoxStyle box,
    boolean isWrapText,
    boolean isCellLocked,
    boolean isCellHidden,
    boolean isShrinkToFit
    )
{
    StyleInfo style = new StyleInfo(mode, backcolor, horizontalAlignment, verticalAlignment, rotation, font, box, isWrapText, isCellLocked, isCellHidden, isShrinkToFit);
    return getLoadedCellStyle(style);
}
项目:jasperreports    文件:JRXlsExporter.java   
public StyleInfo(
    FillPatternType mode,
    short backcolor,
    HorizontalAlignment horizontalAlignment,
    VerticalAlignment verticalAlignment,
    short rotation,
    HSSFFont font,
    JRExporterGridCell gridCell,
    boolean wrapText,
    boolean cellLocked,
    boolean cellHidden,
    boolean shrinkToFit
    )
{
    this(mode, 
        backcolor, 
        horizontalAlignment, 
        verticalAlignment, 
        rotation, 
        font, 
        (gridCell == null ? null : new BoxStyle(gridCell)), 
        wrapText, 
        cellLocked, 
        cellHidden, 
        shrinkToFit);
}
项目:jasperreports    文件:JRXlsMetadataExporter.java   
@Override
protected void initReport() 
{
    super.initReport();

    XlsReportConfiguration configuration = getCurrentItemConfiguration();

    if (!configuration.isWhitePageBackground())
    {
        backgroundMode = FillPatternType.NO_FILL;
    }

    nature = 
        new JRXlsMetadataExporterNature(
            jasperReportsContext, 
            filter, 
            configuration.isIgnoreGraphics(), 
            configuration.isIgnorePageMargins()
            );
}
项目:CCDA-Score-CARD    文件:ScorecardExcelGenerator.java   
public static HSSFCellStyle createCellStyleForColumnHeading(HSSFWorkbook workBook) {
    HSSFCellStyle cellStyle = workBook.createCellStyle();
    HSSFFont fontObj = workBook.createFont();
    cellStyle.setBorderBottom(BorderStyle.THIN);
    cellStyle.setBorderTop(BorderStyle.THIN);
    cellStyle.setBorderLeft(BorderStyle.THIN);
    cellStyle.setBorderRight(BorderStyle.THIN);
    cellStyle.setWrapText(true);
    cellStyle.setAlignment(HorizontalAlignment.CENTER);
    cellStyle.setFillBackgroundColor(Short.valueOf("22").shortValue());
    cellStyle.setFillPattern(FillPatternType.BIG_SPOTS);
    cellStyle.setFillForegroundColor(Short.valueOf("22").shortValue());
    cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
    fontObj.setFontName("Calibri");
    fontObj.setFontHeightInPoints(Short.valueOf("12").shortValue());
    fontObj.setBold(true);
    fontObj.setColor(Short.valueOf("8").shortValue());
    cellStyle.setFont(fontObj);
    return cellStyle;
}
项目:birt    文件:StyleManagerXUtils.java   
@Override
public void addBackgroundColourToStyle(Workbook workbook, CellStyle style, String colour) {
    if(colour == null) {
        return ;
    }
    if(IStyle.TRANSPARENT_VALUE.equals(colour)) {
        return ;
    }
    if(style instanceof XSSFCellStyle) {
        XSSFCellStyle cellStyle = (XSSFCellStyle)style;
        XSSFColor xColour = getXColour(colour);
        if(xColour != null) {
            cellStyle.setFillForegroundColor(xColour);
            cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
        }
    }
}
项目:eoulsan    文件:XLSXTranslatorOutputFormat.java   
/**
 * Public constructor.
 * @param os output stream
 */
public XLSXTranslatorOutputFormat(final OutputStream os) {

  if (os == null) {
    throw new NullPointerException("The output stream is null");
  }

  this.os = os;

  // Temporary files will be compressed
  this.wb.setCompressTempFiles(true);

  // Define default style
  Font defaultFont = this.wb.createFont();
  defaultFont.setFontName("Arial");
  defaultFont.setFontHeightInPoints((short) 10);
  this.defaultStyle = this.wb.createCellStyle();
  this.defaultStyle.setFont(defaultFont);

  // Define header style
  Font headerFont = this.wb.createFont();
  headerFont.setFontName(defaultFont.getFontName());
  headerFont.setFontHeightInPoints(defaultFont.getFontHeightInPoints());
  headerFont.setItalic(true);
  this.headerStyle = this.wb.createCellStyle();
  this.headerStyle.setFillForegroundColor(IndexedColors.ORANGE.getIndex());
  this.headerStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
  this.headerStyle.setFont(headerFont);

  // Define link style
  Font linkfont = this.wb.createFont();
  linkfont.setFontName(defaultFont.getFontName());
  linkfont.setFontHeightInPoints(defaultFont.getFontHeightInPoints());
  linkfont.setUnderline(XSSFFont.U_SINGLE);
  linkfont.setColor(IndexedColors.BLUE.getIndex());
  this.linkStyle = this.wb.createCellStyle();
  this.linkStyle.setFont(linkfont);
}
项目:aem-epic-tool    文件:ReportUtil.java   
public static CellStyle createHeaderStyle(Workbook workbook) {
    XSSFCellStyle headerStyle = createCellStyle(workbook);
    XSSFColor header = new XSSFColor(new byte[]{(byte) 79, (byte) 129, (byte) 189});
    headerStyle.setFillForegroundColor(header);
    headerStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
    headerStyle.getFont().setColor(IndexedColors.WHITE.index);
    return headerStyle;
}
项目:urule    文件:PackageServletHandler.java   
@SuppressWarnings("unchecked")
public void exportExcelTemplate(HttpServletRequest req, HttpServletResponse resp) throws Exception {
    List<VariableCategory> variableCategories=(List<VariableCategory>)httpSessionKnowledgeCache.get(req, VCS_KEY);
    if(variableCategories==null){
        KnowledgeBase knowledgeBase=buildKnowledgeBase(req);
        variableCategories=knowledgeBase.getResourceLibrary().getVariableCategories();
    }
    SXSSFWorkbook wb = new SXSSFWorkbook();
    XSSFCellStyle style=(XSSFCellStyle)wb.createCellStyle();
    Color c=new Color(147,208,15);
    XSSFColor xssfColor=new XSSFColor(c);
    style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
    style.setFillForegroundColor(xssfColor);
    for(VariableCategory vc:variableCategories){
        buildSheet(wb, vc,style);
    }
    resp.setContentType("application/x-xls");
    resp.setHeader("Content-Disposition","attachment; filename=urule-batch-test-template.xlsx");
    OutputStream outputStream=resp.getOutputStream();
    wb.write(outputStream);;
    outputStream.flush();
    outputStream.close();
}
项目:vaadin-gridexport    文件:ExcelExport.java   
/**
 * Returns the default totals row style for Double data. Obtained from:
 * http://svn.apache.org/repos/asf/poi
 * /trunk/src/examples/src/org/apache/poi/ss/examples/TimesheetDemo.java
 *
 * @param wb the wb
 * @return the cell style
 */
protected CellStyle defaultTotalsDoubleCellStyle(final Workbook wb) {
    CellStyle style;
    style = wb.createCellStyle();
    style.setAlignment(HorizontalAlignment.CENTER);
    style.setVerticalAlignment(VerticalAlignment.CENTER);
    style.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
    style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
    style.setDataFormat(doubleDataFormat);
    return style;
}
项目:vaadin-gridexport    文件:ExcelExport.java   
/**
 * Returns the default totals row style for Integer data. Obtained from:
 * http://svn.apache.org/repos/asf/poi
 * /trunk/src/examples/src/org/apache/poi/ss/examples/TimesheetDemo.java
 *
 * @param wb the wb
 * @return the cell style
 */
protected CellStyle defaultTotalsIntegerCellStyle(final Workbook wb) {
    CellStyle style;
    style = wb.createCellStyle();
    style.setAlignment(HorizontalAlignment.CENTER);
    style.setVerticalAlignment(VerticalAlignment.CENTER);
    style.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
    style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
    style.setDataFormat(integerDataFormat);
    return style;
}
项目:hy.common.report    文件:ColorListener.java   
/**
 * 对变量名称反射出来的值进行加工处理
 * 
 * @author      ZhengWei(HY)
 * @createDate  2017-06-29
 * @version     v1.0
 *
 * @param i_RTemplate     模板
 * @param i_TemplateCell  模板单元格对象
 * @param i_DataCell      数据单元格对象
 * @param i_DataWorkbook  数据工作薄对象
 * @param i_RSystemValue  系统变量信息
 * @param i_Datas         本行对应的数据
 * @param i_Value         反射出来的变量名称对应的值
 * @return 
 */
public String getValue(RTemplate i_RTemplate ,Cell i_TemplateCell ,Cell i_DataCell ,RWorkbook i_DataWorkbook ,RSystemValue i_RSystemValue ,Object i_Datas ,Object i_Value)
{
    CellStyle v_NewCellStyle = null;

    if ( i_DataCell.getRow().getRowNum() % 2 == 1 )
    {
        v_NewCellStyle = i_DataWorkbook.getCellStyleByCopy("单行" ,i_DataCell ,i_RTemplate);
        v_NewCellStyle.setFillForegroundColor(IndexedColors.ORANGE.index);
    }
    else
    {
        v_NewCellStyle = i_DataWorkbook.getCellStyleByCopy("双行" ,i_DataCell ,i_RTemplate);
        v_NewCellStyle.setFillForegroundColor(IndexedColors.RED.index);
    }

    v_NewCellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);

    i_DataCell.setCellStyle(v_NewCellStyle);

    if ( i_Value == null )
    {
        return "";
    }

    return i_Value.toString();
}
项目:hy.common.report    文件:JU_Excel2003Color.java   
@Test
public void test_001()
{
    HSSFWorkbook v_Workbook = new HSSFWorkbook();
    HSSFSheet    v_Sheet    = v_Workbook.createSheet("测试单元格颜色");

    v_Sheet.setColumnWidth(0 ,2560);

    for (int v_RowIndex=0; v_RowIndex<4000; v_RowIndex++)
    {
        HSSFRow v_Row = v_Sheet.createRow(v_RowIndex);

        for (int v_ColIndex=0; v_ColIndex<1; v_ColIndex++)
        {
            HSSFCell      v_Cell = v_Row.createCell(v_ColIndex);
            HSSFCellStyle v_CellStyle = v_Workbook.createCellStyle();

            v_CellStyle.setFillForegroundColor((short)(v_RowIndex + 1));
            v_CellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);

            v_Cell.setCellStyle(v_CellStyle);
            v_Cell.setCellValue("" + (v_RowIndex + 1));
        }
    }

    ExcelHelp.save(v_Workbook ,"/Users/hy/Downloads/测试2003版本的单元格颜色");
}
项目:bdf2    文件:TitleStyleBuilder.java   
private XSSFCellStyle createXSSFCellStyle(Workbook wb, int[] bgColor, int[] fontColor, int fontSize) {
    SXSSFWorkbook workbook = (SXSSFWorkbook) wb;
    XSSFFont titleFont = (XSSFFont) workbook.createFont();
    titleFont.setCharSet(HSSFFont.DEFAULT_CHARSET);
    titleFont.setFontName("宋体");

    XSSFColor color9 = new XSSFColor(new java.awt.Color(fontColor[0], fontColor[1], fontColor[2]));
    XSSFColor color10 = new XSSFColor(new java.awt.Color(bgColor[0], bgColor[1], bgColor[2]));

    if (!(fontColor[0] == 0 && fontColor[1] == 0 && fontColor[2] == 0)) {
        titleFont.setColor(color9);
    }
    titleFont.setBold(true);
    titleFont.setFontHeightInPoints((short) fontSize);

    XSSFCellStyle titleStyle = (XSSFCellStyle) createBorderCellStyle(workbook, true);
    titleStyle.setFont(titleFont);
    titleStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
    titleStyle.setFillForegroundColor(color10);
    titleStyle.setAlignment(HorizontalAlignment.CENTER);
    titleStyle.setVerticalAlignment(VerticalAlignment.CENTER);

    return titleStyle;
}
项目:jasperreports    文件:JRXlsExporter.java   
@Override
protected void addBlankCell(JRExporterGridCell gridCell, int colIndex, int rowIndex)
{
    cell = row.createCell(colIndex);

    FillPatternType mode = backgroundMode;
    short backcolor = whiteIndex;

    if (!Boolean.TRUE.equals(sheetInfo.ignoreCellBackground) && gridCell.getCellBackcolor() != null)
    {
        mode = FillPatternType.SOLID_FOREGROUND;
        backcolor = getWorkbookColor(gridCell.getCellBackcolor()).getIndex();
    }

    short forecolor = blackIndex;
    if (gridCell.getForecolor() != null)
    {
        forecolor = getWorkbookColor(gridCell.getForecolor()).getIndex();
    }

    HSSFCellStyle cellStyle =
        getLoadedCellStyle(
            mode,
            backcolor,
            HorizontalAlignment.LEFT,
            VerticalAlignment.TOP,
            (short)0,
            getLoadedFont(getDefaultFont(), forecolor, null, getLocale()),
            gridCell,
            true, 
            true, 
            false, 
            false
            );

    cell.setCellStyle(cellStyle);
}
项目:jasperreports    文件:JRXlsExporter.java   
@Override
protected void exportRectangle(JRPrintGraphicElement element, JRExporterGridCell gridCell, int colIndex, int rowIndex)
{
    short forecolor = getWorkbookColor(element.getLinePen().getLineColor()).getIndex();

    FillPatternType mode = backgroundMode;
    short backcolor = whiteIndex;
    if (!Boolean.TRUE.equals(sheetInfo.ignoreCellBackground) && gridCell.getCellBackcolor() != null)
    {
        mode = FillPatternType.SOLID_FOREGROUND;
        backcolor = getWorkbookColor(gridCell.getCellBackcolor()).getIndex();
    }

    HSSFCellStyle cellStyle =
        getLoadedCellStyle(
            mode,
            backcolor,
            HorizontalAlignment.LEFT,
            VerticalAlignment.TOP,
            (short)0,
            getLoadedFont(getDefaultFont(), forecolor, null, getLocale()),
            gridCell,
            isWrapText(element),
            isCellLocked(element),
            isCellHidden(element),
            isShrinkToFit(element)
            );

    createMergeRegion(gridCell, colIndex, rowIndex, cellStyle);

    cell = row.createCell(colIndex);
    cell.setCellStyle(cellStyle);
}
项目:jasperreports    文件:JRXlsExporter.java   
protected HSSFCellStyle getLoadedCellStyle(
    FillPatternType mode,
    short backcolor,
    HorizontalAlignment horizontalAlignment,
    VerticalAlignment verticalAlignment,
    short rotation,
    HSSFFont font,
    JRExporterGridCell gridCell,
    boolean isWrapText,
    boolean isCellLocked,
    boolean isCellHidden,
    boolean isShrinkToFit
    )
{
    return getLoadedCellStyle(
        new StyleInfo(
            mode, 
            backcolor, 
            horizontalAlignment, 
            verticalAlignment, 
            rotation, 
            font, 
            gridCell, 
            isWrapText, 
            isCellLocked, 
            isCellHidden, 
            isShrinkToFit));
}
项目:jasperreports    文件:JRXlsExporter.java   
@Override
protected void exportFrame(JRPrintFrame frame, JRExporterGridCell gridCell, int x, int y)
{
    FillPatternType mode = backgroundMode;
    short backcolor = whiteIndex;
    if (frame.getModeValue() == ModeEnum.OPAQUE)
    {
        mode = FillPatternType.SOLID_FOREGROUND;
        backcolor = getWorkbookColor(frame.getBackcolor()).getIndex();
    }

    short forecolor = getWorkbookColor(frame.getForecolor()).getIndex();

    HSSFCellStyle cellStyle =
        getLoadedCellStyle(
            mode,
            backcolor,
            HorizontalAlignment.LEFT,
            VerticalAlignment.TOP,
            (short)0,
            getLoadedFont(getDefaultFont(), forecolor, null, getLocale()),
            gridCell,
            isWrapText(frame),
            isCellLocked(frame),
            isCellHidden(frame),
            isShrinkToFit(frame)
            );

    createMergeRegion(gridCell, x, y, cellStyle);

    cell = row.createCell(x);
    cell.setCellStyle(cellStyle);
}
项目:jasperreports    文件:JRXlsExporter.java   
public StyleInfo(
    FillPatternType mode,
    short backcolor,
    HorizontalAlignment horizontalAlignment,
    VerticalAlignment verticalAlignment,
    short rotation,
    HSSFFont font,
    BoxStyle box,
    boolean wrapText,
    boolean cellLocked,
    boolean cellHidden,
    boolean shrinkToFit
    )
{
    this.mode = mode;
    this.backcolor = backcolor;
    this.horizontalAlignment = horizontalAlignment;
    this.verticalAlignment = verticalAlignment;
    this.rotation = rotation;
    this.font = font;

    this.box = box;
    this.lcWrapText = shrinkToFit ? false : wrapText;
    this.lcCellLocked = cellLocked;
    this.lcCellHidden = cellHidden;
    this.lcShrinkToFit = shrinkToFit;
    hashCode = computeHash();
}
项目:jasperreports    文件:JRXlsMetadataExporter.java   
@Override
protected void exportRectangle(JRPrintGraphicElement element) throws JRException {
    String currentColumnName = element.getPropertiesMap().getProperty(JRXlsAbstractMetadataExporter.PROPERTY_COLUMN_NAME);

    if (currentColumnName != null && currentColumnName.length() > 0) {
        boolean repeatValue = getPropertiesUtil().getBooleanProperty(element, JRXlsAbstractMetadataExporter.PROPERTY_REPEAT_VALUE, false);

        setColumnName(currentColumnName);
        adjustColumnWidth(currentColumnName, element.getWidth(), ((JRXlsExporterNature)nature).getColumnAutoFit(element));
        adjustRowHeight(element.getHeight(), ((JRXlsExporterNature)nature).getRowAutoFit(element));

        short forecolor = getWorkbookColor(element.getLinePen().getLineColor()).getIndex();

        FillPatternType mode = backgroundMode;
        short backcolor = whiteIndex;
        if (!Boolean.TRUE.equals(sheetInfo.ignoreCellBackground) && element.getBackcolor() != null) {
            mode = FillPatternType.SOLID_FOREGROUND;
            backcolor = getWorkbookColor(element.getBackcolor()).getIndex();
        }

        HSSFCellStyle cellStyle =
            getLoadedCellStyle(
                mode,
                backcolor,
                HorizontalAlignment.LEFT,
                VerticalAlignment.TOP,
                (short)0,
                getLoadedFont(getDefaultFont(), forecolor, null, getLocale()),
                new BoxStyle(element),
                isCellLocked(element),
                isCellHidden(element),
                isShrinkToFit(element)
                );
        addBlankElement(cellStyle, repeatValue, currentColumnName);
    }
}
项目:jasperreports    文件:JRXlsMetadataExporter.java   
protected HSSFCellStyle getLoadedCellStyle(
    FillPatternType mode,
    short backcolor,
    HorizontalAlignment horizontalAlignment,
    VerticalAlignment verticalAlignment,
    short rotation,
    HSSFFont font,
    BoxStyle box,
    boolean isCellLocked,
    boolean isCellHidden,
    boolean isShrinkToFit
    ) 
{
    return getLoadedCellStyle(new StyleInfo(mode, backcolor, horizontalAlignment, verticalAlignment, rotation, font, box, true, isCellLocked, isCellHidden, isShrinkToFit));
}
项目:jasperreports    文件:JRXlsMetadataExporter.java   
public StyleInfo(
    FillPatternType mode,
    short backcolor,
    HorizontalAlignment horizontalAlignment,
    VerticalAlignment verticalAlignment,
    short rotation,
    HSSFFont font,
    BoxStyle box,
    boolean wrapText,
    boolean cellLocked,
    boolean cellHidden,
    boolean shrinkToFit
    ) 
{
    this.mode = mode;
    this.backcolor = backcolor;
    this.horizontalAlignment = horizontalAlignment;
    this.verticalAlignment = verticalAlignment;
    this.rotation = rotation;
    this.font = font;

    this.box = box;
    this.lcWrapText = shrinkToFit ? false : wrapText;
    this.lcCellLocked = cellLocked;
    this.lcCellHidden = cellHidden;
    this.lcShrinkToFit = shrinkToFit;
    hashCode = computeHash();
}
项目:kunter-generator    文件:MakeDatabaseOfExcel.java   
/**
 * 蓝色背景样式
 *
 * @param workbook
 * @return
 * @author 阳自然
 */
private static CellStyle getCellStyleBlue(Workbook workbook) {

    CellStyle cellStyle = getCellStyle(workbook);

    // 设置单元格颜色
    cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
    cellStyle.setFillForegroundColor(IndexedColors.CORNFLOWER_BLUE.getIndex());

    return cellStyle;
}
项目:appformer    文件:DataSetExportServicesImpl.java   
private Map<String, CellStyle> createStyles(Workbook wb){
    Map<String, CellStyle> styles = new HashMap<>();
    CellStyle style;

    Font titleFont = wb.createFont();
    titleFont.setFontHeightInPoints((short)12);
    titleFont.setBold(true);
    style = wb.createCellStyle();
    style.setAlignment(HorizontalAlignment.CENTER);
    style.setVerticalAlignment(VerticalAlignment.CENTER);
    style.setFillForegroundColor( IndexedColors.GREY_25_PERCENT.getIndex());
    style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
    style.setFont(titleFont);
    style.setWrapText(false);
    style.setBorderBottom(BorderStyle.THIN);
    style.setBottomBorderColor(IndexedColors.GREY_80_PERCENT.getIndex());
    styles.put("header", style);

    Font cellFont = wb.createFont();
    cellFont.setFontHeightInPoints((short)10);
    cellFont.setBold(true);

    style = wb.createCellStyle();
    style.setAlignment(HorizontalAlignment.RIGHT);
    style.setVerticalAlignment(VerticalAlignment.BOTTOM);
    style.setFont(cellFont);
    style.setWrapText(false);
    style.setDataFormat(wb.createDataFormat().getFormat( BuiltinFormats.getBuiltinFormat( 3 )));
    styles.put("integer_number_cell", style);

    style = wb.createCellStyle();
    style.setAlignment(HorizontalAlignment.RIGHT);
    style.setVerticalAlignment(VerticalAlignment.BOTTOM);
    style.setFont(cellFont);
    style.setWrapText(false);
    style.setDataFormat(wb.createDataFormat().getFormat(BuiltinFormats.getBuiltinFormat(4)));
    styles.put("decimal_number_cell", style);

    style = wb.createCellStyle();
    style.setAlignment(HorizontalAlignment.LEFT);
    style.setVerticalAlignment(VerticalAlignment.BOTTOM);
    style.setFont(cellFont);
    style.setWrapText(false);
    style.setDataFormat( (short) BuiltinFormats.getBuiltinFormat("text") );
    styles.put(TEXT_CELL, style);

    style = wb.createCellStyle();
    style.setAlignment(HorizontalAlignment.CENTER);
    style.setVerticalAlignment(VerticalAlignment.BOTTOM);
    style.setFont(cellFont);
    style.setWrapText(false);
    style.setDataFormat(wb.createDataFormat().getFormat( DateFormatConverter.convert( Locale.getDefault(), dateFormatPattern )));
    styles.put("date_cell", style);
    return styles;
}
项目:sqlexplorer-vaadin    文件:ExcelExport.java   
public HSSFCellStyle createHeaderStyle() {
    HSSFCellStyle style = workbook.createCellStyle();
    final HSSFFont font = workbook.createFont();
    font.setBold(true);
    style.setFont(font);
    style.setBorderBottom(BorderStyle.THIN);
    style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
    style.setVerticalAlignment(VerticalAlignment.CENTER);
    style.setAlignment(HorizontalAlignment.CENTER);
    style.setFillForegroundColor(HSSFColor.HSSFColorPredefined.PALE_BLUE.getIndex());
    return style;
}
项目:dashbuilder    文件:DataSetExportServicesImpl.java   
private Map<String, CellStyle> createStyles(Workbook wb){
    Map<String, CellStyle> styles = new HashMap<>();
    CellStyle style;

    Font titleFont = wb.createFont();
    titleFont.setFontHeightInPoints((short)12);
    titleFont.setBold(true);
    style = wb.createCellStyle();
    style.setAlignment(HorizontalAlignment.CENTER);
    style.setVerticalAlignment(VerticalAlignment.CENTER);
    style.setFillForegroundColor( IndexedColors.GREY_25_PERCENT.getIndex());
    style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
    style.setFont(titleFont);
    style.setWrapText(false);
    style.setBorderBottom(BorderStyle.THIN);
    style.setBottomBorderColor(IndexedColors.GREY_80_PERCENT.getIndex());
    styles.put("header", style);

    Font cellFont = wb.createFont();
    cellFont.setFontHeightInPoints((short)10);
    cellFont.setBold(true);

    style = wb.createCellStyle();
    style.setAlignment(HorizontalAlignment.RIGHT);
    style.setVerticalAlignment(VerticalAlignment.BOTTOM);
    style.setFont(cellFont);
    style.setWrapText(false);
    style.setDataFormat(wb.createDataFormat().getFormat( BuiltinFormats.getBuiltinFormat( 3 )));
    styles.put("integer_number_cell", style);

    style = wb.createCellStyle();
    style.setAlignment(HorizontalAlignment.RIGHT);
    style.setVerticalAlignment(VerticalAlignment.BOTTOM);
    style.setFont(cellFont);
    style.setWrapText(false);
    style.setDataFormat(wb.createDataFormat().getFormat(BuiltinFormats.getBuiltinFormat(4)));
    styles.put("decimal_number_cell", style);

    style = wb.createCellStyle();
    style.setAlignment(HorizontalAlignment.LEFT);
    style.setVerticalAlignment(VerticalAlignment.BOTTOM);
    style.setFont(cellFont);
    style.setWrapText(false);
    style.setDataFormat( (short) BuiltinFormats.getBuiltinFormat("text") );
    styles.put(TEXT_CELL, style);

    style = wb.createCellStyle();
    style.setAlignment(HorizontalAlignment.CENTER);
    style.setVerticalAlignment(VerticalAlignment.BOTTOM);
    style.setFont(cellFont);
    style.setWrapText(false);
    style.setDataFormat(wb.createDataFormat().getFormat( DateFormatConverter.convert( Locale.getDefault(), dateFormatPattern )));
    styles.put("date_cell", style);
    return styles;
}
项目:ph-poi    文件:ExcelStyleTest.java   
@Test
public void testFillPattern ()
{
  final ExcelStyle e = new ExcelStyle ();
  assertNull (e.getFillPattern ());
  CommonsTestHelper.testGetClone (e);
  for (final FillPatternType ePattern : FillPatternType.values ())
  {
    assertSame (e, e.setFillPattern (ePattern));
    assertEquals (ePattern, e.getFillPattern ());
    CommonsTestHelper.testGetClone (e);
  }
}
项目:acs-aem-commons    文件:GenericReportExcelServlet.java   
CellStyle createHeaderStyle(Workbook wb){
    XSSFCellStyle xstyle = (XSSFCellStyle)wb.createCellStyle();
    XSSFColor header = new XSSFColor(new byte[]{(byte)79, (byte)129, (byte)189} );
    xstyle.setFillForegroundColor(header);
    xstyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
    XSSFFont font = (XSSFFont)wb.createFont();
    font.setColor(IndexedColors.WHITE.index);
    xstyle.setFont(font);
    return xstyle;
}
项目:bdf2    文件:GridStyleBuilder.java   
private Map<String, CellStyle> createHSSFCellStyles(Workbook wb, int[] contextBgColor, int[] contextFontColor, int contextFontSize, int contextFontAlign, int[] headerBgColor,
        int[] headerFontColor, int headerFontSize, int headerAlign) {
    Map<String, CellStyle> styles = new HashMap<String, CellStyle>();

    HSSFWorkbook workbook = (HSSFWorkbook) wb;
    HSSFPalette palette = workbook.getCustomPalette();
    palette.setColorAtIndex((short) 11, (byte) contextBgColor[0], (byte) contextBgColor[1], (byte) contextBgColor[2]);
    palette.setColorAtIndex((short) 12, (byte) contextFontColor[0], (byte) contextFontColor[1], (byte) contextFontColor[2]);
    palette.setColorAtIndex((short) 13, (byte) headerBgColor[0], (byte) headerBgColor[1], (byte) headerBgColor[2]);
    palette.setColorAtIndex((short) 14, (byte) headerFontColor[0], (byte) headerFontColor[1], (byte) headerFontColor[2]);

    HSSFFont headerFont = workbook.createFont();
    headerFont.setCharSet(HSSFFont.DEFAULT_CHARSET);
    headerFont.setFontName("宋体");
    headerFont.setColor((short) 14);
    headerFont.setBold(true);
    headerFont.setFontHeightInPoints((short) headerFontSize);
    CellStyle headerStyle = this.createBorderCellStyle(workbook, true);

    headerStyle.setFont(headerFont);
    headerStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
    headerStyle.setFillForegroundColor((short) 13);
    this.setCellStyleAligment(headerStyle, headerAlign);
    headerStyle.setVerticalAlignment(VerticalAlignment.CENTER);
    styles.put(GridStyleType.headerStyle.name(), headerStyle);

    HSSFFont dataFont = workbook.createFont();
    dataFont.setColor((short) 12);
    dataFont.setFontHeightInPoints((short) contextFontSize);
    dataFont.setCharSet(HSSFFont.DEFAULT_CHARSET);
    dataFont.setFontName("宋体");

    CellStyle dataAlignLeftStyle = this.createBorderCellStyle(workbook, true);
    dataAlignLeftStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
    dataAlignLeftStyle.setFillForegroundColor((short) 11);
    dataAlignLeftStyle.setFont(dataFont);
    dataAlignLeftStyle.setVerticalAlignment(VerticalAlignment.CENTER);
    dataAlignLeftStyle.setWrapText(true);
    dataAlignLeftStyle.setAlignment(HorizontalAlignment.LEFT);
    styles.put(GridStyleType.dataAlignLeftStyle.name(), dataAlignLeftStyle);

    CellStyle dataAlignCenterStyle = this.createBorderCellStyle(workbook, true);
    dataAlignCenterStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
    dataAlignCenterStyle.setFillForegroundColor((short) 11);
    dataAlignCenterStyle.setFont(dataFont);
    dataAlignCenterStyle.setVerticalAlignment(VerticalAlignment.CENTER);
    dataAlignCenterStyle.setWrapText(true);
    dataAlignCenterStyle.setAlignment(HorizontalAlignment.CENTER);
    styles.put(GridStyleType.dataAlignCenterStyle.name(), dataAlignCenterStyle);

    CellStyle dataAlignRightStyle = this.createBorderCellStyle(workbook, true);
    dataAlignRightStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
    dataAlignRightStyle.setFillForegroundColor((short) 11);
    dataAlignRightStyle.setFont(dataFont);
    dataAlignRightStyle.setVerticalAlignment(VerticalAlignment.CENTER);
    dataAlignRightStyle.setWrapText(true);
    dataAlignRightStyle.setAlignment(HorizontalAlignment.RIGHT);
    styles.put(GridStyleType.dataAlignRightStyle.name(), dataAlignRightStyle);

    CellStyle dateStyle = this.createBorderCellStyle(workbook, true);
    CreationHelper helper = workbook.getCreationHelper();
    dateStyle.setDataFormat(helper.createDataFormat().getFormat("m/d/yy h:mm"));
    dateStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
    dateStyle.setFillForegroundColor((short) 11);
    dateStyle.setFont(dataFont);
    dateStyle.setVerticalAlignment(VerticalAlignment.CENTER);
    this.setCellStyleAligment(dateStyle, contextFontAlign);
    styles.put(GridStyleType.dateStyle.name(), dateStyle);

    return styles;
}
项目:bdf2    文件:GridStyleBuilder.java   
private Map<String, CellStyle> createXSSFCellStyles(Workbook wb, int[] contextBgColor, int[] contextFontColor, int contextFontSize, int contextFontAlign, int[] headerBgColor,
        int[] headerFontColor, int headerFontSize, int headerAlign) {
    Map<String, CellStyle> styles = new HashMap<String, CellStyle>();

    SXSSFWorkbook workbook = (SXSSFWorkbook) wb;
    XSSFColor xssfContextBgColor = new XSSFColor(new java.awt.Color(contextBgColor[0], contextBgColor[1], contextBgColor[2]));
    XSSFColor xssfContextFontColor = new XSSFColor(new java.awt.Color(contextFontColor[0], contextFontColor[1], contextFontColor[2]));
    XSSFColor xssfHeaderBgColor = new XSSFColor(new java.awt.Color(headerBgColor[0], headerBgColor[1], headerBgColor[2]));
    XSSFColor xssfHeaderFontColor = new XSSFColor(new java.awt.Color(headerFontColor[0], headerFontColor[1], headerFontColor[2]));

    XSSFFont headerFont = (XSSFFont) workbook.createFont();
    headerFont.setCharSet(HSSFFont.DEFAULT_CHARSET);
    headerFont.setFontName("宋体");
    if (!(headerFontColor[0] == 0 && headerFontColor[1] == 0 && headerFontColor[2] == 0)) {
        headerFont.setColor(xssfHeaderFontColor);
    }
    headerFont.setBold(true);
    headerFont.setFontHeightInPoints((short) headerFontSize);
    XSSFCellStyle headerStyle = (XSSFCellStyle) this.createBorderCellStyle(workbook, true);
    headerStyle.setFont(headerFont);
    headerStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
    headerStyle.setFillForegroundColor(xssfHeaderBgColor);
    this.setCellStyleAligment(headerStyle, headerAlign);
    headerStyle.setVerticalAlignment(VerticalAlignment.CENTER);
    styles.put(GridStyleType.headerStyle.name(), headerStyle);

    XSSFFont dataFont = (XSSFFont) workbook.createFont();
    if (!(contextFontColor[0] == 0 && contextFontColor[1] == 0 && contextFontColor[2] == 0)) {
        dataFont.setColor(xssfContextFontColor);
    }
    dataFont.setFontHeightInPoints((short) contextFontSize);
    dataFont.setCharSet(HSSFFont.DEFAULT_CHARSET);
    dataFont.setFontName("宋体");

    XSSFCellStyle dataAlignLeftStyle = (XSSFCellStyle) this.createBorderCellStyle(workbook, true);
    dataAlignLeftStyle.setFont(dataFont);
    dataAlignLeftStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
    dataAlignLeftStyle.setFillForegroundColor(xssfContextBgColor);
    dataAlignLeftStyle.setVerticalAlignment(VerticalAlignment.CENTER);
    dataAlignLeftStyle.setWrapText(true);
    dataAlignLeftStyle.setAlignment(HorizontalAlignment.LEFT);
    styles.put(GridStyleType.dataAlignLeftStyle.name(), dataAlignLeftStyle);

    XSSFCellStyle dataAlignCenterStyle = (XSSFCellStyle) this.createBorderCellStyle(workbook, true);
    dataAlignCenterStyle.setFont(dataFont);
    dataAlignCenterStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
    dataAlignCenterStyle.setFillForegroundColor(xssfContextBgColor);
    dataAlignCenterStyle.setVerticalAlignment(VerticalAlignment.CENTER);
    dataAlignCenterStyle.setWrapText(true);
    dataAlignCenterStyle.setAlignment(HorizontalAlignment.CENTER);
    styles.put(GridStyleType.dataAlignCenterStyle.name(), dataAlignCenterStyle);

    XSSFCellStyle dataAlignRightStyle = (XSSFCellStyle) this.createBorderCellStyle(workbook, true);
    dataAlignRightStyle.setFont(dataFont);
    dataAlignRightStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
    dataAlignRightStyle.setFillForegroundColor(xssfContextBgColor);
    dataAlignRightStyle.setVerticalAlignment(VerticalAlignment.CENTER);
    dataAlignRightStyle.setWrapText(true);
    dataAlignRightStyle.setAlignment(HorizontalAlignment.RIGHT);
    styles.put(GridStyleType.dataAlignRightStyle.name(), dataAlignRightStyle);

    XSSFCellStyle dateStyle = (XSSFCellStyle) this.createBorderCellStyle(workbook, true);
    CreationHelper helper = workbook.getCreationHelper();
    dateStyle.setDataFormat(helper.createDataFormat().getFormat("m/d/yy h:mm"));
    dateStyle.setFont(dataFont);
    dateStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
    dateStyle.setFillForegroundColor(xssfContextBgColor);
    dateStyle.setVerticalAlignment(VerticalAlignment.CENTER);
    this.setCellStyleAligment(dateStyle, contextFontAlign);
    styles.put(GridStyleType.dateStyle.name(), dateStyle);

    return styles;
}
项目:jasperreports    文件:JRXlsExporter.java   
@Override
protected void exportLine(JRPrintLine line, JRExporterGridCell gridCell, int colIndex, int rowIndex)
{
    short forecolor = getWorkbookColor(line.getLinePen().getLineColor()).getIndex();

    int side = BoxStyle.TOP;
    float ratio = line.getWidth() / line.getHeight();
    if (ratio > 1)
    {
        if (line.getDirectionValue() == LineDirectionEnum.TOP_DOWN)
        {
            side = BoxStyle.TOP;
        }
        else
        {
            side = BoxStyle.BOTTOM;
        }
    }
    else
    {
        if (line.getDirectionValue() == LineDirectionEnum.TOP_DOWN)
        {
            side = BoxStyle.LEFT;
        }
        else
        {
            side = BoxStyle.RIGHT;
        }
    }
    BoxStyle boxStyle = new BoxStyle(side, line.getLinePen());

    FillPatternType mode = backgroundMode;
    short backcolor = whiteIndex;
    if (!Boolean.TRUE.equals(sheetInfo.ignoreCellBackground) && gridCell.getCellBackcolor() != null)
    {
        mode = FillPatternType.SOLID_FOREGROUND;
        backcolor = getWorkbookColor(gridCell.getCellBackcolor()).getIndex();
    }

    HSSFCellStyle cellStyle =
        getLoadedCellStyle(
            mode,
            backcolor,
            HorizontalAlignment.LEFT,
            VerticalAlignment.TOP,
            (short)0,
            getLoadedFont(getDefaultFont(), forecolor, null, getLocale()),
            boxStyle,
            false,
            isCellLocked(line),
            isCellHidden(line),
            isShrinkToFit(line)
            );

    createMergeRegion(gridCell, colIndex, rowIndex, cellStyle);

    cell = row.createCell(colIndex);
    cell.setCellStyle(cellStyle);
}
项目:jasperreports    文件:JRXlsExporter.java   
@Override
public void exportText(JRPrintText textElement, JRExporterGridCell gridCell, int colIndex, int rowIndex) throws JRException
{
    JRStyledText styledText = getStyledText(textElement);

    if (styledText == null)
    {
        return;
    }

    short forecolor = getWorkbookColor(textElement.getForecolor()).getIndex();

    TextAlignHolder textAlignHolder = getTextAlignHolder(textElement);
    HorizontalAlignment horizontalAlignment = getHorizontalAlignment(textAlignHolder);
    VerticalAlignment verticalAlignment = getVerticalAlignment(textAlignHolder);
    short rotation = getRotation(textAlignHolder);

    FillPatternType mode = backgroundMode;
    short backcolor = whiteIndex;
    if (!Boolean.TRUE.equals(sheetInfo.ignoreCellBackground) && gridCell.getCellBackcolor() != null)
    {
        mode = FillPatternType.SOLID_FOREGROUND;
        backcolor = getWorkbookColor(gridCell.getCellBackcolor()).getIndex();
    }

    StyleInfo baseStyle = 
        isIgnoreTextFormatting(textElement) 
        ? new StyleInfo(
            mode,
            whiteIndex,
            horizontalAlignment,
            verticalAlignment,
            (short)0,
            null,
            (JRExporterGridCell)null, 
            isWrapText(textElement) || Boolean.TRUE.equals(((JRXlsExporterNature)nature).getColumnAutoFit(textElement)),
            isCellLocked(textElement),
            isCellHidden(textElement),
            isShrinkToFit(textElement)
            )
        : new StyleInfo(
            mode,
            backcolor,
            horizontalAlignment,
            verticalAlignment,
            rotation,
            getLoadedFont(textElement, forecolor, null, getTextLocale(textElement)),
            gridCell, 
            isWrapText(textElement) || Boolean.TRUE.equals(((JRXlsExporterNature)nature).getColumnAutoFit(textElement)),
            isCellLocked(textElement),
            isCellHidden(textElement),
            isShrinkToFit(textElement)
            );
    createTextCell(textElement, gridCell, colIndex, rowIndex, styledText, baseStyle, forecolor);
}
项目:jasperreports    文件:JRXlsMetadataExporter.java   
@Override
protected void exportLine(JRPrintLine line) throws JRException {
    String currentColumnName = line.getPropertiesMap().getProperty(JRXlsAbstractMetadataExporter.PROPERTY_COLUMN_NAME);

    if (currentColumnName != null && currentColumnName.length() > 0) {
        boolean repeatValue = getPropertiesUtil().getBooleanProperty(line, JRXlsAbstractMetadataExporter.PROPERTY_REPEAT_VALUE, false);

        setColumnName(currentColumnName);
        adjustColumnWidth(currentColumnName, line.getWidth(), ((JRXlsExporterNature)nature).getColumnAutoFit(line));
        adjustRowHeight(line.getHeight(), ((JRXlsExporterNature)nature).getRowAutoFit(line));

        short forecolor = getWorkbookColor(line.getLinePen().getLineColor()).getIndex();

        int side = BoxStyle.TOP;
        float ratio = line.getWidth() / line.getHeight();
        if (ratio > 1) {
            if (line.getDirectionValue() == LineDirectionEnum.TOP_DOWN) {
                side = BoxStyle.TOP;
            } else {
                side = BoxStyle.BOTTOM;
            }
        } else {
            if (line.getDirectionValue() == LineDirectionEnum.TOP_DOWN) {
                side = BoxStyle.LEFT;
            } else {
                side = BoxStyle.RIGHT;
            }
        }
        BoxStyle boxStyle = new BoxStyle(side, line.getLinePen());

        FillPatternType mode = backgroundMode;
        short backcolor = whiteIndex;
        if (!Boolean.TRUE.equals(sheetInfo.ignoreCellBackground) && line.getBackcolor() != null) {
            mode = FillPatternType.SOLID_FOREGROUND;
            backcolor = getWorkbookColor(line.getBackcolor()).getIndex();
        }

        HSSFCellStyle cellStyle =
            getLoadedCellStyle(
                mode,
                backcolor,
                HorizontalAlignment.LEFT,
                VerticalAlignment.TOP,
                (short)0,
                getLoadedFont(getDefaultFont(), forecolor, null, getLocale()),
                boxStyle,
                isCellLocked(line),
                isCellHidden(line),
                isShrinkToFit(line)
                );
        addBlankElement(cellStyle, repeatValue, currentColumnName);
    }
}
项目:bamboobsc    文件:PdcaReportExcelCommand.java   
private int createPdcaItem(XSSFWorkbook wb, XSSFSheet sh, int row, XSSFCellStyle cellNormalStyle, List<PdcaItemVO> items, PdcaAuditVO audit) throws Exception {

    XSSFColor fnColor = new XSSFColor( SimpleUtils.getColorRGB4POIColor("#000000") );       
    XSSFColor bgLabelColor = new XSSFColor( SimpleUtils.getColorRGB4POIColor("#F2F2F2") );

    XSSFCellStyle cellLabelStyle = wb.createCellStyle();
    cellLabelStyle.setFillForegroundColor( bgLabelColor );
    cellLabelStyle.setFillPattern( FillPatternType.SOLID_FOREGROUND );              

    XSSFFont cellLabelFont = wb.createFont();
    cellLabelFont.setBold(true);
    cellLabelFont.setColor(fnColor);
    cellLabelStyle.setFont(cellLabelFont);      
    cellLabelStyle.setBorderBottom(BorderStyle.THIN);
    cellLabelStyle.setBorderTop(BorderStyle.THIN);
    cellLabelStyle.setBorderRight(BorderStyle.THIN);
    cellLabelStyle.setBorderLeft(BorderStyle.THIN);
    cellLabelStyle.setVerticalAlignment(VerticalAlignment.CENTER);
    cellLabelStyle.setAlignment(HorizontalAlignment.CENTER);
    cellLabelStyle.setWrapText(true);           

    Map<String, String> pdcaTypeMap = PdcaType.getDataMap(false);

    for (PdcaItemVO item : items) {

        Row labelRow = sh.createRow(row);
        Cell labelCell_6_1 = labelRow.createCell(0);    
        labelCell_6_1.setCellValue( pdcaTypeMap.get(item.getType()) );
        labelCell_6_1.setCellStyle(cellLabelStyle);             

        Cell labelCell_6_2 = labelRow.createCell(1);    
        labelCell_6_2.setCellValue( item.getTitle() + ( !StringUtils.isBlank(item.getDescription()) ? "\n\n" + item.getDescription() : "" ) );
        labelCell_6_2.setCellStyle(cellNormalStyle);    

        Cell labelCell_6_3 = labelRow.createCell(2);    
        labelCell_6_3.setCellValue( item.getEmployeeAppendNames() );
        labelCell_6_3.setCellStyle(cellNormalStyle);

        Cell labelCell_6_4 = labelRow.createCell(3);    
        labelCell_6_4.setCellValue( item.getStartDateDisplayValue() + " ~ " + item.getEndDateDisplayValue() );
        labelCell_6_4.setCellStyle(cellNormalStyle);    

        Cell labelCell_6_5 = labelRow.createCell(4);    
        labelCell_6_5.setCellValue( (audit != null ? audit.getEmpId() : " ") );
        labelCell_6_5.setCellStyle(cellNormalStyle);    

        Cell labelCell_6_6 = labelRow.createCell(5);    
        labelCell_6_6.setCellValue( (audit != null ? audit.getConfirmDateDisplayValue() : " ") );
        labelCell_6_6.setCellStyle(cellNormalStyle);


        row++;

    }

    return row;
}
项目:bamboobsc    文件:KpiPeriodTrendsExcelCommand.java   
@SuppressWarnings("unchecked")
private void putTables(XSSFWorkbook wb, XSSFSheet sh, Context context) throws Exception {

    XSSFCellStyle cellHeadStyle = wb.createCellStyle();
    cellHeadStyle.setFillForegroundColor( new XSSFColor( SimpleUtils.getColorRGB4POIColor( "#f5f5f5" ) ) );
    cellHeadStyle.setFillPattern( FillPatternType.SOLID_FOREGROUND );   
    cellHeadStyle.setBorderBottom( BorderStyle.THIN );
    cellHeadStyle.setBorderTop( BorderStyle.THIN );
    cellHeadStyle.setBorderRight( BorderStyle.THIN );
    cellHeadStyle.setBorderLeft( BorderStyle.THIN );        
    XSSFFont cellHeadFont = wb.createFont();
    cellHeadFont.setBold(true);     
    cellHeadStyle.setFont( cellHeadFont );

    sh.setColumnWidth(0, 12000);

    int row = 0;

    Row nowRow = sh.createRow(row);
    Cell cell1 = nowRow.createCell(0);
    cell1.setCellStyle(cellHeadStyle);
    cell1.setCellValue( "KPI" );                
    Cell cell2 = nowRow.createCell(1);
    cell2.setCellStyle(cellHeadStyle);
    cell2.setCellValue( "Maximum" );                                    
    Cell cell3 = nowRow.createCell(2);
    cell3.setCellStyle(cellHeadStyle);
    cell3.setCellValue( "Target" ); 
    Cell cell4 = nowRow.createCell(3);
    cell4.setCellStyle(cellHeadStyle);
    cell4.setCellValue( "Minimum" );                                
    Cell cell5 = nowRow.createCell(4);
    cell5.setCellStyle(cellHeadStyle);
    cell5.setCellValue( "Current score" );          
    Cell cell6 = nowRow.createCell(5);
    cell6.setCellStyle(cellHeadStyle);
    cell6.setCellValue( "Previous score" ); 
    Cell cell7 = nowRow.createCell(6);
    cell7.setCellStyle(cellHeadStyle);
    cell7.setCellValue( "Change(%)" );  

    row++;

    List<PeriodTrendsData<KpiVO>> periodDatas = (List<PeriodTrendsData<KpiVO>>)context.get("periodDatas");
    for (PeriodTrendsData<KpiVO> periodData : periodDatas) {
        nowRow = sh.createRow(row);

        cell1 = nowRow.createCell(0);
        cell1.setCellValue( periodData.getCurrent().getName() );                
        cell2 = nowRow.createCell(1);
        cell2.setCellValue( periodData.getCurrent().getMax() );                                 
        cell3 = nowRow.createCell(2);
        cell3.setCellValue( periodData.getCurrent().getTarget() );  
        cell4 = nowRow.createCell(3);
        cell4.setCellValue( periodData.getCurrent().getMin() );                             
        cell5 = nowRow.createCell(4);
        cell5.setCellValue( BscReportSupportUtils.parse2( periodData.getCurrent().getScore() ) );           
        cell6 = nowRow.createCell(5);
        cell6.setCellValue( BscReportSupportUtils.parse2( periodData.getPrevious().getScore() ) );  
        cell7 = nowRow.createCell(6);
        cell7.setCellValue( BscReportSupportUtils.parse2( periodData.getChange() ) );           

        row++;
    }

    nowRow = sh.createRow(row);

    cell1 = nowRow.createCell(0);
    cell1.setCellValue( "Current period: " + (String)context.get("currentPeriodDateRange") + " , Previous period: " + (String)context.get("previousPeriodDateRange") );             

}
项目:bamboobsc    文件:PersonalReportExcelCommand.java   
private void createFoot(XSSFWorkbook wb, XSSFSheet sh, int row, VisionVO vision, Context context) throws Exception {

    Row footRow=sh.createRow(row);
    Row footRowB=sh.createRow(row+1);
    XSSFCellStyle cellStyle=wb.createCellStyle();

    cellStyle.setFillForegroundColor( new XSSFColor(SimpleUtils.getColorRGB4POIColor("#FFFFFF")) );
    cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);     
    cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
    cellStyle.setBorderBottom(BorderStyle.THIN);
    cellStyle.setBorderTop(BorderStyle.THIN);
    cellStyle.setBorderRight(BorderStyle.THIN);
    cellStyle.setBorderLeft(BorderStyle.THIN);                  
    XSSFFont cellFont=wb.createFont();
    cellFont.setBold(true);
    cellStyle.setFont(cellFont);
    cellStyle.setWrapText(true);        

    Cell footCell1 = footRow.createCell(0);
    footCell1.setCellValue("assess:");
    footCell1.setCellStyle(cellStyle);          
    Cell footCell1B = footRowB.createCell(0);
    footCell1B.setCellValue("assess:");
    footCell1B.setCellStyle(cellStyle);     
    sh.addMergedRegion(new CellRangeAddress(row, row+1, 0, 0));                 

    Cell footCell2 = footRow.createCell(1);
    footCell2.setCellValue( BscReportPropertyUtils.getPersonalReportClassLevel() );
    footCell2.setCellStyle(cellStyle);                  
    Cell footCell3 = footRow.createCell(2);
    footCell3.setCellValue( BscReportPropertyUtils.getPersonalReportClassLevel() );
    footCell3.setCellStyle(cellStyle);          
    Cell footCell4 = footRow.createCell(3);
    footCell4.setCellValue( BscReportPropertyUtils.getPersonalReportClassLevel() );
    footCell4.setCellStyle(cellStyle);          
    Cell footCell2B = footRowB.createCell(1);
    footCell2B.setCellValue( BscReportPropertyUtils.getPersonalReportClassLevel() );
    footCell2B.setCellStyle(cellStyle);                 
    Cell footCell3B = footRowB.createCell(2);
    footCell3B.setCellValue( BscReportPropertyUtils.getPersonalReportClassLevel() );
    footCell3B.setCellStyle(cellStyle);         
    Cell footCell4B = footRowB.createCell(3);
    footCell4B.setCellValue( BscReportPropertyUtils.getPersonalReportClassLevel() );
    footCell4B.setCellStyle(cellStyle);                 
    sh.addMergedRegion(new CellRangeAddress(row, row+1, 1, 3)); 

    Cell footCell5 = footRow.createCell(4);
    footCell5.setCellValue("Total");
    footCell5.setCellStyle(cellStyle);  

    float total = 0.0f;
    if ( context.get("total")!=null && context.get("total") instanceof Float ) {
        total = (Float)context.get("total");
    }

    Cell footCell6 = footRow.createCell(5);
    footCell6.setCellValue( BscReportSupportUtils.parse2(total) );
    footCell6.setCellStyle(cellStyle);          

    Cell footCell5b = footRowB.createCell(4);
    footCell5b.setCellValue("Class");
    footCell5b.setCellStyle(cellStyle);         

    Cell footCell6b = footRowB.createCell(5);
    footCell6b.setCellValue( "" );
    footCell6b.setCellStyle(cellStyle);             

}
项目:ph-poi    文件:ExcelStyle.java   
@Nullable
public FillPatternType getFillPattern ()
{
  return m_eFillPattern;
}