用js导出execl数据,在IE上可以导出,在chrome上没有反应,求大神指点,如何解决,我的代码如下
functionadd(){varelement=document.getElementById(ID);varoXL=newActiveXObject("Excel.a...
function add()
{
var element=document.getElementById(ID);
var oXL = new ActiveXObject("Excel.application");
var oWB = oXL.Workbooks.open(filePath);
oWB.worksheets(1).select();
var oSheet = oWB.ActiveSheet;
var row=oWB.Worksheets(1).UsedRange.Cells.Rows.Count;
try{
for(var i=1;i<=row;i++){
element.value+=oSheet.Cells(i,1).value+"\t"
}
}catch(e){
alert(e.message);
}
oWB.close();
oXL.Quit();
CollectGarbage();
} 展开
{
var element=document.getElementById(ID);
var oXL = new ActiveXObject("Excel.application");
var oWB = oXL.Workbooks.open(filePath);
oWB.worksheets(1).select();
var oSheet = oWB.ActiveSheet;
var row=oWB.Worksheets(1).UsedRange.Cells.Rows.Count;
try{
for(var i=1;i<=row;i++){
element.value+=oSheet.Cells(i,1).value+"\t"
}
}catch(e){
alert(e.message);
}
oWB.close();
oXL.Quit();
CollectGarbage();
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询