ASP successfully guides the data in table tables into Excel practices

Source: Internet
Author: User
excel| data I recently made a project, the requirements of the project is to the ASP page in the library of the data extracted directly into the form of Excel, just at the beginning of my thinking for the good to finally do it out, here and everyone to share!!
---------------------------------------
The script is as follows: <%
Dim rs_code,sql_code,rs_date,sql_date
If Request ("Op") = "Show" Then
Sborder= "0"
sbg1= "Bgcolor=black"
Sbg2= "Bgcolor=white"
Else
Sborder= "1"
Sbg1= ""
Sbg2= ""
If Request ("Op") = "Excel" Then
Response.ContentType = "Application/msexcel"
Response.AddHeader "Content-disposition", "inline"; Filename=1.xls "
ElseIf Request ("Op") = "DownLoad" Then
Response.ContentType = "Application/msexcel"
Filename= "(" &request ("Syear") & "-" &request ("Smonth") & ") ********** (here for the program name you want to do, define for yourself)"
Response.AddHeader "Content-disposition", "attachment"; Filename= "&FileName&". xls "
End If
End If
%>
The page must be routed to the top of the page: parameters: Like qh_tj_c_imbark.asp? Op=show
--------------------------------------------
You must add the following sections in the program you want to convert to Excel output:
<table width= "875" border=<%=sborder%> cellspacing= "1" cellpadding= "1" align= "center" <%=sbg1%>>
---------------------------------------------
<tr <%=sbg2%>>
---------------------------------------------
After you've done your job, you can write the program you want to do.



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.