Bug #2942 [Com]: Problems with files with over 200 row / or 30kb of filesize
| From: | tomasz.rup@gmail.com | Date: | Wed, 01 Apr 2009 09:07:51 +0000 |
| Subject: | Bug #2942 [Com]: Problems with files with over 200 row / or 30kb of filesize | ||
| References: | 1 | Groups: | php.pear.bugs |
| Request: | Send a blank email to pear-bugs+get-289@lists.php.net to get a copy of this message | ||
Edit report at http://pear.php.net/bugs/bug.php?id=2942&edit=1
ID: 2942
Comment by: tomasz.rup@gmail.com
Reported By: alex dot petri at gmx dot de
Summary: Problems with files with over 200 row / or 30kb of
filesize
Status: Open
Type: Bug
Package: Spreadsheet_Excel_Writer
Operating System: Linux
PHP Version: 4.3.9
Roadmap Versions:
New Comment:
Miso's patch work good, but binary file
generated by my test and generated by OO.o 3.0.1 are
different.
[tomek@localhost tmp]$ hexdump test1.xls > test1.hex
[tomek@localhost tmp]$ hexdump test1_miso.xls >
test1_miso.hex
[tomek@localhost tmp]$ diff test1.hex test1_miso.hex
62c62
< 0000560 7473 00fc 2020 00c9 0000 00c9 0000 0013
---
> 0000560 7473 00fc 2017 00c9 0000 00c9 0000 0013
575,576c575,576
< 0002570 003a 0031 0039 0013 3201 3000 3000 3900
< 0002580 2d00 3000 3100 003c 001a 0000 002d 0030
---
> 0002570 003a 0031 0039 0013 3201 3000 3c00 2300
> 0002580 0100 0030 0039 002d 0030 0031 002d 0030
776,777c776,777
< 0003260 0000 0000 3a00 c4f5 b2b5 01c9 3a00 c4f5
< 0003270 b2b5 01c9 0000 0000 0000 0000 0000
0000
---
> 0003260 0000 0000 ef00 f0c5 b2b8 01c9 ef00 f0c5
> 0003270 b2b8 01c9 0000 0000 0000 0000 0000
0000
[tomek@localhost tmp]$ hexdump test2.xls > test2.hex
[tomek@localhost tmp]$ hexdump test2_miso.xls >
test2_miso.hex
[tomek@localhost tmp]$ diff test2.hex test2_miso.hex
62c62
< 0000560 7473 00fc 2020 0112 0000 0112 0000 0013
---
> 0000560 7473 00fc 2018 0112 0000 0112 0000 0013
575,576c575,576
< 0002570 3a00 3100 3600 0800 0100 0030 0030 003a
< 0002580 0030 0032 003a 003c 0005 3100 3700 0a00
---
> 0002570 3a00 3100 3600 0800 0100 0030 0030 003c
> 0002580 000d 3a01 3000 3200 3a00 3100 3700 0a00
839,840c839,840
< 0003660 0000 0000 3a00 c4f5 b2b5 01c9 3a00 c4f5
< 0003670 b2b5 01c9 0000 0000 0000 0000 0000
0000
---
> 0003660 0000 0000 ef00 f0c5 b2b8 01c9 ef00 f0c5
> 0003670 b2b8 01c9 0000 0000 0000 0000 0000
0000
Previous Comments:
------------------------------------------------------------------------
[2009-04-01 09:38:29] tomaszrup
Test file:
require_once "Spreadsheet/Excel/Writer.php";
class xls {
/**
* @var Spreadsheet_Excel_Writer
*/
private $xls;
/**
* @var Spreadsheet_Excel_Writer_Worksheet
*/
private $sheet;
private $row = 0;
private $colDateMasks;
private function init($filename) {
$this->xls = new
Spreadsheet_Excel_Writer($filename);
$this->xls->setVersion(8);
$this->sheet =& $this->xls->addWorksheet('Test');
$this->sheet->setInputEncoding('iso-8859-1');
}
private function createRow($cols) {
for($col = 0; $col < $cols; $col++) {
$content = date($this->colDateMasks[$col],
strtotime('2009-01-01 00:00:00') + ($this->row + $col));
$this->sheet->writeString($this->row, $col,
$content);
}
$this->row++;
}
private function finalize() {
$this->xls->close();
}
public function test($filename, $cols, $rows,
$colDateMasks) {
$this->colDateMasks = $colDateMasks;
$this->init($filename);
for($row = 0; $row < $rows; $row++) {
$this->createRow($cols);
}
$this->finalize();
}
}
$xls = new xls;
$xls->test('test1.xls', 1, 201, array('Y-m-d H:i:s'));
unset($xls);
$xls = new xls;
$xls->test('test2.xls', 2, 137, array('Y-m-d H:i:s', 'H:i:s'));
This code produce 2 files without letters. First file broken
on row 201. Second on row 137. Both files have a size
above 14k
My configuration:
Linux
PHP 5.2.9
PEAR::Spreadsheet_Excel_Writer 0.9.1
------------------------------------------------------------------------
[2008-11-24 14:00:20] mek7
valli, thank you very much, you saved me a day and my hair, wow! :)
------------------------------------------------------------------------
[2007-11-20 05:25:32] valli
Try out the the patch in
http://pear.php.net/bugs/bug.php?id=1572
(Miso's patch)
You can also download the patched Workbook.php from
http://bugs.gentoo.org/attachment.cgi?id=136412
------------------------------------------------------------------------
[2007-09-28 05:34:42] vtsuper
I got the same problem with the others,
I believe the setVersion and setInputEncoding('utf-8') is not work all
the time
when I set
$file->setVersion(8);
$sheet->setInputEncoding('utf-8');
and the excel content with Chinese character then it works.
but if the excel with only English character then it didn't works.
will it has a update version soon?
------------------------------------------------------------------------
[2007-08-23 00:58:55] johnnz
Oops, further to my previous comment. I see that
_calculateSharedStringSizes in ExcelWorkbook does consider the split for
the continue record, but its either not yet implemented or not correctly
implemented. I am still looking at that bit. Whichever way, at the
moment the result is not correct.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://pear.php.net/bugs/bug.php?id=2942
--
Edit this bug report at http://pear.php.net/bugs/bug.php?id=2942&edit=1