Package org.apache.poi.hssf.usermodel

Examples of org.apache.poi.hssf.usermodel.HSSFCell


     * Tests reading a file containing this ptg.
     */
    public void testReading() throws Exception
    {
        HSSFWorkbook workbook = loadWorkbook("ErrPtg.xls");
        HSSFCell cell = workbook.getSheetAt(0).getRow(3).getCell((short) 0);
        assertEquals("Wrong cell value", 4.0, cell.getNumericCellValue(), 0.0);
        assertEquals("Wrong cell formula", "ERROR.TYPE(#REF!)", cell.getCellFormula());
    }
View Full Code Here


     * Tests reading a file containing this ptg.
     */
    public void testReading() throws Exception
    {
        HSSFWorkbook workbook = loadWorkbook("RangePtg.xls");
        HSSFCell cell = workbook.getSheetAt(0).getRow(3).getCell((short) 1);
        assertEquals("Wrong cell value", 10.0, cell.getNumericCellValue(), 0.0);
        assertEquals("Wrong cell formula", "SUM(pineapple:B2)", cell.getCellFormula());
    }
View Full Code Here

      wb.createSheet("NoQuotesNeeded");
      wb.createSheet("Quotes Needed Here &#$@");
     
      HSSFSheet sheet = wb.createSheet("Test");
      HSSFRow row = sheet.createRow(0);
      HSSFCell cell;
     
      cell = row.createCell((short)0);
      cell.setCellFormula("NoQuotesNeeded!A1");
     
      cell = row.createCell((short)1);
      cell.setCellFormula("'Quotes Needed Here &#$@'!A1");
    }
View Full Code Here

     
      wb.createSheet("Cash_Flow");;
     
      HSSFSheet sheet = wb.createSheet("Test");
      HSSFRow row = sheet.createRow(0);
      HSSFCell cell;
     
      cell = row.createCell((short)0);
      cell.setCellFormula("Cash_Flow!A1");
   
  }
View Full Code Here

        wb.createSheet("Cash_Flow");;

        HSSFSheet sheet = wb.createSheet("Test");
        HSSFRow row = sheet.createRow(0);
        HSSFCell cell = row.createCell((short)0);
        String formula = null;

        cell.setCellFormula("1.3E21/3");
        formula = cell.getCellFormula();
        assertEquals("Exponential formula string", "1.3E21/3", formula);

        cell.setCellFormula("-1.3E21/3");
        formula = cell.getCellFormula();
        assertEquals("Exponential formula string", "-1.3E21/3", formula);

        cell.setCellFormula("1322E21/3");
        formula = cell.getCellFormula();
        assertEquals("Exponential formula string", "1.322E24/3", formula);

        cell.setCellFormula("-1322E21/3");
        formula = cell.getCellFormula();
        assertEquals("Exponential formula string", "-1.322E24/3", formula);

        cell.setCellFormula("1.3E1/3");
        formula = cell.getCellFormula();
        assertEquals("Exponential formula string", "13.0/3", formula);

        cell.setCellFormula("-1.3E1/3");
        formula = cell.getCellFormula();
        assertEquals("Exponential formula string", "-13.0/3", formula);

        cell.setCellFormula("1.3E-4/3");
        formula = cell.getCellFormula();
        assertEquals("Exponential formula string", "1.3E-4/3", formula);

        cell.setCellFormula("-1.3E-4/3");
        formula = cell.getCellFormula();
        assertEquals("Exponential formula string", "-1.3E-4/3", formula);

        cell.setCellFormula("13E-15/3");
        formula = cell.getCellFormula();
        assertEquals("Exponential formula string", "1.3E-14/3", formula);

        cell.setCellFormula("-13E-15/3");
        formula = cell.getCellFormula();
        assertEquals("Exponential formula string", "-1.3E-14/3", formula);

        cell.setCellFormula("1.3E3/3");
        formula = cell.getCellFormula();
        assertEquals("Exponential formula string", "1300.0/3", formula);

        cell.setCellFormula("-1.3E3/3");
        formula = cell.getCellFormula();
        assertEquals("Exponential formula string", "-1300.0/3", formula);

        cell.setCellFormula("1300000000000000/3");
        formula = cell.getCellFormula();
        assertEquals("Exponential formula string", "1.3E15/3", formula);

        cell.setCellFormula("-1300000000000000/3");
        formula = cell.getCellFormula();
        assertEquals("Exponential formula string", "-1.3E15/3", formula);

        cell.setCellFormula("-10E-1/3.1E2*4E3/3E4");
        formula = cell.getCellFormula();
        assertEquals("Exponential formula string", "-1.0/310.0*4000.0/30000.0", formula);
    }
