git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1898274 13f79535-47bb-0310-9956-ffa450edef68tags/REL_5_2_1
@@ -42,6 +42,9 @@ import org.apache.poi.ss.formula.ptg.Ref3DPtg; | |||
import org.apache.poi.ss.formula.ptg.Ref3DPxg; | |||
import org.apache.poi.ss.util.CellReference; | |||
import org.apache.poi.ss.util.CellReference.NameType; | |||
import org.apache.poi.util.LocaleUtil; | |||
import java.util.Locale; | |||
/** | |||
* Contains all the contextual information required to evaluate an operation | |||
@@ -533,8 +536,9 @@ public final class OperationEvaluationContext { | |||
} | |||
public static CellReference applyR1C1Reference(CellReference anchorReference, String relativeReference) { | |||
int rpos = relativeReference.indexOf('R'); | |||
int cpos = relativeReference.indexOf('C'); | |||
String upRef = relativeReference.toUpperCase(LocaleUtil.getUserLocale()); | |||
int rpos = upRef.indexOf('R'); | |||
int cpos = upRef.indexOf('C'); | |||
if (rpos >= 0 && cpos > rpos) { | |||
String rval = relativeReference.substring(rpos + 1, cpos).trim(); | |||
String cval = relativeReference.substring(cpos + 1).trim(); |
@@ -168,10 +168,13 @@ final class TestIndirect { | |||
// non-error cases | |||
confirm(feA, c, "INDIRECT(\"R2C3\", FALSE)", 23); | |||
confirm(feA, c, "INDIRECT(\"r2c3\", FALSE)", 23); | |||
confirm(feA, c, "INDIRECT(\"R[-4]C[0]\", FALSE)", 23); | |||
confirm(feA, c, "INDIRECT(\"R[-4]C\", FALSE)", 23); | |||
confirm(feA, c, "INDIRECT(\"R1C1:R1C7\", FALSE)", 13); // de-reference area ref (note formula is in C4) | |||
confirm(feA, c, "INDIRECT(\"r1c1:r1c7\", FALSE)", 13); // de-reference area ref (note formula is in C4) | |||
confirm(feA, c, "SUM(INDIRECT(\"Sheet2!R1C2:R3C3\", FALSE))", 351); // area ref | |||
confirm(feA, c, "SUM(INDIRECT(\"Sheet2!r1c2:r3c3\", FALSE))", 351); // area ref | |||
confirm(feA, c, "SUM(INDIRECT(\"Sheet2! R1C2 : R3C3 \", FALSE))", 351); // spaces in area ref | |||
//scenarios yet to support |