asp生成xls(EXCEL文件)

八 29th, 2008

与生成DOC文件同时接的,废话不多说,直接发代码

< %
download=trim(request("Downloads"))
if download="Get:输出结果.xls" then
Response.ContentType = "Application/msexcel"
Response.AddHeader "Content-Disposition","attachment; filename=输出结果.xls" 
 
'+飞猫友情制作
'http://www.miaoqiyuan.cn
path=server.mappath("./")
set fso=server.createobject("Scripting.FileSystemObject")
set fpo=fso.getfolder(path)
for each files in fpo.files
	ftype=fso.getExtensionName(files)	'文件扩展名
		if ftype="mp3" or ftype="wma" or ftype="txt" then
		response.write replace(files.name,"."&ftype,"")&"	"
		i=i+1
		if(i mod 3)=0 then i=0:response.write chr(13)+chr(10)
	end if
next
set fpo=Nothing
Set fso=Nothing
else
	response.write "<a href=""?Downloads=Get:输出结果.xls&Pid="&date()&"-"&replace(time(),":","-")&""">下载Excel输出结果"
end if
%>
标签: , ,
目前还没有任何评论.