Use the same "is this a formula" logic for both getCellType and getCachedFormulaResultType
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1693767 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
98ed7bb5fb
commit
42bf5e5fc6
@ -536,6 +536,13 @@ public final class XSSFCell implements Cell {
|
|||||||
_cell.setS(idx);
|
_cell.setS(idx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isFormulaCell() {
|
||||||
|
if (_cell.getF() != null || getSheet().isCellInArrayFormulaContext(this)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the cell type.
|
* Return the cell type.
|
||||||
@ -550,10 +557,7 @@ public final class XSSFCell implements Cell {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int getCellType() {
|
public int getCellType() {
|
||||||
|
if (isFormulaCell()) return CELL_TYPE_FORMULA;
|
||||||
if (_cell.getF() != null || getSheet().isCellInArrayFormulaContext(this)) {
|
|
||||||
return CELL_TYPE_FORMULA;
|
|
||||||
}
|
|
||||||
|
|
||||||
return getBaseCellType(true);
|
return getBaseCellType(true);
|
||||||
}
|
}
|
||||||
@ -566,7 +570,7 @@ public final class XSSFCell implements Cell {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int getCachedFormulaResultType() {
|
public int getCachedFormulaResultType() {
|
||||||
if (_cell.getF() == null) {
|
if (! isFormulaCell()) {
|
||||||
throw new IllegalStateException("Only formula cells have cached results");
|
throw new IllegalStateException("Only formula cells have cached results");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user