Help. Error when try to write excel5

Topics: Developer Forum, User Forum
Apr 29, 2010 at 12:37 PM

Whe I go to download de .xls fila, I got a dialog with mess like this: "The file that you try to open, xxxxx.xls, has another format. ..."

Then, when I open de file, I have this text:

Catchable fatal error: Argument 1 passed to PHPExcel_Writer_Excel5::__construct() must be an instance of PHPExcel, null given, called in /home/colegiod/public_html/Sistema/testxls.php on line 16 and defined in /home/colegiod/public_html/Sistema/Classes/PHPExcel/Writer/Excel5.php on line 140

Could you help me please?

Thank you in advance and sorry for my english

My code:

require_once 'Classes/PHPExcel/IOFactory.php';
require_once 'Classes/PHPExcel/Writer/Excel5.php';

$objPHPexcel = PHPExcel_IOFactory::load('ISRA.xls');

$objWorksheet = $objPHPexcel->getActiveSheet();
$objWorksheet->getCell('B5')->setValue('John Smith');
$objWorksheet->getCell('B6')->setValue('1er año');


header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename="ISRAJohnSmith.xls"');
header('Cache-Control: max-age=0');

$objWriter = new PHPExcel_Writer_Excel5($objPHPExcel);
$objWriter->save('php://output');

Coordinator
Apr 29, 2010 at 12:42 PM

Remember that PHP variable names are case-sensitive, so $objPHPexcel is not the same as $objPHPExcel

Apr 29, 2010 at 11:48 PM

Yes! you're right. Thank you