.xlsx file not generated with PHPExcel on linux

Topics: Developer Forum, Project Management Forum, User Forum
May 9, 2011 at 12:50 PM

Hi,

I am using PHPExcel to generate a xlsx file on linux,but i am unable to generate it,if try to generate xls file it gets generated properly,

My PHP version 5.3.6 and OS: Linux(CentOS) and have xml support,

when i use this code in  file

here assume $objPHPExcel has all the columns with data

header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
header('Content-Disposition: attachment;filename="Report.xlsx"');
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel,'Excel2007');
$objWriter->save('php://output');

it doenaot give any output , it just gives a blank page,i mean i see only blank page with no output in browser,but when i replace   Excel2007 and run for xls it will run and gives me xls file,

Please help me in solving my problem.

May 9, 2011 at 1:56 PM

In general, a blank PHP page indicates some error, but you need something like this at the top to see it:

error_reporting(E_ALL ^ E_NOTICE);

May 9, 2011 at 2:10 PM
Hi,
I have incuded error_reporting(E_ALL ^E_NOTICE)
After including error reporting i got this error in file

Class 'XMLWriter' not found in /var/www/html/synteldsr/PHPExcel/Shared/XMLWriter.php

whereas PHPExcel/Shared folder contains file XMLWriter.php

I am not getting what could be posiivle reason even if the XMLWriter.php exists , i am getting the error above error , please help me.



May 9, 2011 at 2:13 PM

Hi,
I have incuded error_reporting(E_ALL ^E_NOTICE)
After including error reporting i got this error in file

Class 'XMLWriter' not found in /var/www/html/synteldsr/PHPExcel/Shared/XMLWriter.php

whereas PHPExcel/Shared folder contains file XMLWriter.php

I am not getting what could be posiivle reason even if the XMLWriter.php exists , i am getting the error above error , please help me.

Thanks
May 9, 2011 at 2:25 PM
pragmites wrote:
Hi,
I have incuded error_reporting(E_ALL ^E_NOTICE)
After including error reporting i got this error in file

Class 'XMLWriter' not found in /var/www/html/xyz/PHPExcel/Shared/XMLWriter.php

whereas PHPExcel/Shared folder contains file XMLWriter.php

I am not getting what could be posiivle reason even if the XMLWriter.php exists , i am getting the error above error , please help me.



 

Coordinator
May 10, 2011 at 12:04 AM

The PHPExcel_Shared_XMLWriter class extends PHP's own XMLWriter class. Do you have the PHP's XMLWriter class enabled?

This is normally enabled by default, but can be disabled when doing a PHP build. It is also dependent on libxml (version 2.6.0 or above) being enabled; again, this is normally enabled by default.