首先去我的云盘下载需要的js:

链接:https://pan.baidu.com/s/13vC-u92ulpx3RbljsuadWw
提取码:mo8m
页面代码:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>多种文件导出方法总结</title>
</head>
<body> <table id="cards_table" class="table table-striped table-bordered text-center table-hover dataTable no-footer"
style="width: 100%;" role="grid" aria-describedby="cards_table_info">
<thead>
<tr role="row">
<th class="text-center sorting_disabled" rowspan="1" colspan="1" aria-label="卡号">卡号</th>
<th class="text-center sorting_disabled" rowspan="1" colspan="1" aria-label="姓名">姓名</th>
<th class="text-center sorting_disabled" rowspan="1" colspan="1" aria-label="身份证号码">身份证号码</th>
<th class="text-center sorting_disabled" rowspan="1" colspan="1" aria-label="卡种">卡种</th>
<th class="text-center sorting_disabled" rowspan="1" colspan="1" aria-label="设备编号">设备编号</th>
<th class="text-center sorting_disabled" rowspan="1" colspan="1" aria-label="网点编号">网点编号</th>
<th class="text-center sorting_disabled" rowspan="1" colspan="1" aria-label="卡盘号">卡盘号</th>
<th class="text-center sorting_disabled" rowspan="1" colspan="1" aria-label="卡槽号">卡槽号</th>
<th class="text-center sorting_disabled" rowspan="1" colspan="1" aria-label="加卡日期">加卡日期</th>
<th class="text-center sorting_disabled" rowspan="1" colspan="1" aria-label="加卡时间">加卡时间</th>
<th class="text-center sorting_disabled" rowspan="1" colspan="1" aria-label="加卡柜员">加卡柜员</th>
</tr>
</thead>
<tbody>
<tr role="row" class="odd">
<td class="text-center sorting_1">6228231467695031768</td>
<td class=" text-center"></td>
<td class=" text-center">440682197705203224</td>
<td class=" text-center">成品银行卡</td>
<td class=" text-center">2000Y5</td>
<td class=" text-center">402880e95d0da971015d0dbaaac00008</td>
<td class=" text-center">4</td>
<td class=" text-center">11</td>
<td class=" text-center">2019-10-24</td>
<td class=" text-center">18:10:40</td>
<td class=" text-center">cardMaker</td>
</tr>
<tr role="row" class="even">
<td class="text-center sorting_1">6228231467695031768</td>
<td class=" text-center"></td>
<td class=" text-center">440682197705203224</td>
<td class=" text-center">成品银行卡</td>
<td class=" text-center">2000Y5</td>
<td class=" text-center">402880e95d0da971015d0dbaaac00008</td>
<td class=" text-center">4</td>
<td class=" text-center">12</td>
<td class=" text-center">2019-10-24</td>
<td class=" text-center">18:10:52</td>
<td class=" text-center">cardMaker</td>
</tr>
<tr role="row" class="odd">
<td class="text-center sorting_1">6228231467695031768</td>
<td class=" text-center"></td>
<td class=" text-center">440682197705203226</td>
<td class=" text-center">成品银行卡</td>
<td class=" text-center">2000Y5</td>
<td class=" text-center">402880e95d0da971015d0dbaaac00008</td>
<td class=" text-center">4</td>
<td class=" text-center">5</td>
<td class=" text-center">2019-10-23</td>
<td class=" text-center">23:10:08</td>
<td class=" text-center">cardMaker</td>
</tr>
<tr role="row" class="even">
<td class="text-center sorting_1">6228231467695031768</td>
<td class=" text-center"></td>
<td class=" text-center">440682197705203224</td>
<td class=" text-center">成品银行卡</td>
<td class=" text-center">2000Y5</td>
<td class=" text-center">402880e95d0da971015d0dbaaac00008</td>
<td class=" text-center">4</td>
<td class=" text-center">12</td>
<td class=" text-center">2019-11-12</td>
<td class=" text-center">11:11:59</td>
<td class=" text-center">cardMaker</td>
</tr>
<tr role="row" class="odd">
<td class="text-center sorting_1">6228231467695031768</td>
<td class=" text-center"></td>
<td class=" text-center">440682197705288888</td>
<td class=" text-center">成品银行卡</td>
<td class=" text-center">2000Y5</td>
<td class=" text-center">402880e95d0da971015d0dbaaac00008</td>
<td class=" text-center">4</td>
<td class=" text-center">12</td>
<td class=" text-center">2019-11-12</td>
<td class=" text-center">12:11:15</td>
<td class=" text-center">cardMaker</td>
</tr>
</tbody>
</table>
<button onclick="exportExcel()" >导出表格Excel</button>
<button onclick="exportCSV()" >导出表格csv</button>
<button onclick="exportStyleExcel()" >导出带有样式的Excel</button>
<button onclick="exportTxt()" >导出Txt</button>
<button onclick="exportJSON()" >导出JSON</button>
<button onclick="exportXML()" >导出XML</button>
<button onclick="exportSQL()" >导出SQL</button>
<button onclick="exportPDF()">导出PDF</button>
</body>
<!-- 这个是所有jquery插件的基础,首先第一个引入 -->
<script src="jquery-3.1.1.js"></script>
<!--PDF Export(导出Excel需要添加插件)
导出的格式可以是:如下
JSON
XML
PNG
CSV
TXT
SQL
MS-Word
Ms-Excel
Ms-Powerpoint
PDF-->
<!--base64,解析中文-->
<script src="jquery.base64.js"></script>
<script src="tableExport.js"></script>
<!--PNG Export(导出png需要添加插件)-->
<script type="text/javascript" src="html2canvas.js"></script>
<!--PDF Export(导出PDF需要添加插件)-->
<script type="text/javascript" src="jspdf/libs/sprintf.js"></script>
<script type="text/javascript" src="jspdf/jspdf.js"></script>
<script type="text/javascript" src="jspdf/libs/base64.js"></script>
<script>
//导出表格excel
function exportExcel() {
//导出按钮
$('#cards_table').tableExport({
type: 'excel',//将表导出的格式,这边为excel,也可以为txt/pdf/json/xml等
escape: 'false',
fileName: 'table',////设置导出的表的默认名称
worksheetName: 'worksheetName2',//工作页名称
tableName: 'tableName',//表格名称
ignoreColumn:'[5]'//表示忽略列数,在这表示把第6(5+1)列的数据给忽略掉,不在Excel中显示
})
}
//导出表格csv
function exportCSV() {
//导出按钮
$('#cards_table').tableExport({
type: 'csv',//将表导出的格式,这边为excel,也可以为txt/pdf/json/xml等
escape: 'false',
fileName: 'table',////设置导出的表的默认名称
worksheetName: 'worksheetName2',//工作页名称
tableName: 'tableName',//表格名称
ignoreColumn:'[5]'//表示忽略列数,在这表示把第6(5+1)列的数据给忽略掉,不在Excel中显示
})
}
//导出带有样式的表格
function exportStyleExcel() {
//导出按钮
$('#cards_table').tableExport({
type: 'excel',//将表导出的格式,这边为excel,也可以为txt/pdf/json/xml等
escape: 'false',
fileName: 'table',////设置导出的表的默认名称
worksheetName: 'worksheetName2',//工作页名称
tableName: 'tableName',//表格名称
ignoreColumn:'[5]',//表示忽略列数,在这表示把第6(5+1)列的数据给忽略掉,不在Excel中显示
excelstyles: ['red', 'color', 'font-weight', 'border']
})
}
//导出txt
function exportTxt() {
//导出按钮
$('#cards_table').tableExport({
type: 'txt',//将表导出的格式,这边为excel,也可以为txt/pdf/json/xml等
escape: 'false',
fileName: 'table',////设置导出的表的默认名称
worksheetName: 'worksheetName2',//工作页名称
tableName: 'tableName',//表格名称
ignoreColumn:'[5]'//表示忽略列数,在这表示把第6(5+1)列的数据给忽略掉,不在Excel中显示
})
}
//导出json
function exportJSON() {
//导出按钮
$('#cards_table').tableExport({
type: 'json',//将表导出的格式,这边为excel,也可以为txt/pdf/json/xml等
escape: 'false',
fileName: 'table',////设置导出的表的默认名称
worksheetName: 'worksheetName2',//工作页名称
tableName: 'tableName',//表格名称
ignoreColumn:'[5]'//表示忽略列数,在这表示把第6(5+1)列的数据给忽略掉,不在Excel中显示
})
}
//导出XML
function exportXML() {
//导出按钮
$('#cards_table').tableExport({
type: 'xml',//将表导出的格式,这边为excel,也可以为txt/pdf/json/xml等
escape: 'false',
fileName: 'table',////设置导出的表的默认名称
worksheetName: 'worksheetName2',//工作页名称
tableName: 'tableName',//表格名称
ignoreColumn:'[5]'//表示忽略列数,在这表示把第6(5+1)列的数据给忽略掉,不在Excel中显示
})
}
//导出SQL
function exportSQL() {
//导出按钮
$('#cards_table').tableExport({
type: 'sql',//将表导出的格式,这边为excel,也可以为txt/pdf/json/xml等
escape: 'false',
fileName: 'table',////设置导出的表的默认名称
worksheetName: 'worksheetName2',//工作页名称
tableName: 'tableName',//表格名称
ignoreColumn:'[5]'//表示忽略列数,在这表示把第6(5+1)列的数据给忽略掉,不在Excel中显示
})
}
//导出PDF:谷歌浏览器不支持
function exportPDF() {
//导出按钮
$('#cards_table').tableExport({
type: 'pdf',//将表导出的格式,这边为excel,也可以为txt/pdf/json/xml等
escape: 'false',
fileName: 'table',////设置导出的表的默认名称
worksheetName: 'worksheetName2',//工作页名称
tableName: 'tableName',//表格名称
ignoreColumn:'[5]'//表示忽略列数,在这表示把第6(5+1)列的数据给忽略掉,不在Excel中显示
})
}
</script>
</html>

