js导出excel
< DOCTYPE html PUBLIC -WCDTD XHTML StrictEN httpwwwworgTRxhtmlDTDxhtml-strictdtd>
function toExcel(tablename){ //导出到excel
var mysheet=new ActiveXObject("OWC.Spreadsheet");
with(mysheet){
DataType = "HTMLData";
HTMLData =tablename.outerHTML;
try{
ActiveSheet.Cells(1,1).value="";
ActiveSheet.Cells(2,1).value="";
// ActiveSheet.Cells(34,1).value="导出完毕";
ActiveSheet.Export("c:\\前6周发货预测系数表.xls", 0);
alert('导出完毕');
window.close();
}; catch (e){
alert('导出Excel表失败,请确定已安装Excel2000(或更高版本),并且没打开同名xls文件');
window.close();
};
}
var mysheet=new ActiveXObject("OWC.Spreadsheet");
with(mysheet){
DataType = "HTMLData";
HTMLData =tablename.outerHTML;
try{
ActiveSheet.Cells(1,1).value="";
ActiveSheet.Cells(2,1).value="";
// ActiveSheet.Cells(34,1).value="导出完毕";
ActiveSheet.Export("c:\\前6周发货预测系数表.xls", 0);
alert('导出完毕');
window.close();
}; catch (e){
alert('导出Excel表失败,请确定已安装Excel2000(或更高版本),并且没打开同名xls文件');
window.close();
};
}