You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2016/01/16 14:44:57 UTC
[Bug 58877] New: Cannot get a numeric value from a error formula
cell
https://bz.apache.org/bugzilla/show_bug.cgi?id=58877
Bug ID: 58877
Summary: Cannot get a numeric value from a error formula cell
Product: POI
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: major
Priority: P2
Component: HSSF
Assignee: dev@poi.apache.org
Reporter: harisingh.rajput@discusit.com
try {
if (cell.getCellType() == Cell.CELL_TYPE_FORMULA) {
FormulaEvaluator fe =
workbook.getCreationHelper().createFormulaEvaluator();
String formatCellValue = formatter.formatCellValue(cell,
fe);
System.out.println("FE : " + formatCellValue);
}
} catch (NotImplementedException et) {
System.err.println("ERR : " + et.getMessage());
// String j_username = formatter.formatCellValue(cell);
// System.out.println(j_username);
System.out.println(cell.getNumericCellValue());
>From above code, I could get RSQ function cell(formula cell) value by
cell.getNumericCellValue() but after writing it by output stream, I could not
get cell value from output file.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 58877] Cannot get a numeric value from a error formula cell
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=58877
Nick Burch <ap...@gagravarr.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |INVALID
Status|NEW |RESOLVED
--- Comment #1 from Nick Burch <ap...@gagravarr.org> ---
For formula cells, you need to check the cached formula result type, and fetch
the cell's value based on that -
https://poi.apache.org/apidocs/org/apache/poi/ss/usermodel/Cell.html#getCachedFormulaResultType%28%29
. You cannot blindly fetch the numeric value for formula cells, as many
formulas don't resolve to numbers, eg they give a String or an Error (as in
your case)
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org