How does ASP export Web page data through OWC execl file

Source: Internet
Author: User
Tags range
Data | Web |OWC

ASP through The OWC component of the Web page data export execl file, implementation code as follows:

<%
' First use Regsvr32.exe msowc.dll to register the OWC component (Msowc.dll install office2000, and search for *owc*.chm in the Office installation directory to find the Help documentation for OWC)
Dim OBJOWC
Dim Execlfilename
Execlfilename = Server.MapPath ("Execltext.xls")
Set OBJOWC = Server.CreateObject ("OWC. Spreadsheet ")

With OBJOWC
. Cells (1,1) = "The following data from the enterprise wealth [stainless steel quotation trading platform]"
. Cells (1,5) = "Order No.: No.2006072815350096014"
. Range ("A1:d1"). Merge ()
. Range ("E1:g1"). Merge ()
. Range ("E1:g1"). HAlignment = 3
. Range ("A1:g1"). rowheight=14.25*1.33
. Range ("A1:g1"). Font.Name = "Song Body"
. Range ("A1:g1"). Font.Size = 9
. Range ("A1:g1"). Valignment = 1
. Range ("A1:g1"). Borders (1). Weight = 1 ' Show bottom border 1,2,3,4 respectively right, bottom, left, top four border (clockwise)
. Range ("A1:g1"). Borders.color = "BLACK"

. Cells (2,1) = "Shanghai precision casting stainless Steel Products Co., Ltd."
. Range ("A2:g2"). Merge ()
. Range ("A2:g2"). Font.Name = "Blackbody"
. Range ("A2:g2"). RowHeight = 50
. Range ("A2:g2"). Font.Size = 14
. Range ("A2:g2"). HAlignment = 2
. Range ("A2:g2"). Valignment = 1
. Range ("A2:g2"). Font.Bold = True

. Cells (3,1) = "Shang Hai Jing Zhu Bu Xiu Gang Zhi Pin you Xian Gong Si"
. Cells (4,1) = "Tel: 021-63609459 Fax: 021-63609453 Address: No. 180th, Xiamen Road, Shanghai-3"
. Range ("A3:g3"). Merge ()
. Range ("A4:g4"). Merge ()
. Range ("A3:g3"). Font.Name = "Arial"
. Range ("A4:g4"). Font.Name = "Song Body"
. Range ("A3:g4"). Font.Size = 10
. Range ("A3:g4"). RowHeight = 25
. Range ("A3:g4"). HAlignment = 2
. Range ("A3:g4"). Valignment = 1

. Cells (5,1) = "Order Form"
. Range ("A5:g5"). Merge ()
. Range ("A5:g5"). Font.Name = "Blackbody"
. Range ("A5:g5"). Font.Size = 16
. Range ("A5:g5"). HAlignment = 2
. Range ("A5:g5"). Valignment = 1
. Range ("A5:g5"). RowHeight = 30*1.33
. Range ("A5:g5"). Font.Bold = True

. Cells (6,1) = "ordinal"
. Cells (6,2) = "Product Name"
. Cells (6,3) = "Product Specification"
. Cells (6,4) = "unit"
. Cells (6,5) = "Quantity"
. Cells (6,6) = "Unit price (including tax)"
. Cells (6,7) = "Total"
. Range ("A6:g6"). Font.Name = "Song Body"
. Range ("A6:g6"). Font.Size = 10
. Range ("A6:g6"). Font.Bold = True
. Range ("A6:g6"). Valignment = 1
. Range ("A6:g6"). HAlignment = 2
. Range ("A6:g6"). RowHeight = 18 *1.33
. Range ("E6:g6"). HAlignment = 3

For i = 1 to 5
. Cells (6+i,1) = i
. Cells (6+i,2) = "301A Stainless steel Seamless pipe"
. Cells (6+i,3) = "22*2.5"
. Cells (6+i,4) = "Kg"
. Cells (6+i,5) = "1.00"
. Cells (6+i,6) = "0.00"
. Cells (6+i,7) = "0.00"
Next

