org.jopendocument.dom.spreadsheet
Class MutableCell<D extends ODDocument>

java.lang.Object
  extended by org.jopendocument.dom.ODNode
      extended by org.jopendocument.dom.StyledNode<S,D>
          extended by org.jopendocument.dom.ImmutableDocStyledNode<S,D>
              extended by org.jopendocument.dom.spreadsheet.Cell<D>
                  extended by org.jopendocument.dom.spreadsheet.MutableCell<D>
Type Parameters:
D - type of document

public class MutableCell<D extends ODDocument>
extends Cell<D>

A cell whose value can be changed.

Author:
Sylvain

Method Summary
 void clearValue()
           
static String formatCurrency(Number n, CellStyle defaultStyle)
           
static String formatNumber(Number n, CellStyle defaultStyle)
           
static String formatPercent(Number n, CellStyle defaultStyle)
           
 DataStyle getDataStyle()
           
protected  CellStyle getDefaultStyle()
           
 Point getPoint()
           
 String getStyleName()
           
protected  org.jdom.Namespace getTABLE()
           
 CellStyle.StyleTableCellProperties getTableCellProperties()
           
 int getX()
           
 int getY()
           
 void merge(int columnsSpanned, int rowsSpanned)
          Merge this cell and the following ones.
 void replaceBy(String oldValue, String newValue)
           
 void setBackgroundColor(Color color)
           
 void setImage(File pic)
           
 void setImage(File pic, boolean keepRatio)
           
 void setImage(String name, Image img)
           
 void setValue(Object obj)
           
 void setValue(Object obj, boolean allowTypeChange)
           
 void setValue(Object obj, ODValueType vt, boolean allowTypeChange, boolean lenient)
          Change the value of this cell.
 void unmerge()
           
 
Methods inherited from class org.jopendocument.dom.spreadsheet.Cell
coversOtherCells, getColumnsSpanned, getError, getFormula, getNS, getRow, getRowsSpanned, getTextValue, getTextValue, getTextValueMode, getType, getValue, getValueNS, getValueType, isCovered, isEmpty, isValid, setTextValueMode
 
Methods inherited from class org.jopendocument.dom.ImmutableDocStyledNode
getContent, getODDocument
 
Methods inherited from class org.jopendocument.dom.StyledNode
getPrivateStyle, getStyle, getStyle, getStyle, getStyle, getStyleDesc, getStyleDesc, getStyleDesc, getStyleStyleDesc, setStyleName, setStyleName
 
Methods inherited from class org.jopendocument.dom.ODNode
getElement, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

formatNumber

public static String formatNumber(Number n,
                                  CellStyle defaultStyle)

formatPercent

public static String formatPercent(Number n,
                                   CellStyle defaultStyle)

formatCurrency

public static String formatCurrency(Number n,
                                    CellStyle defaultStyle)

getX

public final int getX()

getY

public final int getY()

getPoint

public final Point getPoint()

clearValue

public void clearValue()

setValue

public void setValue(Object obj)

setValue

public void setValue(Object obj,
                     boolean allowTypeChange)
              throws UnsupportedOperationException
Throws:
UnsupportedOperationException

setValue

public void setValue(Object obj,
                     ODValueType vt,
                     boolean allowTypeChange,
                     boolean lenient)
              throws UnsupportedOperationException
Change the value of this cell.

Parameters:
obj - the new cell value.
vt - the value type.
allowTypeChange - if true obj and vt might be changed to allow the data style to format, e.g. from Boolean.FALSE to 0.
lenient - false to throw an exception if we can't format according to the ODF, true to try best-effort.
Throws:
UnsupportedOperationException - if obj couldn't be formatted.

getDataStyle

public final DataStyle getDataStyle()

getDefaultStyle

protected final CellStyle getDefaultStyle()

replaceBy

public void replaceBy(String oldValue,
                      String newValue)

unmerge

public final void unmerge()

merge

public final void merge(int columnsSpanned,
                        int rowsSpanned)
Merge this cell and the following ones. If this cell already spanned multiple columns/rows this method un-merge any additional cells.

Parameters:
columnsSpanned - number of columns to merge.
rowsSpanned - number of rows to merge.

getStyleName

public final String getStyleName()
Overrides:
getStyleName in class Cell<D extends ODDocument>

getTableCellProperties

public final CellStyle.StyleTableCellProperties getTableCellProperties()

setImage

public void setImage(File pic)
              throws IOException
Throws:
IOException

setImage

public void setImage(File pic,
                     boolean keepRatio)
              throws IOException
Throws:
IOException

setImage

public void setImage(String name,
                     Image img)
              throws IOException
Throws:
IOException

setBackgroundColor

public final void setBackgroundColor(Color color)

getTABLE

protected final org.jdom.Namespace getTABLE()


Copyright © 2010 jOpenDocument All Rights Reserved.