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

Bug #7534 XLS Character encoding support
Submitted: 2006-05-01 12:56 UTC Modified: 2006-12-16 05:57 UTC
From: torgny dot bjers at gmail dot com Assigned: wiesemann
Status: Closed Package: Structures_DataGrid (version 0.6.3)
PHP Version: 5.1.2 OS: Linux FC4
Roadmaps: (Not assigned)    
Subscription  


 [2006-05-01 12:56 UTC] torgny dot bjers at gmail dot com (Torgny Bjers)
Description: ------------ When exporting an Ecxel document that contains multi-byte characters, the Excel driver needs to be set to version 8 and to have the encoding set according to what the input is. I've included a fix for this by setting the version when the input encoding has been specified, since it will not work with anything below version 8. Test script: --------------- /** * Encoding for use with the worksheet input strings. * @var string */ var $_encoding; -------------------- /** * Sets the input encoding used when adding rows to the worksheet. * * @access public * @params string $encoding The selected encoding for use with iconv */ -------------------- function setEncoding($encoding) { $this->_encoding = $encoding; } /** * Get the spreadsheet object * * @access public */ function &getSpreadsheet() { $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(); if (!empty($this->_encoding)) { $this->_workbook->setVersion(8); $this->_worksheet->setInputEncoding($this->_encoding); } --------------------

Comments

 [2006-05-08 05:24 UTC] wiesemann (Mark Wiesemann)
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. --- Your patch did not work anymore with our refactored code. I've added the setVersion() (always, as 8 is the only possible value) and setInputEncoding() (always, as the encoding option is always given) calls for workbooks and worksheets that SDG creates. In the case that a user provides his own workbook or worksheet he is responsible for calling these methods himself. It would be nice if you could try out the CSV version of SDG and tell us whether this solution solves your problem.