Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.9.3

Request #5808 XLS rendering
Submitted: 2005-10-28 11:17 UTC
From: vv43 Assigned: olivierg
Status: Closed Package: Structures_DataGrid
PHP Version: 4.4.0 OS: debian sarge
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 38 - 15 = ?

 
 [2005-10-28 11:17 UTC] vv43
Description: ------------ The build of the header and the body is done in Structures_DataGrid_Renderer_XLS::getSpreadsheet(), I move it to the Structures_DataGrid_Renderer_XLS::render() - Added naming of worksheet (optionnal) - Possibility to modify the worksheet before rendering // $Id: XLS.php,v 1.23 2005/10/11 00:40:01 olivierg Exp $ Test script: --------------- /** * Force download the spreadsheet * * @access public */ function render() { $this->getSpreadsheet(); if (!$this->_rendered) { $dg->_setDefaultHeaders(); if ($this->header) { $this->_buildHeader(); } $this->_buildBody(); $this->_rendered = true; } $this->_workbook->close(); } /** * Get the spreadsheet object * * @access public */ function &getSpreadsheet($worksheetName = null) { if(!is_a($this->_workbook, "Spreadsheet_Excel_Writer")) { $dg =& $this->_dg; if ($this->_sendToBrowser) { $this->_workbook = new Spreadsheet_Excel_Writer(); $this->_workbook->send($this->_filename); } else { $this->_workbook = new Spreadsheet_Excel_Writer($this->_filename); } $this->_worksheet =& $this->_workbook->addWorksheet($worksheetName); } return $this->_workbook; }

Comments

 [2005-10-28 14:07 UTC] olivierg at php dot net
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better. I have modified the XLS renderer to allow such customizations (among many others). You can now provide custom Excel Writer objects. Example : $workbook = new Spreadsheet_Excel_Writer(); $workbook->send('test.xls'); $worksheet =& $workbook->addWorksheet("My Worksheet"); $renderer =& $datagrid->getRenderer(); $renderer->setCustomWriter ($workbook, $worksheet); $datagrid->render();
 [2005-10-28 14:12 UTC] vv43
Thanks, it's better like this :)