更新时间:2021-11-02 09:13:37
远离,从表到Excel最干净,最简单的导出是 Jquery DataTables表工具插件。您可以获得一个网格,对数据进行排序,筛选,订购和打印,只需添加几行代码和两个小文件,就可以导出到 Excel , PDF strong>, CSV ,剪贴板和打印机。
Far and away, the cleanest, easiest export from tables to Excel is Jquery DataTables Table Tools plugin. You get a grid that sorts, filters, orders, and pages your data, and with just a few extra lines of code and two small files included, you get export to Excel, PDF, CSV, to clipboard and to the printer.
所有需要的代码:
$(document).ready( function () {
$('#example').dataTable( {
"sDom": 'T<"clear">lfrtip',
"oTableTools": {
"sSwfPath": "/swf/copy_cvs_xls_pdf.swf"
}
} );
} );
所以,快速部署,没有浏览器限制,不需要服务器端语言,最重要的是很容易理解。这是双赢的。尽管如此,它所做的一件事是限制列的严格格式。
So, quick to deploy, no browser limitations, no server-side language required, and most of all very EASY to understand. It's a win-win. The one thing it does have limits on, though, is strict formatting of columns.