I can't open any Excel 2007 file generated

Topics: Developer Forum
Jul 26, 2009 at 11:58 PM

Hi,

First, i have to thanks all people behind this proyect.

But, here is my problem: i can't open any file generated by PHPExcel with .xlsx format. I tried the test's examples, and i got this message on Excel:

First message: http://i30.tinypic.com/2hftcn9.jpg

Second message: http://i30.tinypic.com/oucvf8.jpg

When i run the script, i don't have any error or warning message:

01simple.php

19:43:14 Create new PHPExcel object 
19:43:14 Set properties 
19:43:14 Add some data 
19:43:14 Rename sheet
19:43:14 Write to Excel2007 format
19:43:14 Peak memory usage: 7.25 MB 
19:43:14 Done writing file. 

.xls format work great.

Any idea what is the problem?

Developer
Jul 27, 2009 at 12:05 AM

>> Any idea what is the problem?

Perhaps you are running PHP 5.2.8 on Windows with defect zip extension? If this is the case then upgrading PHP is the solution.

Jul 27, 2009 at 12:12 AM

PHP 5.3 or 5.2.9?

Developer
Jul 27, 2009 at 12:22 AM

>> PHP 5.3 or 5.2.9?

PHP 5.2.9 should suffice. Or you can just replace the php_zip.dll in the installation with the one from e.g. PHP 5.2.6, check FAQ:
http://phpexcel.codeplex.com/Wiki/View.aspx?title=FAQ

I have not tested this myself, but others have had success. On the other hand upgrading PHP is probably the best solution.

Jul 27, 2009 at 12:35 AM

This problem is only for Windows? Because when I work locally, I use Windows... but all my proyects run under Linux.

I just uploaded a test to my finally server, and i got this message:

01simple.php

 

19:29:49 Create new PHPExcel object 
19:29:49 Set properties
19:29:49 Add some data
19:29:49 Rename sheet
19:29:49 Write to Excel2007 format
asdf.comFatal error: Uncaught exception 'Exception' with message 'Could not close zip file /var/www/virtual/asdf.com/htdocs/sistema/002/excel/Tests/01simple.xlsx.' in /var/www/virtual/r/htdocs/sistema/002/excel/Classes/PHPExcel/Writer/Excel2007.php:398 Stack trace: #0 /var/www/virtual/asdf.com/htdocs/sistema/002/excel/Tests/01simple.php(75): PHPExcel_Writer_Excel2007->save('/var/www/virtua...') #1 {main} thrown in /var/www/virtual/asdf.com/htdocs/sistema/002/excel/Classes/PHPExcel/Writer/Excel2007.php on line 398

PHP Version 5.2.6-3ubuntu4.1

Zip enabled
Extension Version $Id: php_zip.c,v 1.1.2.43 2008/01/18 00:51:38 pajoye Exp $
Zip version 1.8.11
Libzip version 0.8.0-compatible

I can also only replace the library?

 

Developer
Jul 27, 2009 at 12:43 AM

The problem is only on Windows with PHP 5.2.8. The new problem on Linux is a write permission problem on the directory where the file is saved.

Jul 27, 2009 at 5:31 AM

Thx for the help!

Now work great... thanks a lot!