org.apache.poi.xssf.streaming

## Class SXSSFCell

- java.lang.Object
- - org.apache.poi.ss.usermodel.CellBase
  - - org.apache.poi.xssf.streaming.SXSSFCell

- All Implemented Interfaces:
    Cell

      public class SXSSFCell
      extends CellBase

  Streaming version of XSSFCell implementing the "BigGridDemo" strategy.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SXSSFCell(SXSSFRow row, CellType cellType)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `CellRangeAddress` | `getArrayFormulaRange()` Only valid for array formula cells
    `boolean` | `getBooleanCellValue()` Get the value of the cell as a boolean.
    `CellType` | `getCachedFormulaResultType()` Only valid for formula cells
    `CellType` | `getCachedFormulaResultTypeEnum()` Deprecated. use `getCachedFormulaResultType` instead
    `Comment` | `getCellComment()` Returns comment associated with this cell
    `java.lang.String` | `getCellFormula()` Return a formula for the cell, for example, `SUM(C4:E4)`
    `CellStyle` | `getCellStyle()` Return the cell's style.
    `CellType` | `getCellType()` Return the cell type.
    `int` | `getColumnIndex()` Returns column index of this cell
    `java.util.Date` | `getDateCellValue()` Get the value of the cell as a date.
    `byte` | `getErrorCellValue()` Get the value of the cell as an error code.
    `Hyperlink` | `getHyperlink()`
    `java.time.LocalDateTime` | `getLocalDateTimeCellValue()` Get the value of the cell as a LocalDateTime.
    `double` | `getNumericCellValue()` Get the value of the cell as a number.
    `RichTextString` | `getRichStringCellValue()` Get the value of the cell as a XSSFRichTextString
    `Row` | `getRow()` Returns the Row this cell belongs to
    `int` | `getRowIndex()` Returns row index of a row in the sheet that contains this cell
    `SXSSFSheet` | `getSheet()` Returns the sheet this cell belongs to
    `protected SpreadsheetVersion` | `getSpreadsheetVersion()` Get the spreadsheet version for the given implementation.
    `java.lang.String` | `getStringCellValue()` Get the value of the cell as a string
    `boolean` | `isPartOfArrayFormulaGroup()`
    `void` | `removeCellComment()` Removes the comment for this cell, if there is one.
    `protected void` | `removeFormulaImpl()` Implementation-specific removal of the formula.
    `void` | `removeHyperlink()` Removes the hyperlink for this cell, if there is one.
    `void` | `setAsActiveCell()` Sets this cell as the active cell for the worksheet
    `void` | `setCellComment(Comment comment)` Assign a comment to this cell
    `void` | `setCellErrorValue(byte value)` Set a error value for the cell
    `void` | `setCellFormulaImpl(java.lang.String formula)` Sets formula for this cell.
    `void` | `setCellStyle(CellStyle style)` Set the style for the cell.
    `protected void` | `setCellTypeImpl(CellType cellType)` Implementation-specific logic
    `void` | `setCellValue(boolean value)` Set a boolean value for the cell
    `protected void` | `setCellValueImpl(java.util.Calendar value)` Implementation-specific way to set a calendar value.
    `protected void` | `setCellValueImpl(java.util.Date value)` Implementation-specific way to set a date value.
    `void` | `setCellValueImpl(double value)` Implementation-specific way to set a numeric value.
    `protected void` | `setCellValueImpl(java.time.LocalDateTime value)` Implementation-specific way to set a date value.
    `protected void` | `setCellValueImpl(RichTextString value)` Implementation-specific way to set a RichTextString value.
    `protected void` | `setCellValueImpl(java.lang.String value)` Implementation-specific way to set a string value.
    `void` | `setHyperlink(Hyperlink link)` Assign a hyperlink to this cell.
    `java.lang.String` | `toString()` Returns a string representation of the cell

    - ### Methods inherited from class org.apache.poi.ss.usermodel.CellBase

      `getAddress, getCellTypeEnum, getValueType, removeFormula, setBlank, setCellFormula, setCellType, setCellValue, setCellValue, setCellValue, setCellValue, setCellValue, setCellValue, tryToDeleteArrayFormula`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface org.apache.poi.ss.usermodel.Cell

      `setCellValue`

