Yirmiyahu Fischer
Yirmiyahu Fischer

Reputation: 623

PHPExcel creating file in binary format instead of xml

I am using PHPExcel to generate an Excel file. The problem is that, instead of generating the file in XML format, it is being generated in binary format.

$phpExcel = new PHPExcel();
$phpExcel->getProperties()->setTitle($worksheet_title);
$phpExcel->setActiveSheetIndex(0);
$worksheet = $phpExcel->getActiveSheet();
$worksheet->setCellValue('A1', 'Field');
// ...
$phpExcelWriter = PHPExcel_IOFactory::createWriter($phpExcel, 'Excel2007');
$phpExcelWriter->save('tmp/xxx');

Since I am using the Excel2007 writer, it should be creating the output file in readable xml format, but it's being created in binary format, instead.

Upvotes: 0

Views: 1073

Answers (1)

Mark Baker
Mark Baker

Reputation: 212422

An OfficeOpenXML file is not directly human-readable as one gigantasaurus of an xml file. It is a zipped archive containing a collection of XML files.

Unzip the .xlsx file, then you will find a series of folders containing xml files.

That is what MS Excel generates when you save a file as xlsx, and it is what PHPExcel generates as well

You can look at this link for full details of the OfficeOpenXML standard

Upvotes: 1

Related Questions