Package org.apache.poi.hssf.usermodel

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


        }
      }
    }
   
    private HSSFFont fontWithID(String id) {
      HSSFFont font = (HSSFFont)_fonts.objectForKey(id);
      if(font == null) {
        font = _workbook.createFont();
       
        NSDictionary dict = (NSDictionary)_fontDicts.objectForKey(id);
        String value;
       
        value = dictValueForKey(dict, "name", null);
        if(value != null) {
          font.setFontName(value);
        }
       
        takeNumberValueForKey(dict, "fontHeight", font, null);
        takeNumberValueForKey(dict, "fontHeightInPoints", font, null);
        takeNumberValueForKey(dict, "color", font, null);
View Full Code Here


      if(cellStyle == null) {
        cellStyle = _workbook.createCellStyle();
       
        String fontID = dictValueForKey(dict, "font", null);
        if(fontID != null) {
          HSSFFont font = fontWithID(fontID);
          if(font == null) {
            throw new IllegalArgumentException("Font ID not found!");
          }
          cellStyle.setFont(font);
        }
View Full Code Here

  }

  private void handleCell(final HSSFWorkbook workbook, final HSSFRow row, final Cell cell, final int cellNum) {
    HSSFCell c = row.createCell(cellNum);

    HSSFFont font = workbook.createFont();
    font.setColor(this.getColor(workbook, cell.getFontColor()));
    font.setFontName(cell.getFont());
    font.setFontHeightInPoints((short) cell.getFontSize());

    if (cell.isBold()) {
      font.setBoldweight(Font.BOLDWEIGHT_BOLD);
    }

    if (cell.isItalic()) {
      font.setItalic(true);
    }

    if (cell.isStrikeout()) {
      font.setStrikeout(true);
    }

    if (cell.isUnderline()) {
      font.setUnderline(Font.U_SINGLE);
    }

    HSSFCellStyle style = workbook.createCellStyle();
    style.setAlignment(this.getAlignment(cell.getAlignment()));
    style.setVerticalAlignment(this.getVerticalAlignment(cell.getVerticalAlignment()));
View Full Code Here

  }

  private void handleCell(final HSSFWorkbook workbook, final HSSFRow row, final Cell cell, final int cellNum) {
    HSSFCell c = row.createCell(cellNum);

    HSSFFont font = workbook.createFont();
    font.setColor(this.getColor(workbook, cell.getFontColor()));
    font.setFontName(cell.getFont());
    font.setFontHeightInPoints((short) cell.getFontSize());

    if (cell.isBold()) {
      font.setBoldweight(Font.BOLDWEIGHT_BOLD);
    }

    if (cell.isItalic()) {
      font.setItalic(true);
    }

    if (cell.isStrikeout()) {
      font.setStrikeout(true);
    }

    if (cell.isUnderline()) {
      font.setUnderline(Font.U_SINGLE);
    }

    HSSFCellStyle style = workbook.createCellStyle();
    style.setAlignment(this.getAlignment(cell.getAlignment()));
    style.setVerticalAlignment(this.getVerticalAlignment(cell.getVerticalAlignment()));
View Full Code Here

            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);
            } else {
                font.setBoldweight(HSSFFont.BOLDWEIGHT_NORMAL);           
            }
            font.setUnderline((byte)getUnderline());
            font.setStrikeout(getStrikeThrough());

            color = (HSSFColor)colorhash.get(pstyle.getForegroundColor().toString());
            //System.out.println(pstyle.getForegroundColor().toString());
            if (color == null) color = new HSSFColor.BLACK();
            font.setColor(color.getIndex());
            hssfFont = font;
        }
    }   
View Full Code Here

            }
        }
    }

    private boolean isBlank(HSSFCellStyle style) {
        HSSFFont font = null;
        if (style.getFontIndex() > 0) {
            font = (_workbook.getWorkbook().getFontAt(style.getFontIndex()));
        }
        if (style.getBorderBottom() == 0 &&
                style.getBorderTop() == 0 &&
                style.getBorderRight() == 0 &&
                style.getBorderLeft() == 0 &&
                style.getFillBackgroundColor() == HSSFColor.WHITE.index &&
                style.getFillPattern() == 0 &&
                (style.getFontIndex() == 0 ||
                    ((font.getFontName().equals("Arial") ||
                    font.getFontName().equals("Helvetica")) &&
                    font.getFontHeightInPoints() > 8 &&
                    font.getFontHeightInPoints() < 12))) {
            return true;
        }
        return false;
    }
View Full Code Here

    /**
     * create a font in the underlying HSSF model and return the reference
     */
    HSSFFont createFont() {
       
        HSSFFont font = _workbook.createFont();
      
        return font;
    }
View Full Code Here

        buildStyle_border( workbook, style, "bottom",
                cellStyle.getBorderBottom(), cellStyle.getBottomBorderColor() );
        buildStyle_border( workbook, style, "left", cellStyle.getBorderLeft(),
                cellStyle.getLeftBorderColor() );

        HSSFFont font = cellStyle.getFont( workbook );
        buildStyle_font( workbook, style, font );

        return style.toString();
    }
View Full Code Here

        + align
        + ";";
  }

  public HSSFCellStyle getStyleHSSF(HSSFWorkbook wb) {
    HSSFFont font = wb.createFont();
    font.setFontHeightInPoints((short) this.getFontSize());
    font.setFontName("Courier New");

    if (this.isBold())
      font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
    if (this.isItalic())
      font.setItalic(true);
    if (this.isUnderlined())
      font.setUnderline(HSSFFont.U_SINGLE);

    HSSFCellStyle style = wb.createCellStyle();
    style.setFont(font);

    switch (this.getAlignment()) {
View Full Code Here

      tempCell.setCellValue(displayNames[j]);
    }
   
   
    HSSFCellStyle linkStyle = wb.createCellStyle();
    HSSFFont cellFont= wb.createFont();
    cellFont.setUnderline((byte) 1);
    cellFont.setColor(HSSFColor.BLUE.index);
    linkStyle.setFont(cellFont);

    boolean hasTag = false;
    for(int i = 0 ;i < allDatas.length ; i++)
    {
View Full Code Here

TOP

Related Classes of org.apache.poi.hssf.usermodel.HSSFFont

Copyright © 2018 www.massapicom. 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.