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

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

https://github.com/kayalshri/

tableExport.jquery.plugin

Export HTML Table to

  • JSON
  • XML
  • PNG
  • CSV
  • TXT
  • SQL
  • MS-Word
  • Ms-Excel
  • Ms-Powerpoint
  • PDF

Installation

jquery Plugin < script type="text/javascript" src="tableExport.js"> < script type="text/javascript" src="jquery.base64.js">

PNG Export

<script type="text/javascript" src="html2canvas.js">

PDF Export

<script type="text/javascript" src="jspdf/libs/sprintf.js"> < script type="text/javascript" src="jspdf/jspdf.js"> < script type="text/javascript" src="jspdf/libs/base64.js">

Usage

onClick ="$(‘#tableID‘).tableExport({type:‘pdf‘,escape:‘false‘});"

Options

separator: ‘,‘ ignoreColumn: [2,3], tableName:‘yourTableName‘ type:‘csv‘ pdfFontSize:14 pdfLeftMargin:20 escape:‘true‘ htmlContent:‘false‘ consoleLog:‘false‘

<html>    <head>     <title>Export html table to excel and csv using jquery</title>    <script src="/jquery-1.9.1.min.js"></script>    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css">     <script type="text/javascript" src="/jquery.base64.js"></script>

<script type="text/javascript" src=/tableExport.js"></script>                                   <script type="text/javascript" src="/jspdf/libs/sprintf.js">                       </script>                             <script type="text/javascript" src="http://localhost:8082/myphp/tableExport.jquery.plugin-master/jspdf/jspdf.js"></script>        <script type="text/javascript" src="/jspdf/base64.js"></script>           </head>    <body>     [align=right]      <br><br><br>         <button class="btn btn-success" onClick ="$(‘#customers‘).tableExport({type: ‘excel‘, escape: ‘false‘});">Excel Export</button>      <button class="btn btn-success" onClick ="$(‘#customers‘).tableExport({type: ‘pdf‘, escape: ‘false‘});">CSV Export</button>      <br><br>      [/align]      <table id="customers" class="table table-striped table-bordered" >       <thead>           <tr class=‘warning‘>         <th>Country</th>         <th>Population</th>         <th>Date</th>        </tr>       </thead>       <tbody>        <tr>         <td>Chinna</td>         <td>1,363,480,000</td>         <td>March 24, 2014</td>        </tr>        <tr>         <td>India</td>         <td>1,241,900,000</td>         <td>March 24, 2014</td>        </tr>        <tr>         <td>United States</td>         <td>317,746,000</td>         <td>March 24, 2014</td>        </tr>        <tr>         <td>Indonesia</td>         <td>249,866,000</td>         <td>July 1, 2013</td>        </tr>        <tr>         <td>Brazil</td>         <td>201,032,714</td>         <td>July 1, 2013</td>        </tr>       </tbody>      </table>     </div>    </body>   </html>

时间: 2024-11-07 05:19:42

一个不错的能将HTML表格导出为excel,pdf等的jquery插件的相关文章

html页面表格导出到excel

几种把html页面表格导出到excel的方法比较. 表格例子如下: <table id="tableExcel" width="100%" border="1" cellspacing="0" cellpadding="0"> <tr> <td colspan="5" align="center">html 表格导出道Exceltd

JS 将页面上的表格导出为 Excel 文件

如果在页面上展示了一个表格,想把这个表格导出为Excel文件,那么在要求不高的情况下,可以直接利用 JavaScript 的 Blob 和 Object URL 特性将表格导出.不过,这就是利用了 Excel 能打开 HTML 文档的特性,所以导出的表格实际上是一个 HTML 文档,并且其扩展名只能为 .xls,而不能是 .xlsx,否则Excel无法打开.(有使用JavaScript生成真正Excel文件的方案,以后再研究.) 实例: <!DOCTYPE html> <html>

将HTML表格导出到EXCEL,兼容Firefox,支持中文

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head> <meta http-equiv="Content

MVC把表格导出到Excel

有关Model: namespace MvcApplication1.Models { public class Coach { public int Id { get; set; } public string Name { get; set; } } } HomeController中,借助GridView控件把内容导出到Excel: using System.Collections.Generic; using System.IO; using System.Linq; using Sys

html页面表格导出到excel总结

转载:http://www.cnblogs.com/liuguanghai/archive/2012/12/31/2840262.html <table id="tableExcel" width="100%" border="1" cellspacing="0" cellpadding="0"> <tr> <td colspan="5" align=&qu

将表格导出为excel

1 <table id="tableExcel" border="1"> 2 <tr> 3 <th>零</th> 4 <th>一</th> 5 <th>二</th> 6 <th>三</th> 7 <th>四</th> 8 </tr> 9 <tr> 10 <td>万籁寂无声</td&g

mysql数据库表格导出为excel表格

在本地数据库中操作如下: 由于excel表格的编码是GBK,所以导出时要加一个设置字符编码: select * from 某个表 into outfile 'd:/文件名.xls' CHARACTER SET gbk;

ssh+jxl将表格导出为Excel

首先准备jxl.jar. 然后让我们了解了解这个jxl,Excel本来就有工作簿.工作表.单元格等属性,所以我们从数据库导出表格也必须先有工作簿(workbook).工作表(sheet).单元格(label).实现导出表格也是从三个入手. 首先创建一个writeworkbook对象 Writableworkbook  book=Workbook.createWorkbook(new File(path)): 然后创建工作表sheet对象 WritableSheet sheet=book.crea

前端JS脚本将网页表格导出为Excel

话不多说,上代码! <!DOCTYPE> <html> <head> <title>Excel Test</title> </head> <body> <div style="width:100%;padding:40px;"> Excel Test </div> <table id="excel"> <tr> <td>Na