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
  • 相关阅读:
    day10 Python 形参顺序
    为oracle中的表格增加列和删除列
    为mapcontrol中的图层设置透明度
    最大的愿望 2007-05-10
    动心 2004年后半年
    写在十年 2007-09-15 (写给L之三)
    致vi老大 2011.1
    如潮 2011.2
    自然人——女孩思绪 (2006-09-14 08:21:51)
    朋友(2003年)
  • 原文地址:https://www.cnblogs.com/netact/p/2079952.html
Copyright © 2011-2022 走看看