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/08/08 09:30:53 UTC
DO NOT REPLY [Bug 45593] Formula "Sum(a1:g1)" not calculating string
values
https://issues.apache.org/bugzilla/show_bug.cgi?id=45593
Josh Micich <jo...@gildedtree.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |WORKSFORME
--- Comment #1 from Josh Micich <jo...@gildedtree.com> 2008-08-08 00:30:53 PST ---
I'm having trouble reproducing this bug. I tried on version 3.1 and also svn
trunk, and both seem to be OK. Here is the code I used:
InputStream is = new FileInputStream("c:/temp/ex44593.xls");
HSSFWorkbook wb = new HSSFWorkbook(is);
HSSFSheet sheet = wb.getSheetAt(0);
HSSFRow row = sheet.getRow(0);
for(int i=0; i<5; i++) {
row.getCell(i).setCellValue(5.0);
}
row = sheet.getRow(1);
HSSFFormulaEvaluator evaluator = new HSSFFormulaEvaluator(sheet, wb);
evaluator.setCurrentRow(row);
System.out.println(evaluator.evaluate(row.getCell(0)).getNumberValue());
System.out.println(evaluator.evaluate(row.getCell(1)).getNumberValue());
sheet.setForceFormulaRecalculation(true);
FileOutputStream fos = new FileOutputStream("c:/temp/ex44593-out.xls");
wb.write(fos);
fos.close();
----
The output is:
25.0
25.0
----
I tried to create the input spreadsheet according to your instructions. I'll
attach it for reference.
I'm closing the bug for the moment, but please re-open if you can clarify how
to reproduce the problem.
--
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