//导出Excel
function OutExcel()
{
var oXL = new ActiveXObject("Excel.Application");
var oWB = oXL.Workbooks.Add();
var oSheet = oWB.ActiveSheet;
var PrintA = document.getElementById("listtable");
var Lenr = PrintA.rows.length;
try
{
for (i=0;i<Lenr;i++)
{
var Lenc = PrintA.rows(i).cells.length;
for (j=0;j<Lenc;j++)
{
if(j>0)//去掉前面CheckBox
{
oSheet.Cells(i+1,j).NumberFormatLocal = "@";
oSheet.Cells(i+1,j).EntireColumn.AutoFit;//自动展开
oSheet.Cells(i+1,j).value = PrintA.rows(i).cells(j).innerText;
}
}
}
}
catch(e)
{
showMessageBox(e.description,"0","提示");
}
oXL.Visible = true;
}
IE下导出Excel
最新推荐文章于 2021-08-26 21:06:44 发布