Package org.apache.poi.xssf.usermodel

Examples of org.apache.poi.xssf.usermodel.XSSFFont


    return ctFill;
  }

  private static XSSFFont createDefaultFont() {
    CTFont ctFont = CTFont.Factory.newInstance();
    XSSFFont xssfFont=new XSSFFont(ctFont, 0);
    xssfFont.setFontHeightInPoints(XSSFFont.DEFAULT_FONT_SIZE);
    xssfFont.setColor(XSSFFont.DEFAULT_FONT_COLOR);//setTheme
    xssfFont.setFontName(XSSFFont.DEFAULT_FONT_NAME);
    xssfFont.setFamily(FontFamily.SWISS);
    xssfFont.setScheme(FontScheme.MINOR);
    return xssfFont;
  }
View Full Code Here


        numberFormats.put((int)nfmt.getNumFmtId(), nfmt.getFormatCode());
      }
      if(doc.getStyleSheet().getFonts() != null){
        int idx = 0;
        for (CTFont font : doc.getStyleSheet().getFonts().getFontArray()) {
          XSSFFont f = new XSSFFont(font, idx);
          fonts.add(f);
          idx++;
        }
      }
      if(doc.getStyleSheet().getFills() != null)
View Full Code Here

    out.close();
  }

  private void initialize() {
    //CTFont ctFont = createDefaultFont();
    XSSFFont xssfFont = createDefaultFont();
    fonts.add(xssfFont);

    CTFill[] ctFill = createDefaultFills();
    fills.add(new XSSFCellFill(ctFill[0]));
    fills.add(new XSSFCellFill(ctFill[1]));
View Full Code Here

    return ctFill;
  }

  private static XSSFFont createDefaultFont() {
    CTFont ctFont = CTFont.Factory.newInstance();
    XSSFFont xssfFont=new XSSFFont(ctFont, 0);
    xssfFont.setFontHeightInPoints(XSSFFont.DEFAULT_FONT_SIZE);
    xssfFont.setColor(XSSFFont.DEFAULT_FONT_COLOR);//setTheme
    xssfFont.setFontName(XSSFFont.DEFAULT_FONT_NAME);
    xssfFont.setFamily(FontFamily.SWISS);
    xssfFont.setScheme(FontScheme.MINOR);
    return xssfFont;
  }
View Full Code Here

  }

  private void handleCell(final XSSFWorkbook workbook, final XSSFRow row, final Cell cell, final int cellNum) {
    XSSFCell c = row.createCell(cellNum);

    XSSFFont font = workbook.createFont();
    font.setColor(this.getColor(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);
    }

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

      _inFormula = true;
    }
  }

  private void configureStyle(XSSFCellStyle style) {
    XSSFFont font = style.getFont();
    if (font.getBold()) {
      _style.bold();
    }
    if (font.getItalic()) {
      _style.italic();
    }
    if (font.getUnderline() != FontUnderline.NONE.getByteValue()) {
      _style.underline();
    }

    if (style.getFillPatternEnum() == FillPatternType.SOLID_FOREGROUND) {
      XSSFColor fillForegroundXSSFColor = style
          .getFillForegroundXSSFColor();
      String argb = fillForegroundXSSFColor.getARGBHex();
      if (argb != null) {
        _style.background(argb.substring(2));
      }
    }

    final XSSFFont stdFont = _stylesTable.getStyleAt(0).getFont();
    final short fontHeight = style.getFont().getFontHeightInPoints();
    if (stdFont.getFontHeightInPoints() != fontHeight) {
      _style.fontSize(fontHeight, SizeUnit.PT);
    }

    XSSFColor fontColor = style.getFont().getXSSFColor();
    if (fontColor != null) {
View Full Code Here

        numberFormats.put(newKey, fmt);
        return newKey;
    }
   
    public Font getFontAt(long idx) {
      return new XSSFFont(fonts.get((int) idx));
    }
View Full Code Here

            CTFonts ctfonts = styleSheet.getFonts();
            if(ctfonts != null){
        int idx = 0;
        for (CTFont font : ctfonts.getFontArray()) {
          XSSFFont f = new XSSFFont(font, idx);
          fonts.add(f);
          idx++;
        }
      }
            CTFills ctfills = styleSheet.getFills();
View Full Code Here

    out.close();
  }

  private void initialize() {
    //CTFont ctFont = createDefaultFont();
    XSSFFont xssfFont = createDefaultFont();
    fonts.add(xssfFont);

    CTFill[] ctFill = createDefaultFills();
    fills.add(new XSSFCellFill(ctFill[0]));
    fills.add(new XSSFCellFill(ctFill[1]));
View Full Code Here

    return ctFill;
  }

  private static XSSFFont createDefaultFont() {
    CTFont ctFont = CTFont.Factory.newInstance();
    XSSFFont xssfFont=new XSSFFont(ctFont, 0);
    xssfFont.setFontHeightInPoints(XSSFFont.DEFAULT_FONT_SIZE);
    xssfFont.setColor(XSSFFont.DEFAULT_FONT_COLOR);//setTheme
    xssfFont.setFontName(XSSFFont.DEFAULT_FONT_NAME);
    xssfFont.setFamily(FontFamily.SWISS);
    xssfFont.setScheme(FontScheme.MINOR);
    return xssfFont;
  }
View Full Code Here

TOP

Related Classes of org.apache.poi.xssf.usermodel.XSSFFont

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.