I don't get any file with test page

Topics: User Forum
Mar 1, 2010 at 1:53 PM

Hi, I am trying tu use PHPExcel on my website but can't get any file: http://www.autosdelnea.com.ar/simple.php. I think I have php_zip installed on the server, I don't see any error in the result so I don't know how to solve it. Any idea? Here you have the code, I just modified the includes lines of the Hello Word example (if you want to see the phpinfo() visit http://www.autosdelnea.com.ar/info.php):

/** Error reporting */

/** Include path **/
//ini_set('include_path', ini_get('include_path').';consultas/Classes/');

/** PHPExcel */
include 'consultas/Classes/PHPExcel.php';

/** PHPExcel_Writer_Excel2007 */
include 'consultas/Classes/PHPExcel/Writer/Excel2007.php';

// Create new PHPExcel object
echo date('H:i:s') . " Create new PHPExcel objectn";
$objPHPExcel = new PHPExcel();

// Set properties
echo date('H:i:s') . " Set propertiesn";
$objPHPExcel->getProperties()->setCreator("Maarten Balliauw");
$objPHPExcel->getProperties()->setLastModifiedBy("Maarten Balliauw");
$objPHPExcel->getProperties()->setTitle("Office 2007 XLSX Test Document");
$objPHPExcel->getProperties()->setSubject("Office 2007 XLSX Test Document");
$objPHPExcel->getProperties()->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.");

// Add some data
echo date('H:i:s') . " Add some datan";
$objPHPExcel->getActiveSheet()->SetCellValue('A1', 'Hello');
$objPHPExcel->getActiveSheet()->SetCellValue('B2', 'world!');
$objPHPExcel->getActiveSheet()->SetCellValue('C1', 'Hello');
$objPHPExcel->getActiveSheet()->SetCellValue('D2', 'world!');

// Rename sheet
echo date('H:i:s') . " Rename sheetn";

// Save Excel 2007 file
echo date('H:i:s') . " Write to Excel2007 formatn";
$objWriter = new PHPExcel_Writer_Excel2007($objPHPExcel);
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));

// Echo done
echo date('H:i:s') . " Done writing file.rn";

Mar 16, 2010 at 10:17 AM

If you want the Excel file to be sent to the browser so the user will get a download dialog try to run example Tests/01simple-download-xlsx.php


Mar 16, 2010 at 12:22 PM

Thanks for your reply, after posting the message I realized that the file you refer is the one I had to use.