org.odftoolkit.simple.table
Class Cell

java.lang.Object
  extended by org.odftoolkit.simple.Component
      extended by org.odftoolkit.simple.table.Cell
All Implemented Interfaces:
FrameContainer, ListContainer, ParagraphContainer

public class Cell
extends Component
implements ListContainer, ParagraphContainer, FrameContainer

Cell represents table cell feature in ODF document.

Table provides methods to get/set/modify the cell content and cell properties.


Method Summary
 List addList()
          Add a new List to this container.
 List addList(ListDecorator decorator)
          Add a List with specified ListDecorator to this container.
 Paragraph addParagraph(String text)
          Creates a new paragraph and append text
 void clearList()
          Remove all Lists from this container.
 Boolean getBooleanValue()
          Get the cell boolean value as Boolean object.
 Border getBorder(StyleTypeDefinitions.CellBordersType type)
          Return the border setting for a specific border.
 BufferedImage getBufferedImage()
          Deprecated.  
 Color getCellBackgroundColor()
          Get the background color of this cell.
 String getCellBackgroundColorString()
          Deprecated. As of Simple version 0.3, replaced by getCellBackgroundColor()
 String getCellStyleName()
          Get the cell style name.
 int getColumnIndex()
          Get the index of the table column which contains this cell.
 int getColumnSpannedNumber()
          Get the column spanned number of this cell.
 String getCurrencyCode()
          Return the currency code of this cell, for example, "USD", "EUR", "CNY", and etc.
 String getCurrencySymbol()
          Get the symbol of currency.
 Double getCurrencyValue()
          Get the currency value of this cell as Double object.
 Calendar getDateValue()
          Get the cell date value as Calendar.
 String getDisplayText()
          Get the text displayed in this cell.
 Double getDoubleValue()
          Get the double value of this cell as Double object.
 Font getFont()
          Return the font definition for this cell.
 String getFormatString()
          Get the format string of the cell.
 String getFormula()
          Get the formula string of the cell.
 OdfElement getFrameContainerElement()
          Get the ODF element which can have as child element directly according to ODF specification.
 String getHorizontalAlignment()
          Deprecated. As of Simple version 0.3, replaced by getHorizontalAlignmentType()
 StyleTypeDefinitions.HorizontalAlignmentType getHorizontalAlignmentType()
          Return the horizontal alignment setting of this cell.
 Image getImage()
          Get the image from the specified cell.
static Cell getInstance(TableTableCellElementBase cellElement)
          Get the Cell instance from the TableTableCellElementBase instance.
 OdfElement getListContainerElement()
          Get the ODF element which can have as child element directly according to ODF specification.
 Iterator<List> getListIterator()
          Return an Iterator of the Lists in this ListContainer.
 String getNoteText()
          Get the note text of this table cell.
 TableTableCellElementBase getOdfElement()
          Get the instance of TableTableCellElementBase which represents this cell.
 Cell getOwnerTableCell()
          Get the cell that covers this cell.
 Paragraph getParagraphByIndex(int index, boolean isEmptyParagraphSkipped)
          Return a paragraph with a given index.
 Paragraph getParagraphByReverseIndex(int reverseIndex, boolean isEmptyParagraphSkipped)
          Return a paragraph with a given index.
 OdfElement getParagraphContainerElement()
          Get the ODF element which can have as child element directly.
 Iterator<Paragraph> getParagraphIterator()
          Return an Iterator of the paragraph in this container.
 Double getPercentageValue()
          Get the cell percentage value as Double object.
 int getRowIndex()
          Get the index of the table row which contains this cell.
 int getRowSpannedNumber()
          Get the row spanned number of this cell.
 String getStringValue()
          Get the cell value as a string.
 CellStyleHandler getStyleHandler()
          Return style handler for this cell
 String getStyleName()
          Get the style name of this cell.
 Table getTable()
          Get an instance of table feature which contains this cell.
 Column getTableColumn()
          Get the instance of table column feature which contains this cell.
 Row getTableRow()
          Get the instance of table row feature which contains this cell.
 Calendar getTimeValue()
          Get the cell value as java.util.Calendar.
 String getValueType()
          Get the value type of this cell.
 String getVerticalAlignment()
          Deprecated. As of Simple version 0.3, replaced by getVerticalAlignmentType()
 StyleTypeDefinitions.VerticalAlignmentType getVerticalAlignmentType()
          Return the vertical alignment setting of this cell.
 boolean isTextWrapped()
          Return the wrap option of this cell.
 void removeContent()
          Remove all the content of the cell.
 boolean removeList(List list)
          Remove the existing List from this container.
 boolean removeParagraph(Paragraph para)
          Remove paragraph from this document
 void removeTextContent()
          Remove all the text content of cell.
 void setBooleanValue(Boolean value)
          Set the cell value as a boolean and set the value type to be boolean.
 void setBorders(StyleTypeDefinitions.CellBordersType bordersType, Border border)
          Set the border style definitions for this cell.
 void setCellBackgroundColor(Color cellBackgroundColor)
          Set the background color of this cell.
 void setCellBackgroundColor(String cellBackgroundColor)
          Deprecated. As of Simple version 0.3, replaced by setCellBackgroundColor(Color)
 void setCellStyleName(String styleName)
          Set the cell style name.
 void setCurrencyCode(String currency)
          Set the currency code of this cell, for example, "USD", "EUR", "CNY", and etc.
 void setCurrencyFormat(String currencySymbol, String format)
          Set the currency symbol and overall format of a currency cell.
 void setCurrencyValue(Double value, String currency)
          Set the value and currency of the cell, and set the value type as "currency".
 void setDateValue(Calendar date)
          Set the cell value as a date, and set the value type to be "date".
 void setDisplayText(String content)
          Set the text displayed in this cell.
 void setDisplayText(String content, CellValueAdapter adapter)
          Set the text displayed in this cell.
 void setDisplayText(String content, CellValueAdapter adapter, String stylename)
          Set the text displayed in this cell, with a specified style name.
 void setDisplayText(String content, String stylename)
          Set the text displayed in this cell, with a specified style name.
 void setDoubleValue(Double value)
          Set the cell value as a double and set the value type to be "float".
 void setFont(Font font)
          Set font style for this cell.
 void setFormatString(String formatStr)
          Set the format string of the cell.
 void setFormula(String formula)
          Set a formula to the cell.
 void setHorizontalAlignment(String horizontalAlignment)
          Deprecated. As of Simple version 0.3, replaced by setHorizontalAlignment(SimpleHorizontalAlignmentType)
 void setHorizontalAlignment(StyleTypeDefinitions.HorizontalAlignmentType alignType)
          Set the horizontal alignment setting of this cell.
 Image setImage(URI imageUri)
          Insert an Image from the specified uri to cell.
 void setInputHelpMessage(String title, String text)
          Sets the title and the text of the tip, which will then be displayed if the cell is selected.
 void setNoteText(String note)
          Set note text for this table cell.
 void setPercentageValue(Double value)
          Set the cell value as a percentage value and set the value type as percentage too.
 void setStringValue(String str)
          Set the cell value as a string, and set the value type to be string.
 void setTextWrapped(boolean isTextWrapped)
          Set the wrap option of this cell.
 void setTimeValue(Calendar time)
          Set the cell value as a time and set the value type to be "time" too.
 void setValidityList(List<String> values)
          Specifies the allowed values of this cell in a list.
 void setValueType(String type)
          Set the value type of this cell.
 void setVerticalAlignment(String verticalAlignment)
          Deprecated. As of Simple version 0.3, replaced by setVerticalAlignment(SimpleVerticalAlignmentType)
 void setVerticalAlignment(StyleTypeDefinitions.VerticalAlignmentType verticalAlignment)
          Set the vertical alignment setting of this cell.
 
Methods inherited from class org.odftoolkit.simple.Component
getComponentByElement, getOwnerDocument, registerComponent, unregisterComponent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static Cell getInstance(TableTableCellElementBase cellElement)
Get the Cell instance from the TableTableCellElementBase instance.

Each TableTableCellElementBase instance has a one-to-one relationship to the a Cell instance.

Parameters:
cellElement - the cell element that need to get the corresponding Cell instance
Returns:
the Cell instance that represents a specified cell element

getHorizontalAlignment

@Deprecated
public String getHorizontalAlignment()
Deprecated. As of Simple version 0.3, replaced by getHorizontalAlignmentType()

Return the horizontal alignment setting of this cell.

The returned value can be "center", "end", "justify", "left", "right", or "start". If no horizontal alignment is set, null will be returned.

Returns:
the horizontal alignment setting.
See Also:
getHorizontalAlignmentType()

