You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ye...@apache.org on 2012/04/21 14:48:43 UTC

svn commit: r1328647 - in /poi/trunk: src/documentation/content/xdocs/status.xml src/java/org/apache/poi/ss/formula/LazyAreaEval.java src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java test-data/spreadsheet/53101.xlsx

Author: yegor
Date: Sat Apr 21 12:48:42 2012
New Revision: 1328647

URL: http://svn.apache.org/viewvc?rev=1328647&view=rev
Log:
Bugzilla 53101: fixed evaluation of SUM over cell range > 255

Added:
    poi/trunk/test-data/spreadsheet/53101.xlsx   (with props)
Modified:
    poi/trunk/src/documentation/content/xdocs/status.xml
    poi/trunk/src/java/org/apache/poi/ss/formula/LazyAreaEval.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java

Modified: poi/trunk/src/documentation/content/xdocs/status.xml
URL: http://svn.apache.org/viewvc/poi/trunk/src/documentation/content/xdocs/status.xml?rev=1328647&r1=1328646&r2=1328647&view=diff
==============================================================================
--- poi/trunk/src/documentation/content/xdocs/status.xml (original)
+++ poi/trunk/src/documentation/content/xdocs/status.xml Sat Apr 21 12:48:42 2012
@@ -34,6 +34,7 @@
 
     <changes>
         <release version="3.9-beta1" date="2012-??-??">
+          <action dev="poi-developers" type="fix">53101 - fixed evaluation of SUM over cell range &gt; 255</action>
           <action dev="poi-developers" type="fix">49529 - avoid exception when cloning sheets with no drawing records and initialized drawing patriarch</action>
         </release>
         <release version="3.8-FINAL" date="2012-03-26">

Modified: poi/trunk/src/java/org/apache/poi/ss/formula/LazyAreaEval.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/formula/LazyAreaEval.java?rev=1328647&r1=1328646&r2=1328647&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/formula/LazyAreaEval.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/formula/LazyAreaEval.java Sat Apr 21 12:48:42 2012
@@ -45,8 +45,8 @@ final class LazyAreaEval extends AreaEva
 
 	public ValueEval getRelativeValue(int relativeRowIndex, int relativeColumnIndex) {
 
-		int rowIx = (relativeRowIndex + getFirstRow() ) & 0xFFFF;
-		int colIx = (relativeColumnIndex + getFirstColumn() ) & 0x00FF;
+		int rowIx = (relativeRowIndex + getFirstRow() ) ;
+		int colIx = (relativeColumnIndex + getFirstColumn() ) ;
 
 		return _evaluator.getEvalForCell(rowIx, colIx);
 	}

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java?rev=1328647&r1=1328646&r2=1328647&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java Sat Apr 21 12:48:42 2012
@@ -1317,4 +1317,26 @@ public final class TestXSSFBugs extends 
         }
     }
 
+    /**
+     * Bug 53101:
+     */
+    public void test5301(){
+        Workbook workbook = XSSFTestDataSamples.openSampleWorkbook("53101.xlsx");
+        FormulaEvaluator evaluator =
+                workbook.getCreationHelper().createFormulaEvaluator();
+        // A1: SUM(B1: IZ1)
+        double a1Value =
+                evaluator.evaluate(workbook.getSheetAt(0).getRow(0).getCell(0)).getNumberValue();
+
+        // Assert
+        assertEquals(259.0, a1Value, 0.0);
+
+        // KY: SUM(B1: IZ1)
+        double ky1Value =
+                evaluator.evaluate(workbook.getSheetAt(0).getRow(0).getCell(310)).getNumberValue();
+
+        // Assert
+        assertEquals(259.0, a1Value, 0.0);
+    }
+
 }

Added: poi/trunk/test-data/spreadsheet/53101.xlsx
URL: http://svn.apache.org/viewvc/poi/trunk/test-data/spreadsheet/53101.xlsx?rev=1328647&view=auto
==============================================================================
Binary file - no diff available.

Propchange: poi/trunk/test-data/spreadsheet/53101.xlsx
------------------------------------------------------------------------------
    svn:mime-type = application/vnd.ms-excel



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org