poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 44606] [patch] Setting string value for formula cell yields ClassCastException
Date Mon, 17 Mar 2008 10:16:45 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=44606





--- Comment #5 from Antonio Chirizzi <antonio.chirizzi@gmail.com>  2008-03-17 03:16:45
PST ---
(In reply to comment #2)
> I took a look at the code+spreadsheet you attached.  The latest POI fails well
> before the ClassCastException.  This is because since 3.0, support for parsing
> percent formula token was added, but percent evaluation has not been done yet. 
> From what I recall, in 3.0 the formula parser would just *stop* upon finding
> any unknown char.  That's why you don't *crash* on '%'. If you check the
> evaluated values, you should find that they're out by a factor of 100.
> After I hacked a quick fix for PercentPtg, I could see your ClassCastException
> error.  I have attached a patch to fix just this error.  (The percent
> evaluation stuff will come a bit later).
> If you don't care about the actual results from HSSFFormulaEvaluator, you can
> just apply this patch to your 3.0 version of the code to get up and running. 
> Otherwise you'll have to wait for PercentEval to be added to the svn trunk
> before you'll have a version of POI that can handle your supplied example code.

Thanks a lot Josh, I was able to patch the source and rebuild the jars.
The Exception does not show anymore, the sheet gets saved, the values are
recalculated correctly, but I still have a problem:
Even if the value are recalculated, if I modify a value in the rewritten sheet
or set in the first example program I attached:

sheet.setForceFormulaRecalculation(true);

when I open the workbook all the formulas like "=$D52/$D$47*$H$47*E11/100" show
the "#VALUE" value.
I deleted the % sign as you suggested, and replaced it with the operation
"*cell/100", but I still have problems.
Is the formula too complex?

-Antonio 


-- 
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


Mime
View raw message