getHorizontalAlignmentType

public StyleTypeDefinitions.HorizontalAlignmentType getHorizontalAlignmentType()
Return the horizontal alignment setting of this cell.

Null will returned if there is no explicit style definition for this cell.

Default value will be returned if explicit style definition is found but no horizontal alignment is set.

Returns:
the horizontal alignment setting.

setHorizontalAlignment

@Deprecated
public void setHorizontalAlignment(String horizontalAlignment)
Deprecated. As of Simple version 0.3, replaced by setHorizontalAlignment(SimpleHorizontalAlignmentType)

Set the horizontal alignment setting of this cell.

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.

Parameters:
horizontalAlignment - the horizontal alignment setting.
See Also:
setHorizontalAlignment(StyleTypeDefinitions.HorizontalAlignmentType)

setHorizontalAlignment

public void setHorizontalAlignment(StyleTypeDefinitions.HorizontalAlignmentType alignType)
Set the horizontal alignment setting of this cell. If the alignment is set as Default, the explicit horizontal alignment setting is removed.

Parameters:
alignType - the horizontal alignment setting.

getVerticalAlignment

@Deprecated
public String getVerticalAlignment()
Deprecated. As of Simple version 0.3, replaced by getVerticalAlignmentType()

Return the vertical alignment setting of this cell.

The returned value can be "auto", "automatic", "baseline", "bottom", "middle", or "top".

Returns:
the vertical alignment setting of this cell.
See Also:
getVerticalAlignmentType()

getVerticalAlignmentType

public StyleTypeDefinitions.VerticalAlignmentType getVerticalAlignmentType()
Return the vertical alignment setting of this cell.

Null will returned if there is no explicit style definition for this cell.

Default value will be returned if explicit style definition is found but no vertical alignment is set.

Returns:
the vertical alignment setting.

setVerticalAlignment

@Deprecated
public void setVerticalAlignment(String verticalAlignment)
Deprecated. As of Simple version 0.3, replaced by setVerticalAlignment(SimpleVerticalAlignmentType)

Set the vertical alignment setting of this cell.

The parameter can be "auto", "automatic", "baseline", "bottom", "middle", or "top". If argument is null, the explicit vertical alignment setting is removed.

Parameters:
verticalAlignment - the vertical alignment setting.
See Also:
setVerticalAlignment(StyleTypeDefinitions.VerticalAlignmentType)

setVerticalAlignment

public void setVerticalAlignment(StyleTypeDefinitions.VerticalAlignmentType verticalAlignment)
Set the vertical alignment setting of this cell.

If the alignment is set as Default or null, the explicit vertical alignment setting is removed.

Parameters:
verticalAlignment - the vertical alignment setting.

isTextWrapped

public boolean isTextWrapped()
Return the wrap option of this cell.

Returns:
true if the cell content can be wrapped;

false if the cell content cannot be wrapped.


setTextWrapped

public void setTextWrapped(boolean isTextWrapped)
Set the wrap option of this cell.

Parameters:
isTextWrapped - whether the cell content can be wrapped or not

getRowIndex

public int getRowIndex()
Get the index of the table row which contains this cell.

Returns:
the index of the row containing this cell

getTable

public Table getTable()
Get an instance of table feature which contains this cell.

Returns:
the table containing this cell

getColumnIndex

public int getColumnIndex()
Get the index of the table column which contains this cell.

Returns:
the index of the column containing this cell

getTableColumn

public Column getTableColumn()
Get the instance of table column feature which contains this cell.

Returns:
the instance of table column feature which contains the cell.

getTableRow

public Row getTableRow()
Get the instance of table row feature which contains this cell.

Returns:
the instance of table row feature which contains the cell.

getOwnerTableCell

public Cell getOwnerTableCell()
Get the cell that covers this cell.

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.

Returns:
the cell that covers the current cell

getOdfElement

public TableTableCellElementBase getOdfElement()
Get the instance of TableTableCellElementBase which represents this cell.

Specified by:
getOdfElement in class Component
Returns:
the instance of TableTableCellElementBase

getCurrencyCode

public String getCurrencyCode()
Return the currency code of this cell, for example, "USD", "EUR", "CNY", and etc.

If the value type is not "currency", an IllegalArgumentException will be thrown.

Returns:
the currency code

