Aspose 单元格 - 在 Linux 机器上将 html 工作簿保存到 Xlsx 时出现错误结果

Aspose cells - Bad results when saving html workbook to Xlsx on Linux machine

我使用的是 Aspose cells 版本 19.10。 我有一个带有 table 的 html 文件,我想将其保存到 Xlsx 文件中。

        HtmlLoadOptions loadOptions = new HtmlLoadOptions();
        loadOptions.setLocale(Locale.GERMANY);
        loadOptions.setRegion(CountryCode.GERMANY);
        loadOptions.setLanguageCode(CountryCode.GERMANY);
        loadOptions.setAutoFitColsAndRows(true);
        loadOptions.setDeleteRedundantSpaces(true);
        loadOptions.setKeepPrecision(true);
        loadOptions.setCheckExcelRestriction(true);

        workbook = new Workbook(inputStream, loadOptions);
        workbook.getSettings().setLocale(Locale.GERMANY);
        workbook.getSettings().setRegion(CountryCode.GERMANY);
        workbook.getSettings().setLanguageCode(CountryCode.GERMANY);
        workbook.getSettings().setNumberDecimalSeparator('.');
        workbook.getSettings().setNumberGroupSeparator(' ');
        workbook.save(targetOutputStream, SaveFormat.XLSX);

在我的 Windows 机器上(德语甚至英语区域设置)一切正常,但在不同的 Linux 机器上结果不正确。到目前为止,我注意到生成的 Xlsx 文件中存在两个问题:

在某些单元格中,数字前后有一些空格(1.831.100 -> " 1.831.000 ",应为“1,841,100”或“1.831.000”,具体取决于区域格式) 有些数字转换不好——5.000 转换为 5.000(但实数是 5)而不是 5,000(5 千)

您认为 Linux 机器(Ubuntu 19.10")出现这些问题的原因是什么?

请指教, 塞尔吉乌

最后,我通过在加载文档时将区域设置设置为 LoadOptions 以及在将其保存到 xlsx 之前设置工作簿设置来解决问题。