Home » File Formats » Spreadsheet_Excel_Writer » Bug #6179
Cannot create excel file larger than 2MB
Details
| Submitted | 2005-12-07 12:34 UTC |
|---|---|
| From | tarida at gmail dot com |
| Status | Bogus |
| Package | Spreadsheet_Excel_Writer |
| PHP Version | 5.0.4 |
| OS | Linux |
| Roadmaps | (Not assigned) |
Comments
[2005-12-07 12:34 UTC] tarida at gmail dot com
Description:
------------
I try to create large excel file, with no success. Increasing post_max_size = 8M and upload_max_filesize = 8M in php.ini, but still i cannot create file larger than 2Mb. Is the problem on php or the Spreadsheet Excel Write ?
[2005-12-23 08:17 UTC] peterjlp at telkom dot net
I have the same problem.
Test with this code, and i got the same error..
include_once "Spreadsheet/Excel/Writer.php";
$xls =& new Spreadsheet_Excel_Writer();
$xls->send("test.xls");
$sheet =& $xls->addWorksheet('test');
for ($row = 0; $row < 10000; $row++) {
for ($col = 0; $col < 100; $col++) {
$sheet->write($row,$col,'test');
}
}
$xls->close();
[2006-02-15 23:22 UTC] cheetah at tanabi dot org
The problem may be related to PHP5 and readline/fpassthrough or something similar, which seems to have a weird 2 meg limit (read the comments in the manual for readline for more info).
A workaround: save the spreadsheet to a file, and 'include' it. For example:
include_once "Spreadsheet/Excel/Writer.php";
$xls =& new Spreadsheet_Excel_Writer("test.xls");
// All this does is send headers, so you may as well use it
$xls->send("test.xls");
$sheet =& $xls->addWorksheet('test');
for ($row = 0; $row < 10000; $row++) {
for ($col = 0; $col < 100; $col++) {
$sheet->write($row,$col,'test');
}
}
$xls->close();
include ("test.xls");