jquery - 使用 Jquery 插件将 HTML 表格和表单数据导出到 Excel
问题描述
我有一个 HTML 页面,它有一个 from 和两个表,数据是从 MySQL 中获取的。我想使用 Jquery Plugin 将表单和表格数据导出到 Excel。
我使用了以下 Jquery 插件。但是,它只导出表格数据,省略了表格数据。
<form id="ex1>
<label>Roll No 2</label>
<input type="text value="Anil">
<label>Name</label>
<input type="text value="Anil">
<label>Dept</label>
<input type="text value="CSE">
</form>
<table id="ex2>
<tr>
<th>Subject</th>
<th>Mark</th>
</tr>
<tr>
<td>English</td>
<td>69</td>
</tr>
<tr>
<td>Maths</td>
<td>50</td>
</tr>
<tr>
<td>Computer</td>
<td>90</td>
</tr>
</table>
出口
<script>
$("#export").click(function(){
$("body").table2excel({
exclude: ".noExl",
name: "Worksheet Name",
filename: "Employee Details",
fileext: ".xls",
exclude_img: true,
exclude_links: true,
exclude_inputs: true
});
});
</script>
解决方案
您需要使用格式将form
数据添加到 html中。table
tr td
推荐阅读
- c# - Properties.Settings 在 VS 2013 CE 中不起作用
- python - 反转字符串 - 赋值前引用的局部变量
- python - 如何读取包含字符串的行,然后在没有该字符串的情况下提取该行
- jquery - 为什么带有 Jekyll 和 bootsratp 的 Modal Popup 只显示最后一个孩子的内容?
- aframe - 如何使用 aframe Daydream 触控板控件?
- linux - 使用 exiftool 将纬度-经度(来自文件)添加到 4000 张图像
- url - AWS Cloudfront Link 不通过网络提供服务
- python - 使用我的 python 函数获取完整数据时出错?
- ms-access - 循环通过记录集 vb6
- arm - 手臂的busybox编译:致命错误:byteswap.h:没有这样的文件或目录