You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2008/03/05 23:37:47 UTC
DO NOT REPLY [Bug 44539] Formula cell and area references with rows
>= 32768 do not work
https://issues.apache.org/bugzilla/show_bug.cgi?id=44539
--- Comment #1 from Josh Micich <jo...@gildedtree.com> 2008-03-05 14:37:47 ---
Turns out to be a big change. There's many places beyond the two pointed out
where 16 unsigned values are represented with java primitive shorts.
Here are two test cases that identify these problems:
public void testSetFormulaWithRowBeyond32768_Bug44539() {
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("SUM(A32769:A32770)");
if("SUM(A-32767:A-32766)".equals(cell.getCellFormula())) {
fail("Identified bug 44539");
}
assertEquals("SUM(A32769:A32770)", cell.getCellFormula());
}
public void testEvaluateFormulaWithRowBeyond32768_Bug44539() {
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("SUM(A32769:A32770)");
// put some values in the cells to make the evaluation more
interesting
sheet.createRow(32768).createCell((short)0).setCellValue(31);
sheet.createRow(32769).createCell((short)0).setCellValue(11);
HSSFFormulaEvaluator fe = new HSSFFormulaEvaluator(sheet, wb);
fe.setCurrentRow(row);
CellValue result;
try {
result = fe.evaluate(cell);
} catch (FormulaParseException e) {
if(e.getMessage().equals("Found reference to named
range \"A\", but that named range wasn't defined!")) {
fail("Identifed bug 44539");
}
throw new RuntimeException(e);
}
assertEquals(HSSFCell.CELL_TYPE_NUMERIC, result.getCellType());
assertEquals(42.0, result.getNumberValue(), 0.0);
}
//
--
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: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org