corrupt symbols

Topics: Developer Forum, User Forum
May 15, 2009 at 2:47 PM
Edited May 15, 2009 at 2:49 PM
I want to get this result

for this I use the following code

$objPHPExcel->getActiveSheet()->getStyle('B18')->getFont()->setName('Wingdings 2');
$objPHPExcel->getActiveSheet()->setCellValue('B18', "R");
$objPHPExcel->getActiveSheet()->getStyle('B19')->getFont()->setName('Wingdings 2');
$objPHPExcel->getActiveSheet()->setCellValue('B19', "£");

but as a result of receiving
following result

What could be the problem?

May 15, 2009 at 4:38 PM

Method looks correct. I tested and it worked for me.


Question: Do you see the "£" sign in the formula bar like in the screen shot?

If not, I think you didn't properly save your PHP script as UTF-8.

As a temporary solution you may try this which should work at any time:

$objPHPExcel->getActiveSheet()->getStyle('B19')->getFont()->setName('Wingdings 2');
$objPHPExcel->getActiveSheet()->setCellValue('B19', utf8_encode(chr(163)));

May 18, 2009 at 7:57 AM
tried a version of the code:
$objPHPExcel = new PHPExcel();
$objPHPExcel->getActiveSheet()->getStyle('A1')->getFont()->setName('Wingdings 2');
$objPHPExcel->getActiveSheet()->setCellValue('A1', utf8_encode(chr(163)));
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');

My encoding is UTF-8

I save file to UTF-8 encoding
May 18, 2009 at 11:48 AM

Can you try to send me the two Excel files to (erik at phpexcel dot net)

1. The good Excel file showing what you want

2. The bad Excel file with the wrong symbol (1234.xls)

Will have to look into the binary file to see what the problem is.


May 18, 2009 at 11:59 AM
Okay. I sent you the files
May 18, 2009 at 12:32 PM

[Files received]

I just tried to open the "bad" file 1234.xls. Strangely, it looks ok when I open it in MS Office Excel 2007 and 3 on a WindowsXP machine. Will try to do some other tests later today.


May 18, 2009 at 11:34 PM

I managed to reconstruct this bug anyway, but for some other glyphs. Should be fixed now:


May 19, 2009 at 8:33 AM

I tried your example and got an error:

Fatal error: Uncaught exception 'Exception' with message 'Cell coordinate string can not be a range of cells.' in /var/www/excel/Classes/PHPExcel/Worksheet.php:1085 Stack trace: #0 /var/www/excel/Tests/functions.php(261): PHPExcel_Worksheet->getStyle('A1:P14') #1 {main} thrown in /var/www/excel/Classes/PHPExcel/Worksheet.php on line 1085

in the example I found the following bug:

$ aFont = array ( 'name' => 'Wingdings'. $suffix,' size '=> 18);
should be replaced by the
$ aFont = array ( 'name' => 'Wingdings '. $suffix,' size '=> 18);

between the Windings and $suffix must be a gap

Help me plz
May 19, 2009 at 8:39 AM

Can you try with latest source code (Change set 27621):

May 19, 2009 at 8:50 AM

many thanks, it really works!!!