Package org.apache.poi.xssf.usermodel

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


        //plain string value
        row.createCell(2).setCellValue("This is a string cell");

        //rich text string
        RichTextString str = creationHelper.createRichTextString("Apache");
        Font font = wb.createFont();
        font.setItalic(true);
        font.setUnderline(Font.U_SINGLE);
        str.applyFont(font);
        row.createCell(3).setCellValue(str);
View Full Code Here


public class WorkingWithFonts {
    public static void main(String[] args) throws Exception {
        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();
View Full Code Here

        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");
        font1.setColor(IndexedColors.RED.getIndex());
        CellStyle style1 = wb.createCellStyle();
        style1.setFont(font1);
View Full Code Here

        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");
        font2.setColor(IndexedColors.GREEN.getIndex());
        CellStyle style2 = wb.createCellStyle();
        style2.setFont(font2);
View Full Code Here

        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");
        font3.setColor(IndexedColors.LAVENDER.getIndex());
        CellStyle style3 = wb.createCellStyle();
        style3.setFont(font3);
View Full Code Here

        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");
        font4.setColor(IndexedColors.GOLD.getIndex());
        CellStyle style4 = wb.createCellStyle();
        style4.setFont(font4);
View Full Code Here

        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();
        style5.setFont(font5);

        Cell cell0 = sheet.createRow(0).createCell(1);
View Full Code Here

        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);

        Cell cell;
View Full Code Here

        //plain string value
        row.createCell(2).setCellValue("This is a string cell");

        //rich text string
        RichTextString str = creationHelper.createRichTextString("Apache");
        Font font = wb.createFont();
        font.setItalic(true);
        font.setUnderline(Font.U_SINGLE);
        str.applyFont(font);
        row.createCell(3).setCellValue(str);
View Full Code Here

        cell2.setCellValue("C3");

        Comment comment2 = drawing.createCellComment(anchor);
        RichTextString str2 = factory.createRichTextString("XSSF can set cell comments");
        //apply custom font to the text in the comment
        Font font = wb.createFont();
        font.setFontName("Arial");
        font.setFontHeightInPoints((short)14);
        font.setBoldweight(Font.BOLDWEIGHT_BOLD);
        font.setColor(IndexedColors.RED.getIndex());
        str2.applyFont(font);
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.