JS将表单导出成EXCEL
2011-08-15 18:22
417 查看
这是写好的例子可以测试一下就明白了
本文出自 “博客即日起停止更新” 博客,请务必保留此出处http://sucre.blog.51cto.com/1084905/639732
<!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> <title> new document </title> <meta name="generator" content="editplus" /> <meta name="author" content="" /> <meta name="keywords" content="" /> <meta name="description" content="" /> <SCRIPT LANGUAGE="javascript"> <!-- function AutomateExcel() { // Start Excel and get Application object. var oXL = new ActiveXObject("Excel.Application"); // Get a new workbook. var oWB = oXL.Workbooks.Add(); var oSheet = oWB.ActiveSheet; var table = document.all.data; var hang = table.rows.length; var lie = table.rows(0).cells.length; // Add table headers going cell by cell. for (i=0;i<hang;i++) { for (j=0;j<lie;j++) { //oSheet.Cells(i+1,j+1).Font.Bold = True //oSheet.Cells(i+1,j+1).Font.Size = 50 //oSheet.Cells(i+1,j+1).Alignment = 2 oSheet.Cells(i+1,j+1).value = table.rows(i).cells(j).innerText; } } oXL.Visible = true; oXL.UserControl = true; } //--> </SCRIPT> </head> <body> <table border="1" width="100%" id="data"> <tr> <td> 姓名</td> <td colspan="2">年龄</td> <td>出生日期</td> </tr> <tr> <td>6</td> <td>25</td> <td colspan="2">8</td> </tr> <tr> <td height="22">1</td> <td height="22">2</td> <td colspan="2" height="22">4</td> </tr> </table> <input type="button" name="out_excel" onclick="AutomateExcel();" value="导出到excel" class="notPrint"> </body> </html>
本文出自 “博客即日起停止更新” 博客,请务必保留此出处http://sucre.blog.51cto.com/1084905/639732
相关文章推荐
- JS将表单导出成EXCEL的实例代码
- JS将表单导出成EXCEL的实例代码
- js post、form表单导出excel
- 将ClistCtr中数据导出到Excel表单中
- [转]纯js导出json到excel(支持chrome)
- JS&简单POI实现前端多个jqgrid列表导出Excel
- js 导出到word,excel
- 从浏览器导出excel表单
- js生成excel对象并导出
- js导出页面表格数据到Excel
- js导出成excel
- chrome浏览器js 导出excel
- js导出table数据到excel即导出为EXCEL文档的方法
- 纯js 解决页面table导出excel
- 提交搜索表单 html页面表格导出到excel总结
- tableExport.js导出带边框的excel
- js导出excel
- 直接在客户端通过js导出excel的方法(不限浏览器,不必安装excel)
- java服务端利用poi 导出excel 前端需要用表单提交
- Angularjs ui-grid pdfmake.js 导出excel/pdf及pdf中文问题