|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbiz.c24.io.api.presentation.stream.SpreadSheet
biz.c24.io.api.presentation.stream.SpreadSheetReader
public class SpreadSheetReader
SpreadSheet broker implementation for reading.
Represents the functional part for binding the SpreadSheet to the tree object. (Provides the inverse functionality forSpreadSheet writer broker
.) Additionally to the
generic SpreadSheet broker
it provides the variety methods for
reading the values with respect of their type definitions:
reading the textual data
,reading the numeric data
,reading the date data
,reading the boolean data
.textual data
. In this case string will be always prepend by equal sign ("="). Otherwise
the SpreadSheet cell with formula will be evaluated before and client may request its result. In case if result of
SpreadSheet formula may represent the string value, the formula string will return only. See also
SpreadSheet Formula support disclaimer.
Note. This implementation do not provide the way to get the formula value if its result has textual data type.
The sheet resolution procedure
DO NOT creates the sheet "on the fly" if it is not
exists. If requested sheet is absent the corresponding exception will be thrown. For details see the
method description
.
SpreadSheet
,
SpreadSheetWriter
Nested Class Summary |
---|
Nested classes/interfaces inherited from class biz.c24.io.api.presentation.stream.SpreadSheet |
---|
SpreadSheet.Locator |
Field Summary | |
---|---|
protected org.apache.poi.ss.usermodel.FormulaEvaluator |
evaluator
SpreadSheet formula evaluator. |
Fields inherited from class biz.c24.io.api.presentation.stream.SpreadSheet |
---|
ditches, location, workbook |
Constructor Summary | |
---|---|
|
SpreadSheetReader(InputStream stream)
Constructor with input stream. |
protected |
SpreadSheetReader(org.apache.poi.ss.usermodel.Workbook workbook)
Constructor with 3rd party workbook instance. |
Method Summary | |
---|---|
boolean |
getBooleanValue()
Returns the boolean value of current cell. |
protected org.apache.poi.ss.usermodel.Cell |
getCellAt(SpreadSheet.Locator position)
Returns the evaluated cell at specified position. |
protected org.apache.poi.ss.usermodel.Cell |
getCellAt(SpreadSheet.Locator position,
boolean evaluate)
Returns the (optionally) evaluated cell at specified position. |
protected org.apache.poi.ss.usermodel.CellValue |
getCellValueAt(SpreadSheet.Locator position)
Returns the cell value at specified position. |
Date |
getDateValue()
Returns the date value of current cell. |
double |
getNumericValue()
Returns the numeric value of current cell. |
String |
getStringValue()
Reads the textual data from current cell. |
protected int |
resolveSheet(String name)
Returns the sheet index in workbook used. |
Methods inherited from class biz.c24.io.api.presentation.stream.SpreadSheet |
---|
calculateNext, getDitch, getLocation, getSheetName, mark, next, occupy, parse, rollback, setStartLocation, withdraw |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final org.apache.poi.ss.usermodel.FormulaEvaluator evaluator
Constructor Detail |
---|
public SpreadSheetReader(InputStream stream) throws Exception
input stream
. The data will
be analysed and proper Workbook implementation will be instantiated. The format of incoming data should be listed
in supported format list.
stream
- The incoming data stream.
IllegalArgumentException
- If format could not be defined.
IOException
- If I/O error occurred or data in BIFF format is failed to read.
org.apache.poi.POIXMLException
- If data in OOXML format is failed to read.
Exception
protected SpreadSheetReader(org.apache.poi.ss.usermodel.Workbook workbook)
workbook
.
Also SpreadSheet formula evaluator is instantiated to provide the ability to evaluate the SpreadSheet formula.
workbook
- The workbook
implementation that will be used.Method Detail |
---|
public String getStringValue()
IllegalStateException
- If requested data type is not fit the current cell.public double getNumericValue()
IllegalStateException
- If requested data type is not fit the current cell.public Date getDateValue()
IllegalStateException
- If requested data type is not fit the current cell.public boolean getBooleanValue()
IllegalStateException
- If requested data type is not fit the current cell.protected org.apache.poi.ss.usermodel.Cell getCellAt(SpreadSheet.Locator position)
another
cell getter
.
position
- The position at which the requested cell is.
getCellAt(biz.c24.io.api.presentation.stream.SpreadSheet.Locator, boolean)
protected org.apache.poi.ss.usermodel.Cell getCellAt(SpreadSheet.Locator position, boolean evaluate)
position
. If flag evaluate
was set, the cell is
evaluated before given away. In case if there is no cell at specified position (i.e. there is no such sheet, row
or column), the special Null cell
is
returned.
position
- The position at which the requested cell is.evaluate
- On true forces to evaluate cell (assumed with formula) before return.
protected org.apache.poi.ss.usermodel.CellValue getCellValueAt(SpreadSheet.Locator position)
position
defines the cell
address. If specified address point to nowhere (no sheet, no row or column), the numeric zero ("0.0") value is
returned.
position
- The position at which the requested cell is.
protected int resolveSheet(String name)
name
is null
the current existing
sheet index is returned. If workbook has no requested sheet or there is no any current (if null
is
specified as name
), the negative value (-1
) is returned.
resolveSheet
in class SpreadSheet
name
- The requested sheet name, may be null
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |