Region settings for Date format while converting XLSX to PDF ussing Aspose.Cells for Java

Hello Aspose Team,


When I convert a XLSX file to PDF the date format is not respecting the format of the original file. In the file it is day/month/year, but when I convert it becomes month/day/year.

How do I maintain it?

Hi Mario,


Thank you for contacting Aspose support.

Please note, inbuilt date/number formats convert according to the regional settings of the machine. Please try setting the Workbook’s region to Default after loading the spreadsheet. Check the following piece of code and give it a try on your side. In case the problem persists, please provide us the spreadsheet in question along with it’s resultant PDF.

Java

Workbook book = new Workbook(input);
book.getSettings().setRegion(CountryCode.DEFAULT);
Thanks for the answer Babar.

But it didn't work. The problem is with the server hosting the application. If I test in my PC it works fine, but not on the server.

I tested:

book.getSettings().setRegion(CountryCode.BRAZIL);

But it didn't work also. (dd/MM/yyyy is the default date format in Brazil)

Isn't there a way to "force" it on the entire spreadsheet?

Hi Mario,


We are sorry to know that the presented solution didn’t help, however, it should. Please confirm the Aspose.Cells API version you are currently using on the problematic server. If your current version is lower than 8.5.0 then please give a try to the latest version by downloading it from the Aspose download section.

In case the problem persists with latest version too then we need the following information/artifacts for further investigation.

  • Operating system version & architecture of your server.
  • JDK type & version installed on the server.
  • Locale/Region set for the server.
  • Any JVM arguments you are setting for your application and/or for the conversion process.
  • Sample spreadsheets that replicate the said issue with latest version of the API.
  • Sample code to replicate the problem.