Examples of HSSFCellStyle


Examples of org.apache.poi.hssf.usermodel.HSSFCellStyle

        EPStyle pstyle = (EPStyle) getAncestor(EPStyle.class);
        if ((pstyle != null) && pstyle.isValid()) {
            Hashtable colorhash = pstyle.getColorHash();       
            HSSFColor color = null;

            HSSFCellStyle style = pstyle.getStyle()//oops a little confusing
                                                      //below is the style attribute
                                                      //this is an HSSFCellStyle
                                                      //associated with EPStyle
            style.setBorderBottom((short)getStyle());

            ColorCode colorCode = getColor();
            if (colorCode != null) {
                color = (HSSFColor)colorhash.get(colorCode.toString());
            }
            if (color == null) color = new HSSFColor.BLACK();


            style.setBottomBorderColor(color.getIndex());
        }
       
    }   
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.HSSFCellStyle

   {
      boolean bDate = false;
      double d = cell.getNumericCellValue();
      if (HSSFDateUtil.isValidExcelDate(d))
      {
         HSSFCellStyle style = cell.getCellStyle();
         int i = style.getDataFormat();
         switch (i)
         {
            case 0xe : // m/d/yy
            case 0xf : // d-mmm-yy
            case 0x10 : // d-mmm
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.HSSFCellStyle

        worksheet.createRow((short)2);

        row = worksheet.createRow((short)3);

        HSSFCellStyle style = wb.createCellStyle();
        style.setBorderBottom(HSSFCellStyle.BORDER_THIN);
        font = wb.createFont();
        font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);

        value = new HSSFRichTextString("Name");
        value.applyFont(font);
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.HSSFCellStyle

    protected void exportTableHeader(ExportTable table, HSSFSheet sheet,
        Context context) {
        if (table.isExportTableHeaders()) {

            HSSFRow row = createRow(sheet);
            HSSFCellStyle style = createHeaderStyle(sheet);
            final List tableColumns = table.getExportColumnList();

            for (int i = 0, size = tableColumns.size(); i < size; i++) {
                HSSFCell cell = row.createCell(i);
                cell.setCellStyle(style);
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.HSSFCellStyle

            for (int columnIndex = 0, size = tableColumns.size(); columnIndex <
                size; columnIndex++) {
                HSSFCell cell = excelRow.createCell(columnIndex);
                Column column = (Column) tableColumns.get(columnIndex);
                HSSFCellStyle style = cellStyles.get(column.getName());
                if (style != null) {
                    cell.setCellStyle(style);
                }

                Object columnValue =
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.HSSFCellStyle

            if (messageFormat == null && format != null) {
                messageFormat = new MessageFormat(format, locale);
            }

            if (messageFormat != null) {
                HSSFCellStyle style = createCellStyle(messageFormat);
                cellStyles.put(column.getName(), style);
            }
        }
    }
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.HSSFCellStyle

        currentRow++;
        return row;
    }

    protected HSSFCellStyle createHeaderStyle(HSSFSheet sheet) {
        HSSFCellStyle style = wb.createCellStyle();
        style.setBorderBottom(HSSFCellStyle.BORDER_THIN);
        HSSFFont font = wb.createFont();
        font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
        style.setFont(font);
        return style;
    }
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.HSSFCellStyle

                new HSSFRichTextString(ObjectUtils.toString(value)));
        }
    }

    protected HSSFCellStyle createCellStyle(MessageFormat messageFormat) {
        HSSFCellStyle cellStyle = null;
        String pattern = messageFormat.toPattern();
        cellStyle = wb.createCellStyle();
        short format = parseCellFormat(pattern);
        cellStyle.setDataFormat(format);

        return cellStyle;
    }
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.HSSFCellStyle

        EPStyleRegion sregion = (EPStyleRegion) parent;
       
        if (sregion.isValid()) {
            Hashtable colorhash = sregion.getColorHash();

            HSSFCellStyle style = sregion.getStyle();
            short cnvhalign = convertAlignment(getHorizontalAlignment().getCode());
            style.setAlignment(cnvhalign);
            short cnvvalign = convertVAlignment(getVerticalAlignment().getCode());           
            style.setVerticalAlignment(cnvvalign);
            style.setFillPattern((short)getShade());
           
            if (getShade() == 1) {   //TODO: change to constant when upgrade to new HSSF
                                     //solid w/foreground, bg doesn't matter
                getLogger().debug("shade = 1");
                HSSFColor color = (HSSFColor) colorhash.get(getBackgroundColor().toString());
                if (color == null) {
                    getLogger().debug("s1 BG couldn't find color for "+ getBackgroundColor().toString());
                    color = new HSSFColor.WHITE();          
                }
                style.setFillForegroundColor(color.getIndex());
                color = (HSSFColor) colorhash.get(getPatternColor().toString());
                if (color == null) {
                    getLogger().debug("s1 PC couldn't find color for "+ getPatternColor().toString());
                    color = new HSSFColor.BLACK();  
                }
                style.setFillBackgroundColor(color.getIndex());
            } else {
                HSSFColor color = (HSSFColor) colorhash.get(getBackgroundColor().toString());
                if (color == null) {               
                    getLogger().debug("BG couldn't find color for "+ getBackgroundColor().toString());
                    color = new HSSFColor.BLACK();  
                }
                style.setFillBackgroundColor(color.getIndex());           
                color = (HSSFColor) colorhash.get(getPatternColor().toString());
                if (color == null) {
                    getLogger().debug("PC couldn't find color for "+ getPatternColor().toString());
                    color = new HSSFColor.WHITE();    
                }
                style.setFillForegroundColor(color.getIndex());           
            }
            style.setWrapText(getWrapText());
            style.setLocked(true);
        } else {
           
            invalid = true;
        }
    }   
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.HSSFCellStyle

    final HSSFSheet sheetAt = wb.getSheetAt(0);
    final HSSFRow row = sheetAt.getRow(0);
    final HSSFCell cell0 = row.getCell(0);

    // assert that we are in the correct export type ..
    final HSSFCellStyle cellStyle = cell0.getCellStyle();
    final HSSFColor fillBackgroundColorColor = cellStyle.getFillBackgroundColorColor();
    final HSSFColor fillForegroundColorColor = cellStyle.getFillForegroundColorColor();
    assertEquals("0:0:0", fillBackgroundColorColor.getHexString());
    assertEquals("FFFF:FFFF:9999", fillForegroundColorColor.getHexString());

    // assert that there are no extra columns ..
    final HSSFRow row8 = sheetAt.getRow(7);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.