xml to biff

Topics: User Forum
Sep 7, 2009 at 8:14 AM

Hi

 

Is it possible with phpexcel library to read xml formated excel file and  convert it into BIFF formated file.

 

thx

Coordinator
Sep 7, 2009 at 8:56 AM

Perfectly possible, as long as the xlsx doesn't contain any features that aren't supported by xls (BIFF)

 

/** PHPExcel_IOFactory */
require_once '../Classes/PHPExcel/IOFactory.php';

$objPHPExcel = PHPExcel_IOFactory::load("excel2007.xlsx");

$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save('Excel5.xls');

 

Sep 7, 2009 at 9:04 AM

I forgot to write xml 2003 formated xml not open xml.

Coordinator
Sep 7, 2009 at 9:45 AM

PHPExcel does not have an XML reader, mainly because PHP itself provides a variety of readers for XML data. You could easily create a blank PHPExcel object, use simpleXML or any other PHP XML reader to read the file and populate the PHPExcel object, and the save it to xls.

Sep 7, 2009 at 10:06 AM

Yes I could do this. But my catch is that I manualy create xml formated excel file with pivot table in it. As you know phpexcel doesn't have pivot table support. Because my file is 40Mb big I am searching for a way to write xml into biff. As I see on the web there isn't any php library that could do this.

Coordinator
Sep 7, 2009 at 10:51 AM

We could write an XML reader, that's relatively straightforward.

But until we have implemented pivot table support in PHPExcel, that would be lost.

'fraid I don't know of any PHP libraries that could handle this (without using COM and Excel itself), though if you can call OpenOffice using the command line, then that could handle the conversion