当前位置:首页 > 网络编程 > WEB编程 > ASP > 技巧:用ASP在线创建Word与Excel文档

技巧:用ASP在线创建Word与Excel文档

点击次数:32 次 发布日期:2008-11-22 11:31:05 作者:源代码网
源代码网推荐 下面这段例子代码可用于在线创建Word文档。

以下是引用片段:
<%
Response.ContentType = "application/msword"
Response.AddHeader "Content-Disposition", "attachment;filename=NAME.doc"??? 
response.Write("Dotnetindex.com : <a href=""http://www.dotnetindex.com"">Visit Site</a><br>" & vbnewline)
response.Write("<h1>We can use HTML codes for word documents</h1>")
response.Write ("<div style=""padding:4px; font:11px arial"">CSS can be used tooo</span>")
%>

     下面这段例子代码可用于在线创建Excel文档。

以下是引用片段:
<%
Response.AddHeader "Content-Disposition", "attachment;filename=members.xls"
Response.ContentType = "application/vnd.ms-excel"
response.write "<table width="100%" border="1" >"
response.write "<tr>"
response.write "<th width=""40%""><b>Name</b></th>"
response.write "<th width=""30%""><b>Username</b></th>"
response.write "<th width=""30%""><b>Password</b></th>"
response.write "</tr>"
response.write "<tr>"
response.write "<td width=""40%"">Scud Block</td>"
response.write "<td width=""30%"">scud@gazatem.com</td>"
response.write "<td width=""30%"">mypassword</td>"
response.write "</tr>"
response.write "</table>"
%>

源代码网供稿.
网友评论 (0)
会员中心
网络编程
本站推荐
网络编程之精华