setp=request("step")
if ucase(setp)="DISPLAY" then
%>
<%
TempletFile=request("SelectFile")
if not fso.FileExists(TempletFile) then
%>
对不起您选择的模版文件不<%=TempletFile%>存在!
<%
Response.End
%>
<%
end if
basename=fso.GetBaseName(TempletFile)
TempFile=temppath & basename & ".htm"
%>
<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns="http://www.w3.org/TR/REC-html40">
<body><!--[if !excel]> <![endif]--> <!--下列信息由 Microsoft Excel 的“发布为 Web 页”向导生成。--><!--如果同一条目从 Excel 中重新发布,则所有位于 DIV tag 之间的信息均将得到替换。--><!-----------------------------><!--“从 EXCEL 发布 Web 页”向导开始--><!----------------------------->
<%
doprocess=false
if fso.FileExists(TempFile) then
if fso.GetFile(TempletFile).DateLastModified > fso.GetFile(TempFile).DateLastModified then
fso.DeleteFile(TempFile)
doprocess=true
else
doprocess=false
end if
else
doprocess=true
end if
if doprocess then
set xlApp=server.CreateObject("Excel.Application")
Set xlbook = xlApp.Workbooks.Open(TempletFile)
Set xlsheet = xlbook.Worksheets(1)
xlsheet.SaveAs TempFile,44
Set xlsheet = Nothing
Set xlbook = Nothing
xlApp.Quit
Set xlApp = Nothing
end if
<html>
<body>
请选择所处理的表格模版:
<form name="FileList" method="post" onsubmit="return checkFileList()">
<input type="hidden" name="step" value="DISPLAY">
<%
set TempletFolder=fso.GetFolder(templetpath)
havefile=false
filecount=TempletFolder.Files.Count
for each TempletFile in TempletFolder.Files
if instr(1,TempletFile.Name," ")=0 and ucase(fso.GetExtensionName(TempletFile.Path))="XLT" then
havefile=true
%>
<input type=radio name="SelectFile" value="<%=TempletFile.Path%>"><%=TempletFile.Name%><BR>
<%
end if
next
%>
<%
if havefile then
%>
<BR><input type="submit" value="填表">
<%
else
%>
<BR><input type="submit" value="填表" disabled>
<%
end if
%>
</form>
<script language="JavaScript">
function checkFileList(){
returnvalue=false;
for(i=0;i<<%=filecount%>;i++){
if(document.FileList.SelectFile(i).checked){
returnvalue=true;
break;
}
}
return returnvalue;
}
</script>
</body>
</html>
<%
end if
end if
%>