Throws:
IllegalArgumentException - an IllegalArgumentException will be thrown if the value type is not "currency".

setCurrencyCode

public void setCurrencyCode(String currency)
Set the currency code of this cell, for example, "USD", "EUR", "CNY", and etc.

Parameters:
currency - the currency code that need to be set.
Throws:
IllegalArgumentException - If input currency is null, an IllegalArgumentException will be thrown.

setValueType

public void setValueType(String type)
Set the value type of this cell. The parameter can be "boolean", "currency", "date", "float", "percentage", "string" or "time".

If the parameter type is not a valid cell type, an IllegalArgumentException will be thrown.

Parameters:
type - the type that need to be set If input type is null, an IllegalArgumentException will be thrown.

getValueType

public String getValueType()
Get the value type of this cell. The returned value can be "boolean", "currency", "date", "float", "percentage", "string" or "time". If no value type is set, null will be returned.

Returns:
the type of the cell

getDoubleValue

public Double getDoubleValue()
Get the double value of this cell as Double object.

Throw IllegalArgumentException if the cell type is not "float".

Returns:
the double value of this cell as a Double object. If the cell value is empty, null will be returned.

An IllegalArgumentException will be thrown if the cell type is not "float".


getCurrencyValue

public Double getCurrencyValue()
Get the currency value of this cell as Double object.

Throw IllegalArgumentException if the cell type is not "currency".

Returns:
the currency value of this cell as a Double object. If the cell value is empty, null will be returned.
Throws:
IllegalArgumentException - an IllegalArgumentException will be thrown if the cell type is not "currency".

getCurrencySymbol

public String getCurrencySymbol()
Get the symbol of currency.

Returns:
the currency symbol
Throws:
IllegalArgumentException - an IllegalArgumentException will be thrown if the value type is not "currency".

setCurrencyValue

public void setCurrencyValue(Double value,
                             String currency)
Set the value and currency of the cell, and set the value type as "currency". If value is null, the cell value will be removed.

Parameters:
value - the value that will be set
currency - the currency that will be set.
Throws:
IllegalArgumentException - If input currency is null, an IllegalArgumentException will be thrown.

getPercentageValue

public Double getPercentageValue()
Get the cell percentage value as Double object.

Throw IllegalArgumentException if the cell type is not "percentage".

Returns:
the percentage value of this cell as a Double object. If the cell value is empty, null will be returned.
Throws:
IllegalArgumentException - an IllegalArgumentException will be thrown if the cell type is not "percentage".

setPercentageValue

public void setPercentageValue(Double value)
Set the cell value as a percentage value and set the value type as percentage too. If value is null, the cell value will be removed.

Parameters:
value - the value that will be set

getDisplayText

public String getDisplayText()
Get the text displayed in this cell.

Returns:
the text displayed in this cell

setDisplayText

public void setDisplayText(String content,
                           CellValueAdapter adapter)
Set the text displayed in this cell. If content is null, it will display the empty string instead.

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. So an adapter can be assigned to adapt cell value and value type.

Parameters:
content - the displayed text.
adapter - the CellValueAdapter used to adapt cell value and value type.
Since:
0.3
See Also:
CellValueAdapter

setDisplayText

public void setDisplayText(String content)
Set the text displayed in this cell. If content is null, it will display the empty string instead.

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. The cell value and value type will be updated follow by the rules which are designed in the DefaultCellValueAdapter.

Parameters:
content - the displayed text.
See Also:
CellValueAdapter, DefaultCellValueAdapter

setDisplayText

public void setDisplayText(String content,
                           CellValueAdapter adapter,
                           String stylename)
Set the text displayed in this cell, with a specified style name.

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. So an adapter can be assigned to adapt cell value and value type.

Parameters:
content - the displayed text. If content is null, it will display the empty string instead.
adapter - the CellValueAdapter used to adapt cell value and value type.
stylename - the style name. If style name is null, the content will use the default paragraph style.
Since:
0.3
See Also:
CellValueAdapter

setDisplayText

public void setDisplayText(String content,
                           String stylename)
Set the text displayed in this cell, with a specified style name.

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. The cell value and value type will be updated follow by the rules which are designed in the DefaultCellValueAdapter.

Parameters:
content - the displayed text. If content is null, it will display the empty string instead.
stylename - the style name. If style name is null, the content will use the default paragraph style.
See Also:
CellValueAdapter, DefaultCellValueAdapter

