Package org.apache.poi.ss.usermodel

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


    public void testGetFontAt(){
       XSSFWorkbook workbook = new XSSFWorkbook();
        StylesSource styleSource = workbook.getStylesSource();
        short i = 0;
        //get default font
        Font fontAt = workbook.getFontAt(i);
        assertNotNull(fontAt);
       
        //get customized font
        Font customFont = new XSSFFont();
        customFont.setItalic(true);
        Long x = styleSource.putFont(customFont);
        fontAt = workbook.getFontAt(x.shortValue());
        assertNotNull(fontAt);
    }
View Full Code Here


  public void testGetFontAt(){
     XSSFWorkbook workbook = new XSSFWorkbook();
    StylesTable styleSource = workbook.getStylesSource();
    short i = 0;
    //get default font
    Font fontAt = workbook.getFontAt(i);
    assertNotNull(fontAt);

    //get customized font
    XSSFFont customFont = new XSSFFont();
    customFont.setItalic(true);
View Full Code Here

  CellStyle createStyle(Workbook wb) {
    CellStyle style = wb.createCellStyle();
    style.setAlignment(align.apachePOI());

    if (bold) {
      Font font = wb.createFont();
      font.setBoldweight(Font.BOLDWEIGHT_BOLD);
      style.setFont(font);
    }

    return style;
  }
View Full Code Here

    Workbook wb = new XSSFWorkbook();
    Sheet sheet1 = wb.createSheet("Summary");
    sheet1.setColumnWidth(0, 3000);
    sheet1.setColumnWidth(1, 3000);

    Font font = wb.createFont();
    font.setBoldweight(Font.BOLDWEIGHT_BOLD);  
//-------------------------------sheet1-----------------------------------------------------   
    Row firstrow = sheet1.createRow((short) 0)
    CellStyle firstrow_style = wb.createCellStyle();
    firstrow_style.setFillForegroundColor(IndexedColors.LIGHT_CORNFLOWER_BLUE.getIndex());
    firstrow_style.setFillPattern(CellStyle.SOLID_FOREGROUND);
View Full Code Here

    Workbook wb = new XSSFWorkbook();
    Sheet sheet1 = wb.createSheet("Summary");
    sheet1.setColumnWidth(0, 3000);
    sheet1.setColumnWidth(1, 3000);

    Font font = wb.createFont();
    font.setBoldweight(Font.BOLDWEIGHT_BOLD);  
//-------------------------------sheet1-----------------------------------------------------   
    Row firstrow = sheet1.createRow((short) 0)
    CellStyle firstrow_style = wb.createCellStyle();
    firstrow_style.setFillForegroundColor(IndexedColors.LIGHT_CORNFLOWER_BLUE.getIndex());
    firstrow_style.setFillPattern(CellStyle.SOLID_FOREGROUND);
View Full Code Here

      // Create a row and put some cells in it. Rows are 0 based.
      Row row = sheet.createRow(1);

      // Create a new font and alter it.
      Font font = wb.createFont();
      font.setFontHeightInPoints((short)24);
      font.setFontName("Courier New");
      font.setItalic(true);
      font.setStrikeout(true);

      // Fonts are set into a style so create a new one to use.
      CellStyle style = wb.createCellStyle();
      style.setFont(font);
View Full Code Here

      Sheet sheet = wb.createSheet("Accounts");
     
      int rowNum = 1;
      Row row = sheet.createRow(rowNum++);
     
      Font font = wb.createFont();
      font.setFontHeightInPoints((short)24);
      font.setFontName(FONT_TYPE);
      font.setColor(FONT_COLOR_TITLE);

      /***  Header *****/
      CellStyle style = wb.createCellStyle();
      style.setFont(font);
      style.setAlignment(CellStyle.ALIGN_CENTER);
      style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
      style.setFillForegroundColor(BACKGROUND_COLOR);      

      Cell cell = row.createCell((short) 1);
      cell.setCellValue("Account Report per Beneficiary");
      cell.setCellStyle(style);
      sheet.addMergedRegion(new CellRangeAddress(
              1, //first row (0-based)
              2, //last row  (0-based)
              1, //first column (0-based)
              16  //last column  (0-based)
      ));

      /***  Body *****/
      font = wb.createFont();
      font.setFontHeightInPoints((short)12);
      font.setFontName(FONT_TYPE);
      font.setColor(FONT_COLOR);
     
      style = wb.createCellStyle();
      style.setFont(font);
     
      rowNum =  rowNum + 3;
View Full Code Here

      Sheet sheet = wb.createSheet("Accounts");
     
      int rowNum = 1;
      Row row = sheet.createRow(rowNum++);
     
      Font font = wb.createFont();
      font.setFontHeightInPoints((short)24);
      font.setFontName(FONT_TYPE);
      font.setColor(FONT_COLOR_TITLE);

      /***  Header *****/
      CellStyle style = wb.createCellStyle();
      style.setFont(font);
      style.setAlignment(CellStyle.ALIGN_CENTER);
      style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
      style.setFillForegroundColor(BACKGROUND_COLOR);      

      Cell cell = row.createCell((short) 1);
      cell.setCellValue("Account Report per Beneficiary");
      cell.setCellStyle(style);
      sheet.addMergedRegion(new CellRangeAddress(
              1, //first row (0-based)
              2, //last row  (0-based)
              1, //first column (0-based)
              16  //last column  (0-based)
      ));

      /***  Body *****/
      font = wb.createFont();
      font.setFontHeightInPoints((short)12);
      font.setFontName(FONT_TYPE);
      font.setColor(FONT_COLOR);
     
      style = wb.createCellStyle();
      style.setFont(font);
     
      rowNum =  rowNum + 3;
View Full Code Here

TOP

Related Classes of org.apache.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.