我用 com +导
<!-- #include file="Include/conStr.asp"
-->
<%
dim objUser,iRec,ExcelFileName,sErr,ReportType,ClassID,ExamID,GradeGroupID
ReportType=request("ReportType"
set objUser=Server.CreateObject("user.PRIVILAGE"
IF ReportType<30 THEN '年级前n名
iRec=objUser.Export_Excel(ConStr,Session("userID"
,ReportType,ExcelFileName,serr)
end if
if ReportType=30 then '//学生info
if isEmpty(request("ClassID"
) then
response.Redirect("Error_Close.asp?sErr=必须选择班级...&URL=javascript:window.close();"
response.End()
end if
ClassID=request("ClassID"
iRec=objUser.Export_Excel_StudentInfo(ConStr,Session("userID"
,0,CSTR(CLASSID),ExcelFileName,serr)
END IF
IF ReportType=32 THEN '学生成绩
if isEmpty(request("ClassID"
) then
response.Redirect("Error_Close.asp?sErr=必须选择班级...&URL=javascript:window.close();"
response.End()
end if
ClassID=request("ClassID"
ExamID=request("ExamID"
iRec=objUser.Export_Excel_Same_Interface(ConStr,Session("userID"
,ReportType,"",ExcelFileName,serr,0,ClassID,ExamID)
END IF
IF ReportType=35 THEN
GradeGroupID=request("GradeGroupID"
ExamID=request("ExamID"
iRec=objUser.Export_Excel_Same_Interface(ConStr,Session("userID"
,"35","",ExcelFileName,serr,GradeGroupID,"0",ExamID)
END IF
IF ReportType=36 THEN
GradeGroupID=request("GradeGroupID"
ExamID=request("ExamID"
iRec=objUser.Export_Excel_Same_Interface(ConStr,Session("userID"
,ReportType,"",ExcelFileName,serr,GradeGroupID,"0",ExamID)
END IF
IF ReportType=40 THEN '年级前n名
GradeGroupID=request("GradeGroupID"
ExamID=request("ExamID"
iRec=objUser.Export_Excel_Same_Interface(ConStr,Session("userID"
,ReportType,"",ExcelFileName,serr,GradeGroupID,"0",ExamID)
END IF
IF ReportType=45 THEN '年级前n名
GradeGroupID=request("GradeGroupID"
ExamID=request("ExamID"
iRec=objUser.Export_Excel_Same_Interface(ConStr,Session("userID"
,ReportType,"",ExcelFileName,serr,GradeGroupID,"0",ExamID)
END IF
IF ReportType=46 THEN '年级前n名
GradeGroupID=request("GradeGroupID"
ExamID=request("ExamID"
iRec=objUser.Export_Excel_Same_Interface(ConStr,Session("userID"
,ReportType,"",ExcelFileName,serr,GradeGroupID,"0",ExamID)
END IF
IF ReportType=48 THEN '课程表
if isEmpty(request("ClassID"
) then
response.Redirect("Error_Close.asp?sErr=必须选择班级...&URL=javascript:window.close();"
response.End()
end if
ClassID=request("ClassID"
iRec=objUser.Export_Excel_Same_Interface(ConStr,Session("userID"
,ReportType,"",ExcelFileName,serr,0,ClassID,0)
END IF
set objUser=nothing
if iRec=0 then
response.Redirect("Error_Close.asp?sErr="
& sErr & "&URL=javascript:window.close();"
Response.End
end if
if iRec=-1 then
response.Redirect("Error_Close.asp?sErr=服务器发生异常错误,无法导出Excel...&URL=javascript:window.close();"
Response.End
end if
if ExcelFileName<>""
then Response.Redirect("Excel/"& ExcelFileName)
Response.End()
%>
<SCRIPT language=javascript>
<!--
function MyOpenExcelWindow( url, winName, width, height)
{
xposition=0
yposition=0;
if ((parseInt(navigator.appVersion) >= 4 ))
{
xposition = (screen.width - width) / 2;
yposition = (screen.height - height) / 2;
}
theproperty= "width="
+ width + ","+ "height="
+ height + ","+ "location=0,"
+ "menubar=1,"
+ "resizable=1,"
+ "scrollbars=0,"
+ "status=0,"
+ "titlebar=0,"
+ "toolbar=0,"
+ "hotkeys=0,"
+ "screenx="
+ xposition + ","
//??êêó?óúNetscape
+ "screeny="
+ yposition + ","
//??êêó?óúNetscape
+ "left="
+ xposition + ","
//IE
+ "top="
+ yposition
//IE
window.open( url,winName,theproperty );
}
//window.open("Excel/<%=ExcelFileName%>"
;
MyOpenExcelWindow("Excel/<%=ExcelFileName%>","abc",800,400);
//alert('Excel/<%=ExcelFileName%>');
window.history.go(-1);
//-->
</SCRIPT>