⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 exportstep1.asp

📁 学生档案与成绩管理(1)学生档案管理:记录每个学生的档案信息
💻 ASP
字号:
<!-- #include file = "../include/asphead.asp" -->
<!-- #include file = "../include/function.asp" -->
<%CheckUser()%>
<link href="../include/main.css" rel="stylesheet" type="text/css">
<script src="../include/function.js" type="text/javascript"></script>

<script ID="clientEventHandlersJS" LANGUAGE="javascript">
<!--

	function LocalDC() 
	{
		if(frmData.ExportRange[1].status==true)
		{
			if(frmData.CurSelectedRows.value=="")
			{
				alert("当前页中您未选定任何记录,请选择后再导出。")
				return false;
			}	
		}
		//如果已选中表单模板,则必须选择有效的模板
		if(frmData.ExportFormat[3].status==true)
		{
			if(frmData.SheetTableID.length<=1)
			{
				alert("尚未设置用于导出的表单模板,请进入系统管理设置。")
				return false;
			}
			else
			{
				if(frmData.SheetTableID.selectedIndex<=0) 
				{
					alert("未选择有效的表单模板,请选择。")
					return false;
				}
			}
		}
		return true;
	}

	function Next() 
	{
		if(LocalDC()==true)
		{
			DisableButton();
			document.frmData.target ="_self";
			document.frmData.action="exportstep2.asp";
			document.frmData.submit();
		}
	}

	function Cancel() 
	{
		var discard;
		discard=confirm("放弃导出吗?");
		if(discard==true)
		{
			parent.window.returnValue = "";
			parent.window.close();
		}
	}

	function DisableButton() 
	{
		frmData.btnCancel.disabled =true;
		frmData.btnPre.disabled =true;
		frmData.btnNext.disabled =true;
	}

	function OpenSample(file) {
		try
		{
			window.open (file,'Sample')
		}
		catch(e)
		{
			alert('打开示例失败。\n请检查当前浏览器版本,建议使用IE6.0以上版本。')
		}
	}

	function Init() 
	{
		SetOtherOption();
	}
	
	function SetOtherOption()
	{
		//自定义表单格式,子表数据的导出会变得很复杂,暂不支持
		if(frmData.ExportFormat[3].status==true)
		{
			frmData.chkExportRefDetail.status=false;
			frmData.chkExportRefDetail.disabled=true;
		}
		else
		{
			//其它格式可以
			if(frmData.RefDetail.value=="1")
				frmData.chkExportRefDetail.disabled=false;
			else
				frmData.chkExportRefDetail.disabled=true;
		}

		//Excel格式、自定义表单格式,不可以可以导出操作历史
		if(frmData.ExportFormat[0].status==true || frmData.ExportFormat[3].status==true)
		{
			frmData.chkExportHistory.status=false;
			frmData.chkExportHistory.disabled=true;
		}
		else
			//只有word格式、html格式可以
			frmData.chkExportHistory.disabled=false;
	} 

