https://issues.apache.org/bugzilla/show_bug.cgi?id=49397
Yegor Kozlov <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |INVALID --- Comment #3 from Yegor Kozlov <[email protected]> 2010-07-29 02:29:06 EDT --- You are using a wrong method to retrieve results. FormulaEvaluator#evaluateFormulaCell evaluates the formula and returns the type of the formula result, not the result itself. In your case it returned 0 which corresponds to Cell.CELL_TYPE_NUMERIC, that is the result of formula was number. Use FormulaEvaluator#evaluate to get the result. The code below worked fine to me: HSSFWorkbook wb = new HSSFWorkbook(new FileInputStream(inputFile)); HSSFFormulaEvaluator formulaEvaluator = new HSSFFormulaEvaluator(wb); HSSFSheet sheet = wb.getSheet("20-MEETNET"); for (int i = 1; i <= sheet.getLastRowNum(); i++) { HSSFRow row = sheet.getRow(i); HSSFCell cell = row.getCell(1); CellValue val = formulaEvaluator.evaluate(cell); int internBereikId = (int)val.getNumberValue(); System.out.println(i + ": " + internBereikId); } Yegor -- Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
