function getExcelSheet() {//得到Excel工作表
var theSheet;
theApp = new ActiveXObject("Excel.Application");
theSheet = theApp.WorkBooks.Add().ActiveSheet;
theApp.Visible = true;
return theSheet;
}var theSheet;
try
{
theSheet = getExcelSheet();
} catch(exception) {
alert("Error!" + "\n" + "可能原因是你的浏览器的安全级别太高!");
return false;
}
theSheet.Cells(1,1).Value = sTitle;
with (theSheet.Range("A1:T2")) {
Font.Name = "楷体_GB2312"
Font.FontStyle = "加粗"
Font.Size = 18
RowHeight = 30
HorizontalAlignment = -4108
VerticalAlignment = -4108
Mergecells = true
}这段代码放在静态的html中就可以导出excel, 但放到jsp页面上报 “Error!可能原因是你的浏览器的安全级别太高”。不明白,请高手解答。
var theSheet;
theApp = new ActiveXObject("Excel.Application");
theSheet = theApp.WorkBooks.Add().ActiveSheet;
theApp.Visible = true;
return theSheet;
}var theSheet;
try
{
theSheet = getExcelSheet();
} catch(exception) {
alert("Error!" + "\n" + "可能原因是你的浏览器的安全级别太高!");
return false;
}
theSheet.Cells(1,1).Value = sTitle;
with (theSheet.Range("A1:T2")) {
Font.Name = "楷体_GB2312"
Font.FontStyle = "加粗"
Font.Size = 18
RowHeight = 30
HorizontalAlignment = -4108
VerticalAlignment = -4108
Mergecells = true
}这段代码放在静态的html中就可以导出excel, 但放到jsp页面上报 “Error!可能原因是你的浏览器的安全级别太高”。不明白,请高手解答。
alert("Error!" + "\n" + "可能原因是你的浏览器的安全级别太高!");
return false;
异常被你catch掉了
你alert一下看看啊