Jquery 将HTML表格导出到excel-保存我们问题

Jquery 将HTML表格导出到excel-保存我们问题,jquery,html,Jquery,Html,我有一个Html表格,我使用jquery方法table2excel将其导出到excel function exporttoExcl() { var date = $("#txtDate").val(); $(function () { $(".testt").table2excel({ exclude: ".noExl", name: "Excel Document Name",

我有一个Html表格,我使用jquery方法
table2excel
将其导出到excel

function exporttoExcl() { 
    var date = $("#txtDate").val();
    $(function () {
        $(".testt").table2excel({               
            exclude: ".noExl",
            name: "Excel Document Name",
            filename: "WeeklyAttendanceRpt_" + date,
            fileext: ".xls",
            exclude_img: true,
            exclude_links: true,
            exclude_inputs: true
        });
    });
}

<table class="testt">
<tr>
    <td>test1</td>
    <td>test2</td>
</tr>  
</table>
函数exporttoExcl(){
var日期=$(“#txtDate”).val();
$(函数(){
$(“.testt”).table2excel({
排除:“.noExl”,
名称:“Excel文档名称”,
文件名:“WeeklyAttendanceRpt”+日期,
fileext:“.xls”,
排除:正确,
排除链接:true,
排除_输入:true
});
});
}
测试1
测试2
使用上面的代码,我可以导出并下载“.xls”文件。但我尝试对下载的文件执行“另存为”操作,它保存为“htm/html”类型。下载文件的默认文件格式为“htm/html”。如何在下载的文件中将默认类型设置为“xls”或“xlsx”,而不是“htm/html”。

“另存为”保存整个页面,这是一个html文件,据我所知,无法更改“另存为”行为,可以创建一个带有自定义“另存为”选项的自定义菜单,以所需扩展名“另存为”保存exel保存整个页面,这是一个html文件,据我所知,没有办法改变“另存为”的行为,可以创建一个带有自定义“另存为”选项的自定义菜单,用所需的扩展名保存exel