[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@1922986 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
PJ Fanning 2025-01-08 11:21:24 +00:00
parent 116c32137d
commit b0515e7493

View File

@ -396,6 +396,10 @@ public class XSSFSheetXMLHandler extends DefaultHandler {
thisStr = formatter.formatRawCellContents(d, this.formatIndex, this.formatString);
} catch (NumberFormatException e) {
// Formula is a String result not a Numeric one
LOG.atInfo().log(
"Error formatting cell '{}' - will use its raw value instead (format '{}')",
cellRef,
this.formatString);
thisStr = fv;
}
} else {
@ -431,8 +435,10 @@ public class XSSFSheetXMLHandler extends DefaultHandler {
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);
LOG.atInfo().log(
"Error formatting cell '{}' - will use its raw value instead (format '{}')",
cellRef,
this.formatString);
thisStr = n;
}
} else {