zoukankan      html  css  js  c++  java
  • 前端把html表格生成为excel表格

    最近公司改后台管理系统。要求导出台账项目等等为excel表格,找半天还真有,他是通过query.table2excel.js 实现,原谅我原生不会弄这个当然大家有可以给我留言。

    <!DOCTYPE html>
    <html>
    	<head>
    		<meta charset="utf-8" />
    		<title></title>
    	</head>
    	<body>
    		<table class="table">  //表格
    			<tr class="noExl"> //加class是为了有些你不想导出用来选则
    				<th>Header</th>
    				<th>111</th>
    			</tr>
    			<tr>
    				<td>Data</td>
    				<td>222</td>
    			</tr>
    		</table>
    		
    		<button id="btn">导出</button>
    		
    		<script src="js/jquery-1.11.0.min.js" type="text/javascript" charset="utf-8"></script>//引入jquery
    		<script src="js/jquery.table2excel.js" type="text/javascript" charset="utf-8"></script> //引入jquer插件
    		<script type="text/javascript">
    			$("#btn").click(function(){  //点击按钮执行导出
    				$(".table").table2excel({  //选取导出的表格
    					exclude: ".noExl",  //写你不想都想导出的
    					name: "Excel Document Name",
    					filename: "项目",  //导出的文件名
    					exclude_img: true,  //是否导出图片
    					exclude_links: true,
    					exclude_inputs: true 
    				});
    			})
    		</script>
    		
    	</body>
    </html>
    

      

  • 相关阅读:
    CCF NOI1062 计算曼哈顿距离
    CCF NOI1061 Wifi密码
    CCF NOI1073 放苹果
    CCF NOI1072 爬楼梯
    CCF NOI1071 Pell数列
    CCF NOI1064 计算斐波那契第n项
    NOI训练行动路线图
    CCF NOI1060 雷同检测
    CCF NOI1059 表达式求值
    CCF NOI1057 石头剪刀布
  • 原文地址:https://www.cnblogs.com/durenlong/p/7544129.html
Copyright © 2011-2022 走看看