This is very common problem we face while generating huge Excel file using PEAR, Php-Excel, php excel writer class . I spent many hours to find out solution and finally found something very useful.
There is some limitation comes with excel file generation.
There are two ways to resolve this issue.
(1) Generate Excel file as per below code.
For huge file use HTML to excel conversion, It works many times for me and it works fine in huge file too.
2) Install OLE::Storage_Lite module
Thanks for reading my post
There is some limitation comes with excel file generation.
Description | Limit |
---|---|
Maximum number of chars in a string | 32767 |
Maximum number of columns | 256 |
Maximum number of rows | 65536 |
Maximum chars in a sheet name | 31 |
Maximum chars in a header/footer | 254 |
There are two ways to resolve this issue.
(1) Generate Excel file as per below code.
For huge file use HTML to excel conversion, It works many times for me and it works fine in huge file too.
<?php
$strOutput="<table width="100%" border="1" cellspacing="0" cellpadding="0"><tr>
<td>Column1</td>
<td>Column2</td>
</tr>
<tr>
<td>Value of Column1 </td>
<td>Value of Column2 </td>
</tr>
</table>";
$file = 'myxlsfile.xls';
//export start
header("Content-type: application/vnd.ms-excel; charset=UTF-8");
header("Content-Type: application/force-download");
header("Content-Disposition: attachment; filename=" . $file);
echo $strOutput;
?>
Note: Generated file using this method may show some warning when we open in excel.
2) Install OLE::Storage_Lite module
Thanks for reading my post
Comments
Post a Comment