补充:

TableExport插件依赖于jQuery(1.2.1+),FileSaver.js。为了支持.xlsx(Office Open XML SpreadsheetML Format)格式,你必须在 FileSaver.js 和 TableExport.js文件之前引入xlsx-core.js文件。为了使旧的浏览器(Firefox < 20, Opera < 15, Safari < 6)支持.xlsx,需要在 FileSaver.js 文件之前引入 Blob.js文件。
<script src="jquery.min.js"></script>
<script src="xlsx-core.js"></script>
<script src="blob.js"></script>
<script src="filesaver.js"></script>
<script src="tableexport.js"></script>
												

导出Excel/Pdf/txt/json/XML/PNG/CSV/SQL/MS-Word/ Ms-Powerpoint/等通过tableExport.js插件来实现的更多相关文章

  1. Python导出Excel为Lua/Json/Xml实例教程(一):初识Python

    Python导出Excel为Lua/Json/Xml实例教程(一):初识Python 相关链接: Python导出Excel为Lua/Json/Xml实例教程(一):初识Python Python导出 ...

  2. Python导出Excel为Lua/Json/Xml实例教程(三):终极需求

    相关链接: Python导出Excel为Lua/Json/Xml实例教程(一):初识Python Python导出Excel为Lua/Json/Xml实例教程(二):xlrd初体验 Python导出E ...

  3. Python导出Excel为Lua/Json/Xml实例教程(二):xlrd初体验

    Python导出Excel为Lua/Json/Xml实例教程(二):xlrd初体验 相关链接: Python导出Excel为Lua/Json/Xml实例教程(一):初识Python Python导出E ...

  4. 导出jqgrid表格数据为EXCEL文件,通过tableExport.js插件。

    今天公司项目需要做个导出功能,将jqgrid查询出的数据导出为EXCEL表格文件,期间遇到两个问题: 1.导出报错 uncaught exception: INVALID_CHARACTER_ERR: ...

  5. RDLC - 后台代码直接导出Excel/PDF/Word格式

    最近做报表功能,用到了.net的报表组件rdlc. 其中有个功能就是后台代码直接输出Excel/PDF/Word格式的文件,网上看了些资源,做个总结: 参考地址 我直接贴出代码: //自动导出exce ...

  6. Word,Excel,pdf,txt等文件上传并提取内容

    近期项目需求:1.要用到各种文件上传,下载. 2.并对文件进行搜索. 3.仅仅要文件里包括有搜索的内容,所有显示出来. 今天正好有时间整理一下,方便以后阅读,及对须要用到的朋友提供微薄之力.首先在实现 ...

  7. solr6.6 导入 文本(txt/json/xml/csv)文件

    参照:solr6.6 导入 pdf文件 重点就是三个配置文件 1.建立的data-config.xml 内容如下: <dataConfig> <dataSource name=&qu ...

  8. 一个不错的能将HTML表格导出为excel,pdf等的jquery插件

    https://github.com/kayalshri/tableExport.jquery.plugin https://github.com/kayalshri/ tableExport.jqu ...

  9. java中使用poi导入导出excel文件_并自定义日期格式

    Apache POI项目的使命是创造和保持java API操纵各种文件格式基于Office Open XML标准(OOXML)和微软的OLE复合文档格式(OLE2)2.总之,你可以读写Excel文件使 ...

