Saturday 31 August 2013

Error XLS file generate and open using html,php

Error XLS file generate and open using html,php

I have generate xls file using html and php everthing is fine. But problem
is that when tring to open file then following error display

My code is here:
$filename = "file.xls";
header("Content-Type: application/vnd.ms-excel; charset=utf-8");
header("Content-type: application/x-msexcel; charset=utf-8");
header("Content-Disposition: attachment;filename=".$filename); //tell
browser what's the file name
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: max-age=0");
echo '<table>
<tr>
<th>heading1</th>
<th>heading2</th>
<th>heading3</th>
</tr>
<tr>
<td>data1</td>
<td>data2</td>
<td>data3</td>
</tr>
</table>';

No comments:

Post a Comment