开发者

create excel file from HTML table using jQuery or PHP

I have a HTML table on my PHP page,that I want to export to excel file and available this file for user download on a button开发者_开发问答 click . How can I do this using jQuery or PHP ? .Any code examples to demo. this would be great


You have to post the html markup of the table you have on the page or create the same markup on the server side and then use the below code to export it into excel format.

<?php
$file="test.xls";
$test="TheTableMarkupWillGoHere";
header("Content-type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=$file");
echo $test;
?>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