Bugzilla 53101: fixed evaluation of SUM over cell range > 255

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1328647 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yegor Kozlov 2012-04-21 12:48:42 +00:00
parent 0afefcd2b8
commit 8ae072fc85
4 changed files with 25 additions and 2 deletions

View File

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

View File

@ -45,8 +45,8 @@ final class LazyAreaEval extends AreaEvalBase {
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);
}

View File

@ -1317,4 +1317,26 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
}
}
/**
* 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);
}
}

Binary file not shown.