网站首页 手机版
 注册 登录
您现在的位置: 畅无忧设计 >> 网络编程 >> ASP教程 >> 正文
最新文章
· FSO 组件asp生成html静态页面碰到缓存
· asp实现长文章自动分页插件
· 在ASP中访问和更新Cookies集合
· ASP错误提示大全
· 学习ASP的几个观点
· ASP用两级联动下拉列表来显示大类和小
· ASP取当前页面地址和参数
· ASP删除记录的同时删除相关图片
· asp将查询结果导出到excel
· ASP批量导入Excel到Access或者Sql Se
热门文章
 化境ASP无组件上传类 - upload_5xs
 一个获取ACCESS数据库表名以及表名
 asp将查询结果导出到excel
 艾恩ASP无组件上传修改版
 ASP批量导入Excel到Access或者Sql 
 ASP读取数据库的Flash+JS图片切换特
 ASP用两级联动下拉列表来显示大类和
 ASP+JS实现网页歌曲连播、点播功能
 使用ASP重启服务器
 asp批量替换access数据库中指定字段
相关文章
没有相关文章
ASP在线创建Word与Excel文档
来源:中国asp之家 更新时间:2009/5/14 17:21:49 阅读次数:
字体:[ ] 我要投稿

ASP具备动态输出任一Office应用程序文件格式的功能。在开始编写代码之前,我们首先需要做的就是设置正确的文件类型,因为浏览器需要知道如何处理文件。第二步是编辑文件名称,我们可以使用HTML和CSS来创建Word文档或Excel文档的样式。

下面这段例子代码可用于在线创建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>" 
%>

  • 上一篇文章:
  • 下一篇文章:
  • 关于我们 - 联系我们 - 广告服务 - 在线投稿 - 友情链接 - 网站地图 - 版权声明
    CopyRight 2008-2010, CWYDESIGN.COM - 畅无忧设计, Inc. All Rights Reserved
    滇ICP备09005765号