- Tags:
- By Jesse Donat on
- (Updated: )
Update 2017: The functionality of "XML Excel Exporter" is now part of the Quorum Exporter project.
Recent Activity
XSpreadsheet dies after outputting the spreadsheet now, preventing corruption
Repository Restructured
-Working Corpus now in Source Folder
-`Scripts` folder added, includes database dump batch, and README.md HTML viewer
-`Local` folder added, for testing use with local database connections, etc
Documentation
-Finally! Created an initial README.md
-TODO moved from includes folder into root
This simple class allows you via PHP to export an XML Spreadsheet compatible with all versions of Excel 2003 and up.
The files generated will work with versions of Office 2003 and up. It is considered production safe, and is currently in use in a fair number of production sites.
Unlike CSV or HTML Table exports, you can have multiple worksheets of data! A sheets data can be added to the spreadsheet either by a MySQL query resource or as a 2 dimensional array.
Known bugs:
- Office 2007/2010 bark about XLS file extensions despite refusing to open XML file extensions downloaded from the internet. (Anyone know a solution?)
- DOMDocument incorrectly converts/removes non-printable/low range characters (eg: ).
Limitations:
- File Format is not supported by:
- Open Office
- Google Documents
- Microsoft Office Live
MySQL Example
require('includes/classes/XSpreadsheet.php');
$spread = new XSpreadsheet($fname)
$spread->AddWorksheet('Products', mysql_query("Select * From products"))
->AddWorksheet('Categories', mysql_query("Select * From categories"))
->Generate()->Send();
Array Example
require('includes/classes/XSpreadsheet.php');
$data = array(
array( 'Column 1', 'Column 2', 'Column 3' ),
array( 1, 2, 3 ),
);
$spread = new XSpreadsheet($fname)
$spread->AddWorksheet('Awesome Sheet', $data )
->Generate()->Send();

Comments
Nothing yet. Say the first thing.
Sign in to join the conversation.