|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.odftoolkit.odfdom.doc.table.OdfTableCell
org.odftoolkit.simple.table.Cell
in Simple API.
public class OdfTableCell
OdfTableCell represents table cell feature in ODF document.
OdfTable provides methods to get/set/modify the cell content and cell properties.
Method Summary | |
---|---|
Boolean |
getBooleanValue()
Deprecated. Get the cell boolean value as Boolean object. |
Color |
getCellBackgroundColor()
Deprecated. Get the background color of this cell. |
String |
getCellBackgroundColorString()
Deprecated. Get the background color string of this cell. |
protected OdfStyle |
getCellStyleElement()
Deprecated. |
protected OdfStyle |
getCellStyleElementForWrite()
Deprecated. |
int |
getColumnIndex()
Deprecated. Get the index of the table column which contains this cell. |
String |
getCurrencyCode()
Deprecated. Return the currency code of this cell, for example, "USD", "EUR", "CNY", and etc. |
String |
getCurrencySymbol()
Deprecated. Get the symbol of currency. |
Double |
getCurrencyValue()
Deprecated. Get the currency value of this cell as Double object. |
Calendar |
getDateValue()
Deprecated. Get the cell date value as Calendar. |
String |
getDisplayText()
Deprecated. Get the text displayed in this cell. |
Double |
getDoubleValue()
Deprecated. Get the double value of this cell as Double object. |
String |
getFormatString()
Deprecated. Get the format string of the cell. |
String |
getFormula()
Deprecated. Get the formula string of the cell. |
String |
getHorizontalAlignment()
Deprecated. Return the horizontal alignment setting of this cell. |
static OdfTableCell |
getInstance(TableTableCellElementBase cellElement)
Deprecated. Get the OdfTableCell instance from the TableTableCellElementBase instance. |
TableTableCellElementBase |
getOdfElement()
Deprecated. Get the instance of TableTableCellElementBase which represents this cell. |
OdfTableCell |
getOwnerTableCell()
Deprecated. Get the cell that covers this cell. |
Double |
getPercentageValue()
Deprecated. Get the cell percentage value as Double object. |
int |
getRowIndex()
Deprecated. Get the index of the table row which contains this cell. |
String |
getStringValue()
Deprecated. Get the cell value as a string. |
String |
getStyleName()
Deprecated. Get the style name of this cell. |
OdfTable |
getTable()
Deprecated. Get an instance of table feature which contains this cell. |
OdfTableColumn |
getTableColumn()
Deprecated. Get the instance of table column feature which contains this cell. |
OdfTableRow |
getTableRow()
Deprecated. Get the instance of table row feature which contains this cell. |
Calendar |
getTimeValue()
Deprecated. Get the cell value as java.util.Calendar . |
String |
getValueType()
Deprecated. Get the value type of this cell. |
String |
getVerticalAlignment()
Deprecated. Return the vertical alignment setting of this cell. |
boolean |
isTextWrapped()
Deprecated. Return the wrap option of this cell. |
void |
removeContent()
Deprecated. Remove all the content of the cell. |
void |
removeTextContent()
Deprecated. Remove all the text content of cell. |
void |
setBooleanValue(Boolean value)
Deprecated. Set the cell value as a boolean and set the value type to be boolean. |
void |
setCellBackgroundColor(Color cellBackgroundColor)
Deprecated. Set the background color of this cell. |
void |
setCellBackgroundColor(String cellBackgroundColor)
Deprecated. Set the background color of this cell using string. |
void |
setCurrencyCode(String currency)
Deprecated. Set the currency code of this cell, for example, "USD", "EUR", "CNY", and etc. |
void |
setCurrencyFormat(String currencySymbol,
String format)
Deprecated. Set the currency symbol and overall format of a currency cell. |
void |
setCurrencyValue(Double value,
String currency)
Deprecated. Set the value and currency of the cell, and set the value type as "currency". |
void |
setDateValue(Calendar date)
Deprecated. Set the cell value as a date, and set the value type to be "date". |
void |
setDisplayText(String content)
Deprecated. Set the text displayed in this cell. |
void |
setDisplayText(String content,
String stylename)
Deprecated. Set the text displayed in this cell, with a specified style name. |
void |
setDoubleValue(Double value)
Deprecated. Set the cell value as a double and set the value type to be "float". |
void |
setFormatString(String formatStr)
Deprecated. Set the format string of the cell. |
void |
setFormula(String formula)
Deprecated. Set a formula to the cell. |
void |
setHorizontalAlignment(String horizontalAlignment)
Deprecated. Set the horizontal alignment setting of this cell. |
void |
setPercentageValue(Double value)
Deprecated. Set the cell value as a percentage value and set the value type as percentage too. |
void |
setStringValue(String str)
Deprecated. Set the cell value as a string, and set the value type to be string. |
void |
setTextWrapped(boolean isTextWrapped)
Deprecated. Set the wrap option of this cell. |
void |
setTimeValue(Calendar time)
Deprecated. Set the cell value as a time and set the value type to be "time" too. |
void |
setValueType(String type)
Deprecated. Set the value type of this cell. |
void |
setVerticalAlignment(String verticalAlignment)
Deprecated. Set the vertical alignment setting of this cell. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static OdfTableCell getInstance(TableTableCellElementBase cellElement)
OdfTableCell
instance from the TableTableCellElementBase
instance.
Each TableTableCellElementBase
instance has a one-to-one relationship to the a OdfTableCell
instance.
cellElement
- the cell element that need to get the corresponding OdfTableCell
instance
OdfTableCell
instance that represents a specified cell elementpublic String getHorizontalAlignment()
The returned value can be "center", "end", "justify", "left", "right", or "start". If no horizontal alignment is set, null will be returned.
public void setHorizontalAlignment(String horizontalAlignment)
The parameter can be "center", "end", "justify", "left", "right", or "start". Actually, "left" will be interpreted as "start", while "right" will be interpreted as "end". If argument is null, the explicit horizontal alignment setting is removed.
horizontalAlignment
- the horizontal alignment setting.public String getVerticalAlignment()
The returned value can be "auto", "automatic", "baseline", "bottom", "middle", or "top".
public void setVerticalAlignment(String verticalAlignment)
The parameter can be "auto", "automatic", "baseline", "bottom", "middle", or "top". If argument is null, the explicit vertical alignment setting is removed.
verticalAlignment
- the vertical alignment setting.public boolean isTextWrapped()
false if the cell content cannot be wrapped.
public void setTextWrapped(boolean isTextWrapped)
isTextWrapped
- whether the cell content can be wrapped or notpublic int getRowIndex()
public OdfTable getTable()
public int getColumnIndex()
public OdfTableColumn getTableColumn()
public OdfTableRow getTableRow()
public OdfTableCell getOwnerTableCell()
If the cell is a covered cell, the owner cell will be returned; if the cell is a real cell , the cell itself will be returned.
public TableTableCellElementBase getOdfElement()
TableTableCellElementBase
which represents this cell.
TableTableCellElementBase
public String getCurrencyCode()
If the value type is not "currency", an IllegalArgumentException will be thrown.
IllegalArgumentException
- an IllegalArgumentException will be thrown if the value type is not "currency".public void setCurrencyCode(String currency)
currency
- the currency code that need to be set.
IllegalArgumentException
- If input currency
is null, an IllegalArgumentException will be thrown.public void setValueType(String type)
If the parameter type
is not a valid cell type, an IllegalArgumentException will be thrown.
type
- the type that need to be set
If input type is null, an IllegalArgumentException will be thrown.public String getValueType()
public Double getDoubleValue()
Throw IllegalArgumentException if the cell type is not "float".
An IllegalArgumentException will be thrown if the cell type is not "float".
public Double getCurrencyValue()
Throw IllegalArgumentException if the cell type is not "currency".
IllegalArgumentException
- an IllegalArgumentException will be thrown if the cell type is not "currency".public String getCurrencySymbol()
IllegalArgumentException
- an IllegalArgumentException will be thrown if the value type is not "currency".public void setCurrencyValue(Double value, String currency)
value is null, the cell value will be removed.
- Parameters:
value
- the value that will be setcurrency
- the currency that will be set.
- Throws:
IllegalArgumentException
- If input currency is null, an IllegalArgumentException will be thrown.
public Double getPercentageValue()
Throw IllegalArgumentException if the cell type is not "percentage".
IllegalArgumentException
- an IllegalArgumentException will be thrown if the cell type is not "percentage".public void setPercentageValue(Double value)
value is null, the cell value will be removed.
- Parameters:
value
- the value that will be set
public String getDisplayText()
public void setDisplayText(String content)
Please note the displayed text in ODF viewer might be different with the value set by this method, because the displayed text in ODF viewer is calculated and set by editor.
content
- the displayed text.
If content is null, it will display the empty string instead.public void setDisplayText(String content, String stylename)
Please note the displayed text in ODF viewer might be different with the value set by this method, because the displayed text in ODF viewer are calculated and set by editor.
content
- the displayed text. If content is null, it will display the empty string instead.stylename
- the style name. If stylename is null, the content will use the default paragraph style.public void setDoubleValue(Double value)
value
- the double value that will be set. Ifvalue is null, the cell value will be removed.
public Boolean getBooleanValue()
Throw IllegalArgumentException if the cell type is not "boolean".
IllegalArgumentException
- an IllegalArgumentException will be thrown if the cell type is not "boolean".public void setBooleanValue(Boolean value)
value is null, the cell value will be removed.
- Parameters:
value
- the value of boolean type
public Calendar getDateValue()
Throw IllegalArgumentException if the cell type is not "date".
IllegalArgumentException
- an IllegalArgumentException will be thrown, if the cell type is not "date".public void setDateValue(Calendar date)
date
- the value of java.util.Calendar
type.public void setStringValue(String str)
str
- the value of string type.
If input string is null, an empty string will be set.public String getStringValue()
If the cell type is not string, the display text will be returned.
public Calendar getTimeValue()
java.util.Calendar
.
Throw exception if the cell type is not "time".
IllegalArgumentException
- an IllegalArgumentException will be thrown if the cell type is not time.public void setTimeValue(Calendar time)
time
- the value of java.util.Calendar
type.
IllegalArgumentException
- If input time is null, an IllegalArgumentException exception will be thrown.public Color getCellBackgroundColor()
If no background color is set, default background color "#FFFFFF" will be returned.
public String getCellBackgroundColorString()
If no background color is set, default background color "#FFFFFF" will be returned.
public void setCellBackgroundColor(Color cellBackgroundColor)
cellBackgroundColor
- the background color that need to set.
If cellBackgroundColor
is null, default background color Color.WHITE
will be set.public void setCellBackgroundColor(String cellBackgroundColor)
org.odftoolkit.odfdom.type.Color
.
cellBackgroundColor
- the background color that need to set.
If cellBackgroundColor is null, default background color #FFFFFF will be set.Color
public String getStyleName()
public void setFormula(String formula)
Please note, the parameter formula
will not be checked and interpreted;
the cell value will not be calculated.
It's just simply set as a formula attribute. See table:formula
formula
- the formula that need to be set.
IllegalArgumentException
- if formula is null, an IllegalArgumentException will be thrown.public String getFormula()
If the cell does not contain a formula, null will be returned.
public void setCurrencyFormat(String currencySymbol, String format)
Please note the overall format includes the symbol character, for example: $#,##0.00.
This function only works for currency.
currencySymbol
- the currency symbolformat
- overall format
IllegalArgumentException
- if input currencySymbol or format is null, an IllegalArgumentException will be thrown.public void setFormatString(String formatStr)
This function only works for float, date, time and percentage, otherwise an
IllegalArgumentException
will be thrown.
For value type float and percentage, the formatStr
must follow the encoding
rule of
.
For value type date and time, the java.text.DecimalFormat
formatStr
must follow the encoding
rule of
.
java.text.SimpleDateFormat
Refer to
to set the format of currency.
setCurrencyFormat
If the cell value type is not set, the method will try to give it a value type, according to common ordination. The adapt order is: percentage-> time-> date-> float.
The adapt result may be inaccurate, so you'd better set value type before call this method. If adaptive failed, an
ValueType Distinguish Symbol Distinguish Priority percentage % 1 time H, k, m, s, S 2 date y, M, w, W, D, d, F, E, K, h 3 float #, 0 4
UnsupportedOperationException
will be thrown.
formatStr
- the cell need be formatted as this specified format string.
IllegalArgumentException
- if formatStr
is null or the cell value type is supported.
UnsupportedOperationException
- if the adaptive failed, when cell value type is not set.SimpleDateFormat
,
DecimalFormat
protected OdfStyle getCellStyleElement()
protected OdfStyle getCellStyleElementForWrite()
public String getFormatString()
public void removeTextContent()
public void removeContent()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |