Class Cell

java.lang.Object
com.independentsoft.office.odf.Cell
All Implemented Interfaces:
IContentElement
Direct Known Subclasses:
CoveredCell

public class Cell extends Object implements IContentElement
Represents a table cell. It is contained in a table row element. A table cell can contain paragraphs and other text content as well as sub tables. Table cells may span multiple columns and rows. Table cells may be empty.
  • Field Details

    • content

      protected List<ICellContent> content
    • numberOfRepeatedCells

      protected int numberOfRepeatedCells
    • style

      protected String style
    • contentValidation

      protected String contentValidation
    • isProtected

      protected boolean isProtected
    • numericValue

      protected String numericValue
    • dateValue

      protected String dateValue
    • timeValue

      protected String timeValue
    • booleanValue

      protected String booleanValue
    • stringValue

      protected String stringValue
    • type

      protected CellValueType type
    • formula

      protected String formula
    • matrixColumnsSpannedCount

      protected int matrixColumnsSpannedCount
    • matrixRowsSpannedCount

      protected int matrixRowsSpannedCount
    • currency

      protected String currency
  • Constructor Details

    • Cell

      public Cell()
      Initializes a new instance of the Cell class.
    • Cell

      public Cell(String value, CellValueType type)
      Initializes a new instance of the Cell class.
      Parameters:
      value - the value
      type - the type
    • Cell

      public Cell(String value)
      Initializes a new instance of the Cell class.
      Parameters:
      value - the value
    • Cell

      public Cell(double value)
      Initializes a new instance of the Cell class.
      Parameters:
      value - the value
    • Cell

      public Cell(boolean value)
      Initializes a new instance of the Cell class.
      Parameters:
      value - the value
    • Cell

      public Cell(Date value)
      Initializes a new instance of the Cell class.
      Parameters:
      value - the value
  • Method Details

    • getContentElements

      public List<IContentElement> getContentElements()
      Returns all content elements.
      Specified by:
      getContentElements in interface IContentElement
      Returns:
      A collection of content elements.
    • getParent

      public IContentElement getParent()
      Returns the parent content element.
      Specified by:
      getParent in interface IContentElement
      Returns:
      the parent
    • setParent

      public void setParent(IContentElement parent)
      Sets the parent content element.
      Specified by:
      setParent in interface IContentElement
      Parameters:
      parent - the new parent
    • clone

      public Cell clone()
      Creates a new object that is a deep copy of the current instance.
      Specified by:
      clone in interface IContentElement
      Overrides:
      clone in class Object
      Returns:
      A new object that is a copy of this instance.
    • toString

      public String toString()
      Converts the value of the current Cell object to its equivalent string representation.
      Overrides:
      toString in class Object
      Returns:
      the string
    • getContent

      public List<ICellContent> getContent()
      Gets the content.
      Returns:
      the content
    • getNumberOfRepeatedCells

      public int getNumberOfRepeatedCells()
      Gets the number of successive columns in which a cell is repeated. It may be used to describe two or more adjoining cells with a single cell element, if they meet the following conditions: - The cells contain the same content and style. - The cells are not merged horizontally or vertically.
      Returns:
      the number of repeated cells
    • setNumberOfRepeatedCells

      public void setNumberOfRepeatedCells(int numberOfRepeatedCells)
      Sets the number of successive columns in which a cell is repeated. It may be used to describe two or more adjoining cells with a single cell element, if they meet the following conditions: - The cells contain the same content and style. - The cells are not merged horizontally or vertically.
      Parameters:
      numberOfRepeatedCells - the new number of repeated cells
    • getSpannedColumnsCount

      public int getSpannedColumnsCount()
      Gets the number of columns that a cell spans.
      Returns:
      the spanned columns count
    • setSpannedColumnsCount

      public void setSpannedColumnsCount(int spannedColumnsCount)
      Sets the number of columns that a cell spans.
      Parameters:
      spannedColumnsCount - the new spanned columns count
    • getSpannedRowsCount

      public int getSpannedRowsCount()
      Gets the number of rows that a cell spans.
      Returns:
      the spanned rows count
    • setSpannedRowsCount

      public void setSpannedRowsCount(int spannedRowsCount)
      Sets the number of rows that a cell spans.
      Parameters:
      spannedRowsCount - the new spanned rows count
    • getMatrixColumnsSpannedCount

      public int getMatrixColumnsSpannedCount()
      Gets the number of columns spanned by a matrix.
      Returns:
      the matrix columns spanned count
    • setMatrixColumnsSpannedCount

      public void setMatrixColumnsSpannedCount(int matrixColumnsSpannedCount)
      Sets the number of columns spanned by a matrix.
      Parameters:
      matrixColumnsSpannedCount - the new matrix columns spanned count
    • getMatrixRowsSpannedCount

      public int getMatrixRowsSpannedCount()
      Gets the number of rows spanned by a matrix.
      Returns:
      the matrix rows spanned count
    • setMatrixRowsSpannedCount

      public void setMatrixRowsSpannedCount(int matrixRowsSpannedCount)
      Sets the number of rows spanned by a matrix.
      Parameters:
      matrixRowsSpannedCount - the new matrix rows spanned count
    • getFormula

      public String getFormula()
      Gets the formula for a table cell.
      Returns:
      the formula
    • setFormula

      public void setFormula(String formula)
      Sets the formula for a table cell.
      Parameters:
      formula - the new formula
    • getCurrency

      public String getCurrency()
      Gets the currency for a value of a table cell, a text field, or a form property.
      Returns:
      the currency
    • setCurrency

      public void setCurrency(String currency)
      Sets the currency for a value of a table cell, a text field, or a form property.
      Parameters:
      currency - the new currency
    • getStyle

      public String getStyle()
      Gets the style of table cell.
      Returns:
      the style
    • setStyle

      public void setStyle(String style)
      Sets the style of table cell.
      Parameters:
      style - the new style
    • getContentValidation

      public String getContentValidation()
      Specifies if a cell contains a validity check. The value of this attribute is a name found in the name attribute of a ContentValidation. If this attribute is not present, a cell may have arbitrary content.
      Returns:
      the content validation
    • setContentValidation

      public void setContentValidation(String contentValidation)
      Specifies if a cell contains a validity check. The value of this attribute is a name found in the name attribute of a ContentValidation. If this attribute is not present, a cell may have arbitrary content.
      Parameters:
      contentValidation - the new content validation
    • getType

      public CellValueType getType()
      Gets the value-type of a table cell, a text field, or a form property.
      Returns:
      the type
    • setType

      public void setType(CellValueType type)
      Sets the value-type of a table cell, a text field, or a form property.
      Parameters:
      type - the new type
    • getValue

      public String getValue()
      Gets the currency, float or percentage value for a table cell, a text field, or a form property.
      Returns:
      the value
    • setValue

      public void setValue(String value)
      Sets the currency, float or percentage value for a table cell, a text field, or a form property.
      Parameters:
      value - the new value