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
  • 相关阅读:
    2019年江苏大学885编程大题
    2018年江苏大学885编程题
    python-类和对象
    unity游戏框架学习-登录模块
    unity游戏框架学习-AssetBundle
    记 Firebase Crashlytics 接入遇到的坑
    c# 枚举Enum
    unity性能优化-UGUI
    unity性能优化-GPU
    unity性能优化-CPU
  • 原文地址:https://www.cnblogs.com/netact/p/2079952.html
Copyright © 2011-2022 走看看