https://issues.apache.org/bugzilla/show_bug.cgi?id=45593
Summary: Formula "Sum(a1:g1)" not calculating string values
Product: POI
Version: 3.0
Platform: PC
OS/Version: Windows XP
Status: NEW
Severity: major
Priority: P2
Component: HSSF
AssignedTo: [email protected]
ReportedBy: [EMAIL PROTECTED]
I have an excel file with following:
Row1, column a1 to e1 has value AAA.
Row2 Col1 has a formula "=sum(a1:e1)"
Row2 Col2 has a formula "=A1+B1+C1+D1+E1"
Now I read this excel sheet using POI, and modify the AAA values to 5.
And used the following to calculate formulas, but Row2Col1 calculate to 0,
where as Row2Col2 calculates to 30:
--------------------------
for(int sheetNum = 0; sheetNum < wb.getNumberOfSheets();
sheetNum++) {
HSSFSheet sheet = wb.getSheetAt(sheetNum);
HSSFFormulaEvaluator evaluator = new
HSSFFormulaEvaluator(sheet, wb);
for(Iterator rit = sheet.rowIterator(); rit.hasNext();)
{
HSSFRow r = (HSSFRow)rit.next();
evaluator.setCurrentRow(r);
for(Iterator cit = r.cellIterator();
cit.hasNext();) {
HSSFCell c = (HSSFCell)cit.next();
if(c.getCellType() ==
HSSFCell.CELL_TYPE_FORMULA) {
evaluator.evaluateFormulaCell(c);
}
}
}
}
}
---------------------------------
--
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]