org.apache.poi.ss.util
Class AreaReference
- java.lang.Object
-
- org.apache.poi.ss.util.AreaReference
-
- Direct Known Subclasses:
- AreaReference
public class AreaReference extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor and Description AreaReference(CellReference topLeft, CellReference botRight)Creates an area ref from a pair of Cell References.AreaReference(java.lang.String reference)Create an area ref from a string representation.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description java.lang.StringformatAsString()Returns a text representation of this area reference.static AreaReference[]generateContiguous(java.lang.String reference)Takes a non-contiguous area reference, and returns an array of contiguous area references.CellReference[]getAllReferencedCells()Returns a reference to every cell covered by this areaCellReferencegetFirstCell()CellReferencegetLastCell()Note - if this area reference refers to a single cell, the return value of this method will be identical to that of getFirstCell()static AreaReferencegetWholeColumn(java.lang.String start, java.lang.String end)static AreaReferencegetWholeRow(java.lang.String start, java.lang.String end)static booleanisContiguous(java.lang.String reference)Is the reference for a contiguous (i.e.booleanisSingleCell()booleanisWholeColumnReference()static booleanisWholeColumnReference(CellReference topLeft, CellReference botRight)Is the reference for a whole-column reference, such as C:C or D:G ?java.lang.StringtoString()
-
-
-
Constructor Detail
-
AreaReference
public AreaReference(java.lang.String reference)
Create an area ref from a string representation. Sheet names containing special characters should be delimited and escaped as per normal syntax rules for formulas.
The area reference must be contiguous (i.e. represent a single rectangle, not a union of rectangles)
-
AreaReference
public AreaReference(CellReference topLeft, CellReference botRight)
Creates an area ref from a pair of Cell References.
-
-
Method Detail
-
isContiguous
public static boolean isContiguous(java.lang.String reference)
Is the reference for a contiguous (i.e. unbroken) area, or is it made up of several different parts? (If it is, you will need to callgenerateContiguous(String))
-
getWholeRow
public static AreaReference getWholeRow(java.lang.String start, java.lang.String end)
-
getWholeColumn
public static AreaReference getWholeColumn(java.lang.String start, java.lang.String end)
-
isWholeColumnReference
public static boolean isWholeColumnReference(CellReference topLeft, CellReference botRight)
Is the reference for a whole-column reference, such as C:C or D:G ?
-
isWholeColumnReference
public boolean isWholeColumnReference()
-
generateContiguous
public static AreaReference[] generateContiguous(java.lang.String reference)
Takes a non-contiguous area reference, and returns an array of contiguous area references.
-
isSingleCell
public boolean isSingleCell()
- Returns:
falseif this area reference involves more than one cell
-
getFirstCell
public CellReference getFirstCell()
- Returns:
- the first cell reference which defines this area. Usually this cell is in the upper left corner of the area (but this is not a requirement).
-
getLastCell
public CellReference getLastCell()
Note - if this area reference refers to a single cell, the return value of this method will be identical to that of getFirstCell()- Returns:
- the second cell reference which defines this area. For multi-cell areas, this is cell diagonally opposite the 'first cell'. Usually this cell is in the lower right corner of the area (but this is not a requirement).
-
getAllReferencedCells
public CellReference[] getAllReferencedCells()
Returns a reference to every cell covered by this area
-
formatAsString
public java.lang.String formatAsString()
Returns a text representation of this area reference. Example return values:Result Comment A1:A1 Single cell area reference without sheet A1:$C$1 Multi-cell area reference without sheet Sheet1!A$1:B4 Standard sheet name 'O''Brien''s Sales'!B5:C6' Sheet name with special characters - Returns:
- the text representation of this area reference as it would appear in a formula.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-
DataMelt 3.0 © DataMelt by jWork.ORG