欢迎您访问我爱IT技术网,今天小编为你分享的编程技术是:【技巧:用ASP在线创建Word与Excel文档】,下面是详细的分享!
技巧:用ASP在线创建Word与Excel文档
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.chinaz.com/program/2008/1010/""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>" %> |
以上所分享的是关于技巧:用ASP在线创建Word与Excel文档,下面是编辑为你推荐的有价值的用户互动:
相关问题:web如何直接打开一个excel文档并可以使用
答:web直接打开一个excel文档并可以使用方法如下: 安装Office以后,有一个ActiveX控件被安 装到了系统中,这个控件位于“Program Files\Microsoft Office\OFFICE11\owssupp.dll”。通过这个控件,客户端页面上的java script就可以激活本地的Office软... >>详细
相关问题:如何把WORD 跟EXCEL 一起放进一个PDF的文档呢?
答:下载安装Adobe Acrobat 。 打开Adobe Acrobat 软件,点击文件---创建PDF---从多个文件。 根据提示浏览添加word,excel文件,创建PDF保存即可。 >>详细
相关问题:ASP怎么实现在线浏览word文档
答:目前想到的方案: 1、如果能够保证客户端都安装了Word,那么可以修改一个注册表选项,使得在IE中点击指向Word文档的链接时,不是提示下载,而是直接在IE里面用嵌入Word的方式打开(就是所谓的Active Document方式); 2、如果希望让任何客户端即... >>详细
- 评论列表(网友评论仅供网友表达个人看法,并不表明本站同意其观点或证实其描述)
-
