https://issues.apache.org/bugzilla/show_bug.cgi?id=44508
--- Comment #2 from Josh Micich <[EMAIL PROTECTED]> 2008-02-29 11:24:41 ---
HSSFFormulaEvaluator.evaluateInCell() does an evaluation of the cell formula
and then replaces the formula with the evaluation result.
Can you tell me why you are using this non-idempotent method? Is it a question
of performance?
HSSFCell has a method setCellType() which both gets and sets the cell value.
The cell value accessor methods are mostly type checked, preventing setting or
getting a value of the wrong type. The combination of these causes some
convoluted logic.
This patch I have submitted only fixes the case where the formula result is a
boolean. Here is a test case specifically for this patch:
private void testEvaluateBooleanInCell_bug44508() {
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sheet = wb.createSheet();
wb.setSheetName(0, "Sheet1");
HSSFRow row = sheet.createRow(0);
HSSFCell cell = row.createCell((short)0);
cell.setCellFormula("1=1");
HSSFFormulaEvaluator fe = new HSSFFormulaEvaluator(sheet, wb);
fe.setCurrentRow(row);
try {
fe.evaluateInCell(cell);
} catch (NumberFormatException e) {
fail("Identified bug 44508");
}
assertEquals(true, cell.getBooleanCellValue());
}
--
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]