ASP create Word and Excel documents online

Source: Internet
Author: User
Tags reference

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.

The following is a reference fragment:
<%
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.

The following is a reference fragment:
<%
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>"
%>



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.