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/06/03 19:02:02 UTC

DO NOT REPLY [Bug 45123] New: Token operand class not being copied by SharedFormulaRecord. convertSharedFormulas()

https://issues.apache.org/bugzilla/show_bug.cgi?id=45123

           Summary: Token operand class not being copied by
                    SharedFormulaRecord.convertSharedFormulas()
           Product: POI
           Version: 3.0-dev
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HSSF
        AssignedTo: dev@poi.apache.org
        ReportedBy: josh@gildedtree.com
                CC: sandeep30469@hotmail.com


Originally reported as a re-open of bug 42541.

If the example file
(https://issues.apache.org/bugzilla/attachment.cgi?id=22062) is read and
re-written by POI, the formulas in Sheet1!C6:C21 all display as '#VALUE!' in
Excel.

The formulas contain tokens with operand class 'array'.  The code in
SharedFormulaRecord.convertSharedFormulas() does not propagate the operand
class correctly.


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


DO NOT REPLY [Bug 45123] Token operand class not being copied by SharedFormulaRecord. convertSharedFormulas()

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45123





--- Comment #3 from Josh Micich <jo...@gildedtree.com>  2008-06-03 12:54:27 PST ---
Created an attachment (id=22065)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=22065)
Draft of SharedFormulaRecord (.java and .class)

base version is r652934


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


DO NOT REPLY [Bug 45123] Token operand class not being copied by SharedFormulaRecord. convertSharedFormulas()

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45123


vijay <vk...@njit.edu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |vkt3142@njit.edu




--- Comment #2 from vijay <vk...@njit.edu>  2008-06-03 11:48:05 PST ---
Josh,
     Could you send me the revised SharedFormulaRecord.java file or give me the
location to get that file. I want to test it out.

Thanks


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


DO NOT REPLY [Bug 45123] Token operand class not being copied by SharedFormulaRecord. convertSharedFormulas()

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45123


Josh Micich <jo...@gildedtree.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED




--- Comment #5 from Josh Micich <jo...@gildedtree.com>  2008-06-04 20:14:26 PST ---
(In reply to comment #1)
> The following patch fixes this bug ...

Applied patch in svn r663436

junit test added as well.


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


DO NOT REPLY [Bug 45123] Token operand class not being copied by SharedFormulaRecord. convertSharedFormulas()

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45123





--- Comment #4 from Josh Micich <jo...@gildedtree.com>  2008-06-03 13:00:10 PST ---
(In reply to comment #3)
> Created an attachment (id=22065)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=22065) [details]

This file can be patched into the svn trunk (I think it depends on bug 45060,
which is very recent). 

You can get the latest from subversion with the following command:
svn co https://svn.apache.org/repos/asf/poi/trunk


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


DO NOT REPLY [Bug 45123] Token operand class not being copied by SharedFormulaRecord. convertSharedFormulas()

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45123


Josh Micich <jo...@gildedtree.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED




--- Comment #1 from Josh Micich <jo...@gildedtree.com>  2008-06-03 10:06:48 PST ---
The following patch fixes this bug:
Index: SharedFormulaRecord.java
===================================================================
--- SharedFormulaRecord.java    (revision 661934)
+++ SharedFormulaRecord.java    (working copy)
@@ -201,6 +201,10 @@
         if (ptgs != null)
           for (int k = 0; k < ptgs.size(); k++) {
             Ptg ptg = (Ptg) ptgs.get(k);
+            byte originalOperandClass = -1;
+            if (!ptg.isBaseToken()) {
+                originalOperandClass = ptg.getPtgClass();
+            }
             if (ptg instanceof RefNPtg) {
               RefNPtg refNPtg = (RefNPtg)ptg;
               ptg = new
ReferencePtg(fixupRelativeRow(formulaRow,refNPtg.getRow(),refNPtg.isRowRelative()),
@@ -249,7 +253,11 @@
                                 areaNAPtg.isLastRowRelative(),
                                 areaNAPtg.isFirstColRelative(),
                                 areaNAPtg.isLastColRelative());
-            }
+            }
+            if (!ptg.isBaseToken()) {
+                ptg.setClass(originalOperandClass);
+            }
+
             newPtgStack.add(ptg);
         }
         return newPtgStack;


A junit also needs to be added.


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