Package org.apache.poi.ss.usermodel

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


 
  public CellStyle buildHeaderTitleCellStyle(Sheet sheet){
    CellStyle cellStyle = sheet.getWorkbook().createCellStyle();
        cellStyle.setAlignment(CellStyle.ALIGN_LEFT);
        cellStyle.setVerticalAlignment(CellStyle.ALIGN_CENTER)
        Font font = sheet.getWorkbook().createFont();
        font.setFontHeightInPoints((short)16);
        font.setFontName("Arial");
        font.setColor(IndexedColors.DARK_BLUE.getIndex());
        font.setBoldweight(Font.BOLDWEIGHT_BOLD);
        cellStyle.setFont(font);
        return cellStyle;
  }
View Full Code Here


          int startingFonts = initialFonts[i];
         
          assertEquals(startingFonts, wb.getNumberOfFonts());
         
          // Get a font, and slightly change it
          Font a = wb.createFont();
          assertEquals(startingFonts+1, wb.getNumberOfFonts());
          a.setFontHeightInPoints((short)23);
          assertEquals(startingFonts+1, wb.getNumberOfFonts());
         
          // Get two more, unchanged
          Font b = wb.createFont();
          assertEquals(startingFonts+2, wb.getNumberOfFonts());
          Font c = wb.createFont();
          assertEquals(startingFonts+3, wb.getNumberOfFonts());
       }
    }
View Full Code Here

          "This line finishes with two trailing spaces.  ";
      
       XSSFWorkbook wb = new XSSFWorkbook();
       XSSFSheet sheet = wb.createSheet();

       Font font1 = wb.createFont();
       font1.setColor((short) 20);
       Font font2 = wb.createFont();
       font2.setColor(Font.COLOR_RED);
       Font font3 = wb.getFontAt((short)0);

       XSSFRow row = sheet.createRow(2);
       XSSFCell cell = row.createCell(2);

       XSSFRichTextString richTextString =
View Full Code Here

        cs_formal       = wb.createCellStyle();
        cs_table        = wb.createCellStyle();
        cs_type         = wb.createCellStyle();
        cs_number       = wb.createCellStyle();
       
        Font title_font = wb.createFont();
        title_font.setFontHeightInPoints((short)12);
        title_font.setColor(HSSFColor.DARK_BLUE.index);
       
        Font header_font = wb.createFont();
        header_font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
        header_font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
       
        Font table_font = wb.createFont();
        table_font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
       
        defaultcellstyle(cs_default);
        defaultcellstyle(cs_title);
        defaultcellstyle(cs_header);
        defaultcellstyle(cs_num_header);
View Full Code Here

        cs_formal       = wb.createCellStyle();
        cs_table        = wb.createCellStyle();
        cs_type         = wb.createCellStyle();
        cs_number       = wb.createCellStyle();
       
        Font title_font = wb.createFont();
        title_font.setFontHeightInPoints((short)12);
        title_font.setColor(HSSFColor.DARK_BLUE.index);
       
        Font header_font = wb.createFont();
        header_font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
        header_font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
       
        Font table_font = wb.createFont();
        table_font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
       
        defaultcellstyle(cs_default);
        defaultcellstyle(cs_title);
        defaultcellstyle(cs_header);
        defaultcellstyle(cs_num_header);
View Full Code Here

            style.setDataFormat(workbook.createDataFormat().getFormat(format.value()));
    }

    private void applyFontTo(CellStyle style, Workbook workbook) {
        if (fontSize != null) {
            Font font = workbook.createFont();
            font.setFontHeightInPoints(fontSize.value());
            font.setColor(fontColour.value().getPoiStyle());
            style.setFont(font);
        } else {
            // doesn't work
            Font existing = workbook.getFontAt(style.getFontIndex());
            existing.setColor(fontColour.value().getPoiStyle());
            style.setFont(existing);
        }
    }
View Full Code Here

        cs_formal       = wb.createCellStyle();
        cs_table        = wb.createCellStyle();
        cs_type         = wb.createCellStyle();
        cs_number       = wb.createCellStyle();
       
        Font title_font = wb.createFont();
        title_font.setFontHeightInPoints((short)12);
        title_font.setColor(HSSFColor.DARK_BLUE.index);
       
        Font header_font = wb.createFont();
        header_font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
        header_font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
       
        Font table_font = wb.createFont();
        table_font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
       
        defaultcellstyle(cs_default);
        defaultcellstyle(cs_title);
        defaultcellstyle(cs_header);
        defaultcellstyle(cs_num_header);
View Full Code Here

          int startingFonts = initialFonts[i];
         
          assertEquals(startingFonts, wb.getNumberOfFonts());
         
          // Get a font, and slightly change it
          Font a = wb.createFont();
          assertEquals(startingFonts+1, wb.getNumberOfFonts());
          a.setFontHeightInPoints((short)23);
          assertEquals(startingFonts+1, wb.getNumberOfFonts());
         
          // Get two more, unchanged
          Font b = wb.createFont();
          assertEquals(startingFonts+2, wb.getNumberOfFonts());
          Font c = wb.createFont();
          assertEquals(startingFonts+3, wb.getNumberOfFonts());
       }
    }
View Full Code Here

          int startingFonts = initialFonts[i];
         
          assertEquals(startingFonts, wb.getNumberOfFonts());
         
          // Get a font, and slightly change it
          Font a = wb.createFont();
          assertEquals(startingFonts+1, wb.getNumberOfFonts());
          a.setFontHeightInPoints((short)23);
          assertEquals(startingFonts+1, wb.getNumberOfFonts());
         
          // Get two more, unchanged
          Font b = wb.createFont();
          assertEquals(startingFonts+2, wb.getNumberOfFonts());
          Font c = wb.createFont();
          assertEquals(startingFonts+3, wb.getNumberOfFonts());
       }
    }
View Full Code Here

          "This line finishes with two trailing spaces.  ";
      
       XSSFWorkbook wb = new XSSFWorkbook();
       XSSFSheet sheet = wb.createSheet();

       Font font1 = wb.createFont();
       font1.setColor((short) 20);
       Font font2 = wb.createFont();
       font2.setColor(Font.COLOR_RED);
       Font font3 = wb.getFontAt((short)0);

       XSSFRow row = sheet.createRow(2);
       XSSFCell cell = row.createCell(2);

       XSSFRichTextString richTextString =
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.