Home » Structures » Structures_DataGrid » Bug #7534
XLS Character encoding support
Details
| Submitted | 2006-05-01 17:56 UTC |
|---|---|
| From | torgny dot bjers at gmail dot com |
| Assigned | wiesemann |
| Status | Closed |
| Package | Structures_DataGrid |
| PHP Version | 5.1.2 |
| OS | Linux FC4 |
| Roadmaps | (Not assigned) |
Comments
[2006-05-01 17:56 UTC] torgny dot bjers at gmail dot com
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);
}
--------------------