From 0c5f8a6bf4896b1f17186fdd7a8edc40ed187e34 Mon Sep 17 00:00:00 2001 From: "Andrew C. Oliver" Date: Thu, 28 Nov 2002 19:26:20 +0000 Subject: [PATCH] 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 --- .../org/apache/poi/hssf/util/CellReference.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) 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; } -- 2.39.5