* For POI internal use only
*
* @author Josh Micich
+ * @author Cédric Walter
*/
public final class OperationEvaluationContext {
public static final FreeRefFunction UDF = UserDefinedFunction.instance;
} else {
// look up sheet by name from external workbook
String workbookName = externalSheet.getWorkbookName();
- try {\r
- targetEvaluator = _bookEvaluator.getOtherWorkbookEvaluator(workbookName);\r
- } catch (WorkbookNotFoundException e) {\r
- throw new RuntimeException(e.getMessage(), e);\r
- }\r
- otherSheetIndex = targetEvaluator.getSheetIndex(externalSheet.getSheetName());\r
- if (otherSheetIndex < 0) {\r
+ try {
+ targetEvaluator = _bookEvaluator.getOtherWorkbookEvaluator(workbookName);
+ } catch (WorkbookNotFoundException e) {
+ throw new RuntimeException(e.getMessage(), e);
+ }
+ otherSheetIndex = targetEvaluator.getSheetIndex(externalSheet.getSheetName());
+ if (otherSheetIndex < 0) {
throw new RuntimeException("Invalid sheet name '" + externalSheet.getSheetName()
+ "' in bool '" + workbookName + "'.");
}
int firstRow, firstCol, lastRow, lastCol;
switch (part1refType) {
case COLUMN:
- firstRow =0;
- lastRow = ssVersion.getLastRowIndex();
- firstCol = parseColRef(refStrPart1);
- lastCol = parseColRef(refStrPart2);
- break;
+ firstRow =0;
+ if (part2refType.equals(NameType.COLUMN))
+ {
+ lastRow = ssVersion.getLastRowIndex();
+ firstCol = parseRowRef(refStrPart1);
+ lastCol = parseRowRef(refStrPart2);
+ }
+ else {
+ lastRow = ssVersion.getLastRowIndex();
+ firstCol = parseColRef(refStrPart1);
+ lastCol = parseColRef(refStrPart2);
+ }
+ break;
case ROW:
- firstCol = 0;
- lastCol = ssVersion.getLastColumnIndex();
- firstRow = parseRowRef(refStrPart1);
- lastRow = parseRowRef(refStrPart2);
+ // support of cell range in the form of integer:integer
+ firstCol = 0;
+ if (part2refType.equals(NameType.ROW))
+ {
+ firstRow = parseColRef(refStrPart1);
+ lastRow = parseColRef(refStrPart2);
+ lastCol = ssVersion.getLastColumnIndex();
+ } else {
+ lastCol = ssVersion.getLastColumnIndex();
+ firstRow = parseRowRef(refStrPart1);
+ lastRow = parseRowRef(refStrPart2);
+ }
break;
case CELL:
CellReference cr;
--- /dev/null
+/* ====================================================================\r
+ Licensed to the Apache Software Foundation (ASF) under one or more\r
+ contributor license agreements. See the NOTICE file distributed with\r
+ this work for additional information regarding copyright ownership.\r
+ The ASF licenses this file to You under the Apache License, Version 2.0\r
+ (the "License"); you may not use this file except in compliance with\r
+ the License. You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+ Unless required by applicable law or agreed to in writing, software\r
+ distributed under the License is distributed on an "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ See the License for the specific language governing permissions and\r
+ limitations under the License.\r
+==================================================================== */\r
+\r
+package org.apache.poi.ss.formula.functions;\r
+\r
+/**\r
+ * Tests INDIRECT() as loaded from a test data spreadsheet.<p/>\r
+ *\r
+ * Tests for bug fixes and specific/tricky behaviour can be found in the corresponding test class\r
+ * (<tt>TestXxxx</tt>) of the target (<tt>Xxxx</tt>) implementor, where execution can be observed\r
+ * more easily.\r
+ *\r
+ * @author Cédric Walter\r
+ */\r
+public final class TestIndirectFunctionFromSpreadsheet extends BaseTestFunctionsFromSpreadsheet {\r
+\r
+ @Override\r
+ protected String getFilename() {\r
+ return "IndirectFunctionTestCaseData.xls";\r
+ }\r
+}\r
\r
\r
/**\r
- * Tests lookup functions (VLOOKUP, HLOOKUP, LOOKUP, MATCH) as loaded from a test data spreadsheet.<p/>\r
- * These tests have been separated from the common function and operator tests because the lookup\r
- * functions have more complex test cases and test data setup.\r
+ * Tests Match functions as loaded from a test data spreadsheet.<p/>\r
*\r
* Tests for bug fixes and specific/tricky behaviour can be found in the corresponding test class\r
* (<tt>TestXxxx</tt>) of the target (<tt>Xxxx</tt>) implementor, where execution can be observed\r
* more easily.\r
*\r
- * @author Josh Micich\r
- * @author Cedric Walter at innoveo.com\r
+ * @author Cédric Walter\r
*/\r
public final class TestMatchFunctionsFromSpreadsheet extends BaseTestFunctionsFromSpreadsheet {\r
\r