Output of currency amount in Euros

Topics: User Forum
Sep 4, 2011 at 1:26 PM

I am struggling with the UTF8 encoding etc to get an amount into a cell which is formatted to show the Euro symbol.

My php code currently has the following in it:

$currencyFormat = '#,#0.## \€;[Red]-#,#0.## \€';
$objSheet->setCellValue('D4',$totalAmount);
$objSheet->getStyle('D4:D'.$xlsRow)->getNumberFormat()->setFormatCode($currencyFormat);

Unfortunately, the final Excel spreadsheet does not show the euro symbol.

I know that this is down to the need to convert the euro to UTF8 - I have tried:

$currencyFormat = iconv("ISO-8859-1", "UTF-8", '#,#0.## \€;[Red]-#,#0.## \€');

although that stops the Excel error on opening the spreadsheet, the euro symbol does not appear in the output.

So, what am I missing? 

Maybe the solution should be added to the PHPExcel_Style_NumberFormat class !

Sep 9, 2011 at 12:41 PM

This is still causing me a headache - and foreign currencies appear to be a major bugbear for many people on here.

What is the best way of tackling this?

Sep 15, 2011 at 8:45 AM

Check out this discussion for a solution

http://phpexcel.codeplex.com/discussions/272552