zoukankan      html  css  js  c++  java
  • ASP 生成xls excle

    Set fs = server.createObject("scripting.filesystemobject")

    '--假设你想让生成的EXCEL文件做如下的存放
    '
    filename = Server.MapPath("temp/ria.xls")
    filename = Server.MapPath(Application("DOWNLOADFILEURL") ) & "\DA_BudgetQuery_"& objUser.Account & ".xls"


    '--如果原来的EXCEL文件存在的话删除它
    if fs.FileExists(filename) then
    'response.end
    fs.deleteFile(filename)

    end if

    response.write
    "3<br />"
    '--创建EXCEL文件
    set myfile = fs.createTextFile(filename,true,true)


    'stop
    strSql = Request.QueryString("strSql")


    'strSql = " exec RIAproRpt_NEW '"& strConn &"'"
    Set conn2 = Server.Createobject("ADODB.Connection")
    conn2.Open strCnn
    Set conn3 = Server.Createobject("ADODB.Connection")
    conn3.Open strCnn


    Set tmpRs =conn.execute(strSql)
    if not tmpRs.EOF and not tmpRs.BOF then


    dim strLine,responsestr
    strLine
    =""
    strLine
    =strLine & "<table border=""1px"" cellspacing=""0"" cellpadding=""0"" style=""padding:0px; margin:0px"" > <tr > <td>区域</td>

    '--将表的列名先写入EXCEL
    myfile.WriteLine (strLine )

    myfile.writeline(
    "</table>")

    Response.Write
    "生成EXCEL文件成功,点击<a href='"&Application("DOWNLOADFILEURL")& "\DA_BudgetQuery_"& objUser.Account & ".xls' >下载</a>!"
    'Response.Write "生成EXCEL文件成功,点击<a href='Temp/RIA.xls' >下载</a>!"


    'fs.close
    set fs=nothing
    myfile.close
    set myfile=nothing
    tmpRs.Close
    set tmpRs = nothing
    Conn.Close
    Set Conn = nothing
  • 相关阅读:
    第08组 Alpha事后诸葛亮
    第08组 Alpha冲刺(4/4)
    第08组 Alpha冲刺 (3/4)
    第08组 Alpha冲刺 (2/4)
    第08组 Alpha冲刺(1/4)
    第08组 团队git现场编程实战
    第二次结对编程作业
    团队项目-需求分析报告
    团队项目—选题报告
    2019 SDN上机第7次作业
  • 原文地址:https://www.cnblogs.com/netact/p/2079952.html
Copyright © 2011-2022 走看看