Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.9.2

Bug #2146 setversion(8) used with printArea crashes Excel
Submitted: 2004-08-17 07:32 UTC Modified: 2009-11-29 02:43 UTC
From: pwa dot net at free dot fr Assigned:
Status: Verified Package: Spreadsheet_Excel_Writer
PHP Version: 4.3.1 OS: unix
Roadmaps: (Not assigned)    
Subscription  
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes. If this is not your bug, you can add a comment by following this link. If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: pwa dot net at free dot fr
New email:
PHP Version: Package Version: OS:

 

 [2004-08-17 07:32 UTC] pwa dot net at free dot fr
Description: ------------ setversion(8) used with printArea crashes Excel Use excel spreadsheet 0.8, OLE 5.0 Reproduce code: --------------- require_once 'Spreadsheet/Excel/Writer.php'; // Creating a workbook $workbook = new Spreadsheet_Excel_Writer(); $workbook->SetVersion(8); // sending HTTP headers $workbook->send('test.xls'); // Creating a worksheet $worksheet1 =& $workbook->addWorksheet('Premier feuillet'); // The actual data $worksheet1->write(3, 2, 'Ce fichier à été entièrement généré avec PHP'); // BUG WITH THIS LINE $worksheet1->printArea(1,1,5,5); // Let's send the file $workbook->close(); Actual result: -------------- Excel crashes

Comments

 [2007-07-31 02:37 UTC] bogacaslan (Bogac Aslanyürek)
setversion(8) used with printArea definitely crashes Excel. $worksheet->setInputEncoding('UTF-8') needs setversion(8) to be used, so encoding problem with UTF-8 data occurs. * A solution in comments by [2007-03-19 15:42 UTC] purs (Dima Pursanov) for Bug #2942 didnt work for me : $worksheet->setInputEncoding('UTF-8');//changing unicode $worksheet->write(0, 0, "sample"); $worksheet->setInputEncoding();//parameter error occurs. * Another solution utf8_decode() for text data also doesnt work and causes data loss. * My solution was making a function to use mb_convert_encode() on every value in an array. Excel accepts ISO-8859-9 charset, which is for Turkish characters, I think it may work for several other charsets.Here are codes: ======= function arrayConvertEncoding($arr){ foreach ($arr as $key=>$val){ $arr[$key]=mb_convert_encoding($val,"ISO-8859-9","UTF-8"); } return $arr; } =========== Hope this saves time to someone else.
 [2008-03-22 08:15 UTC] doconnor (Daniel O'Connor)
This sounds vaguely like bug #2010 - is it?
 [2009-11-29 02:43 UTC] cschmitz (Carsten Schmitz)
-Status: Open +Status: Verified
I can confirm that I can reproduce this behaviour using the provided text script.