does range resolution...doh I meant to check this in awhile ago
git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@352549 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
91df898367
commit
f3a963cdfd
@ -16,6 +16,18 @@ public class ReferenceUtil {
|
||||
private ReferenceUtil() {
|
||||
}
|
||||
|
||||
/**
|
||||
* takes in a cell range and returns an array of integers x1,y1,x2,y2
|
||||
*/
|
||||
public static int[] getXYXYFromAreaRef(String reference) {
|
||||
int retval[] = null;
|
||||
String[] refs = seperateAreaRefs(reference);
|
||||
int[] xy1 = getXYFromReference(refs[0]);
|
||||
int[] xy2 = getXYFromReference(refs[1]);
|
||||
retval = new int[] {xy1[0],xy1[1],xy2[0],xy2[1]};
|
||||
return retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* takes in a cell reference string A1 for instance and returns an integer
|
||||
* array with the first element being the row number and the second being
|
||||
@ -104,5 +116,22 @@ public class ReferenceUtil {
|
||||
retval[1] = reference.substring(loc);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* seperates Area refs in two parts and returns them as seperate elements in a
|
||||
* String array
|
||||
*/
|
||||
private static String[] seperateAreaRefs(String reference) {
|
||||
String retval[] = new String[2];
|
||||
int length = reference.length();
|
||||
|
||||
int loc = reference.indexOf(':',0);
|
||||
|
||||
retval[0] = reference.substring(0,loc);
|
||||
retval[1] = reference.substring(loc+1);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user