- - ### Constructor Detail

    - #### SXSSFCell

          public SXSSFCell(SXSSFRow row,
                           CellType cellType)

  - ### Method Detail

    - #### getSpreadsheetVersion

          protected SpreadsheetVersion getSpreadsheetVersion()

      Get the spreadsheet version for the given implementation.
      Specified by:
        `getSpreadsheetVersion` in class `CellBase`
      Returns:
        the spreadsheet version

    - #### getColumnIndex

          public int getColumnIndex()

      Returns column index of this cell
      Returns:
        zero-based column index of a column in a sheet.

    - #### getRowIndex

          public int getRowIndex()

      Returns row index of a row in the sheet that contains this cell
      Returns:
        zero-based row index of a row in the sheet that contains this cell

    - #### getSheet

          public SXSSFSheet getSheet()

      Returns the sheet this cell belongs to
      Returns:
        the sheet this cell belongs to

    - #### getRow

          public Row getRow()

      Returns the Row this cell belongs to
      Returns:
        the Row that owns this cell

    - #### setCellTypeImpl

          protected void setCellTypeImpl(CellType cellType)

      Description copied from class: `CellBase`
      Implementation-specific logic
      Specified by:
        `setCellTypeImpl` in class `CellBase`
      Parameters:
        `cellType` - new cell type. Guaranteed non-null, not _NONE.

    - #### getCellType

          public CellType getCellType()

      Return the cell type.
      Returns:
        the cell type

    - #### getCachedFormulaResultType

          public CellType getCachedFormulaResultType()

      Only valid for formula cells
      Returns:
        one of (`CellType.NUMERIC`, `CellType.STRING`, `CellType.BOOLEAN`, `CellType.ERROR`) depending on the cached value of the formula

    - #### getCachedFormulaResultTypeEnum

          @Deprecated
           @Removal(version="4.2")
          public CellType getCachedFormulaResultTypeEnum()

      Deprecated. use `getCachedFormulaResultType` instead
      Only valid for formula cells
      Returns:
        one of (`CellType.NUMERIC`, `CellType.STRING`, `CellType.BOOLEAN`, `CellType.ERROR`) depending on the cached value of the formula
      Since:
        POI 3.15 beta 3

    - #### setCellValueImpl

          public void setCellValueImpl(double value)

      Implementation-specific way to set a numeric value. `value` is guaranteed to be a valid (non-NaN) double. The implementation is expected to adjust the cell type accordingly, so that after this call getCellType() or getCachedFormulaResultType() would return `CellType.NUMERIC`.
      Specified by:
        `setCellValueImpl` in class `CellBase`
      Parameters:
        `value` - the new value to set

    - #### setCellValueImpl

          protected void setCellValueImpl(java.util.Date value)

      Implementation-specific way to set a date value. `value` is guaranteed to be non-null. The implementation is expected to adjust the cell type accordingly, so that after this call getCellType() or getCachedFormulaResultType() would return `CellType.NUMERIC`.
      Specified by:
        `setCellValueImpl` in class `CellBase`
      Parameters:
        `value` - the new date to set

    - #### setCellValueImpl

          protected void setCellValueImpl(java.time.LocalDateTime value)

      Implementation-specific way to set a date value. `value` is guaranteed to be non-null. The implementation is expected to adjust the cell type accordingly, so that after this call getCellType() or getCachedFormulaResultType() would return `CellType.NUMERIC`.
      Specified by:
        `setCellValueImpl` in class `CellBase`
      Parameters:
        `value` - the new date to set

    - #### setCellValueImpl

          protected void setCellValueImpl(java.util.Calendar value)

      Implementation-specific way to set a calendar value. `value` is guaranteed to be non-null. The implementation is expected to adjust the cell type accordingly, so that after this call getCellType() or getCachedFormulaResultType() would return `CellType.NUMERIC`.
      Specified by:
        `setCellValueImpl` in class `CellBase`
      Parameters:
        `value` - the new calendar value to set

    - #### setCellValueImpl

          protected void setCellValueImpl(RichTextString value)

      Implementation-specific way to set a RichTextString value. The value is guaranteed to be non-null, having non-null value, and to satisfy the length limitation imposed by the spreadsheet version. The implementation is expected to adjust cell type accordingly, so that after this call getCellType() or getCachedFormulaResultType() (whichever appropriate) would return `CellType.STRING`.
      Specified by:
        `setCellValueImpl` in class `CellBase`
      Parameters:
        `value` - the new value to set.

    - #### setCellValueImpl

          protected void setCellValueImpl(java.lang.String value)

      Implementation-specific way to set a string value. The value is guaranteed to be non-null and to satisfy the length limitation imposed by the spreadsheet version. The implementation is expected to adjust cell type accordingly, so that after this call getCellType() or getCachedFormulaResultType() (whichever appropriate) would return `CellType.STRING`.
      Specified by:
        `setCellValueImpl` in class `CellBase`
      Parameters:
        `value` - the new value to set.

    - #### setCellFormulaImpl

          public void setCellFormulaImpl(java.lang.String formula)
                                  throws FormulaParseException

      Sets formula for this cell.

      Note, this method only sets the formula string and does not calculate the formula value. To set the precalculated value use `CellBase.setCellValue(double)` or `CellBase.setCellValue(String)`

      Specified by:
        `setCellFormulaImpl` in class `CellBase`
      Parameters:
        `formula` - the formula to set, e.g. `"SUM(C4:E4)"`. If the argument is `null` then the current formula is removed.
      Throws:
        `FormulaParseException` - if the formula has incorrect syntax or is otherwise invalid

    - #### removeFormulaImpl

          protected void removeFormulaImpl()

      Description copied from class: `CellBase`
      Implementation-specific removal of the formula. The cell is guaranteed to have a regular formula set. Shall preserve the "cached" value.
      Specified by:
        `removeFormulaImpl` in class `CellBase`

    - #### getCellFormula

          public java.lang.String getCellFormula()

      Return a formula for the cell, for example, `SUM(C4:E4)`
      Returns:
        a formula for the cell
      Throws:
        `java.lang.IllegalStateException` - if the cell type returned by `getCellType()` is not CellType.FORMULA

    - #### getNumericCellValue

          public double getNumericCellValue()

      Get the value of the cell as a number.

      For strings we throw an exception. For blank cells we return a 0. For formulas or error cells we return the precalculated value;

      Returns:
        the value of the cell as a number
      Throws:
        `java.lang.IllegalStateException` - if the cell type returned by `getCellType()` is CellType.STRING
        `java.lang.NumberFormatException` - if the cell value isn't a parsable `double`.
      See Also:
        `for turning this number into a string similar to that which Excel would render this number as.`

    - #### getDateCellValue

          public java.util.Date getDateCellValue()

      Get the value of the cell as a date.

      For strings we throw an exception. For blank cells we return a null.

      Returns:
        the value of the cell as a date
      Throws:
        `java.lang.IllegalStateException` - if the cell type returned by `getCellType()` is CellType.STRING
        `java.lang.NumberFormatException` - if the cell value isn't a parsable `double`.
      See Also:
        `for formatting this date into a string similar to how excel does.`

    - #### getLocalDateTimeCellValue

          public java.time.LocalDateTime getLocalDateTimeCellValue()

      Get the value of the cell as a LocalDateTime.

      For strings we throw an exception. For blank cells we return a null.

      Returns:
        the value of the cell as a date
      Throws:
        `java.lang.IllegalStateException` - if the cell type returned by `getCellType()` is CellType.STRING
        `java.lang.NumberFormatException` - if the cell value isn't a parsable `double`.
      See Also:
        `for formatting this date into a string similar to how excel does.`

    - #### getRichStringCellValue

          public RichTextString getRichStringCellValue()

      Get the value of the cell as a XSSFRichTextString

      For numeric cells we throw an exception. For blank cells we return an empty string. For formula cells we return the pre-calculated value if a string, otherwise an exception.

      Returns:
        the value of the cell as a XSSFRichTextString

    - #### getStringCellValue

          public java.lang.String getStringCellValue()

      Get the value of the cell as a string

      For numeric cells we throw an exception. For blank cells we return an empty string. For formulaCells that are not string Formulas, we throw an exception.

      Returns:
        the value of the cell as a string

    - #### setCellValue

          public void setCellValue(boolean value)

      Set a boolean value for the cell
      Parameters:
        `value` - the boolean value to set this cell to. For formulas we'll set the precalculated value, for booleans we'll set its value. For other types we will change the cell to a boolean cell and set its value.

    - #### setCellErrorValue

          public void setCellErrorValue(byte value)

      Set a error value for the cell
      Parameters:
        `value` - the error value to set this cell to. For formulas we'll set the precalculated value , for errors we'll set its value. For other types we will change the cell to an error cell and set its value.
      See Also:
        `FormulaError`

    - #### getBooleanCellValue

          public boolean getBooleanCellValue()

      Get the value of the cell as a boolean.

      For strings, numbers, and errors, we throw an exception. For blank cells we return a false.

      Returns:
        the value of the cell as a boolean
      Throws:
        `java.lang.IllegalStateException` - if the cell type returned by `getCellType()` is not CellType.BOOLEAN, CellType.BLANK or CellType.FORMULA

    - #### getErrorCellValue

          public byte getErrorCellValue()

      Get the value of the cell as an error code.

      For strings, numbers, and booleans, we throw an exception. For blank cells we return a 0.

      Returns:
        the value of the cell as an error code
      Throws:
        `java.lang.IllegalStateException` - if the cell type returned by `getCellType()` isn't CellType.ERROR
      See Also:
        `for error codes`

    - #### setCellStyle

          public void setCellStyle(CellStyle style)

      Set the style for the cell. The style should be an CellStyle created/retreived from the Workbook.

      To change the style of a cell without affecting other cells that use the same style, use `CellUtil.setCellStyleProperties(Cell, Map)`

      Parameters:
        `style` - reference contained in the workbook. If the value is null then the style information is removed causing the cell to used the default workbook style.
      See Also:
        `Workbook.createCellStyle()`

    - #### getCellStyle

          public CellStyle getCellStyle()

      Return the cell's style.
      Returns:
        the cell's style. Always not-null. Default cell style has zero index and can be obtained as `workbook.getCellStyleAt(0)`
      See Also:
        `Workbook.getCellStyleAt(int)`

    - #### setAsActiveCell

          public void setAsActiveCell()

      Sets this cell as the active cell for the worksheet

    - #### setCellComment

          public void setCellComment(Comment comment)

      Assign a comment to this cell
      Parameters:
        `comment` - comment associated with this cell

    - #### getCellComment

          public Comment getCellComment()

      Returns comment associated with this cell
      Returns:
        comment associated with this cell or `null` if not found

    - #### removeCellComment

          public void removeCellComment()

      Removes the comment for this cell, if there is one.

    - #### getHyperlink

          public Hyperlink getHyperlink()

      Returns:
        hyperlink associated with this cell or `null` if not found

    - #### setHyperlink

          public void setHyperlink(Hyperlink link)

      Assign a hyperlink to this cell. If the supplied hyperlink is null, the hyperlink for this cell will be removed.
      Parameters:
        `link` - hyperlink associated with this cell

    - #### removeHyperlink

          public void removeHyperlink()

      Removes the hyperlink for this cell, if there is one.

    - #### getArrayFormulaRange

          @NotImplemented
          public CellRangeAddress getArrayFormulaRange()

      Only valid for array formula cells
      Returns:
        range of the array formula group that the cell belongs to.

    - #### isPartOfArrayFormulaGroup

          @NotImplemented
          public boolean isPartOfArrayFormulaGroup()

      Returns:
        `true` if this cell is part of group of cells having a common array formula.

    - #### toString

          public java.lang.String toString()

      Returns a string representation of the cell

      Formula cells return the formula string, rather than the formula result. Dates are displayed in dd-MMM-yyyy format Errors are displayed as #ERR<errIdx>

      Overrides:
        `toString` in class `java.lang.Object`

Copyright 2020 The Apache Software Foundation or its licensors, as applicable.