setDoubleValue

public void setDoubleValue(Double value)
Set the cell value as a double and set the value type to be "float".

Parameters:
value - the double value that will be set. If value is null, the cell value will be removed.

getBooleanValue

public Boolean getBooleanValue()
Get the cell boolean value as Boolean object.

Throw IllegalArgumentException if the cell type is not "boolean".

Returns:
the Boolean value of cell. If the cell value is empty, null will be returned.
Throws:
IllegalArgumentException - an IllegalArgumentException will be thrown if the cell type is not "boolean".

setBooleanValue

public void setBooleanValue(Boolean value)
Set the cell value as a boolean and set the value type to be boolean. If value is null, the cell value will be removed.

Parameters:
value - the value of boolean type

getDateValue

public Calendar getDateValue()
Get the cell date value as Calendar.

Throw IllegalArgumentException if the cell type is not "date".

Returns:
the Calendar value of cell
Throws:
IllegalArgumentException - an IllegalArgumentException will be thrown, if the cell type is not "date".

setDateValue

public void setDateValue(Calendar date)
Set the cell value as a date, and set the value type to be "date".

Parameters:
date - the value of java.util.Calendar type.

setCellStyleName

public void setCellStyleName(String styleName)
Set the cell style name. When lots of cells have the same style features, the user can configuration the first one and set the other's style name directly. That will improve the performance.

Parameters:
styleName - an exit cell style name.
Since:
0.4

getCellStyleName

public String getCellStyleName()
Get the cell style name.

Returns:
cell style name.
Since:
0.4

setStringValue

public void setStringValue(String str)
Set the cell value as a string, and set the value type to be string.

Parameters:
str - the value of string type. If input string is null, an empty string will be set.

getStringValue

public String getStringValue()
Get the cell value as a string.

If the cell type is not string, the display text will be returned.

Returns:
the string value of this cell, or the display text

getTimeValue

public Calendar getTimeValue()
Get the cell value as java.util.Calendar.

Throw exception if the cell type is not "time".

Returns:
the Calendar value of cell
Throws:
IllegalArgumentException - an IllegalArgumentException will be thrown if the cell type is not time.

setTimeValue

public void setTimeValue(Calendar time)
Set the cell value as a time and set the value type to be "time" too.

Parameters:
time - the value of java.util.Calendar type.
Throws:
IllegalArgumentException - If input time is null, an IllegalArgumentException exception will be thrown.

getCellBackgroundColor

public Color getCellBackgroundColor()
Get the background color of this cell.

If no background color is set, default background color "#FFFFFF" will be returned.

Returns:
the background color of this cell

getCellBackgroundColorString

@Deprecated
public String getCellBackgroundColorString()
Deprecated. As of Simple version 0.3, replaced by getCellBackgroundColor()

Get the background color string of this cell.

If no background color is set, default background color "#FFFFFF" will be returned.

Returns:
the background color of this cell
See Also:
getCellBackgroundColor()

setCellBackgroundColor

public void setCellBackgroundColor(Color cellBackgroundColor)
Set the background color of this cell.

Parameters:
cellBackgroundColor - the background color that need to set. If cellBackgroundColor is null, default background color Color.WHITE will be set.

setCellBackgroundColor

@Deprecated
public void setCellBackgroundColor(String cellBackgroundColor)
Deprecated. As of Simple version 0.3, replaced by setCellBackgroundColor(Color)

Set the background color of this cell using string. The string must be a valid argument for constructing org.odftoolkit.odfdom.type.Color.

Parameters:
cellBackgroundColor - the background color that need to set. If cellBackgroundColor is null, default background color #FFFFFF will be set.
See Also:
Color, setCellBackgroundColor(Color)

getColumnSpannedNumber

public int getColumnSpannedNumber()
Get the column spanned number of this cell.

Returns:
the column spanned number

getRowSpannedNumber

public int getRowSpannedNumber()
Get the row spanned number of this cell.

Returns:
the row spanned number

getStyleName

public String getStyleName()
Get the style name of this cell.

Returns:
the name of the style

setFormula

public void setFormula(String formula)
Set a formula to the cell.

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.

Parameters:
formula - the formula that need to be set.
Throws:
IllegalArgumentException - if formula is null, an IllegalArgumentException will be thrown.
See Also:
TableFormulaAttribute

getFormula

