We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Bad results when saving html workbook to xlsx on Linux machine

Hi,

I’m using Aspose cells version 19.10.
I have an html file with a table which I would like to save to an Xlsx file.

  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);

On my Windows machine (with German or even English region settings) everything works fine, but on a different Linux machine the results are not correct. So far I noticed two problems in the resulted Xlsx file:

  1. On some cells there are some spaces before and after the number (1.831.100 -> " 1.831.000 " and should be “1,841,100” or “1.831.000”, depending on region formatting )
  2. Some numbers are transformed badly - 5.000 is transformed to 5.000 (but real number is 5) instead of 5,000 (5 thousand)

What do you think could be the cause of these problems on the Linux machine (it’s an Ubuntu 19.10")?
I have attached the html input file + both results (the good one and the bad one).

Please advise,
Regards,
Sergiu Martinfiles.zip (18.4 KB)

@ssmartin81,

Since you are using some older version of the product, so we may not evaluate your issue using the older version of the API. We recommend you to kindly try our latest version/fix: Aspose.Cells for Java 21.10. If you still find the problem using the latest version, kindly do highlight the issue(s) (especially the second one) in a screenshot when comparing input HTML Vs output Excel file. We will check your issue soon.

Thanks @Amjad_Sahi for the reply.

For now I can’t update to the latest version, but below I provide the two pictures (Also in the attachments you have the input html and both the good and bad resulted xlsx files).

Hope this is enough for now, please let me know if you have any ideas what could cause this?

Best regards,
SergiugoodSave.png (166.5 KB)
badSave.png (222.4 KB)

@ssmartin81,

We are sorry but we cannot evaluate the issue using older version of the APIs. You need to test the issue separately using the latest version in a separate project on your environment. You may skip setting license and just try the latest version in evaluation mode and let us know your feedback. In case, the issue occurred with latest version/fix, you may provide complete environment details (OS and version, display settings (scale) set on the os, JDK version, etc.).

Hi @Amjad_Sahi

I managed to fix the problems by setting the locale to the LoadOptions on loading and workbook settings on saving.

Thank you for the reply!

@ssmartin81,

Good to know that you have sorted out your issue now. In the event of further queries or comments, feel free to write us back.