随机推荐

  1. (转)Java垃圾回收基本过程

    本编博客内容来自oschina,是一篇译文,文中图片比较直观的介绍了JVM进行垃圾回收的过程.原文内容来自oracle官网:Java Garbage Collection Basics oschina ...

  2. idea中无法自动提示相关jar包

    遇到的问题:今天在pom.xml导入数据库坐标后,发现在在配置数据相关属性时,idea无法使用我引入的jar包,后面才发现是因为在下载包时,没网络了,jar包下载失败 解决办法:cmd进入自己的mav ...

  3. Mount Windows (CIFS) shares on Linux with credentials in a secure way

      Posted on 09/09/2014 In almost all cases, when mounting a CIFS-share on a Linux host, you will nee ...

  4. contextlib:上下文管理器工具

    介绍 contextlib模块包含的工具可以用于处理上下文管理器和with语句 上下文管理器API ''' 上下文管理器(context manager)负责管理一个代码块中的资源,会在进入代码块时创 ...

  5. linux基础—课堂随笔04_文件查找和压缩

    文件查找和压缩 文件查找 1.locate   这个命令是对其生成的数据库进行遍历(生成数据库的命令:updatedb),这一特性决定了用locate查找文件速度很快,但是locate命令只能对文件进 ...

  6. postman 接口测试(一)

    一.postman 应用场景 开发接口快速的调用接口,以便调试 方便的调用接口,通过不同的参数去测试接口的输出 这些接口调用时需要保存下来的反复运行的 在运行中如果有断言(检查点 <预期 和现实 ...

  7. Zabbix 监控Windows磁盘IO

    Windows下,打开cmd输入 typeperf -qx > c:\typeperf.txt #打开c:\typeperf.txt文件 windows性能计数器里面包含windows相关数值 ...

  8. 【安徽集训】Entropy

    出题人罗哲正是神爷 Orz Description 这是一道披着交互题外衣的通信题,只支持 C++. 你需要实现 \(2\) 个函数. 交互库先给第一个函数传入一个参数 \(n\),你加密得到的 \( ...

  9. PAT乙级1011

    题目链接 https://pintia.cn/problem-sets/994805260223102976/problems/994805312417021952 题解 很明显这题是考数值范围的,i ...

  10. pycharm运行程序,总是出现IPthony界面(IPython 6.2.1 -- An enhanced Interactive Python. Type '?' for help. PyDev console: using IPython 6.2.1)

    解决方式如下: 取消即可.