file fomat error

Oct 9, 2008 at 4:45 AM
I don't know why can't open the excel file?
Excel show a error message about file fomat error...

Below is my program code

/** Error reporting */
error_reporting(E_ALL);
 
/** Include path **/
ini_set('include_path', ini_get('include_path').';../Classes/');
 
/** PHPExcel */
include 'PHPExcel.php';
 
include 'PHPExcel/Writer/Excel2007.php';
 
$excel = new PHPExcel();
$sheet = $excel->getActiveSheet();

 

$excel->setActiveSheetIndex(0);
$excel->getActiveSheet()->SetCellValue('A1', 'Hello');
$excel->getActiveSheet()->SetCellValue('B2', 'world!');
$excel->getActiveSheet()->SetCellValue('C1', 'Hello');
$excel->getActiveSheet()->SetCellValue('D2', 'world!');

$drawing = new PHPExcel_Worksheet_Drawing();
$drawing->setPath('ching.jpg');
$drawing->setWorksheet($sheet);
$drawing->setCoordinates('C5');

$writer = new PHPExcel_Writer_Excel2007($excel);
$writer->save('test4.xlsx');


Please Help Me ~
Thanks~
Developer
Oct 9, 2008 at 5:05 AM
Hmm... I don't see any errors. Can you upload the file somewhere so we can inspect?

Coordinator
Oct 9, 2008 at 6:43 AM
Try upgrading php_zip, there are versions which produce invalid OpenXML packages, unfortunately...
Oct 9, 2008 at 7:16 AM
Which version of php_zip is suitable for me use?