用acticex 打印本地的excel ,执行到xlsApp.Workbooks.Open("")执行出错
function printExcel() {
var xlsApp = null;
try {
xlsApp = new ActiveXObject('Excel.Application');
} catch (e) {
alert('请启用ActiveX控件');
return;
}
//var xlBook = xlsApp.Workbooks.Open('http://'+window.location.host+obj.value);
var xlBook = xlsApp.Workbooks.Open("d://test.xlsx");
alert(xlBook);
var xlsheet = xlBook.Worksheets(1);
//xlsApp.Application.Visible = false;
//xlsApp.visible = false;
xlsheet.Printout;
xlsApp.Quit();
xlsApp = null;
}
ActiveX插件已启用,每次执行到var xlBook = xlsApp.Workbooks.Open("d://test.xlsx");的时候就执行不下去了?
请问这是为什么呢?请各位指教,不胜感激!