View Full Code Here

     * Tests reading a file containing this ptg.
     */
    public void testReading() throws Exception
    {
        HSSFWorkbook workbook = loadWorkbook("IntersectionPtg.xls");
        HSSFCell cell = workbook.getSheetAt(0).getRow(4).getCell((short) 2);
        assertEquals("Wrong cell value", 5.0, cell.getNumericCellValue(), 0.0);
        assertEquals("Wrong cell formula", "SUM(A1:B2 B2:C3)", cell.getCellFormula());
    }
View Full Code Here

     */
    private ByteArrayOutputStream setupRunFile(HSSFWorkbook book) throws Exception {
        ByteArrayOutputStream stream = new ByteArrayOutputStream();
        HSSFSheet sheet = book.createSheet("Test");
        HSSFRow   row   = sheet.createRow(0);
        HSSFCell  cell  = row.createCell((short)0);
        cell.setCellValue(10.5);
        book.write(stream);
        return stream;
    }
View Full Code Here

    wb.createSheet("NoQuotesNeeded");
    wb.createSheet("Quotes Needed Here &#$@");

    HSSFSheet sheet = wb.createSheet("Test");
    HSSFRow row = sheet.createRow(0);
    HSSFCell cell;

    cell = row.createCell((short)0);
    cell.setCellFormula("NoQuotesNeeded!A1");

    cell = row.createCell((short)1);
    cell.setCellFormula("'Quotes Needed Here &#$@'!A1");
  }
View Full Code Here

    wb.createSheet("Cash_Flow");

    HSSFSheet sheet = wb.createSheet("Test");
    HSSFRow row = sheet.createRow(0);
    HSSFCell cell;

    cell = row.createCell((short)0);
    cell.setCellFormula("Cash_Flow!A1");
  }
View Full Code Here

    wb.createSheet("Cash_Flow");

    HSSFSheet sheet = wb.createSheet("Test");
    HSSFRow row = sheet.createRow(0);
    HSSFCell cell = row.createCell((short)0);
    String formula = null;

    cell.setCellFormula("1.3E21/3");
    formula = cell.getCellFormula();
    assertEquals("Exponential formula string", "1.3E21/3", formula);

    cell.setCellFormula("-1.3E21/3");
    formula = cell.getCellFormula();
    assertEquals("Exponential formula string", "-1.3E21/3", formula);

    cell.setCellFormula("1322E21/3");
    formula = cell.getCellFormula();
    assertEquals("Exponential formula string", "1.322E24/3", formula);

    cell.setCellFormula("-1322E21/3");
    formula = cell.getCellFormula();
    assertEquals("Exponential formula string", "-1.322E24/3", formula);

    cell.setCellFormula("1.3E1/3");
    formula = cell.getCellFormula();
    assertEquals("Exponential formula string", "13.0/3", formula);

    cell.setCellFormula("-1.3E1/3");
    formula = cell.getCellFormula();
    assertEquals("Exponential formula string", "-13.0/3", formula);

    cell.setCellFormula("1.3E-4/3");
    formula = cell.getCellFormula();
    assertEquals("Exponential formula string", "1.3E-4/3", formula);

    cell.setCellFormula("-1.3E-4/3");
    formula = cell.getCellFormula();
    assertEquals("Exponential formula string", "-1.3E-4/3", formula);

    cell.setCellFormula("13E-15/3");
    formula = cell.getCellFormula();
    assertEquals("Exponential formula string", "1.3E-14/3", formula);

    cell.setCellFormula("-13E-15/3");
    formula = cell.getCellFormula();
    assertEquals("Exponential formula string", "-1.3E-14/3", formula);

    cell.setCellFormula("1.3E3/3");
    formula = cell.getCellFormula();
    assertEquals("Exponential formula string", "1300.0/3", formula);

    cell.setCellFormula("-1.3E3/3");
    formula = cell.getCellFormula();
    assertEquals("Exponential formula string", "-1300.0/3", formula);

    cell.setCellFormula("1300000000000000/3");
    formula = cell.getCellFormula();
    assertEquals("Exponential formula string", "1.3E15/3", formula);

    cell.setCellFormula("-1300000000000000/3");
    formula = cell.getCellFormula();
    assertEquals("Exponential formula string", "-1.3E15/3", formula);

    cell.setCellFormula("-10E-1/3.1E2*4E3/3E4");
    formula = cell.getCellFormula();
    assertEquals("Exponential formula string", "-1.0/310.0*4000.0/30000.0", formula);
  }
View Full Code Here

TOP

Related Classes of org.apache.poi.hssf.usermodel.HSSFCell

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.