By dihonore on
I have the following fonction:
function RSE_Export_export_stuff() {
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);
date_default_timezone_set('Europe/London');
require_once("sites/all/libraries/PHPExcel/Classes/PHPExcel.php");
require_once("sites/all/libraries/PHPExcel/Classes/PHPExcel/IOFactory.php");
//module_load_include('inc', 'phpexcel');
$data = array();
$headers = array();
// First worksheet
global $user;
$userId = $user->name;
...
// Freeze pane so that the heading line won't scroll
$objPHPExcel->getActiveSheet()->freezePane('A2');
// Save as an Excel BIFF (xls) file
$objWriter = new PHPExcel_Writer_Excel2007($objPHPExcel);
header('Content-type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
header('Content-Disposition:inline;filename=contacts.xlsx');
ob_clean();
if ( headers_sent() ) die("**Error: headers sent");
$objWriter->save('php://output');
exit;
} It works fine on the development environment.
On the test environment, I have the following message:
PHPExcel_Writer_Exception : Could not close zip file php://output. dans PHPExcel_Writer_Excel2007->save() (ligne 348 dans /home/site1394/www/sites/all/libraries/PHPExcel/Classes/PHPExcel/Writer/Excel2007.php).
I have check the rights on site/default/files and they are the same than on the development.
The goal is to generate an excel file and to download it on the PC.
Do you have an idea??
Thanks
Didier
Comments
One Thing To Check
One more thing to check that I didn't see on the other pages mentioning this issue -- make sure the drive you're attempting to save to isn't full!
May be trouble with zip php
May be trouble with zip php extensions. Try this: