Home » File Formats » Spreadsheet_Excel_Writer » Bug #8733
*** ERROR IN SST ***
Details
| Submitted | 2006-09-19 09:35 UTC |
|---|---|
| From | zielony at gemius dot pl |
| Status | Open |
| Package | Spreadsheet_Excel_Writer |
| PHP Version | Irrelevant |
| OS | Linux |
| Roadmaps | (Not assigned) |
Comments
[2006-09-19 09:35 UTC] zielony at gemius dot pl
Description:
------------
Error in Shared Strings Table when using setVersion(8).
Test script:
---------------
function GenerateRandomString( $i )
{
return md5( $i );
};
$workbook=new Spreadsheet_Excel_Writer_Workbook("");
$workbook->setVersion(8);
$worksheet =& $workbook->addWorksheet('worksheet');
$worksheet->setInputEncoding('utf-8');
for( $i=1; $i<2000; $i++ )
{
$worksheet->write($i, 0, $i );
$worksheet->write($i, 1, GenerateRandomString($i) );
};
$workbook->close();
[2006-09-19 09:39 UTC] zielony at gemius dot pl
Cells below 126 are corrupt
[2006-09-20 10:57 UTC] zielony at gemius dot pl
Possible temporary fix.
Long strings (over 4000 chars) still crash the .xls, but who cares. Nobody writes 4000 chars strings to .xls.
1. Change in workbook.php in function _calculateSharedStringsSizes():
from:
foreach (array_keys($this->_str_table) as $string) {
to:
foreach (array_keys($this->_str_table) as $string) {
if( strlen( $string ) > $continue_limit )
{
die( "Error: string $string too long" );
};
2. Change in workbook.php in function _calculateSharedStringsSizes():
from:
if ($space_remaining > $header_length) {
to:
//if ($space_remaining > $header_length) {
if (false){
3. Change in workbook.php in function 1. Change in workbook.php in function _calculateSharedStringsSizes():
from:
//if ($space_remaining > $header_length) {
if ($space_remaining > $header_length) {
to:
if (false){