Error: CDF V2 Document, corrupt

Topics: Developer Forum
Jan 16, 2012 at 2:23 PM
Edited Jan 16, 2012 at 2:43 PM

Hello all!

I use PHP 5.2 and PHPExcel 1.7.6.

I create .xls file and save it with PHPExcel_Writer_Excel5. OpenOffice and MS Office opens it without any trouble. But when I'm trying to load this file on server by form with mime-type validation it's halted with error "CDF V2 Document, corrupt: Cannot read summary info".

My code is simple:

...

$pExcel = new PHPExcel();

... // fill cells

// save to file

$objWriter = new PHPExcel_Writer_Excel5($pExcel);
$objWriter->save( $target_file ); // path is absolute

// http-headers

header( 'Content-Type: application/vnd.ms-excel' );
 header( 'Accept-Ranges: bytes' );
header( 'Content-Disposition: attachment; filename='.basename($target_file) );
header( 'Content-Length: '.filesize($target_file) );

readfile( $target_file );

Can anybody explain me what's wrong, please?

P.S.: sorry for my English

Coordinator
Jan 17, 2012 at 1:14 PM

Summary Info is not yet supported with the Excel5 Writer, this is currently active work in progress (Work Item #9759) and hopefully will be in the next release at the end of this month.

However, a Summary Information workstream is not mandatory in an OLE/CDF document, which is why OO and Excel themselves have no issues with this. Why your server software should complain about an optional workstream not being present in the file, I don't know.