. Range ("A7:d" & 6+i). HAlignment = 2
. Range ("A6:g" & 6+i+1). Borders.Weight = 1
. Range ("A6:g" & 6+i+1). Borders.color = "BLACK"


. Cells (6+i,1) = "Grand total:"
. Range ("a" & 6+i & ":d" & 6+i). Merge ()
. Range ("a" & 6+i). HAlignment = 1
. Cells (6+i,5) = "5.00"
. Cells (6+i,7) = "0.00"
. Cells (6+i+1,1) = "Sales Amount (uppercase): Sering 0 Points"
. Range ("a" & 6+i+1 & ": G" & 6+i+1). Merge ()

. Range ("B6:b6"). ColumnWidth = 18*10
. Range ("F6:f6"). ColumnWidth = 7.5*10

. Range ("A7:g" & (6+i+2)). Font.Size = 10
. Range ("A7:g" & (6+i+2)). Font.Name = "Song Body"

. Cells (6+i+2,1) = "demand-side information"
. Range ("a" & 6+i+2 & ": G" & 6+i+2). Merge ()
. Range ("a" & 6+i+2 & ": G" & 6+i+2). RowHeight = 20 *1.33
. Range ("a" & 6+i+2 & ": G" & 6+i+2). HAlignment = 2
. Range ("a" & 6+i+2 & ": G" & 6+i+2). Valignment = 1
. Range ("a" & 6+i+2 & ": G" & 6+i+2). Font.Size = 12
. Range ("a" & 6+i+2 & ": G" & 6+i+2). Font.Name = "Blackbody"

. Cells (6+i+3,1) = "Unit name:"
. Cells (6+i+3,2) = "Shanghai Enterprise Network Technology Information Development Co., Ltd. (test data)"
. Range ("B" & 6+i+3 & ": G" & 6+i+3). Merge ()
. Range ("a" & 6+i+3). HAlignment = 3

. Cells (6+i+4,1) = "Unit Address:"
. Range ("a" & 6+i+4). HAlignment = 3
Cells (6+i+4,2) = "Shanghai Minhang Xinzhuang No. Three Village, room 1501, 49th"
. Range ("B" & 6+i+4 & ": G" & 6+i+4). Merge ()

. Cells (6+i+5,1) = "Tel:"
. Range ("a" & 6+i+5). HAlignment = 3

. Cells (6+i+5,2) = "021-54172198"
. Cells (6+i+5,3) = "Fax:"
. Range ("C" & 6+i+5). HAlignment = 3

. Cells (6+i+5,4) = "021-54172196"
. Range ("D" & 6+i+5 & ": E" & 6+i+5). Merge ()
. Cells (6+i+5,6) = "Contact:"
. Range ("F" & 6+i+5). HAlignment = 3

. Cells (6+i+5,7) = "John"

. Range ("a" & 6+i+3 & ": G" & 6+i+5). Font.Name = "Song Body"
. Range ("a" & 6+i+3 & ": G" & 6+i+5). Font.Size = 9

. Range ("a" & 6+i+3 & ": G" & 6+i+5). Borders.weight=1
. Range ("a" & 6+i+3 & ": G" & 6+i+5). Borders.color= "BLACK"

. Range ("E7:g" & 6+i). NumberFormat = "0.00"

' Even copyright information ^_^ (qq:278919507)
. Cells (6+i+6,1) = "Powered by Jimmy (young under the Banyan tree) qq:278919507"
. Range ("a" & 6+i+6 & ": G" & 6+i+6). Merge ()
. Range ("a" & 6+i+6 & ": G" & 6+i+6). HAlignment = 3
. Range ("a" & 6+i+6 & ": G" & 6+i+6). RowHeight = 30*1.33
. Range ("a" & 6+i+6 & ": G" & 6+i+6). Hyperlink.Address = "Http://blog.1jq.net"

End With

Call ObjOWC.ActiveSheet.Export (execlfilename,0)
Set OBJOWC = Nothing

Response.Write "<a href=" "& Execlfilename &" ' target=_blank> ' & execlfilename & ' Build complete </a> '
%>



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.