Bug #19321 [Com]: Corrupt spreadsheet

From: Date: Fri, 24 Oct 2014 18:44:33 +0000
Subject: Bug #19321 [Com]: Corrupt spreadsheet
References: 1  Groups: php.pear.bugs 
Request: Send a blank email to pear-bugs+get-11075@lists.php.net to get a copy of this message
Edit report at http://pear.php.net/bugs/bug.php?id=19321&edit=1 ID: 19321 Comment by: rirobel_ing Reported By: benchhiba dot rihab at gmail dot com Summary: Corrupt spreadsheet Status: Open Type: Bug Package: Spreadsheet_Excel_Writer Operating System: Debian Package Version: 0.9.3 PHP Version: 5.3.10 New Comment: I have a problem with Excel 2013 , in fact all the cells are not well formatted . the chart is stopped in a certain number of cells. Could someone help me please ? Previous Comments: ------------------------------------------------------------------------ [2012-08-30 17:44:20] zeitpunkt The problem seems to be code in Worksheet.php line 649-657 closing the file. But the file is accessed later again in line 688. So you need the move the closing code to the end of the getData() method: function close($sheetnames) { ...... /* WN: HOTFIX: CODE DISABLED - FILE IS ACCESSED AGAIN AFTER IT IS WRITTEN if ( $this->_tmp_file != '' ) { if ( $this->_filehandle ) { fclose($this->_filehandle); $this->_filehandle = ''; } @unlink($this->_tmp_file); $this->_tmp_file = ''; $this->_using_tmpfile = true; } */ ..... function getData() { ....... // WN: HOTFIX: MOVED CODE FROM LINE 653 here if ( $this->_tmp_file != '' ) { if ( $this->_filehandle ) { fclose($this->_filehandle); $this->_filehandle = ''; } @unlink($this->_tmp_file); $this->_tmp_file = ''; $this->_using_tmpfile = true; } // No data to return return ''; } With the OLE RC2 Workaround from identit (http://pear.php.net/bugs/bug.php?id=19284#1344445946) applied it seems to be possible to use Spreadsheet_Excel_Writer 0.9.3 together with 1.0.0RC2 successfully ------------------------------------------------------------------------ [2012-03-08 22:30:53] adrianbjones Actually it turns out the Mac/Excel 2011 can read them from 0.9.2 and OLE-1.0.0RC2, but for larger(?) spreadsheets, Windows/Excel 2010 needs 0.9.2 and OLE-1.0.0RC1 ------------------------------------------------------------------------ [2012-03-08 17:37:41] adrianbjones Sorry, I should have searched better. Looks like it is the issue with 0.9.3 and OLE-1.0.0RC2: http://pear.php.net/bugs/bug.php?id=19284 So either downgrade to 0.9.2 or OLE-1.0.0RC1 ------------------------------------------------------------------------ [2012-03-08 17:24:34] adrianbjones Description: ------------ When creating a spreadsheet with 0.9.3 I get the following errors: fseek() expects parameter 1 to be resource, string given in /usr/local/lib/php/Spreadsheet/Excel/Writer/Worksheet.php on line 688 fread() expects parameter 1 to be resource, string given in /usr/local/lib/php/Spreadsheet/Excel/Writer/Worksheet.php on line 694 Reverting to 0.9.2 fixes the problem. ------------------------------------------------------------------------ -- Edit this bug report at http://pear.php.net/bugs/bug.php?id=19321&edit=1

« previous php.pear.bugs (#11075) next »