Writing Excel sheets from PHP
This article gives a few pointers on writing excel sheets from PHP.
Install the Excel sheet writing package

pear install OLE

pear install Spreadsheet_Excel_Writer-beta

PHP Code Example




 // Include PEAR::Spreadsheet_Excel_Writer

 require_once "Spreadsheet/Excel/Writer.php";

 

 // Create an instance, passing the filename to create

 $xls =& new Spreadsheet_Excel_Writer('sheets/binary.xls');

 

 // Add a worksheet to the file, returning an object to add data to

 $sheet =& $xls->addWorksheet('Binary Count');

 $sheet->setColumn(0,2,20); //Set column width of columns 0 thru 2 to 20

 // Write some data using write(Row#,Col#,Data)

   $sheet->write(0,0,"orange"); // Row 0, Column 0

   $sheet->write(1,0,"apple"); //Row 1, Column 0

   $sheet->write(2,0,"banana");

   $sheet->write(0,1,"orange"); //Row 0, Column 1

   $sheet->write(1,1,"orange"); //Row 1, Column 1

   $sheet->write(2,0,"yellow");

 

 

 // Finish the spreadsheet, dumping it to the browser

 $xls->close();





Media Lab Overview
LIACS Homepage
MM Conf
ACM Multimedia
ACM ICMR
IAPR ICPR
Science Direct
IEEE Library
LIACS Publications
ACM Digital Library