execel file into ASP page

Source: Internet
Author: User
Tags insert range save file
Insert | page execel file insert to ASP page <%
Set xlapp=server.createobject ("Execel.application")
Xlapp.visible=false
' Make the server not appear execel window
Set Myworkbook=xlapp. Wordbooks.add
Set myworksheet=myworkbook.worksheets (1)
' Build a worksheet
Myworksheet.range ("A1"). Value= '
Myworksheet.range ("A1"). Vont.size=18
Myworksheet.range ("A1"). Font.bold=true
Myworksheet.range ("A2"). Value= ' name '
Myworksheet.range ("B2"). Value= ' Address '
Myworksheet.range ("C2"). Value= ' phone '
Myworksheet.range ("D2"). Value= ' Fax '
' Set the head of the table
Myworksheet.range ("A2:d2"). Font.bold=true
strfilename=session.sessionid& ". xls"
' Make sure the filename is unique
Strapppath=request.servervariables ("path_translated")
Strapppath=left (Strapppth,instrrev (Strapppath, "\"))
Strfullpath=strapppath&strfilename
Myworkbook.saveas (strFullPath)
' Save file
Myworkbook.close
' Close Excel
xlApp.Quit
Set myworksheet=nothing
Set myworkbook=nothing
Set myxlapp=nothing
Response.Redirect strFileName
' Send it to the browser.
%>



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.