From: Andrew C. Oliver Date: Thu, 28 Nov 2002 19:26:20 +0000 (+0000) Subject: http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14269 X-Git-Tag: REL_1_10~79 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=0c5f8a6bf4896b1f17186fdd7a8edc40ed187e34;p=poi.git http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14269 PR: Obtained from: Submitted by: Reviewed by: git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@352930 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/poi/hssf/util/CellReference.java b/src/java/org/apache/poi/hssf/util/CellReference.java index 55eb27214f..804b572316 100644 --- a/src/java/org/apache/poi/hssf/util/CellReference.java +++ b/src/java/org/apache/poi/hssf/util/CellReference.java @@ -57,6 +57,7 @@ package org.apache.poi.hssf.util; /** * * @author Avik Sengupta + * @author Dennis Doubleday (patch to seperateRowColumns()) */ public class CellReference { @@ -126,11 +127,18 @@ public class CellReference { * number format. */ private String[] seperateRowColumns(String reference) { - int loc = 0; // location of first number + + // Look for end of sheet name. This will either set + // start to 0 (if no sheet name present) or the + // index after the sheet reference ends. + int start = reference.indexOf("!") + 1; + String retval[] = new String[2]; int length = reference.length(); - + + char[] chars = reference.toCharArray(); + int loc = start; if (chars[loc]=='$') loc++; for (; loc < chars.length; loc++) { if (Character.isDigit(chars[loc]) || chars[loc] == '$') { @@ -139,7 +147,7 @@ public class CellReference { } - retval[0] = reference.substring(0,loc); + retval[0] = reference.substring(start,loc); retval[1] = reference.substring(loc); return retval; }