public String getFormula()
Get the formula string of the cell.

Returns:
the formula representation of the cell

If the cell does not contain a formula, null will be returned.


setCurrencyFormat

public void setCurrencyFormat(String currencySymbol,
                              String format)
Set the currency symbol and overall format of a currency cell.

Please note the overall format includes the symbol character, for example: $#,##0.00.

This function only works for currency.

Parameters:
currencySymbol - the currency symbol
format - overall format
Throws:
IllegalArgumentException - if input currencySymbol or format is null, an IllegalArgumentException will be thrown.

setFormatString

public void setFormatString(String formatStr)
Set the format string of the cell.

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 java.text.DecimalFormat. For value type date and time, the formatStr must follow the encoding rule of java.text.SimpleDateFormat.

Refer to setCurrencyFormat to set the format of currency.

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.

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
The adapt result may be inaccurate, so you'd better set value type before call this method. If adaptive failed, an UnsupportedOperationException will be thrown.

Parameters:
formatStr - the cell need be formatted as this specified format string.
Throws:
IllegalArgumentException - if formatStr is null or the cell value type is supported.
UnsupportedOperationException - if the adaptive failed, when cell value type is not set.
See Also:
SimpleDateFormat, DecimalFormat

getFormatString

public String getFormatString()
Get the format string of the cell.

Returns:
the format string of the cell

removeTextContent

public void removeTextContent()
Remove all the text content of cell.


removeContent

public void removeContent()
Remove all the content of the cell.


getFont

public Font getFont()
Return the font definition for this cell.

Null will be returned if there is no explicit style definition, or even default style definition, for this cell.

Returns:
the font definition null if there is no style definition for this cell
Since:
0.3

setFont

public void setFont(Font font)
Set font style for this cell.

Parameters:
font - - the font
Since:
0.3

setBorders

public void setBorders(StyleTypeDefinitions.CellBordersType bordersType,
                       Border border)
Set the border style definitions for this cell.

This method will invoke CellStyleHandler.setBorders(Border border, SimpleCellBordersType bordersType).

Parameters:
bordersType - - A predefined border type
border - - border style description
Since:
0.3
See Also:
CellStyleHandler.setBorders(Border border, StyleTypeDefinitions.CellBordersType bordersType)

getBorder

public Border getBorder(StyleTypeDefinitions.CellBordersType type)
Return the border setting for a specific border.

This method will invoke CellStyleHandler.getBorder(SimpleCellBordersType type).

Parameters:
type - - the border type which describes a single border
Returns:
the border setting
Since:
0.3.5
See Also:
CellStyleHandler.getBorder(StyleTypeDefinitions.CellBordersType type)

getNoteText

public String getNoteText()
Get the note text of this table cell. If there is no note on this cell, null will be returned.

The note may contain text list, text paragraph and styles, but this method extracts only text from them.

Returns:
the note text of this cell.

setNoteText

public void setNoteText(String note)
Set note text for this table cell. This method creates a text paragraph without style as note. The note text is text paragraph content.

Only simple text is supported to receive in this method, which is a sub function of office annotation. So overwriting a note with text might loose structure and styles.

Parameters:
note - note content.

setImage

public Image setImage(URI imageUri)
Insert an Image from the specified uri to cell. Note: if there is any other text content in this cell, it will be removed.

Parameters:
imageUri - The URI of the image that will be added to the cell, add image stream to the package, in the 'Pictures/' graphic directory with the same image file name as in the URI. If the imageURI is relative first the user.dir is taken to make it absolute.
Since:
0.4.5

getBufferedImage

public BufferedImage getBufferedImage()
Deprecated. 

Get the Image from the specified cell.

Returns:
If there is a image exist in this cell, An Image will be returned.
Since:
0.4.5

getImage

public Image getImage()
Get the image from the specified cell.

Returns:
If there is a image exist in this cell, an Image will be returned.
Since:
0.5.5

getStyleHandler

public CellStyleHandler getStyleHandler()
Return style handler for this cell

Returns:
the style handler
Since:
0.3

getListContainerElement

public OdfElement getListContainerElement()
Description copied from interface: ListContainer
Get the ODF element which can have as child element directly according to ODF specification. This Element will help to find the position to insert a new List. For example, element is usable with element, so TextDocument will return OfficeTextElement. While Presentation Notes is an indirectly ListContainer, which holds List with the help of its grand-child element , so for Notes, DrawTextBoxElement should be return.

