|
xelem.3.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Cell
Represents the Cell element. The XLElement Cell is not aware of it's parent,
nor of it's index-position in a row or worksheet. This makes it possible
to use the same instances of Cells on different worksheets, or different
places in the worksheet. Only at the time of
assembly the cell-index and the attribute ss:Index are automatically set,
if necessary. See also: Row.cellIterator()
.
(Also a Cell that is read by the nl.fountain.xelem.lex-API has it's index set.)
Null values
If the passed parameter has a value of null
the resulting
xml will have a datatype set to "Error",
the formula of the cell will be set to "=#N/A
" and the cell will
display "#N/A
" when the spreadsheet is opened.
Infinite values
If the passed parameter is of type Double, Float or the primitive representation
of these objects and the method isInfinite
results to true
the xml will have a datatype set to
"String" and the cell will display "Infinite" when the spreadsheet is opened.
NaN values
If the passed parameter is of type Double, Float or the primitive representation
of these objects and the method isNaN
results to true
the resulting xml will have a datatype set to
"String" and the cell will display "NaN" when the spreadsheet is opened.
Field Summary | |
---|---|
static String |
DATATYPE_BOOLEAN
The Excel datatype for boolean values: "Boolean". |
static String |
DATATYPE_DATE_TIME
The Excel datatype for date and time values: "DateTime". |
static String |
DATATYPE_ERROR
The Excel datatype for error values: "Error". |
static String |
DATATYPE_NUMBER
The Excel datatype for number values: "Number". |
static String |
DATATYPE_STRING
The Excel datatype for string values: "String". |
static String |
ERRORVALUE_DIV_BY_0
The Excel error value indicating division by zero: "#DIV/0". |
static String |
ERRORVALUE_NA
The Excel error value indicating a value is not available: "#N/A". |
static String |
ERRORVALUE_NAME
The Excel error value indicating text in a formula is not being recognized: "#NAME?". |
static String |
ERRORVALUE_NULL
The Excel error value indicating intersection of two cell ranges is empty "#NULL!". |
static String |
ERRORVALUE_NUM
The Excel error value indicating problems with a number in a formula or function: "#NUM!". |
static String |
ERRORVALUE_REF
The Excel error value indicating that a cell reference is not valid: "#REF!". |
static String |
ERRORVALUE_VALUE
The Excel error value indicating the wrong type of argument or operand is being used: "#VALUE!". |
Fields inherited from interface nl.fountain.xelem.excel.XLElement |
---|
PREFIX_HTML, PREFIX_O, PREFIX_SS, PREFIX_X, XMLNS, XMLNS_HTML, XMLNS_O, XMLNS_SS, XMLNS_X |
Method Summary | |
---|---|
Comment |
addComment()
Adds a comment to this cell. |
Comment |
addComment(Comment comment)
Adds the given comment to this cell. |
Comment |
addComment(String text)
Adds a comment to this cell and sets the data-attribute of the comment to the given text. |
boolean |
booleanValue()
Convenience method for reading the value of the data element of this cell as a boolean . |
double |
doubleValue()
Convenience method for reading the value of the data element of this cell as a double . |
Comment |
getComment()
Gets the comment of this cell. |
Object |
getData()
Gets the value of the data element of this cell as an object. |
String |
getData$()
Gets the NodeValue of the Data-tag as a String. |
Element |
getDataElement(Document doc)
Gets the Data-element of this cell as an org.w3c.dom.Element . |
String |
getFormula()
Gets the formula that was set on this cell. |
String |
getHRef()
Gets the ss:HRef-attribute value that was set on this cell. |
int |
getIndex()
Gets the value of the ss:Index-attribute of this Cell-element. |
int |
getMergeAcross()
Gets the number of cells over which this cell has been merged horizontally. |
int |
getMergeDown()
Gets the number of cells over which this cell has been merged vertically. |
String |
getStyleID()
Gets the ss:StyleID which was set on this cell. |
String |
getXLDataType()
Gets the value of the ss:Type-attribute of the Data-element. |
boolean |
hasComment()
Specifies whether this cell has a comment. |
boolean |
hasData()
Specifies whether this cell has data. |
boolean |
hasError()
Specifies whether this cell has an error. |
int |
intValue()
Convenience method for reading the value of the data element of this cell as an int . |
void |
setData(boolean data)
Sets the given boolean as the data of this cell. |
void |
setData(Boolean data)
Sets the given Boolean as the data of this cell. |
void |
setData(byte data)
Sets the given byte as the data of this cell. |
void |
setData(char data)
Sets the data of this cell to the value String.valueOf(char) . |
void |
setData(Date data)
Sets the given Date as the data of this cell. |
void |
setData(double data)
Sets the given double as the data of this cell. |
void |
setData(Double data)
Sets the given Double as the data of this cell. |
void |
setData(float data)
Sets the given float as the data of this cell. |
void |
setData(Float data)
Sets the given Float as the data of this cell. |
void |
setData(int data)
Sets the given int as the data of this cell. |
void |
setData(Integer data)
Sets the given Integer as the data of this cell. |
void |
setData(long data)
Sets the given long as the data of this cell. |
void |
setData(Long data)
Sets the given Long as the data of this cell. |
void |
setData(Number data)
Sets the given Number as the data of this cell. |
void |
setData(Object data)
Sets the given object as the data of this cell. |
void |
setData(short data)
Sets the given short as the data of this cell. |
void |
setData(String data)
Sets the given String as the data of this cell. |
void |
setError(String error_value)
Sets the given error value as the data of this cell. |
void |
setFormula(String formula)
Sets the ss:Formula-attribute on this cell. |
void |
setHRef(String href)
Sets the ss:HRef-attribute on this cell. |
void |
setIndex(int index)
Sets the value of the ss:Index-attribute of this Cell-element. |
void |
setMergeAcross(int m)
Merges this cell with adjacent cells on the same row. |
void |
setMergeDown(int m)
Merges this cell with adjacent cells on the same column. |
void |
setStyleID(String styleID)
Sets the ss:StyleID on this cell. |
Methods inherited from interface nl.fountain.xelem.excel.XLElement |
---|
addElementComment, assemble, getElementComments, getNameSpace, getPrefix, getTagName, setAttributes, setChildElement |
Field Detail |
---|
static final String DATATYPE_NUMBER
static final String DATATYPE_DATE_TIME
static final String DATATYPE_BOOLEAN
static final String DATATYPE_STRING
static final String DATATYPE_ERROR
static final String ERRORVALUE_DIV_BY_0
static final String ERRORVALUE_NAME
static final String ERRORVALUE_NULL
static final String ERRORVALUE_NUM
static final String ERRORVALUE_NA
static final String ERRORVALUE_REF
static final String ERRORVALUE_VALUE
Method Detail |
---|
void setStyleID(String styleID)
styleID
- the id of the style to employ on this cell.String getStyleID()
null
if no styleID was previously set.void setFormula(String formula)
cell.setData(3); cell.setFormula("=1+1");will display
2
in the opened spreadsheet.
formula
- The formula for this cell.String getFormula()
null
if the cell has no formula.void setHRef(String href)
href
- the ss:HRef-attribute on this cell.String getHRef()
null
if this cell has no HRef.Comment addComment()
Comment addComment(Comment comment)
comment
- the comment to be added to this cell
Comment addComment(String text)
text
- the string to be displayed in the newly added comment
boolean hasComment()
true
if this cell has a comment, false otherwise.Comment getComment()
null
.void setMergeAcross(int m)
The value of
m
must be greater than 0 in order to have effect on
the resulting xml. No logic is included to prevent the merging of
cells that goes beyond the width of the spreadsheet. If such is the case,
the resulting xml spreadsheet will not open.
No other cells must be added within the scope of the merged cell:
Cell c1 = sheet.addCellAt(1, 3); // adds a cell at row 1, column 3 c1.setMergeAcross(5); // merges c1 across columns 3 - 8 // illegal: first free index = 3 + 5 + 1 = 9 // Cell c2 = sheet.addCellAt(1, 7);
m
- The number of cells to include in the merge.int getMergeAcross()
0
indicates no horizontal merge
was applied on this cell.
void setMergeDown(int m)
The value of
m
must be greater than 0 in order to have effect on
the resulting xml.
No other rows or cells must be added within the scope of the merged cell:
Cell c1 = sheet.addCellAt(1, 3); // adds a cell at row 1, column 3 c1.setMergeDown(5); // merges c1 across rows 1 - 6 // illegal: first free index = 1 + 5 + 1 = 7 // Cell c2 = sheet.addCellAt(5, 3);
m
- The number of cells to include in the merge.int getMergeDown()
0
indicates no vertical merge
was applied on this cell.
void setData(Number data)
data
- The data to be displayed in this cell.void setData(Integer data)
data
- The data to be displayed in this cell.void setData(Double data)
data
- The data to be displayed in this cell.void setData(Long data)
data
- The data to be displayed in this cell.void setData(Float data)
data
- The data to be displayed in this cell.void setData(Date data)
data
- The data to be displayed in this cell.void setData(Boolean data)
data
- The data to be displayed in this cell.void setData(String data)
data
- The data to be displayed in this cell.void setData(Object data)
toString
-value of the given object and the datatype to
"String".
data
- The data to be displayed in this cell.void setError(String error_value)
error_value
- Must be one of Cell's ERRORVALUE_XXX values.void setData(byte data)
data
- The data to be displayed in this cell.void setData(short data)
data
- The data to be displayed in this cell.void setData(int data)
data
- The data to be displayed in this cell.void setData(long data)
data
- The data to be displayed in this cell.void setData(float data)
data
- The data to be displayed in this cell.void setData(double data)
data
- The data to be displayed in this cell.void setData(char data)
String.valueOf(char)
. The attribute
ss:Type of the Data-element will be set to "String".
data
- The data to be displayed in this cell.void setData(boolean data)
data
- The data to be displayed in this cell.String getData$()
String getXLDataType()
boolean hasData()
true
if this cell has a data element,
false
otherwiseboolean hasError()
true
if the 'Type' attribute of this cells
data element equals DATATYPE_ERROR, false
otherwiseObject getData()
xlDataType | returned type |
---|---|
Number | Double |
DateTime | Date |
Boolean | Boolean |
String | String |
Error | String |
(not specified) | String |
int intValue()
int
. Returns 0
if the value could not be converted.
double doubleValue()
double
. Returns 0.0
if the value could not be converted.
boolean booleanValue()
boolean
. Returns false
if the value is not equal to "1".
Element getDataElement(Document doc)
org.w3c.dom.Element
.
doc
- the document to which the returned element may be appended
void setIndex(int index)
Row.cellIterator()
, which sets the
index of cells during assembly.
If you want to place a cell in any particular place, use the addCellAt-methods of Row, Table or Worksheet, or use Worksheets CellPointer.
index
- the index of this cellint getIndex()
|
xelem.3.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |