Specify Custom Number Decimal and Group Separators for Workbook doesn't work

Hi,

i’m trying to change the decimal and group separator on a workbook which setting locale is Locale.<span style=“font-family: “Courier New”; background-color: rgb(228, 228, 255);”>ITALIAN . but it doesn’t work. here is my code.

<pre style=“font-family: “Courier New”; background-color: rgb(255, 255, 255);”>Workbook workbook = new Workbook();
workbook.getSettings().setLocale(Locale.ITALIAN);
workbook.getSettings().setNumberDecimalSeparator(’.’);
workbook.getSettings().setNumberGroupSeparator(’,’);
Worksheet worksheet = workbook.getWorksheets().get(0);
Cell cell = worksheet.getCells().get(“A1”);
cell.putValue(123456.789);
Style style = cell.getStyle();
style.setCustom("#,##0.000;-#,##0.000");
cell.setStyle(style);
System.out.println(cell.getDisplayStringValue());
I expected 123,456.789 but it returns <span style=“white-space: normal; font-family: “Times New Roman”;”>123,456,789. It seems that it doesn’t consider the decimal separator. Any idea how can i solve this? 

Hi,


Please comment out the following line of code, it would work as per your expectations:
e.g
Sample code:
<span style=“font-family: “Courier New”; font-size: 13.44px; background-color: rgb(255, 255, 255);”>
<span style=“font-family: “Courier New”; font-size: 13.44px; background-color: rgb(255, 255, 255);”>workbook.getSettings().setLocale(Locale.<span style=“font-family: “Courier New”; font-size: 13.44px; color: rgb(102, 14, 122); font-weight: bold; font-style: italic;”>ITALIAN<span style=“font-family: “Courier New”; font-size: 13.44px; background-color: rgb(255, 255, 255);”>);

Thank you.

Hi,


works cause it takes the default locale to English i think.
But for example if
<pre style=“font-family: “Courier New”; background-color: rgb(255, 255, 255);”>Workbook workbook = new Workbook();
// workbook.getSettings().setLocale(Locale.ITALIAN);
workbook.getSettings().setNumberDecimalSeparator(’,’);
workbook.getSettings().setNumberGroupSeparator(’.’);
Worksheet worksheet = workbook.getWorksheets().get(0);
Cell cell = worksheet.getCells().get(“A1”);
cell.putValue(123456.789);
Style style = cell.getStyle();
style.setCustom("#,##0.000;-#,##0.000");
cell.setStyle(style);
System.out.println(cell.getDisplayStringValue());
It return 123.456.789 insted of 123.456,789
Hi,

Well, to workaround this time, you need not to set number decimal separator and group separator, you only need to set ITALIAN locale. Anyways, I observed the original issue as you mentioned. I found specifying Custom Number Decimal and Group Separators for Workbook is not supported. It works fine with the default Number Decimal and Group Separators (automatically set) for different locales (e.g ITALIAN) but if we need to customize the Number Decimal and Group Separators in the code while using specific locale e.g the ITALIAN locale, it won't work.
e.g
Sample code:

Workbook workbook = new Workbook();
workbook.getSettings().setLocale(Locale.ITALIAN);
workbook.getSettings().setNumberDecimalSeparator('.');
workbook.getSettings().setNumberGroupSeparator(',');
Worksheet worksheet = workbook.getWorksheets().get(0);
Cell cell = worksheet.getCells().get("A1");
cell.putValue(123456.789);
Style style = cell.getStyle();
style.setCustom("#,##0.000;-#,##0.000");
cell.setStyle(style);
System.out.println(cell.getDisplayStringValue()); //It should return 123,456.789 but it returns 123,456,789 which is wrong.

I have logged a ticket with an id "CELLSJAVA-41909" for your issue. We will look into it to figure it out soon.

Thank you.

Hi,

Thanks for your using Aspose.Cells.

Please download and try the latest fix: Aspose.Cells for Java v8.8.3.5 and let us know your feedback.

Hi,


it works. When it will be release? in 8.8.4?

Hi,


Thanks for your feedback.

Good to know that your issue is sorted out by the new fix. Well, you may use this fix for your needs, it will behave like an official release. It has all the functionality, enhancements and fixes (full fledged) since the release of v8.8.3 till that version/fix v8.8.3.4. You may use this fix for production server. By the way, we are scheduled to release our next official version (Aspose.Cells for Java v8.9.0) in the third or fourth week of July 2016, so you have to wait a bit if you want to use official release from Downloads module. You will also get automatic notification when we publish our next version.

Thank you.

The issues you have found earlier (filed as CELLSJAVA-41909) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.