Show amounts with european currency (euro)

Help for developers that uses and extend DJ

Moderator: djmamana

Show amounts with european currency (euro)

Postby yaki_nuka » 23 Oct 2009, 11:10

Hi.

I need to export my report to Excel, and some columns contains money amounts.
Overmore, in Spain, the decimal point is ",", not ".", so I must show "50,32 €" instead of "50.32 €", "€ 50.32" and so on.

I was trying it with setPattern. Currency "$" worked perfectly, but my currency (euros, with the symbol "€") did not work.
So, then I tried it with setTextFormatter, passing my own java.text.Format class. It works right with the currency (it shows "50,32 €"), but all cells
in the column appear with the "green corner", warning me about "it's a number stored as a string". So, this "green corner" must be fixed.

How could I get my format ("50,32 €") without strings, "green corners",etc. ?

Any answer would be very appreciated. Thank you in advance

_____________________________________________________________________________

Hola.

Necesito exportar mi infome a Excel. Algunas columnas contienen cantidades de dinero.
Además, en España, el separador decimal es ',' , no '.' , y es obligatorio mostrar "50,32 €".

Lo estaba intentando con setPattern. La moneda "$" funcionaba, pero mi moneda (euros, con el símbolo "€") no.
Entonces lo intenté con setTextFormatter, pasando mi propio formateador que extiende java.text.Format class. Funciona bien, porque muestra "50,32 €", pero las celdas de la columna muestran la "esquina verde" de Excel, avisándome que "Es un número almacenado como texto". Estos avisos de la "esquina verde" no deben salir.

¿Cómo puedo mostrar mi formato ("50,32 €") sin convertir a String (que parece que es un problema para mí), avisos en "esquinas verdes",etc. ?

Muchas gracias de antemano. Un saludo
yaki_nuka
 
Posts: 8
Joined: 11 Aug 2009, 06:45

Re: Show amounts with european currency (euro)

Postby ricardo » 23 Oct 2009, 13:34

Only set column pattern,
and then set IS_DETECT_CELL_TYPE parameter for xls exporter like this
Code: Select all
JRXlsExporter exporter = new JRXlsExporter();
...
exporter.setParameter(JRXlsExporterParameter.IS_DETECT_CELL_TYPE,Boolean.TRUE);


Ricardo
ricardo
 
Posts: 47
Joined: 22 Jun 2009, 13:41

Re: Show amounts with european currency (euro)

Postby yaki_nuka » 26 Oct 2009, 08:56

Thanks a lot, Ricardo, but the problem still remains.

My code sets the parameter IS_DETECT_CELL_TYPE with true:
Code: Select all
JExcelApiExporter exporter = new JExcelApiExporter();
...
exporter.setParameter(JExcelApiExporterParameter.IS_DETECT_CELL_TYPE, Boolean.TRUE);


Is this right? Is important that the exporter must be JRXlsExporter instead of JExcelApiExporter?

With setPattern("$ ##,##0.00"), I get "$ 50,32" without the green corner, so it's right.
But with setPattern("##,##0.00 €"), I get "50,32" without the green corner, and without the currency symbol (€), so it's not right.

Any help?

Thanks again. Best regards
yaki_nuka
 
Posts: 8
Joined: 11 Aug 2009, 06:45

Re: Show amounts with european currency (euro)

Postby ricardo » 26 Oct 2009, 12:53

try to set this pattern "#,##0. €00"
ricardo
 
Posts: 47
Joined: 22 Jun 2009, 13:41

Re: Show amounts with european currency (euro)

Postby yaki_nuka » 27 Oct 2009, 07:15

Ricardo, that pattern works perfectly!

Thanks a lot. Best regards
yaki_nuka
 
Posts: 8
Joined: 11 Aug 2009, 06:45

Re: Show amounts with european currency (euro)

Postby YakiNuka » 30 Jul 2010, 05:27

Hello again.

I need to reopen this thread. Pattern "#,##0. €00" (with one space between . and €) works fine for positive currency, but not with negative.

If I write "-0,53 €" with that pattern, the result is "0,53".
I tried to extend the pattern to "#,##0. €00;[Red] -#,##0. €00" , and the result was "-0,53", so that's wrong too, because I need the currency symbol.

Do you have any suggestion?
Thanks in advance.
______________________________________________________________________________________________________________________

Hola de nuevo.

Tengo que reabrir este hilo. El patrón "#,##0. €00" (con un espacio entre . y €) funciona correctamente para cantidades positivas, pero no para las negativas.

Si escribo "-0,53 €" con este patrón, el resultado es "0,53".
Intenté ampliar dicho patrón a "#,##0. €00;[Red] -#,##0. €00" , y el resultado fue de "-0,53", que también es incorrecto porque necesito el símbolo de la moneda.

¿Alguna sugerencia?
Muchas gracias de antemano.
YakiNuka
 
Posts: 1
Joined: 30 Jul 2010, 05:15


Return to Help

Who is online

Users browsing this forum: No registered users and 1 guest