Methods Summary |
---|
private int | convertColStringToNum(java.lang.String ref)takes in a column reference portion of a CellRef and converts it from
ALPHA-26 number format to 0-based base 10.
int len = ref.length();
int retval=0;
int pos = 0;
for (int k = ref.length()-1; k > -1; k--) {
char thechar = ref.charAt(k);
if ( pos == 0) {
retval += (Character.getNumericValue(thechar)-9);
} else {
retval += (Character.getNumericValue(thechar)-9) * (pos * 26);
}
pos++;
}
return retval-1;
|
private static java.lang.String | convertNumToColString(int col)takes in a 0-based base-10 column and returns a ALPHA-26 representation
String retval = null;
int mod = col % 26;
int div = col / 26;
char small=(char)(mod + 65);
char big = (char)(div + 64);
if (div == 0) {
retval = ""+small;
} else {
retval = ""+big+""+small;
}
return retval;
|
public short | getCol()return (short) col;
|
public int | getRow()return row;
|
public java.lang.String | getSheetName()return sheetName;
|
public boolean | isColAbsolute()return colAbs;
|
public boolean | isRowAbsolute()return rowAbs;
|
private java.lang.String[] | separateRefParts(java.lang.String reference)Seperates the row from the columns and returns an array. Element in
position one is the substring containing the columns still in ALPHA-26
number format.
// 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.
String retval[] = new String[3];
int start = reference.indexOf("!");
if (start != -1) retval[0] = reference.substring(0, start);
start += 1;
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] == '$") {
break;
}
}
retval[1] = reference.substring(start,loc);
retval[2] = reference.substring(loc);
return retval;
|
public java.lang.String | toString()
StringBuffer retval = new StringBuffer();
retval.append( (colAbs)?"$":"");
retval.append( convertNumToColString(col));
retval.append((rowAbs)?"$":"");
retval.append(row+1);
return retval.toString();
|