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/19 19:59:23 UTC
DO NOT REPLY [Bug 44636] [patch] HSSF formula cells not calculating
https://issues.apache.org/bugzilla/show_bug.cgi?id=44636
Josh Micich <jo...@gildedtree.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|HSSF formula cells not |[patch] HSSF formula cells
|calculating |not calculating
--- Comment #1 from Josh Micich <jo...@gildedtree.com> 2008-03-19 11:59:22 PST ---
I tried your test code on the latest svn trunk, and got a different error. All
formulas (in D1:D6) displayed as '#VALUE!' (my excel is 2007). I found one
difference which was that POI currently writes tRef PTGs involved in a shared
formula back as tRefV PTGs. There is a one line change to RefVPtg that will
fix that problem, after which all D1:D6 display ok:
$ svn diff src/java/org/apache/poi/hssf/record/formula/RefVPtg.java
Index: src/java/org/apache/poi/hssf/record/formula/RefVPtg.java
===================================================================
--- src/java/org/apache/poi/hssf/record/formula/RefVPtg.java (revision
638958)
+++ src/java/org/apache/poi/hssf/record/formula/RefVPtg.java (working copy)
@@ -32,6 +32,7 @@
public RefVPtg(int row, int column, boolean isRowRelative, boolean
isColumnRelative) {
super(row, column, isRowRelative, isColumnRelative);
+ setClass(CLASS_VALUE);
}
There have been a lot of changes in POI formula evaluation since v3.0, so I'm
not sure if the same patch will fully solve the problem in that version.
Furthermore, I know I haven't fully isolated this '#VALUE!' problem that I
observed in the latest POI trunk, because a simple test case would not
reproduce it (i.e. writing a spreadsheet formula just with tRefV PTGs instead
of tRef PTGs did not upset excel). There must be some other detail (in
combination with the wrong PTGs) that causes '#VALUE!' to appear.
If you attempt to apply this patch directly to v3.0, please post back if if
doesn't fix your problem.
The patch so far is tiny, but there are a few issues that need much more
investigation:
1 - Up until now, I had not seen any evidence of why POI bothers with PTG token
classes at all. All junit tests continue to run when that code
(setClass/getPtgClass) is disabled. The attached spreadsheet and test code
seems to be the first concrete example of why it might be necessary.
2 - It does not make sense to have ptg-class based java sub-classes of Ptg in
the presence of a method "setClass(byte)" which can change the ptg-lass.
3 - POI unpacks shared formula records, but doesn't seem to re-pack them
together when the spreadsheet is re-written.
--
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