From 3f89a431760e9ea34d5d395907f228af3665fb45 Mon Sep 17 00:00:00 2001 From: Javen O'Neal Date: Sun, 6 Dec 2015 21:11:38 +0000 Subject: [PATCH] supporting change for bug 56454: SheetUtil.containsCell and CellRangeAddress.isInRange are equivalent git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1718221 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/poi/ss/util/SheetUtil.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/java/org/apache/poi/ss/util/SheetUtil.java b/src/java/org/apache/poi/ss/util/SheetUtil.java index 2103fdf2f7..d4fb3dbc3a 100644 --- a/src/java/org/apache/poi/ss/util/SheetUtil.java +++ b/src/java/org/apache/poi/ss/util/SheetUtil.java @@ -318,14 +318,16 @@ public class SheetUtil { if (font.getUnderline() == Font.U_SINGLE ) str.addAttribute(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON, startIdx, endIdx); } + /** + * Check if the cell is in the specified cell range + * + * @param cr the cell range to check in + * @param rowIx the row to check + * @param colIx the column to check + * @return true if the range contains the cell [rowIx, colIx] + */ public static boolean containsCell(CellRangeAddress cr, int rowIx, int colIx) { - //FIXME: isn't this the same as cr.isInRange(rowInd, colInd) ? - if (cr.getFirstRow() <= rowIx && cr.getLastRow() >= rowIx - && cr.getFirstColumn() <= colIx && cr.getLastColumn() >= colIx) - { - return true; - } - return false; + return cr.isInRange(rowIx, colIx); } /** -- 2.39.5