Package org.apache.poi.xssf.usermodel

Examples of org.apache.poi.xssf.usermodel.XSSFWorkbook.createCellStyle()


        //formula
        row.createCell(5).setCellFormula("SUM(A1:B1)");

        //date
        CellStyle style = wb.createCellStyle();
        style.setDataFormat(creationHelper.createDataFormat().getFormat("m/d/yy h:mm"));
        cell = row.createCell(6);
        cell.setCellValue(new Date());
        cell.setCellStyle(style);
View Full Code Here


        // Create a cell and put a value in it.
        Cell cell = row.createCell((short) 1);
        cell.setCellValue(4);

        // Style the cell with borders all around.
        CellStyle style = wb.createCellStyle();
        style.setBorderBottom(CellStyle.BORDER_THIN);
        style.setBottomBorderColor(IndexedColors.BLACK.getIndex());
        style.setBorderLeft(CellStyle.BORDER_THIN);
        style.setLeftBorderColor(IndexedColors.GREEN.getIndex());
        style.setBorderRight(CellStyle.BORDER_THIN);
View Full Code Here

        Workbook wb = new XSSFWorkbook()//or new HSSFWorkbook();
        Sheet sheet = wb.createSheet("Fonts");

        Font font0 = wb.createFont();
        font0.setColor(IndexedColors.BROWN.getIndex());
        CellStyle style0 = wb.createCellStyle();
        style0.setFont(font0);

        Font font1 = wb.createFont();
        font1.setFontHeightInPoints((short)14);
        font1.setFontName("Courier New");
View Full Code Here

        Font font1 = wb.createFont();
        font1.setFontHeightInPoints((short)14);
        font1.setFontName("Courier New");
        font1.setColor(IndexedColors.RED.getIndex());
        CellStyle style1 = wb.createCellStyle();
        style1.setFont(font1);

        Font font2 = wb.createFont();
        font2.setFontHeightInPoints((short)16);
        font2.setFontName("Arial");
View Full Code Here

        Font font2 = wb.createFont();
        font2.setFontHeightInPoints((short)16);
        font2.setFontName("Arial");
        font2.setColor(IndexedColors.GREEN.getIndex());
        CellStyle style2 = wb.createCellStyle();
        style2.setFont(font2);

        Font font3 = wb.createFont();
        font3.setFontHeightInPoints((short)18);
        font3.setFontName("Times New Roman");
View Full Code Here

        Font font3 = wb.createFont();
        font3.setFontHeightInPoints((short)18);
        font3.setFontName("Times New Roman");
        font3.setColor(IndexedColors.LAVENDER.getIndex());
        CellStyle style3 = wb.createCellStyle();
        style3.setFont(font3);

        Font font4 = wb.createFont();
        font4.setFontHeightInPoints((short)18);
        font4.setFontName("Wingdings");
View Full Code Here

        Font font4 = wb.createFont();
        font4.setFontHeightInPoints((short)18);
        font4.setFontName("Wingdings");
        font4.setColor(IndexedColors.GOLD.getIndex());
        CellStyle style4 = wb.createCellStyle();
        style4.setFont(font4);

        Font font5 = wb.createFont();
        font5.setFontName("Symbol");
        CellStyle style5 = wb.createCellStyle();
View Full Code Here

        CellStyle style4 = wb.createCellStyle();
        style4.setFont(font4);

        Font font5 = wb.createFont();
        font5.setFontName("Symbol");
        CellStyle style5 = wb.createCellStyle();
        style5.setFont(font5);

        Cell cell0 = sheet.createRow(0).createCell(1);
        cell0.setCellValue("Default");
        cell0.setCellStyle(style0);
View Full Code Here

        Workbook wb = new XSSFWorkbook(); //or new HSSFWorkbook();
        CreationHelper createHelper = wb.getCreationHelper();

        //cell style for hyperlinks
        //by default hypelrinks are blue and underlined
        CellStyle hlink_style = wb.createCellStyle();
        Font hlink_font = wb.createFont();
        hlink_font.setUnderline(Font.U_SINGLE);
        hlink_font.setColor(IndexedColors.BLUE.getIndex());
        hlink_style.setFont(hlink_font);
View Full Code Here

        //formula
        row.createCell(5).setCellFormula("SUM(A1:B1)");

        //date
        CellStyle style = wb.createCellStyle();
        style.setDataFormat(creationHelper.createDataFormat().getFormat("m/d/yy h:mm"));
        cell = row.createCell(6);
        cell.setCellValue(new Date());
        cell.setCellStyle(style);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.