Specified by:
getListContainerElement in interface ListContainer
Returns:
container element which can hold .

addList

public List addList()
Description copied from interface: ListContainer
Add a new List to this container.

Specified by:
addList in interface ListContainer
Returns:
added list.

addList

public List addList(ListDecorator decorator)
Description copied from interface: ListContainer
Add a List with specified ListDecorator to this container.

Specified by:
addList in interface ListContainer
Parameters:
decorator - the specified ListDecorator
Returns:
added list.

clearList

public void clearList()
Description copied from interface: ListContainer
Remove all Lists from this container.

Specified by:
clearList in interface ListContainer

getListIterator

public Iterator<List> getListIterator()
Description copied from interface: ListContainer
Return an Iterator of the Lists in this ListContainer. The Lists are iterated in the same order that they occur in the ListContainer.

Specified by:
getListIterator in interface ListContainer
Returns:
an Iterator of the Lists in this ListContainer
See Also:
Iterator

removeList

public boolean removeList(List list)
Description copied from interface: ListContainer
Remove the existing List from this container.

Specified by:
removeList in interface ListContainer
Returns:
true, if the container contains this List.

addParagraph

public Paragraph addParagraph(String text)
Creates a new paragraph and append text

Specified by:
addParagraph in interface ParagraphContainer
Parameters:
text -
Returns:
the new paragraph
Throws:
Exception - if the file DOM could not be created.
Since:
0.5.5

removeParagraph

public boolean removeParagraph(Paragraph para)
Remove paragraph from this document

Specified by:
removeParagraph in interface ParagraphContainer
Parameters:
para - - the instance of paragraph
Returns:
true if the paragraph is removed successfully, false if errors happen.
Since:
0.5.5

getParagraphContainerElement

public OdfElement getParagraphContainerElement()
Get the ODF element which can have as child element directly.

Specified by:
getParagraphContainerElement in interface ParagraphContainer
Returns:
- an ODF element which can have paragraph as child.
Since:
0.5.5

getParagraphByIndex

public Paragraph getParagraphByIndex(int index,
                                     boolean isEmptyParagraphSkipped)
Return a paragraph with a given index.

An index of zero represents the first paragraph.

If empty paragraph is skipped, the empty paragraph won't be counted.

Specified by:
getParagraphByIndex in interface ParagraphContainer
Parameters:
index - - the index started from 0.
isEmptyParagraphSkipped - - whether the empty paragraph is skipped or not
Returns:
the paragraph with a given index
Since:
0.5.5

getParagraphByReverseIndex

public Paragraph getParagraphByReverseIndex(int reverseIndex,
                                            boolean isEmptyParagraphSkipped)
Return a paragraph with a given index. The index is in reverse order.

An index of zero represents the last paragraph.

If empty paragraph is skipped, the empty paragraph won't be counted.

Specified by:
getParagraphByReverseIndex in interface ParagraphContainer
Parameters:
reverseIndex - - the index started from 0 in reverse order.
isEmptyParagraphSkipped - - whether the empty paragraph is skipped or not
Returns:
the paragraph with a given index
Since:
0.5.5

getParagraphIterator

public Iterator<Paragraph> getParagraphIterator()
Return an Iterator of the paragraph in this container.

Specified by:
getParagraphIterator in interface ParagraphContainer
Returns:
an Iterator of the paragraph in this container
Since:
0.5.5

getFrameContainerElement

public OdfElement getFrameContainerElement()
Description copied from interface: FrameContainer
Get the ODF element which can have as child element directly according to ODF specification. This Element will help to find the position to insert a new draw:frame element.

Specified by:
getFrameContainerElement in interface FrameContainer
Returns:
the parent of draw:frame

setValidityList

public void setValidityList(List<String> values)
Specifies the allowed values of this cell in a list. Any value out of this list is invalid.

NOTE: Now, the validity rule does not take effect when a cell value is updated by Simple ODF API yet.

Parameters:
values - the list of allowed values.
Since:
0.6

setInputHelpMessage

public void setInputHelpMessage(String title,
                                String text)
Sets the title and the text of the tip, which will then be displayed if the cell is selected.

Parameters:
title - the title of the tip.
text - the text of the tip.
Since:
0.6


Copyright © 2010-2011 The Apache Software Foundation. All Rights Reserved.