//-->
</script>
<%
	dim WExcel
	set WExcel=server.CreateObject("WExcel.Sheet")

	dim ExportRange,ExportFormat,SheetTableID,ExportHistory,ExportRefDetail,CurSelectedRows,PageRows,TotalCount
	dim RangeChk(3),FormatChk(4)
	dim SheetID
	SheetID=Request.Cookies("Temp")("SheetID")
	dim Exist
	Exist=WExcel.SheetExist(cint(UserID),cint(SheetID))
	CheckErr
	if Exist=false then
		Response.Redirect "/hcgis/notfound.asp?Name=数据表&Depth=2"
	end if
	ExportRange=Request.Cookies("ImExport")("ExportRange")
	ExportFormat=Request.Cookies("ImExport")("ExportFormat")
	SheetTableID=Request.Cookies("ImExport")("SheetTableID")
	ExportHistory=Request.Cookies("ImExport")("ExportHistory")
	ExportRefDetail=Request.Cookies("ImExport")("ExportRefDetail")
	CurSelectedRows=Request.Cookies("ImExport")("CurSelectedRows")
	PageRows=Request.Cookies("ImExport")("PageRows")
	TotalCount=Request.Cookies("ImExport")("TotalCount")
	dim QueryString,Querys
	if Request.QueryString("Rows")<>"" then
		'从数据表界面来,需要读取保存行选择
		QueryString=Request.QueryString("Rows")
		Querys=split(QueryString,"|")
		CurSelectedRows=Querys(0)
		PageRows=Querys(1)
		TotalCount=Querys(2)
		Response.Cookies("ImExport")("CurSelectedRows")=CurSelectedRows
		Response.Cookies("ImExport")("PageRows")=PageRows
		Response.Cookies("ImExport")("TotalCount")=TotalCount
		Response.Cookies("ImExport").Expires = CookieLife
	end if
	RangeChk(0)=""
	RangeChk(1)=""
	RangeChk(2)=""
	if ExportRange="" then
		ExportRange=1	'缺省选中第2个
	end if
	if ExportRange>2 or ExportRange<0 then
		ExportRange=0
	end if
	RangeChk(ExportRange)=" checked "

	FormatChk(0)=""
	FormatChk(1)=""
	FormatChk(2)=""
	FormatChk(3)=""
	if ExportFormat="" then
		ExportFormat=0	'缺省选中Excel格式
	end if
	if ExportFormat>3 or ExportFormat<0 then
		ExportFormat=0
	end if
	FormatChk(ExportFormat)=" checked "

	dim HasRefDetail,RefDetail
	HasRefDetail=WExcel.HasRefDetail(cint(UserID),cint(SheetID))
	if HasRefDetail then
		RefDetail="1"
	else
		RefDetail="0"
	end if
	dim TableOption,curTableID
	curTableID=0
	if trim(SheetTableID)<>"" then
		if IsNumeric(SheetTableID) then
			curTableID=SheetTableID
		end if
	end if
	TableOption=WExcel.GetTableOption(cint(UserID),cint(SheetID),cint(curTableID),cint(TableType_List))
	CheckErr
%>
<HTML>
<HEAD>
	<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</HEAD>
