export table data in to Excel using jQuery
2013-05-24 00:00
507 查看
--html--
<button id="myButtonControlID">Export Table data into Excel</button>
<div id="divTableDataHolder">
<table>
<tr><th>ColumnOne </th><th>ColumnTwo</th></tr>
<tr>
<td>row1ColValue1</td><td>row1ColValue2</td>
</tr>
<tr>
<td>row2ColValue1</td><td>row2ColValue2</td>
</tr>
</table>
</div>
------js---
$("[id$=myButtonControlID]").click(function(e) {
window.open('data:application/vnd.ms-excel,' + encodeURIComponent( $('div[id$=divTableDataHolder]').html()));
e.preventDefault();
});
<button id="myButtonControlID">Export Table data into Excel</button>
<div id="divTableDataHolder">
<table>
<tr><th>ColumnOne </th><th>ColumnTwo</th></tr>
<tr>
<td>row1ColValue1</td><td>row1ColValue2</td>
</tr>
<tr>
<td>row2ColValue1</td><td>row2ColValue2</td>
</tr>
</table>
</div>
------js---
$("[id$=myButtonControlID]").click(function(e) {
window.open('data:application/vnd.ms-excel,' + encodeURIComponent( $('div[id$=divTableDataHolder]').html()));
e.preventDefault();
});
相关文章推荐
- Export SQLite data to Excel in iOS programmatically(OC)
- Reporting Services - Export Data to Excel In Only One Sheet
- Export Grid Data To Excel In Advance Kendo UI Using MVC WEB API And Entity Framework
- Multiple GridView that contain multiple header row export data to excel(csharp)
- Import Data from Excel sheet to DB Table through OAF page
- export datagrid's data to excel
- How to export data as a CSV file in Symfony
- 94.You plan to move data from a flat file to a table in your database. You decide to use SQL*Loader
- excel export to latex table
- 5 Solutions to Export Data to Excel for ASP.NET
- Simple VBScript program to extract data from all worksheets in an Excel spreadsheet
- NetSuite SuiteScript 2.0 export data to Excel file(xls)
- Import data from EXCEL to Oracle table with PL/SQL Developer
- Export Data from GridView to Excel, Word, HTML with C#
- Simple VBScript program to extract data from all worksheets in an Excel spreadsheet
- Export large data to excel use poi
- Import / export data in MS Excel using C#
- SQLException: ORA-01653: unable to extend table ... by 1024 in tablespace RISK_DATA
- csharp: Export DataTable to Excel using OpenXml 2.5 in asp.net
- Export Internal Table to Excel using OLE