Class Cell

java.lang.Object
de.zedlitz.opendocument.Cell
Direct Known Subclasses:
EmptyCell

public class Cell extends Object
Author:
Jesper Zedlitz <jze@informatik.uni-kiel.de>
  • Field Details

  • Method Details

    • getCurrency

      public String getCurrency()
      Get the raw value of the currency attribute. It is only present for cells with the type "currency".
      Returns:
      the raw currency value or null if not present.
    • getTimeValue

      public String getTimeValue()
      Get the raw value of the time-value attribute. It is only present for cells with the type "time".
      Returns:
      the raw time value or null if not present.
    • getBooleanValue

      public String getBooleanValue()
      Get the raw value of the boolean-value attribute. It is only present for cells with the type "boolean".
      Returns:
      the raw boolean value or null if not present.
    • getDateValue

      public String getDateValue()
      Get the raw value of the date-value attribute. It is only present for cells with the type "date".
      Returns:
      the raw date value or null if not present.
    • getValueType

      public String getValueType()
      Get the raw value of the value-type attribute. It should be present for every cell.
      Returns:
      Returns the valueType or null if not present.
    • getContent

      public String getContent()
      Returns the content of the cell formatted for the locale of the file. For example in a German ods file the boolean value true will be returned as WAHR. In a French ods file it will be VRAI. And in an English ods file it will be TRUE.

      If you are looking for a language independent value you can use the getValue method.

    • getNumberColumnsRepeated

      public int getNumberColumnsRepeated()
    • toString

      public String toString()
      Overrides:
      toString in class Object
      See Also:
    • asBoolean

      public boolean asBoolean()
      Return the boolean value of the cell. This works only for cells with the type "boolean". Check for "boolean".equals(cell.getValueType()) before invoking this method.
      Returns:
      a LocalDate object with the value of the cell.
      Throws:
      OdsReaderException - is the cell is not a boolean cell
    • asDate

      public LocalDate asDate()
      Return a LocalDate object with the value of the cell. This works only for cells with the type "date" and do not have a time component. Check for "date".equals(cell.getValueType()) before invoking this method.
      Returns:
      a LocalDate object with the value of the cell.
      Throws:
      OdsReaderException - is the cell is not a date cell
    • asDateTime

      public LocalDateTime asDateTime()
      Return a LocalDateTime object with the value of the cell. This works only for cells with the type "date". Check for "date".equals(cell.getValueType()) before invoking this method. If the cell contains only a date and no time the time 00:00:00 will be used as the time component.
      Returns:
      a LocalDateTime object with the value of the cell.
      Throws:
      OdsReaderException - is the cell is not a date cell
    • isDateTime

      public boolean isDateTime()
      Does the cell contain a value that consists of a date and a time?
    • asTime

      public LocalTime asTime()
      Return a LocalTime object with the value of the cell. This works only for cells with the type "time". Check for "time".equals(cell.getValueType()) before invoking this method.
      Returns:
      a LocalTime object with the value of the cell.
      Throws:
      OdsReaderException - is the cell is not a time cell
    • getColumnIndex

      public int getColumnIndex()
    • getAddress

      public String getAddress()
    • getValue

      public String getValue()
      Returns the language independent value of a cell. This is only present for cell with the type float, currency, and percentage. It is stored in the value attribute of the cell element.

      If getValue() is null you can use getContent() to get the text value of the cell.

      Returns:
      the language independent value of a cell or null if not value is present.
    • getLanguageIndependentContent

      public String getLanguageIndependentContent()
      Returns the language independent value of a cell.

      It is the contents of the content or the value attribute of the cell element.