Cool phpexcel, Official Website: http://www.codeplex.com/PHPExcel
Both import and export are supported. The office2007 format can be exported and 2003 compatible.
The downloaded package contains documents and examples, which you can study on your own.
Example:
<? PHP
/**
* Phpexcel
*
* Copyright (c) 2006-2007 phpexcel
*
* This library is free software; you can redistribute it and/or
* Modify it under the terms of the GNU lesser general public
* License as published by the Free Software Foundation; either
* Version 2.1 of the license, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* But without any warranty; without even the implied warranty
* Merchantability or fitness for a special purpose. See the GNU
* Lesser General Public License for more details.
*
* You shoshould have written ed a copy of the GNU lesser general public
* License along with this library; if not, write to the Free Software
* Foundation, inc., 51 Franklin Street, fifth floor, Boston, MA 02110-1301 USA
*
* @ Category phpexcel
* @ Package phpexcel
* @ Copyright (c) 2006-2007 phpexcel (http://www.codeplex.com/PHPExcel)
* @ License http://www.gnu.org/licenses/lgpl.txt lgpl
* @ Version 1.5.0, 2007-10-23
*/
/** Error Reporting */
Error_reporting (e_all );
/** Include path **/
Set_include_path (get_include_path (). path_separator. '../classes /');
/** Phpexcel */
Include 'phpexcel. php ';
/** Phpexcel_writer_excel2007 */
Include 'phpexcel/Writer/excel2007.php ';
// Create new phpexcel object
Echo date ('H: I: s'). "create new phpexcel object/N ";
$ Objphpexcel = new phpexcel ();
// Set Properties
Echo date ('H: I: s'). "Set Properties/N ";
$ Objphpexcel-> getproperties ()-> setcreator ("Maarten balliauw ");
$ Objphpexcel-> getproperties ()-> setlastmodifiedby ("Maarten balliauw ");
$ Objphpexcel-> getproperties ()-> settitle ("Office 2007 XLSX test document ");
$ Objphpexcel-> getproperties ()-> setsubject ("Office 2007 XLSX test document ");
$ Objphpexcel-> getproperties ()-> setdescr resume ption ("test document for Office 2007 XLSX, generated usingphp classes .");
$ Objphpexcel-> getproperties ()-> setkeywords ("Office 2007 openxml PHP ");
$ Objphpexcel-> getproperties ()-> setcategory ("Test Result file ");
// Add some data
Echo date ('H: I: s'). "add some data/N ";
$ Objphpexcel-> setactivesheetindex (0 );
$ Objphpexcel-> getactivesheet ()-> setcellvalue ('a1', 'Hello ');
$ Objphpexcel-> getactivesheet ()-> setcellvalue ('b2', 'World! ');
$ Objphpexcel-> getactivesheet ()-> setcellvalue ('c1', 'Hello ');
$ Objphpexcel-> getactivesheet ()-> setcellvalue ('d2 ', 'World! ');
// Rename Sheet
Echo date ('H: I: s'). "RENAME sheet/N ";
$ Objphpexcel-> getactivesheet ()-> settitle ('simple ');
// Set active sheet index to the first sheet, so Excel opens this as the first sheet
$ Objphpexcel-> setactivesheetindex (0 );
// Save Excel 2007 File
Echo date ('H: I: s'). "Write to excel2007 format/N ";
$ Objwriter = new phpexcel_writer_excel2007 ($ objphpexcel );
$ Objwriter-> Save (str_replace ('. php', '.xlsx', _ file __));
// Echo done
Echo date ('H: I: s'). "done writing file./R/N ";