Linux Windows与Java读取Excel的不同结果

Linux Windows与Java读取Excel的不同结果,java,apache-poi,Java,Apache Poi,我正在用Windows在本地主机上用Java阅读Excel,然后生成.war并将此代码上载到服务器Linux,但我得到了不同的结果---> 我的代码有2000行-> switch (cell.getCellType()) { case Cell.CELL_TYPE_FORMULA: LOGGER.info("CELL_TYPE_FORMULA"); try { LOGG

我正在用Windows在本地主机上用Java阅读Excel,然后生成.war并将此代码上载到服务器Linux,但我得到了不同的结果--->

我的代码有2000行->

switch (cell.getCellType()) {
            case Cell.CELL_TYPE_FORMULA:
                LOGGER.info("CELL_TYPE_FORMULA");
                try {
                    LOGGER.info("Intentar parsear la formula");
                    stringValue = NumberFormat.getNumberInstance().format(cell.getNumericCellValue())
                            .replaceAll("\\.", "");
                } catch (Exception ex) {
                    // El resultado de la formula es ' - ' , eso no se puede parsear.
                    LOGGER.error("------------------------------------------------------------");
                    LOGGER.error("------------------------------------------------------------");
                    LOGGER.error("El resultado de la formula es ' - ' , no se puede parsear.");
                    LOGGER.error("Error previsible y controlado.");
                    LOGGER.error(ex.getMessage() + ex);
                    LOGGER.error(ex.getLocalizedMessage());
                    LOGGER.error("------------------------------------------------------------");
                    LOGGER.error("------------------------------------------------------------");

                    stringValue = null;
                }
                break;

        }
当我用Windows阅读这篇文章时,我得到->

在linux中->

在我的国家,“是千的”,“是十进制的

有些人会说“你可以做所有的事”,“因为”,但在我的国家,“是非常重要的

与->

  stringValue = NumberFormat.getNumberInstance().format(cell.getNumericCellValue())
Excel->

在我的国家是“3600万”

我用

<dependency>
    <groupId>org.apache.poi</groupId>
    <artifactId>poi-ooxml</artifactId>
    <version>3.15</version>
</dependency>

org.apache.poi
poi ooxml
3.15
在windows中是可以的,但在Linux中我得到了其他结果。。。 在windows中,我失去了“数千个”,但我不在乎,当Linux改变时,它是危险的

尝试在构造函数中使用Locale对象创建NumberFormatter

以下是受支持的区域设置列表: (您可以选择语言和国家/地区的不同组合,例如:en_GB、en_US、ja_JP)

数字格式在不同地区的工作方式:

123 456   fr_FR
123.456   de_DE
123,456   en_US

新区域设置(“es”),现在Windows->>36500000 failI是错误的。尝试新区域设置(“es”,“es”);-它是正确的区域设置构造函数,使用
apache poi
将是更好的方法。请参阅。而不是
stringValue=NumberFormat.getNumberInstance().format(cell.getNumericCellValue())
do
…DataFormatter formatter=newdataformatter(新区域设置(“es”、“es”));…stringValue=formatter.formatCellValue(单元格);…
123 456   fr_FR
123.456   de_DE
123,456   en_US