I am putting some HTML content in Session through ob_content () and Jquery.post and then i am writing this content to a xls file. The below is the code :
$myFile = $FileName.“.xls”;
$Path=$myFile;
$fh = fopen($Path, ‘w’) or die(“can’t open file”);
$stringData = $_SESSION[‘MyContent’];
fwrite($fh, $stringData);
fclose($fh);
header(‘Content-disposition: attachment; filename=’.$Path);
header(‘Content-type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet’);
readfile($Path);
unlink($Path);
I am creating the xls file and then dumping content on it through the above code , forcing download through header and then unlinking it.
It was working on all in all versions of excel upto 2007 but now the customer has installed office 2013 and there when they open the same file , the excel hangs for few seconds and then opens. It is still acceptable when they have few records such as reports for 1 to 2 days as it hangs for few seconds only but the time increases when there is more data. A month’s report which has around 3000 to 4000 records takes at least 5 mins to open and during this time the excel becomes unresponsive.
Can anyone advise what can be done.