Class SXSSFCell

  • All Implemented Interfaces:
    Cell

    public class SXSSFCell
    extends CellBase
    Streaming version of XSSFCell implementing the "BigGridDemo" strategy.
    • Method Detail

      • 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
      • getCellType

        public CellType getCellType()
        Return the cell type.
        Returns:
        the cell type
      • getCellFormula

        public String getCellFormula()
        Return a formula for the cell, for example, SUM(C4:E4)
        Returns:
        a formula for the cell
        Throws:
        IllegalStateException - if the cell type returned by getCellType() is not CellType.FORMULA
      • 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 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:
        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:
        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/retrieved 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()
      • 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 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 Object