<BODY LANGUAGE=javascript onload="return Init()">
	<form METHOD="post" name="frmData">
		<table width="58%" border=0 align=center cellPadding=0 cellSpacing=1>
			<tr height=35>
				<td colspan=2>
					<b>第1步:选择导出范围、导出格式</b>
				</td>
			</tr>
			<tr height=43>
				<td colspan=2>
					数据可导出,以便打印出来讨论,或发送给其他人。
				</td>
			</tr>
			<tr height=60 valign=center>
				<td bgcolor="#e0e0e0" width="25%" valign=center>
					<p align="left">导出范围</p>
				</td>
				<td width="75%">
					<table width="90%" border=0 cellPadding=0 cellSpacing=0>
						<tr height=15>
						</tr>
						<tr>
							<td>
								<p align=left>
									<INPUT id=ExportRange name=ExportRange value='0' <%=RangeChk(0)%> type =radio>当前页所有记录
								</p>
							</td>
						</tr>
						<tr>
							<td>
								<p align=left>
									<INPUT id=ExportRange name=ExportRange value='1' <%=RangeChk(1)%> type =radio>当前页中选定的记录
								</p>
							</td>
						</tr>
						<tr>
							<td>
								<p align=left>
									<INPUT id=ExportRange name=ExportRange value='2' <%=RangeChk(2)%>  type=radio>所有页所有记录
								</p>
							</td>
						</tr>
					</table>
				</td>
			</tr>
			<tr height=60 valign=center>
				<td bgcolor="#e0e0e0" valign=center>
					<p align="left">导出格式</p>
				</td>
				<td>
					<table width="90%" border=0 cellPadding=0 cellSpacing=0>
						<tr height=15>
						</tr>
						<tr>
							<td width="70%">
								<p align=left>
									<INPUT id=ExportFormat name=ExportFormat value='0' <%=FormatChk(0)%> type =radio onclick="SetOtherOption();">Excel
								</p>
							</td>
							<td>
								<p align=right>
									<U style="CURSOR: hand;" onclick="javascript:OpenSample('export20041210.xls')">效果示例</U>
								</p>
							</td>
						</tr>
						<tr>
							<td>
								<p align=left>
									<INPUT id=ExportFormat name=ExportFormat value='2' <%=FormatChk(2)%> type =radio onclick="SetOtherOption();">Word
								</p>
							</td>
							<td>
								<p align=right>
									<U style="CURSOR: hand;" onclick="javascript:OpenSample('export20051212.doc')">效果示例</U>
								</p>
							</td>
						</tr>
						<tr>
							<td>
								<p align=left>
									<INPUT id=ExportFormat name=ExportFormat value='1' <%=FormatChk(1)%>  type=radio onclick="SetOtherOption();">HTML
								</p>
							</td>
							<td>
								<p align=right>
									<U style="CURSOR: hand;" onclick="javascript:OpenSample('exporthtml.htm')">效果示例</U>
								</p>
							</td>
						</tr>
						<tr>
							<td>
								<p align=left>
									<INPUT id=ExportFormat name=ExportFormat value='3' <%=FormatChk(3)%>  type=radio onclick="SetOtherOption();"><select name=SheetTableID style="WIDTH: 113px">
										<Option value=0>填入表单模板:</Option>
										<%=TableOption%>
									</select>
								</p>
							</td>
							<td>
								<p align=right>
									<U style="CURSOR: hand;" onclick="javascript:OpenSample('ExportToTemplate.xls')">效果示例</U>
								</p>
							</td>
						</tr>
					</table>
				</td>
			</tr>
			<tr height=40 valign=center>
				<td bgcolor="#e0e0e0" valign=center>
					<p align="left">其它选项</p>
				</td>
				<td>
					<table width="90%" border=0 cellPadding=0 cellSpacing=0>
						<tr>
							<td>
								<p align=left>
									<%if HasRefDetail then%>
										<INPUT name=chkExportRefDetail <%if ExportRefDetail="1" then%>checked<%end if%> type=checkbox>同时导出子表的数据
									<%else%>
										<INPUT name=chkExportRefDetail disabled type=checkbox>同时导出子表的数据
									<%end if%>
								</p>
							</td>
						</tr>
						<tr>
							<td>
								<p align=left>
									<INPUT name=chkExportHistory <%if ExportHistory="1" then%>checked<%end if%> type=checkbox>同时导出操作历史
								</p>
							</td>
						</tr>
					</table>
				</td>
			</tr>
			<tr height=50 valign=bottom>
				<td colspan=2>
					<table align=center width="87%">
						<tr>
							<td width="33%"><input id="btnCancel" type="button" value="取消" name="btnCancel" style="CURSOR: hand; HEIGHT: 24px; WIDTH: 65px" LANGUAGE="javascript" onclick="return Cancel()"></td>
							<td width="33%"><input id="btnPre" type="button" disabled value="上一步" name="btnPre" style="CURSOR: hand; HEIGHT: 24px; WIDTH: 65px" LANGUAGE="javascript" onclick="return Pre()"></td>
							<td width="33%"><input id="btnNext" type="button" value="下一步" name="btnNext" style="CURSOR: hand; HEIGHT: 24px; WIDTH: 65px" LANGUAGE="javascript" onclick="return Next()"></td>
						</tr>
					</table>
				</td>
			</tr>
		</table>
		<input TYPE="hidden" NAME="CurSelectedRows" value="<%=CurSelectedRows%>">
		<input TYPE="hidden" NAME="PageRows" value="<%=PageRows%>">
		<input TYPE="hidden" NAME="TotalCount" value="<%=TotalCount%>">
		<input TYPE="hidden" NAME="RefDetail" value="<%=RefDetail%>">
	</form>
</BODY>
</HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -