Package org.apache.poi.ss.usermodel

Examples of org.apache.poi.ss.usermodel.Sheet.createRow()


       HSSFWorkbook workbook = new HSSFWorkbook();
       Sheet sheet = workbook.createSheet("Bug50416");
       Row row1 = sheet.createRow(0);
       Cell cellA_1 = row1.createCell(0,Cell.CELL_TYPE_STRING);
       cellA_1.setCellValue("Cell A,1");
       Row row2 = sheet.createRow(1);
       Cell cellA_2 = row2.createCell(0,Cell.CELL_TYPE_STRING);
       cellA_2.setCellValue("Cell A,2");
       Row row3 = sheet.createRow(2);
       Cell cellA_3 = row3.createCell(0,Cell.CELL_TYPE_STRING);
       cellA_3.setCellValue("Cell A,3");
View Full Code Here


       Cell cellA_1 = row1.createCell(0,Cell.CELL_TYPE_STRING);
       cellA_1.setCellValue("Cell A,1");
       Row row2 = sheet.createRow(1);
       Cell cellA_2 = row2.createCell(0,Cell.CELL_TYPE_STRING);
       cellA_2.setCellValue("Cell A,2");
       Row row3 = sheet.createRow(2);
       Cell cellA_3 = row3.createCell(0,Cell.CELL_TYPE_STRING);
       cellA_3.setCellValue("Cell A,3");
      
       // Test the last Row number it currently correct
       assertEquals(2, sheet.getLastRowNum());
View Full Code Here

        Workbook wb = openSample("53404.xls");
        Sheet sheet = wb.getSheet("test-sheet");
        int rowCount = sheet.getLastRowNum() + 1;
        int newRows = 5;
        for (int r = rowCount; r < rowCount + newRows; r++) {
            Row row = sheet.createRow((short) r);
            row.createCell(0).setCellValue(1.03 * (r + 7));
            row.createCell(1).setCellValue(new Date());
            row.createCell(2).setCellValue(Calendar.getInstance());
            row.createCell(3).setCellValue(String.format("row:%d/col:%d", r, 3));
            row.createCell(4).setCellValue(true);
View Full Code Here

     * =IFERROR(C1,\"Error in calculation\")"      References the result of dividing 55 by 0 and returns the error text
     */
    public static void testEvaluate(){
        Workbook wb = new HSSFWorkbook();
        Sheet sh = wb.createSheet();
        Row row1 = sh.createRow(0);
        Row row2 = sh.createRow(1);

        // Create cells
        row1.createCell(0, Cell.CELL_TYPE_NUMERIC);
        row1.createCell(1, Cell.CELL_TYPE_NUMERIC);
View Full Code Here

     */
    public static void testEvaluate(){
        Workbook wb = new HSSFWorkbook();
        Sheet sh = wb.createSheet();
        Row row1 = sh.createRow(0);
        Row row2 = sh.createRow(1);

        // Create cells
        row1.createCell(0, Cell.CELL_TYPE_NUMERIC);
        row1.createCell(1, Cell.CELL_TYPE_NUMERIC);
        row1.createCell(2, Cell.CELL_TYPE_NUMERIC);
View Full Code Here

        sh.getRow(a2.getRow()).getCell(a2.getCol()).setCellValue(55);
        sh.getRow(b1.getRow()).getCell(b1.getCol()).setCellValue(35);
        sh.getRow(b2.getRow()).getCell(b2.getCol()).setCellValue(0);
        sh.getRow(c1.getRow()).getCell(c1.getCol()).setCellFormula("A1/B2");
       
        Cell cell1 = sh.createRow(3).createCell(0);
        cell1.setCellFormula("IFERROR(A1/B1,\"Error in calculation\")");
        Cell cell2 = sh.createRow(3).createCell(0);
        cell2.setCellFormula("IFERROR(A2/B2,\"Error in calculation\")");
        Cell cell3 = sh.createRow(3).createCell(0);
        cell3.setCellFormula("IFERROR(C1,\"error\")");
View Full Code Here

        sh.getRow(b2.getRow()).getCell(b2.getCol()).setCellValue(0);
        sh.getRow(c1.getRow()).getCell(c1.getCol()).setCellFormula("A1/B2");
       
        Cell cell1 = sh.createRow(3).createCell(0);
        cell1.setCellFormula("IFERROR(A1/B1,\"Error in calculation\")");
        Cell cell2 = sh.createRow(3).createCell(0);
        cell2.setCellFormula("IFERROR(A2/B2,\"Error in calculation\")");
        Cell cell3 = sh.createRow(3).createCell(0);
        cell3.setCellFormula("IFERROR(C1,\"error\")");
       
        double accuracy = 1E-9;
View Full Code Here

       
        Cell cell1 = sh.createRow(3).createCell(0);
        cell1.setCellFormula("IFERROR(A1/B1,\"Error in calculation\")");
        Cell cell2 = sh.createRow(3).createCell(0);
        cell2.setCellFormula("IFERROR(A2/B2,\"Error in calculation\")");
        Cell cell3 = sh.createRow(3).createCell(0);
        cell3.setCellFormula("IFERROR(C1,\"error\")");
       
        double accuracy = 1E-9;

        FormulaEvaluator evaluator = wb.getCreationHelper().createFormulaEvaluator();
View Full Code Here

    }

    public void testXmlEncoding(){
        Workbook wb = _testDataProvider.createWorkbook();
        Sheet sh = wb.createSheet();
        Row row = sh.createRow(0);
        Cell cell = row.createCell(0);
        String sval = "\u0000\u0002\u0012<>\t\n\u00a0 &\"POI\'\u2122";
        cell.setCellValue(sval);

        wb = _testDataProvider.writeOutAndReadBack(wb);
View Full Code Here

    }

    public void testBug55658SetNumericValue(){
        Workbook wb = new SXSSFWorkbook();
        Sheet sh = wb.createSheet();
        Row row = sh.createRow(0);
        Cell cell = row.createCell(0);
        cell.setCellValue(Integer.valueOf(23));
       
        cell.setCellValue("some");
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.