Problem with BigDecimal values and format masks

Hi Aspose,
I would like to report an issue when BigDecimal values are supplied as merge field value when there is format defined, and when it is used locale that uses comma as decimal separator. I guess that cause for that is that BigDecimal is converted to string using toString(), and it always uses dot as decimal separator (does not uses it from current locale).

Here is example:
[case 1] {MERGEFIELD field1 # “0,00”}
[case 2] {MERGEFIELD field1 # “#.##0,00”}
[case 3] {MERGEFIELD field2 # “0,00”}
[case 4] {MERGEFIELD field2 # “#.##0,00”}

If we run this template in Dutch locale in jvm, and add BigDecimal for field1, and Double as field2:
Document doc = new Document(“C:\template.docx”);
doc.getMailMerge().execute(new String[]{“field1”, “field2”}, new Object[]{BigDecimal.valueOf(1234567.8d), Double.valueOf(1234567.8d)});
doc.save(“C:\out.docx”);

We get:
[case 1] 12.345.678,00
[case 2] 12345678,00
[case 3] 1.234.567,80
[case 4] 1234567,80

So, it shows that it works for Double, but not for BigDecimal.
Our workaround is therefore to work with Double instead of BigDecimal, but it could help maybe someone to understand/fix his problem, and also you can improve your great library by fixing this.

Regards,
Vladimir

Hi Vladimir,


Thanks for your inquiry. I have managed to reproduce the same issue at my side. I have logged this issue as WORDSJAVA-664 in our issue tracking system. I have linked this forum thread to the same issue and you will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

The issues you have found earlier (filed as WORDSJAVA-664) have been fixed in this .NET update and this Java update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.