我生成这么一个表格,想在这个网页提供一个生成EXCEL表下载的功能,求高人指点!帮我改改谢谢!<table  width="100%" class="sortable" cellspacing="0"   border="1" cellpadding="0"  align="center" id="table1">
<thead>
<tr align="center">
<th>设备类型</th>
<th>设备名称</th>
<th>国家编码</th>
<th>内部编码</th>
<th>设备价格</th>
<th>入库日期</th>
<th>编辑</th>
</tr>
</thead>
<c:forEach items="${equiments}" var="equi" >
<tr   align="center"  onmouseover="bgColor='FDE432'"   onmouseout="bgColor='#ffffff'" >     <td >${equi.types}</td>
<td >${equi.equiName}</td>
<td >${equi.equiCode}</td>
<td >${equi.innerCode}</td>
<td >${equi.equiPrice}</td>
<td >${equi.buyDate}</td>
<td>
<html:link page="/equiment.do?method=delEquiment&ID=${equi.ID}">
<bean:message key="lable.delEqui"/>
</html:link>
<html:link page="/equiment.do?method=repairEqui&ID=${equi.ID}">
<bean:message key="lable.repairEqui"/>
</html:link>
<html:link page="/updateEqui.do?method=loadEqui&ID=${equi.ID}">
<bean:message key="lable.updateEqui"/>
</html:link>
</td>
</tr>
</c:forEach>
</table>

解决方案 »

  1.   

    <script language="javascript"> 
    function exportExcel(tableid){ 
    if (typeof(EXPORT_OBJECT)!="object"){ 
    document.body.insertAdjacentHTML("afterBegin","<OBJECT style='display:none' classid=clsid:0002E510-0000-0000-C000-000000000046 id=EXPORT_OBJECT></Object>"); 

    with (EXPORT_OBJECT){ 
    DataType = "HTMLData"; 
    HTMLData =tableid.outerHTML; 
    try{ 
    ActiveSheet.Export("C:\\表格.xls", 0); 
    alert('成功导出EXCEL表格!'); 

    catch (e){ 
    alert('导出EXCEL表格失败,请确定已安装Excel2000(或更高版本),并且没打开同名xls文件'); 



    </script> 
      

  2.   


    你顺便教我怎么调用把,我不会javascript