保存为excel格式:(先测试下,看我发的是不是乱码,要行一会再发个保存为word格式的)
[CODE]
<%
if request.cookies("flag")< 1 then
response.redirect "error.htm"
response.End
end if
%>
<!--#include file="conn.asp"-->
<%
Response.ContentType = "application/vnd.ms-excel"
filename="CHINACOAT_NAME"
Response.AddHeader "content-disposition", "attachment; filename=" & filename & ".xls"
%>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="90%" border="1" align="center" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#FFFFFF"> <div align="center"><font color="#000000"><strong>Exh
name<br>
</strong></font></div></td>
<td bgcolor="#FFFFFF"> <div align="center"><font color="#000000"><strong>Co.
Name in Eng</strong></font></div></td>
<td bgcolor="#FFFFFF"> <div align="center"><font color="#000000"><strong>Co.
Name in Chinese</strong></font></div></td>
<td bgcolor="#FFFFFF"><div align="center"><strong>Chinese (Eng) Name</strong></div></td>
<%
set rs= server.CreateObject("adodb.recordset")
rs.open " select * from detail order by shortname asc",myconn,1,1
%>
<td> <div align="center"><font color="#FFFFFF"><strong><font color="#000000">Origin</font><br>
</strong></font></div></td>
<td bgcolor="#FFFFFF"> <div align="center"><font color="#000000"><strong>Origin
(Chinese)</strong></font><font color="#FFFFFF"></font></div></td>
<td bgcolor="#FFFFFF"><div align="center"><strong>Follow up office</strong></div></td>
<td bgcolor="#FFFFFF"> <div align="center"><font color="#000000"><strong>Rep
by<br>
</strong></font></div></td>
<td bgcolor="#FFFFFF"> <div align="center"><font color="#000000"><strong>NEW<br>
</strong></font></div></td>
<td bgcolor="#FFFFFF"> <div align="center"><font color="#000000"><strong>Hall</strong></font></div></td>
<td bgcolor="#FFFFFF"> <div align="center"><font color="#000000"><strong>Zone
</strong></font></div></td>
<td bgcolor="#FFFFFF"> <div align="center"><font color="#000000"><strong>Booth
No.</strong></font><font color="#FFFFFF"></font></div></td>
<td bgcolor="#FFFFFF"> <div align="center"><font color="#000000"><strong>Profile(chi)<br>
</strong></font></div></td>
<td bgcolor="#FFFFFF"> <div align="center"><font color="#000000"><strong>Profile</strong></font></div></td>
<td bgcolor="#FFFFFF"><div align="center"><strong>Add people</strong></div></td>
<td bgcolor="#FFFFFF"><div align="center"><strong>Add date</strong></div></td>
<td bgcolor="#FFFFFF"> <div align="center"><strong><font color="#000000">update
people </font></strong></div></td>
<td bgcolor="#FFFFFF"> <div align="center"><strong><font color="#000000">update
date </font></strong></div></td>
</tr>
<%do while not rs.eof%>
<tr>
<td> <div align="center"><%=rs("shortname")%></div></td>
<td><div align="center"><%=rs("companyeng")%> </div></td>
<td><%=rs("companychi")%> </td>
<td><%=rs("companychieng")%></td>
<td><div align="center"><%=rs("country")%> </div></td>
<td><%=rs("countrychi")%></td>
<td><%=rs("followup")%></td>
<td><div align="center"><%=rs("representby")%> </div></td>
<td> <div align="center"> <%=rs("new1") %> </div></td>
<td><div align="center"><%=rs("hall")%> </div></td>
<td> <div align="center"><%=rs("zone1")%></div></td>
<td> <div align="center"><%=rs("boothnumber")%></div></td>
<td> <div align="center">
<%if rs("instrchi") <>"" then response.write "Yes" end if%>
</div></td>
<td>
<%if rs("instreng") <>"" then response.write "Yes" end if%>
</td>
<td><%=rs("addman")%></td>
<td><%=year(rs("timeaddman"))&"-"&month(rs("timeaddman"))&"-"&day(rs("timeaddman"))%></td>
<td>
<%if rs("flag")>2 then%>
<%=rs("admin")%>
<%end if%>
</td>
<td>
<%if rs("flag")>2 then%>
<%=year(rs("time2"))&"-"&month(rs("time2"))&"-"&day(rs("time2"))%>
<%end if%>
</td>
</tr>
<%rs.movenext
loop
rs.close
set rs=nothing
%>
</table>[/CODE]
[此贴子已经被阳光白雪于2007-6-27 17:25:24编辑过]