diff options
author | PJ Fanning <fanningpj@apache.org> | 2023-05-25 10:39:47 +0000 |
---|---|---|
committer | PJ Fanning <fanningpj@apache.org> | 2023-05-25 10:39:47 +0000 |
commit | 2676dcc7f48b78ef367202fe41c9acb7565700c0 (patch) | |
tree | d68abdd312c0071f6755d60b67c2108ad50af596 /poi | |
parent | dfe5dd150cdcb5a32fbcb00d9c442ef1a21d0085 (diff) | |
download | poi-2676dcc7f48b78ef367202fe41c9acb7565700c0.tar.gz poi-2676dcc7f48b78ef367202fe41c9acb7565700c0.zip |
[bug-66614] remove limit on offset function params
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1910049 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi')
-rw-r--r-- | poi/src/main/java/org/apache/poi/ss/formula/functions/Offset.java | 9 | ||||
-rw-r--r-- | poi/src/main/java/org/apache/poi/ss/util/CellReference.java | 4 |
2 files changed, 3 insertions, 10 deletions
diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/Offset.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/Offset.java index cd77d72c9b..b37eb3bb4b 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/Offset.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/Offset.java @@ -17,6 +17,7 @@ package org.apache.poi.ss.formula.functions; +import org.apache.poi.ss.SpreadsheetVersion; import org.apache.poi.ss.formula.eval.AreaEval; import org.apache.poi.ss.formula.eval.ErrorEval; import org.apache.poi.ss.formula.eval.EvaluationException; @@ -39,10 +40,6 @@ import org.apache.poi.ss.formula.eval.ValueEval; * <b>width</b> (default same width as base reference) is the column count for the returned area reference.<br> */ public final class Offset implements Function { - // These values are specific to BIFF8 - private static final int LAST_VALID_ROW_INDEX = 0xFFFF; - private static final int LAST_VALID_COLUMN_INDEX = 0xFF; - /** * A one dimensional base + offset. Represents either a row range or a column range. @@ -199,10 +196,10 @@ public final class Offset implements Function { LinearOffsetRange absRows = orRow.normaliseAndTranslate(baseRef.getFirstRowIndex()); LinearOffsetRange absCols = orCol.normaliseAndTranslate(baseRef.getFirstColumnIndex()); - if(absRows.isOutOfBounds(0, LAST_VALID_ROW_INDEX)) { + if(absRows.isOutOfBounds(0, SpreadsheetVersion.EXCEL2007.getLastRowIndex())) { throw new EvaluationException(ErrorEval.REF_INVALID); } - if(absCols.isOutOfBounds(0, LAST_VALID_COLUMN_INDEX)) { + if(absCols.isOutOfBounds(0, SpreadsheetVersion.EXCEL2007.getLastColumnIndex())) { throw new EvaluationException(ErrorEval.REF_INVALID); } return baseRef.offset(orRow.getFirstIndex(), orRow.getLastIndex(), orCol.getFirstIndex(), orCol.getLastIndex()); diff --git a/poi/src/main/java/org/apache/poi/ss/util/CellReference.java b/poi/src/main/java/org/apache/poi/ss/util/CellReference.java index 0e8ea7dee4..1749878163 100644 --- a/poi/src/main/java/org/apache/poi/ss/util/CellReference.java +++ b/poi/src/main/java/org/apache/poi/ss/util/CellReference.java @@ -93,10 +93,6 @@ public class CellReference implements GenericRecord { * digits or dot. (They can even end in dot). */ private static final Pattern NAMED_RANGE_NAME_PATTERN = Pattern.compile("[_A-Z][_.A-Z0-9]*", Pattern.CASE_INSENSITIVE); - //private static final String BIFF8_LAST_COLUMN = SpreadsheetVersion.EXCEL97.getLastColumnName(); - //private static final int BIFF8_LAST_COLUMN_TEXT_LEN = BIFF8_LAST_COLUMN.length(); - //private static final String BIFF8_LAST_ROW = String.valueOf(SpreadsheetVersion.EXCEL97.getMaxRows()); - //private static final int BIFF8_LAST_ROW_TEXT_LEN = BIFF8_LAST_ROW.length(); // FIXME: _sheetName may be null, depending on the entry point. // Perhaps it would be better to declare _sheetName is never null, using an empty string to represent a 2D reference. |