Examples of HSSFCellStyle


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

    font.setBoldweight(boldStyle);
    fontMap.put(String.valueOf(fontSize)
        + String.valueOf(boldStyle),font);
    }

    HSSFCellStyle cellStyle = wb.createCellStyle();
    cellStyle.setFont(font);
    cellStyle.setAlignment(alignment);
    if(backgroundColor!=-1){
    cellStyle.setFillBackgroundColor(backgroundColor);
    cellStyle.setFillForegroundColor(backgroundColor);
    cellStyle.setFillPattern((short) 1);
    }

    if (borderLeft != null) {
      cellStyle.setBorderLeft(borderLeft);
    }
    if (borderTop != null) {
      cellStyle.setBorderTop(borderTop);
    }
    if (borderRight != null) {
      cellStyle.setBorderRight(borderRight);
    }
    if (borderBottom != null) {
      cellStyle.setBorderBottom(borderBottom);
    }
   
    if(dataFormat!=null){
      DataFormat format = wb.createDataFormat();
      cellStyle.setDataFormat(format.getFormat(dataFormat));
    }
    return cellStyle;

  }
View Full Code Here

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

  }

  public HSSFCellStyle getStyle(HSSFFont font, Short borderLeft,
      Short borderTop, Short borderRight, Short borderBottom) {
    HSSFCellStyle style = wb.createCellStyle();
    style.setFont(font);
    if (borderLeft != null) {
      style.setBorderLeft(borderLeft);
    }
    if (borderTop != null) {
      style.setBorderTop(borderTop);
    }
    if (borderRight != null) {
      style.setBorderRight(borderRight);
    }
    if (borderBottom != null) {
      style.setBorderBottom(borderBottom);
    }
    return style;
  }
View Full Code Here

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

    }*/

    HSSFCellStyle addStyleRegion(Region region) {

        HSSFCellStyle style = _workbook.createStyle();
        /*
        getLogger().debug("region = "+ region.getRowFrom() + ","+region.getColumnFrom()+
            ","+region.getRowTo()+","+region.getColumnTo());
            */
        regions.put(region, style);
View Full Code Here

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

                HSSFRow row  = _sheet.getRow(rownum);

                for (short colnum = region.getColumnFrom(); colnum < region.getColumnTo()+1; colnum ++) {

                    HSSFCellStyle style = (HSSFCellStyle)regions.get(region);


                    if (!isBlank(style)) { //don't waste time with huge blocks of blankly
                                           //styled cells
View Full Code Here

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

        EPStyle pstyle = (EPStyle) parent;
        if (pstyle.isValid()) {
            Hashtable colorhash = pstyle.getColorHash();
            HSSFColor color = null;

            HSSFCellStyle style = pstyle.getStyle();
            //style.setFillForegroundColor(
            Workbook workbook = getWorkbook();
            HSSFFont font = workbook.createFont();
            style.setFont(font);
            font.setFontHeightInPoints((short)getUnit());
            //font.setFontName(getFont());
            font.setItalic(getItalic());
            if (getBold()) {
                font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
View Full Code Here

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.setBorderTop((short)getStyle());

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


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

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

     * this should match reasonably close to what is in the StyleRegion element
     * in the gnumeric ss.
     */
    HSSFCellStyle createStyle() {
       
        HSSFCellStyle style = _workbook.createCellStyle();
      
        return style;
    }
View Full Code Here

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.setBorderLeft((short)getStyle());

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


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

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.setBorderRight((short)getStyle());

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


            style.setRightBorderColor(color.getIndex());
        }
       
    }       
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);
           
            String format = null;

      try {
    format = getFormat();
            } catch (NullPointerException e) {
    format = "General";
            }

            if (!format.equals("General")) {
                format = kludgeForGnumericMisformats(format);
                format = kludgeForGnumericDateDivergence(format);
                short nformat = org.apache.poi.hssf.usermodel.HSSFDataFormat.getFormat(format);
                        getLogger().debug("setting format to "+ nformat);
                style.setDataFormat(nformat);
            }
        } else {
           
            invalid = true;
        }
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.