开发者

create excel file from HTML table using jQuery or PHP

开发者 https://www.devze.com 2023-04-01 12:42 出处:网络
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 ex

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

精彩评论

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