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
  • 相关阅读:
    BLE 5协议栈-安全管理层
    BLE 5协议栈-通用属性规范层(GATT)
    BLE 5协议栈-属性协议层(ATT)
    BLE 5协议栈-逻辑链路控制与适配协议层(L2CAP)
    BLE 5协议栈-主机控制接口(HCI)
    BLE 5协议栈-直接测试模式
    BLE 5协议栈-链路层
    BLE 5协议栈-物理层
    名词缩写
    C#中数据库事务、存储过程基本用法
  • 原文地址:https://www.cnblogs.com/netact/p/2079952.html
Copyright © 2011-2022 走看看