public class ExcelSheetPoint extends java.lang.Object implements SheetPoint, java.lang.Cloneable
Constructor and Description |
---|
ExcelSheetPoint(java.lang.String sheetPointer)
Creates a sheetPoint object from the format sheetName!
|
ExcelSheetPoint(java.lang.String name,
org.apache.poi.ss.usermodel.Sheet sh,
int row,
short col)
Creates a sheetPoint object providing all parameters.
|
ExcelSheetPoint(java.lang.String name,
org.apache.poi.ss.usermodel.Sheet sh,
java.lang.String rowCol)
Creates a sheetPoint object providing all parameters.
|
ExcelSheetPoint(java.lang.String sheetPointer,
org.apache.poi.ss.usermodel.Workbook wb)
Creates a sheetPoint object from a sheetPointer string of the following form:
sheetName!
|
Modifier and Type | Method and Description |
---|---|
ExcelSheetPoint |
clone()
Clone.
|
ExcelSheetPoint |
down()
Moves this SheetPoint to point to the cell that is below this cell.
|
ExcelSheetPoint |
down(int n)
Moves this SheetPoint down n cells.
|
boolean |
equals(java.lang.Object obj)
Equals.
|
ExcelRSCell |
getCell()
Obtains the HSSFCell object corresponding to the cell name.
|
java.lang.String |
getCellCoordinates()
Gets the cell coordinates in the A1 representation.
|
java.lang.String |
getCellName()
Gets the cell name.
|
short |
getCol()
Access to the column.
|
org.apache.poi.ss.usermodel.RichTextString |
getContent()
Access to the value of the cell and returns an HSSFRichTextString.
|
boolean |
getContentAsBoolean()
Access to the value in the cell pointed to by this object
the value is converted to a boolean depending on the
content type of the cell.
|
boolean |
getContentAsBoolean(boolean exceptionsIfBlank,
boolean exceptionsIfError)
Access to the value in the cell pointed to by this object
the value is converted to a boolean depending on the
content type of the cell.
|
boolean |
getContentAsBoolean(boolean exceptionsIfBlank,
boolean valueIfBlankAndException,
boolean exceptionsIfError,
boolean valueIfErrorAndException)
Access to the value in the cell pointed to by this object
the value is converted to a boolean depending on the
content type of the cell.
|
java.util.Date |
getContentAsDate()
Access to the value in the cell pointed to by this object
the value is converted to a Date depending on the
content type of the cell.
|
java.lang.Double |
getContentAsDouble()
Access to the value in the cell as a Double.
|
ExcelSheetPoint |
getContentAsSheetPoint(org.apache.poi.ss.usermodel.Workbook wb)
Obtains an ExcelSheetPoint class instance with a reference to the workbook passed in as parameter.
|
java.lang.String |
getContentAsString()
Access to the value in the cell pointed to by this object
the value is converted to a string depending on the
content type of the cell.
|
SheetPointFactory |
getFactory()
Gets the factory.
|
org.apache.poi.ss.usermodel.Cell |
getOrCreateCell()
Obtains the HSSFCell object or creates a new cell if it is not found in the
HSSFSheet.
|
int |
getRow()
Access to the row.
|
ExcelRSSheet |
getSheet()
Access to the sheet for this SheetPoint.
|
java.lang.String |
getSheetName()
Access to the sheet name.
|
org.apache.poi.ss.usermodel.CellStyle |
getStyle()
Access to the style defined in the cell.
|
int |
hashCode() |
ExcelSheetPoint |
left()
Moves this SheetPoint to point to the cell that is on the left of this cell.
|
ExcelSheetPoint |
left(int n)
Moves this SheetPoint to the left n cells.
|
static ExcelSheetPoint |
make(java.lang.String sheetPointer,
org.apache.poi.ss.usermodel.Workbook wb) |
ExcelSheetPoint |
right()
Moves this SheetPoint to point to the cell that is on the right of this cell.
|
ExcelSheetPoint |
right(int n)
Moves this SheetPoint to the right n cells.
|
void |
setCol(short col)
Sets the column.
|
void |
setRow(int row)
Sets the row.
|
static java.lang.String |
shortToChars(short val)
Short to chars.
|
org.apache.poi.ss.util.CellRangeAddressList |
toCellRangeAddressList()
Convenient method to create a POI CellRangeAddressList representing this cell.
|
java.lang.String |
toString()
To string.
|
ExcelSheetPoint |
up()
Moves this SheetPoint to point to the cell that is above this cell.
|
ExcelSheetPoint |
up(int n)
Moves this SheetPoint up n cells.
|
public ExcelSheetPoint(java.lang.String sheetPointer, org.apache.poi.ss.usermodel.Workbook wb) throws InvalidSheetPointException
Creates a sheetPoint object from a sheetPointer string of the following form: sheetName!Xn or sheetName!name
sheetName is the name of the sheet. It MUST exist
X is the row name in letters. First row is A...
n is the column number. First column is 1
$ characters are ignored. Sheet1!$A$3 will be considered equivalent to Sheet1!A3
The alternative format is based on a cell name (Range name). Cell names must exist at the time this object is created.
wb is the HSSFWorkBook. if not indicated then the HSSFSheet of this object will be null and sheet name will be the empty string
sheetPointer
- Stringwb
- HSSFWorkbook where the sheetName exists.InvalidSheetPointException
- if the sheetPointer string is not properly writtenpublic ExcelSheetPoint(java.lang.String name, org.apache.poi.ss.usermodel.Sheet sh, int row, short col)
name
- String Sheet namesh
- HSSFSheet objectrow
- row number, first row is 0col
- col number, first col is 0public ExcelSheetPoint(java.lang.String sheetPointer) throws InvalidSheetPointException
This constructor does not resolve cell names and only works when the workbook or Sheet object is not required by the application.
Use with care
sheetPointer
- the sheet pointInvalidSheetPointException
- the invalid sheet point exceptionpublic ExcelSheetPoint(java.lang.String name, org.apache.poi.ss.usermodel.Sheet sh, java.lang.String rowCol) throws InvalidSheetPointException
name
- String Sheet namesh
- HSSFSheet objectrowCol
- row name and column name in A1 formatInvalidSheetPointException
- the invalid sheet point exceptionpublic static ExcelSheetPoint make(java.lang.String sheetPointer, org.apache.poi.ss.usermodel.Workbook wb) throws InvalidSheetPointException
InvalidSheetPointException
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
SheetPoint
equals
in interface SheetPoint
equals
in class java.lang.Object
obj
- the objpublic static java.lang.String shortToChars(short val)
val
- the valpublic ExcelSheetPoint clone()
SheetPoint
clone
in interface SheetPoint
clone
in class java.lang.Object
public java.lang.String toString()
SheetPoint
toString
in interface SheetPoint
toString
in class java.lang.Object
public java.lang.String getCellCoordinates()
SheetPoint
getCellCoordinates
in interface SheetPoint
public java.lang.String getSheetName()
getSheetName
in interface SheetPoint
public java.lang.String getContentAsString() throws SheetPointAccessException
getContentAsString
in interface SheetPoint
SheetPointAccessException
- if there is no cell in the sheetpublic boolean getContentAsBoolean() throws SheetPointAccessException
getContentAsBoolean
in interface SheetPoint
SheetPointAccessException
- if there is no cell in the sheetpublic java.util.Date getContentAsDate() throws SheetPointAccessException
If the cell type is unknown then an exception is raised
HSSFCell.BLANK cells returns new java.util.Date(0)
HSSFCell.ERROR cells returns new java.util.Date(0)
HSSFCell.BOOLEAN cells returns new java.util.Date(0)
HSSFCell.NUMERIC cells returns a date from the Excel cell
HSSFCell.STRING cells returns the parsed date of the Excel cell
HSSFCell.FORMULA cells returns a value depending on the formula result type, only NUMERIC or STRING are handled
getContentAsDate
in interface SheetPoint
SheetPointAccessException
- if there is no cell in the sheetpublic boolean getContentAsBoolean(boolean exceptionsIfBlank, boolean exceptionsIfError) throws SheetPointAccessException
exceptionsIfBlank
- if this parameter is true, the function will raise an exception if the cell is blank rather than return false which is the defaultexceptionsIfError
- if this parameter is true, the function will raise an exception if the cell is an error rather than return false which is the defaultSheetPointAccessException
- if there is no cell in the sheetpublic boolean getContentAsBoolean(boolean exceptionsIfBlank, boolean valueIfBlankAndException, boolean exceptionsIfError, boolean valueIfErrorAndException) throws SheetPointAccessException
exceptionsIfBlank
- if this parameter is true, the function will raise an exception if the cell is blank rather than return the value of the valueIfBlankAndException parametervalueIfBlankAndException
- this is the value returned in case the cell is blank and exceptions are not reportedexceptionsIfError
- if this parameter is true, the function will raise an exception if the cell is an error rather than return the value of the valueIfErrorAndException parametervalueIfErrorAndException
- this is the value returned in case the cell contains an error and exceptions are not reportedSheetPointAccessException
- there is a IllegalStateException or NumberFormatExceptionpublic java.lang.Double getContentAsDouble() throws SheetPointAccessException
getContentAsDouble
in interface SheetPoint
SheetPointAccessException
- if there is no cell in the sheetpublic org.apache.poi.ss.usermodel.RichTextString getContent() throws SheetPointAccessException
SheetPointAccessException
- if there is no cell in the sheetpublic org.apache.poi.ss.usermodel.CellStyle getStyle() throws SheetPointAccessException
SheetPointAccessException
- the sheet point access exceptionpublic ExcelRSCell getCell() throws SheetPointAccessException
getCell
in interface SheetPoint
SheetPointAccessException
- if the row or the column does not existspublic org.apache.poi.ss.usermodel.Cell getOrCreateCell() throws SheetPointAccessException
SheetPointAccessException
- if the row or the column is outside allowable range (0..1048575)public ExcelRSSheet getSheet()
getSheet
in interface SheetPoint
public int getRow()
getRow
in interface SheetPoint
public short getCol()
getCol
in interface SheetPoint
public java.lang.String getCellName()
getCellName
in interface SheetPoint
public void setRow(int row)
row
- int new valuepublic void setCol(short col)
col
- short new valuepublic ExcelSheetPoint up()
public ExcelSheetPoint up(int n)
up
in interface SheetPoint
n
- the npublic ExcelSheetPoint down()
public ExcelSheetPoint down(int n)
down
in interface SheetPoint
n
- the npublic ExcelSheetPoint left()
public ExcelSheetPoint left(int n)
left
in interface SheetPoint
n
- the npublic ExcelSheetPoint right()
public ExcelSheetPoint right(int n)
right
in interface SheetPoint
n
- the npublic SheetPointFactory getFactory()
SheetPoint
getFactory
in interface SheetPoint
public ExcelSheetPoint getContentAsSheetPoint(org.apache.poi.ss.usermodel.Workbook wb) throws InvalidSheetPointException, SheetPointAccessException
wb
- the workbook to create an ExcelSheetPoint toInvalidSheetPointException
SheetPointAccessException
public org.apache.poi.ss.util.CellRangeAddressList toCellRangeAddressList()
Copyright 2006-2015 Reporting Standard S.L., C/ Torrecilla del Puerto 1, 28043, Madrid, Espaņa