excel|word| Create | tips | online
ASP has the ability to dynamically export any Office application file format. Before we start writing code, the first thing we need to do is set the correct file type, because the browser needs to know how to process the file. The second step is to edit the file name, and we can use HTML and CSS to create styles for Word documents or Excel documents.
The following example code can be used to create Word documents online.
<%
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 ("Response. Write ("<div style=" "Padding:4px font:11px Arial" ">css can be used tooo</span>")
%>
The following example code can be used to create an Excel document online.
<%
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>"
%>