Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.poi.xssf.streaming
Class SXSSFCell

    java.lang.Object
      org.apache.poi.xssf.streaming.SXSSFCell

All Implemented Interfaces:
  Cell

    public class SXSSFCell

extends java.lang.Object
implements Cell

Streaming version of XSSFRow implementing the "BigGridDemo" strategy.

Field Summary

Fields inherited from interface org.apache.poi.ss.usermodel.Cell
`CELL_TYPE_BLANK, CELL_TYPE_BOOLEAN, CELL_TYPE_ERROR, CELL_TYPE_FORMULA, CELL_TYPE_NUMERIC, CELL_TYPE_STRING`

Constructor Summary
`SXSSFCell(SXSSFRow row, CellType cellType)`

Method Summary
`CellAddress` | `getAddress()` Gets the address of this cell
`CellRangeAddress` | `getArrayFormulaRange()` Only valid for array formula cells
`boolean` | `getBooleanCellValue()` Get the value of the cell as a boolean.
`int` | `getCachedFormulaResultType()` Deprecated. 3.15. Will return a `CellType` enum in the future.
`CellType` | `getCachedFormulaResultTypeEnum()` Only valid for formula cells
`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.
`int` | `getCellType()` Deprecated. 3.15. Will return a `CellType` enum in the future.
`CellType` | `getCellTypeEnum()` 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()`
`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
`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.
`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` | `setCellFormula(java.lang.String formula)` Sets formula for this cell.
`void` | `setCellStyle(CellStyle style)` Set the style for the cell.
`void` | `setCellType(CellType cellType)` Set the cells type (numeric, formula or string)
`void` | `setCellType(int cellType)` Deprecated. POI 3.15 beta 3. Use `setCellType(CellType)` instead. Will be deleted when we make the CellType enum transition. See bug 59791.
`void` | `setCellValue(boolean value)` Set a boolean value for the cell
`void` | `setCellValue(java.util.Calendar value)` Set a date value for the cell.
`void` | `setCellValue(java.util.Date value)` Converts the supplied date to its equivalent Excel numeric value and sets that into the cell.
`void` | `setCellValue(double value)` Set a numeric value for the cell
`void` | `setCellValue(RichTextString value)` Set a rich string value for the cell.
`void` | `setCellValue(java.lang.String value)` Set a string value for the cell.
`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 java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### SXSSFCell

    public SXSSFCell(SXSSFRow row,
                     CellType cellType)

Method Detail

### getColumnIndex

    public int getColumnIndex()

  Returns column index of this cell

  Specified by:
    `getColumnIndex` in interface `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

  Specified by:
    `getRowIndex` in interface `Cell`
  Returns:
    zero-based row index of a row in the sheet that contains this cell

### getAddress

    public CellAddress getAddress()

  Gets the address of this cell

  Specified by:
    `getAddress` in interface `Cell`
  Returns:
    `A1` style address of this cell

### getSheet

    public SXSSFSheet getSheet()

  Returns the sheet this cell belongs to

  Specified by:
    `getSheet` in interface `Cell`
  Returns:
    the sheet this cell belongs to

### getRow

    public Row getRow()

  Returns the Row this cell belongs to

  Specified by:
    `getRow` in interface `Cell`
  Returns:
    the Row that owns this cell

### setCellType

    public void setCellType(int cellType)

  Deprecated. POI 3.15 beta 3. Use `setCellType(CellType)` instead. Will be deleted when we make the CellType enum transition. See bug 59791.

  Set the cells type (numeric, formula or string)

  Specified by:
    `setCellType` in interface `Cell`
  Throws:
    `java.lang.IllegalArgumentException` - if the specified cell type is invalid
  See Also:
    `CellType.NUMERIC`, `CellType.STRING`, `CellType.FORMULA`, `CellType.BLANK`, `CellType.BOOLEAN`, `CellType.ERROR`

### setCellType

    public void setCellType(CellType cellType)

  Set the cells type (numeric, formula or string)

  Specified by:
    `setCellType` in interface `Cell`
  Throws:
    `java.lang.IllegalArgumentException` - if the specified cell type is invalid

### getCellType

    public int getCellType()

  Deprecated. 3.15. Will return a `CellType` enum in the future.

  Return the cell type.

  Specified by:
    `getCellType` in interface `Cell`
  Returns:
    the cell type

### getCellTypeEnum

    public CellType getCellTypeEnum()

  Return the cell type.

  Specified by:
    `getCellTypeEnum` in interface `Cell`
  Returns:
    the cell type
  Since:
    POI 3.15 beta 3 Will be deleted when we make the CellType enum transition. See bug 59791.

### getCachedFormulaResultType

    public int getCachedFormulaResultType()

  Deprecated. 3.15. Will return a `CellType` enum in the future.

  Only valid for formula cells

  Specified by:
    `getCachedFormulaResultType` in interface `Cell`
  Returns:
    one of (`CellType.NUMERIC`, `CellType.STRING`, `CellType.BOOLEAN`, `CellType.ERROR`) depending on the cached value of the formula

### getCachedFormulaResultTypeEnum

    public CellType getCachedFormulaResultTypeEnum()

  Only valid for formula cells

  Specified by:
    `getCachedFormulaResultTypeEnum` in interface `Cell`
  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 Will be deleted when we make the CellType enum transition. See bug 59791.

### setCellValue

    public void setCellValue(double value)

  Set a numeric value for the cell

  Specified by:
    `setCellValue` in interface `Cell`
  Parameters:
    `value` - the numeric value to set this cell to. For formulas we'll set the precalculated value, for numerics we'll set its value. For other types we will change the cell to a numeric cell and set its value.

