currency format euro

Dec 1, 2010 at 2:19 PM

Hello,

I don't manage to format a range of cells in euro format like this : 300,00 €

Besides how to format a cell in percent format like this : 19,6%

 

Thanks for your help

Christophe

Coordinator
Dec 1, 2010 at 10:16 PM

Have you tried the built-in number format masks FORMAT_CURRENCY_EUR_SIMPLE and FORMAT_PERCENTAGE_00, or using any of the number format masks that you'd use in excel itself?

Dec 2, 2010 at 7:23 AM

Yes I tried  that

$sheet1->getStyleByColumnAndRow(8,15)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE);

but I get this : EUR 300,00 instead of 300,00 €

Concerning precentage I get : 19.60% instead of 19,6%

How to format these cells ?

Coordinator
Dec 2, 2010 at 9:42 PM

Use Excel to identify any custom format mask that you need.

Try using a format mask like:

_-[$€] #,##0.00_  *

for currency, and:

0.0%

for percentage.

Dec 3, 2010 at 2:40 PM
Edited Dec 3, 2010 at 2:40 PM

Thanks Mark it works well this way but I simply discover that my script was in ISO-.. instead of UTF8... sorry for that, now it works with this

'#,##0.00€' 

I have another with an excel template problem but i open a new discussion for it..

 

 

 

 


Jan 18, 2012 at 8:59 AM
Edited Jan 18, 2012 at 9:23 AM

thx @flash22, for me works too , I was using a wrong one 

'"€"#,##0.00'

 and formated wrong the numbers with 6 digits and more.

EDIT: nope, this one too, doesn't work for me , with more that 4 digits. I setting up like:

 

setFormatCode('"€"#,##0.00'); or 
setFormatCode('€#,##0.00');