FileDocCategorySizeDatePackage
AreaReference.javaAPI DocApache Poi 3.0.12671Mon Jan 01 12:39:36 GMT 2007org.apache.poi.hssf.util

AreaReference

public class AreaReference extends Object

Fields Summary
private CellReference[]
cells
private int
dim
Constructors Summary
public AreaReference(String reference)
Create an area ref from a string representation

        String[] refs = seperateAreaRefs(reference);
        dim = refs.length;
        cells = new CellReference[dim];
        for (int i=0;i<dim;i++) {
            cells[i]=new CellReference(refs[i]);
        }
    
Methods Summary
public org.apache.poi.hssf.util.CellReference[]getCells()
return the cell references that define this area

        return cells;
    
public intgetDim()
return the dimensions of this area

        return dim;
    
private java.lang.String[]seperateAreaRefs(java.lang.String reference)
seperates Area refs in two parts and returns them as seperate elements in a String array

        String[] retval = null;

        int length = reference.length();

        int loc = reference.indexOf(':",0);
        if(loc == -1){
           retval = new String[1];
           retval[0] = reference;
        }
        else{
           retval = new String[2];
           int sheetStart = reference.indexOf("!");

           retval[0] = reference.substring(0, sheetStart+1) + reference.substring(sheetStart + 1,loc);
           retval[1] = reference.substring(0, sheetStart+1) + reference.substring(loc+1);
        }
        return retval;
    
public java.lang.StringtoString()

        StringBuffer retval = new StringBuffer();
        for (int i=0;i<dim;i++){
            retval.append(':");
            retval.append(cells[i].toString());
        }
        retval.deleteCharAt(0);
        return retval.toString();