bug 56958: validate array formulas wasn't correctly checking for overlap with a merged region

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1748829 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Javen O'Neal 2016-06-17 10:22:09 +00:00
parent 3f4d479b13
commit f4948c2d14
1 changed files with 1 additions and 4 deletions

View File

@ -395,10 +395,7 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet {
if(cell.isPartOfArrayFormulaGroup()){ if(cell.isPartOfArrayFormulaGroup()){
CellRangeAddress arrayRange = cell.getArrayFormulaRange(); CellRangeAddress arrayRange = cell.getArrayFormulaRange();
if (arrayRange.getNumberOfCells() > 1 && if (arrayRange.getNumberOfCells() > 1 && region.intersects(arrayRange)) {
// region.intersects(arrayRange) is more concise and probably correct. Is it equivalent?
( arrayRange.isInRange(region.getFirstRow(), region.getFirstColumn()) ||
arrayRange.isInRange(region.getFirstRow(), region.getFirstColumn())) ){
String msg = "The range " + region.formatAsString() + " intersects with a multi-cell array formula. " + String msg = "The range " + region.formatAsString() + " intersects with a multi-cell array formula. " +
"You cannot merge cells of an array."; "You cannot merge cells of an array.";
throw new IllegalStateException(msg); throw new IllegalStateException(msg);