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

Bug #2146 setversion(8) used with printArea crashes Excel
Submitted: 2004-08-17 12:32 UTC
From: pwa dot net at free dot fr Assigned:
Status: Feedback Package: Spreadsheet_Excel_Writer
PHP Version: 4.3.1 OS: unix
Roadmaps: (Not assigned)    
Subscription  


 [2004-08-17 12: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 07: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 12:15 UTC] doconnor (Daniel O'Connor)
This sounds vaguely like bug #2010 - is it?
 [2009-11-29 07:43 UTC] cschmitz (Carsten Schmitz)
-Status: Open +Status: Verified
I can confirm that I can reproduce this behaviour using the provided text script.
 [2016-06-21 02:52 UTC] sanmai (Alexey Kopytko)
-Status: Verified +Status: Feedback
Thank you for taking the time to report a problem with the package. Unfortunately you are not using a current version of the package -- the problem might already be fixed. Please download a new version from http://pear.php.net/packages.php If you are able to reproduce the bug with one of the latest versions, please change the package version on this bug report to the version you tested and change the status back to "Open". Again, thank you for your continued support of PEAR. *** Please try with newest version from Composer. If issue still remains, please report.