Package org.zkoss.poi.ss.usermodel

Examples of org.zkoss.poi.ss.usermodel.Font


            sb.append("</span>");
            prespan = false;
          }
        }
        b = e;
        final Font font = getFont(book, rstr, j);
        if (font != null) {
          sb.append("<span style=\"")
            .append(getFontCSSStyle(book, font))
            .append("\">");
          prespan = true;
View Full Code Here


    }
  }
  
  public static Font getOrCreateFont(Book book, short boldWeight, Color color, short fontHeight, java.lang.String name,
      boolean italic, boolean strikeout, short typeOffset, byte underline) {
    Font font = book.findFont(boldWeight, color, fontHeight, name, italic, strikeout, typeOffset, underline);
    if (font == null) {
      font = book.createFont();
      font.setBoldweight(boldWeight);
      BookHelper.setFontColor(book, font, color);
      font.setFontHeight(fontHeight);
      font.setFontName(name);
      font.setItalic(italic);
      font.setStrikeout(strikeout);
      font.setTypeOffset(typeOffset);
      font.setUnderline(underline);
    }
    return font;
  }
View Full Code Here

            break;
          //case CellStyle.VERTICAL_BOTTOM: //default
          //  break;
          }
         
          Font font = _book.getFontAt(cellStyle.getFontIndex());
          short fontHeight = font.getFontHeightInPoints();
          if (fontHeight != XSSFFont.DEFAULT_FONT_SIZE) {
            attrs.put("fs", fontHeight);
          }
        }
      }
View Full Code Here

    return getFontAt((short)0);
  }
 
  @Override
  public void setDefaultFont(Font font) {
    final Font defFont = getDefaultFont();
    defFont.setBoldweight(font.getBoldweight());
    defFont.setCharSet(font.getCharSet());
    defFont.setColor(font.getColor());
    defFont.setFontHeight(font.getFontHeight());
    defFont.setFontName(font.getFontName());
    defFont.setItalic(font.getItalic());
    defFont.setStrikeout(font.getStrikeout());
    defFont.setTypeOffset(font.getTypeOffset());
    defFont.setUnderline(font.getUnderline());
   
    //TODO: recalic _defaultCharWidth
  }
View Full Code Here

    visitCells(sheet, rect, new CellVisitor(){

      @Override
      public void handle(CellVisitorContext context) {
        Font srcFont = context.getFont();
        Font font = context.getOrCreateFont(boldWeight, color,
            fontHeight, fontName, italic, strikeout, typeOffset, underline);
        if (!srcFont.equals(font)) {
          CellStyle newStyle = context.cloneCellStyle();
          newStyle.setFont(font);
          context.getRange().setStyle(newStyle);
View Full Code Here

      @Override
      public void handle(CellVisitorContext context) {
        String srcColor = context.getFontColor();
        if (!srcColor.equalsIgnoreCase(color)) {
          final Workbook book = sheet.getWorkbook();
          Font srcFont = context.getFont();

          Color fontColor = BookHelper.HTMLToColor(book, color);
          Font newFont = context.getOrCreateFont(srcFont.getBoldweight(), fontColor, srcFont.getFontHeight(), srcFont.getFontName(),
              srcFont.getItalic(), srcFont.getStrikeout(), srcFont.getTypeOffset(), srcFont.getUnderline());
          CellStyle newStyle = context.cloneCellStyle();
          newStyle.setFont(newFont);
          newStyle.setFontColorColor(fontColor);
          context.getRange().setStyle(newStyle);
View Full Code Here

      public void handle(CellVisitorContext context) {
        String srcFontName = context.getFontFamily();

        if (srcFontName != fontName) {
          final Workbook book = sheet.getWorkbook();
          Font srcFont = context.getFont();
          Font newFont = context.getOrCreateFont(srcFont.getBoldweight(), BookHelper.getFontColor(book, srcFont), srcFont.getFontHeight(), fontName,
              srcFont.getItalic(), srcFont.getStrikeout(), srcFont.getTypeOffset(), srcFont.getUnderline());
          CellStyle newStyle = context.cloneCellStyle();
          newStyle.setFont(newFont);
          context.getRange().setStyle(newStyle);
        }
View Full Code Here

      @Override
      public void handle(CellVisitorContext context) {
        short srcFontHgh = context.getFontHeight();
        if (srcFontHgh != fontHeight) {
          final Workbook book = sheet.getWorkbook();
          Font srcFont = context.getFont();
          Font newFont = context.getOrCreateFont(srcFont.getBoldweight(), BookHelper.getFontColor(book, srcFont), fontHeight, srcFont.getFontName(),
            srcFont.getItalic(), srcFont.getStrikeout(), srcFont.getTypeOffset(), srcFont.getUnderline());
          CellStyle newStyle = context.cloneCellStyle();
          newStyle.setFont(newFont);
          context.getRange().setStyle(newStyle);
        }
View Full Code Here

    return _defaultCharWidth;
  }
 
  @Override
  public void setDefaultFont(Font font) {
    final Font defFont = getDefaultFont();
    defFont.setBoldweight(font.getBoldweight());
    defFont.setCharSet(font.getCharSet());
    defFont.setColor(font.getColor());
    defFont.setFontHeight(font.getFontHeight());
    defFont.setFontName(font.getFontName());
    defFont.setItalic(font.getItalic());
    defFont.setStrikeout(font.getStrikeout());
    defFont.setTypeOffset(font.getTypeOffset());
    defFont.setUnderline(font.getUnderline());
   
    //TODO: recalic _defaultCharWidth
  }
View Full Code Here

      @Override
      public void handle(CellVisitorContext context) {
        boolean srcBold = context.isBold();
        if (srcBold != isBold) {
          final Workbook book = sheet.getWorkbook();
          Font srcFont = context.getFont();
          Font newFont = context.getOrCreateFont(isBold ? Font.BOLDWEIGHT_BOLD : Font.BOLDWEIGHT_NORMAL, BookHelper.getFontColor(book, srcFont), srcFont.getFontHeight(), srcFont.getFontName(),
              srcFont.getItalic(), srcFont.getStrikeout(), srcFont.getTypeOffset(), srcFont.getUnderline());
          CellStyle newStyle = context.cloneCellStyle();
          newStyle.setFont(newFont);
          context.getRange().setStyle(newStyle);
        }
View Full Code Here

TOP

Related Classes of org.zkoss.poi.ss.usermodel.Font

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.