mirror of
https://github.com/apache/poi.git
synced 2025-02-07 18:48:20 +00:00
[bug-69529] try to workaround cells with numeric type whose format cannot be applied
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1922985 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8d73b7ac2b
commit
116c32137d
@ -426,10 +426,18 @@ public class XSSFSheetXMLHandler extends DefaultHandler {
|
||||
|
||||
case NUMBER:
|
||||
String n = value.toString();
|
||||
if (this.formatString != null && n.length() > 0)
|
||||
thisStr = formatter.formatRawCellContents(Double.parseDouble(n), this.formatIndex, this.formatString);
|
||||
else
|
||||
if (this.formatString != null && n.length() > 0) {
|
||||
try {
|
||||
thisStr = formatter.formatRawCellContents(
|
||||
Double.parseDouble(n), this.formatIndex, this.formatString);
|
||||
} catch (NumberFormatException e) {
|
||||
LOG.atInfo().log("Error formatting cell '{}' - will use its raw value instead",
|
||||
cellRef);
|
||||
thisStr = n;
|
||||
}
|
||||
} else {
|
||||
thisStr = n;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
Loading…
x
Reference in New Issue
Block a user