### setCellValue

    public void setCellValue(java.util.Date value)

  Converts the supplied date to its equivalent Excel numeric value and sets that into the cell.

  Note - There is actually no 'DATE' cell type in Excel. In many cases (when entering date values), Excel automatically adjusts the cell style to some date format, creating the illusion that the cell data type is now something besides `CellType.NUMERIC`. POI does not attempt to replicate this behaviour. To make a numeric cell display as a date, use `setCellStyle(CellStyle)` etc.

  Specified by:
    `setCellValue` in interface `Cell`
  Parameters:
    `value` - the numeric value to set this cell to. For formulas we'll set the precalculated value, for numerics we'll set its value. For other types we will change the cell to a numerics cell and set its value.

### setCellValue

    public void setCellValue(java.util.Calendar value)

  Set a date value for the cell. Excel treats dates as numeric so you will need to format the cell as a date.

  This will set the cell value based on the Calendar's timezone. As Excel does not support timezones this means that both 20:00+03:00 and 20:00-03:00 will be reported as the same value (20:00) even that there are 6 hours difference between the two times. This difference can be preserved by using `setCellValue(value.getTime())` which will automatically shift the times to the default timezone.

  Specified by:
    `setCellValue` in interface `Cell`
  Parameters:
    `value` - the date value to set this cell to. For formulas we'll set the precalculated value, for numerics we'll set its value. For othertypes we will change the cell to a numeric cell and set its value.

### setCellValue

    public void setCellValue(RichTextString value)

  Set a rich string value for the cell.

  Specified by:
    `setCellValue` in interface `Cell`
  Parameters:
    `value` - value to set the cell to. For formulas we'll set the formula string, for String cells we'll set its value. For other types we will change the cell to a string cell and set its value. If value is null then we will change the cell to a Blank cell.

### setCellValue

    public void setCellValue(java.lang.String value)

  Set a string value for the cell.

  Specified by:
    `setCellValue` in interface `Cell`
  Parameters:
    `value` - value to set the cell to. For formulas we'll set the formula string, for String cells we'll set its value. For other types we will change the cell to a string cell and set its value. If value is null then we will change the cell to a Blank cell.

### setCellFormula

    public void setCellFormula(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 `setCellValue(double)` or `setCellValue(String)`

  Specified by:
    `setCellFormula` in interface `Cell`
  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

### getCellFormula

    public java.lang.String getCellFormula()

  Return a formula for the cell, for example, `SUM(C4:E4)`

  Specified by:
    `getCellFormula` in interface `Cell`
  Returns:
    a formula for the cell
  Throws:
    `java.lang.IllegalStateException` - if the cell type returned by `getCellTypeEnum()` 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;

  Specified by:
    `getNumericCellValue` in interface `Cell`
  Returns:
    the value of the cell as a number
  Throws:
    `java.lang.IllegalStateException` - if the cell type returned by `getCellTypeEnum()` 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.

  Specified by:
    `getDateCellValue` in interface `Cell`
  Returns:
    the value of the cell as a date
  Throws:
    `java.lang.IllegalStateException` - if the cell type returned by `getCellTypeEnum()` 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.

  Specified by:
    `getRichStringCellValue` in interface `Cell`
  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.

  Specified by:
    `getStringCellValue` in interface `Cell`
  Returns:
    the value of the cell as a string

### setCellValue

    public void setCellValue(boolean value)

  Set a boolean value for the cell

  Specified by:
    `setCellValue` in interface `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

  Specified by:
    `setCellErrorValue` in interface `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.

  Specified by:
    `getBooleanCellValue` in interface `Cell`
  Returns:
    the value of the cell as a boolean
  Throws:
    `java.lang.IllegalStateException` - if the cell type returned by `getCellTypeEnum()` 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.

  Specified by:
    `getErrorCellValue` in interface `Cell`
  Returns:
    the value of the cell as an error code
  Throws:
    `java.lang.IllegalStateException` - if the cell type returned by `getCellTypeEnum()` 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)`

  Specified by:
    `setCellStyle` in interface `Cell`
  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.

  Specified by:
    `getCellStyle` in interface `Cell`
  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

  Specified by:
    `setAsActiveCell` in interface `Cell`

### setCellComment

    public void setCellComment(Comment comment)

  Assign a comment to this cell

  Specified by:
    `setCellComment` in interface `Cell`
  Parameters:
    `comment` - comment associated with this cell

### getCellComment

    public Comment getCellComment()

  Returns comment associated with this cell

  Specified by:
    `getCellComment` in interface `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.

  Specified by:
    `removeCellComment` in interface `Cell`

### getHyperlink

    public Hyperlink getHyperlink()

  Specified by:
    `getHyperlink` in interface `Cell`
  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.

  Specified by:
    `setHyperlink` in interface `Cell`
  Parameters:
    `link` - hyperlink associated with this cell

### removeHyperlink

    public void removeHyperlink()

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

  Specified by:
    `removeHyperlink` in interface `Cell`

### getArrayFormulaRange

    @NotImplemented
    public CellRangeAddress getArrayFormulaRange()

  Only valid for array formula cells

  Specified by:
    `getArrayFormulaRange` in interface `Cell`
  Returns:
    range of the array formula group that the cell belongs to.

### isPartOfArrayFormulaGroup

    @NotImplemented
    public boolean isPartOfArrayFormulaGroup()

  Specified by:
    `isPartOfArrayFormulaGroup` in interface `Cell`
  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`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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