Cell.
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| public CellAddress | |
| protected abstract SpreadsheetVersion | Returns: the spreadsheet versionGet the spreadsheet version for the given implementation. |
| protected final CellType | |
| public final void | |
| protected abstract void | |
| public void | setBlank()
Implements org. Removes formula and value from the cell, and sets its type to |
| public final void | setCellFormula(String
the formula to set, e.g. formula)"SUM(C4:E4)".
If the argument is null then the current formula is removed.Implements org. Sets formula for this cell. |
| protected abstract void | setCellFormulaImpl(String
The text of the formula to set. formula)Implementation-specific setting the formula. |
| public final void | setCellType(CellType cellType)
Implements org. Set the cells type (blank, numeric, boolean, error or string). |
| protected abstract void | setCellTypeImpl(CellType
new cell type. Guaranteed non-null, not _NONE. cellType)Implementation-specific logic |
| public void | setCellValue(double
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. value)Implements org. Set a numeric value for the cell. |
| public void | setCellValue(Date
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. value)Implements org. Converts the supplied date to its equivalent Excel numeric value and sets that into the cell. |
| public void | setCellValue(LocalDateTime
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. value)Implements org. Converts the supplied date to its equivalent Excel numeric value and sets that into the cell. |
| public void | setCellValue(Calendar
the date 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. value)Implements org. Set a date value for the cell. |
| public void | setCellValue(String
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. value)Implements org. Set a string value for the cell. |
| public void | setCellValue(RichTextString
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. value)Implements org. Set a rich string value for the cell. |
| protected abstract void | setCellValueImpl(double
the new value to set value)Implementation-specific way to set a numeric value. |
| protected abstract void | |
| protected abstract void | setCellValueImpl(LocalDateTime
the new date to set value)Implementation-specific way to set a date value. |
| protected abstract void | setCellValueImpl(Calendar
the new calendar value to set value)Implementation-specific way to set a calendar value. |
| protected abstract void | setCellValueImpl(String
the new value to set. value)Implementation-specific way to set a string value. |
| protected abstract void | setCellValueImpl(RichTextString
the new value to set. value)Implementation-specific way to set a RichTextString value. |
| public final void | tryToDeleteArrayFormula(String
a customized exception message for the case if deletion of the cell is impossible. If null, a
default message will be generated message)Called when this an array formula in this cell is deleted. |
| private void |
| CellBase | back to summary |
|---|---|
| public CellBase() | |
| checkLength | back to summary |
|---|---|
| private void checkLength(String value) | |
| getAddress | back to summary |
|---|---|
| public CellAddress getAddress() Implements org. Doc from org. Gets the address of this cell
| |
| getSpreadsheetVersion | back to summary |
|---|---|
| protected abstract SpreadsheetVersion getSpreadsheetVersion() Get the spreadsheet version for the given implementation.
| |
| getValueType | back to summary |
|---|---|
| protected final CellType getValueType() Get value type of this cell. Can return BLANK, NUMERIC, STRING, BOOLEAN or ERROR.
For current implementations where type is strongly coupled with formula, is equivalent to
This is meant as a temporary helper method until the time when value type is decoupled from the formula.
| |
| removeFormula | back to summary |
|---|---|
| public final void removeFormula() Implements org. Doc from org. Removes formula, if any. If cell was blank, leaves it as is. If it is a part of an array formula group, blanks the cell. If has a regular formula, removes the formula preserving the "cached" value.
| |
| removeFormulaImpl | back to summary |
|---|---|
| protected abstract void removeFormulaImpl() Implementation-specific removal of the formula. The cell is guaranteed to have a regular formula set. Shall preserve the "cached" value. | |
| setBlank | back to summary |
|---|---|
| public void setBlank() Implements org. Doc from org. Removes formula and value from the cell, and sets its type to
| |
| setCellFormula | back to summary |
|---|---|
| public final void setCellFormula(String formula) throws FormulaParseException, IllegalStateException Implements org. Doc from org. Sets formula for this cell. If Note, this method only sets the formula string and does not calculate the formula value.
To set the precalculated value use If the cell was blank, sets value to 0. Otherwise, preserves the value as precalculated. In XSSF implementation, there is a
| |
| setCellFormulaImpl | back to summary |
|---|---|
| protected abstract void setCellFormulaImpl(String formula) Implementation-specific setting the formula. Formula is not null. Shall not change the value.
| |
| setCellType | back to summary |
|---|---|
| public final void setCellType(CellType cellType) Implements org. Doc from org. Set the cells type (blank, numeric, boolean, error or string). If the cell currently contains a value, the value will be converted to match the new type, if possible. Formatting is generally lost in the process however. Conversion rules: to NUMERIC: numeric value is left as is. True converts to 1.0, false converts to 0. otherwise, the value is set to 0. Formula is removed. If what you want to do is get a String value for your
numeric cell, stop! This is not the way to do it.
Instead, for fetching the string value of a numeric or boolean
or date cell, use If cell is a member of an array formula group containing more than 1 cell, an Passing
| |
| setCellTypeImpl | back to summary |
|---|---|
| protected abstract void setCellTypeImpl(CellType cellType) Implementation-specific logic
| |
| setCellValue | back to summary |
|---|---|
| public void setCellValue(double value) Implements org. Doc from org. Set a numeric value for the cell.
| |
| setCellValue | back to summary |
|---|---|
| public void setCellValue(Date value) Implements org. Doc from org. 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 | |
| setCellValue | back to summary |
|---|---|
| public void setCellValue(LocalDateTime value) Implements org. Doc from org. 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
| |
| setCellValue | back to summary |
|---|---|
| public void setCellValue(Calendar value) Implements org. Doc from org. 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 | back to summary |
|---|---|
| public void setCellValue(String value) Implements org. Doc from org. Set a string value for the cell. | |
| setCellValue | back to summary |
|---|---|
| public void setCellValue(RichTextString value) Implements org. Doc from org. Set a rich string value for the cell.
| |
| setCellValueImpl | back to summary |
|---|---|
| protected abstract void setCellValueImpl(double value) Implementation-specific way to set a numeric value.
| |
| setCellValueImpl | back to summary |
|---|---|
| protected abstract void setCellValueImpl(Date value) Implementation-specific way to set a date value.
| |
| setCellValueImpl | back to summary |
|---|---|
| protected abstract void setCellValueImpl(LocalDateTime value) Implementation-specific way to set a date value.
| |
| setCellValueImpl | back to summary |
|---|---|
| protected abstract void setCellValueImpl(Calendar value) Implementation-specific way to set a calendar value.
| |
| setCellValueImpl | back to summary |
|---|---|
| protected abstract void setCellValueImpl(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
| |
| setCellValueImpl | back to summary |
|---|---|
| protected abstract 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
| |
| tryToDeleteArrayFormula | back to summary |
|---|---|
| public final void tryToDeleteArrayFormula(String message) Called when this an array formula in this cell is deleted. The purpose of this method is to validate the cell state prior to modification.
| |
| tryToDeleteArrayFormulaIfSet | back to summary |
|---|---|
| private void tryToDeleteArrayFormulaIfSet() | |