Can output as HTML but not as XLS

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Sonnich

    Can output as HTML but not as XLS

    Hi all!

    I haven't being doing that much in ASP, but I have to create this:
    It has to read out data from some DB to excel.

    The following (corrected) code works if just it outputs as html, once
    the Response.Conten tType is excel. then it offers to open/save the
    file, and stops - file not found - what do I do wrong?

    BR
    Sonnich

    <%
    'Change HTML header to specify Excel's MIME content type.
    'Response.Buffe r = TRUE
    ' Response.Conten tType = "applicatio n/vnd.ms-excel"
    %>
    <HTML>
    <HEAD>
    <TITLE>Excel</TITLE>
    </HEAD>
    <BODY bgcolor="#FFFFF F">
    <form name="ExcelForm ">
    <TABLE>
    <TR>
    <TD colspan=3>Creat ed: <%=cstr(now)% ></TD>
    </TR>
    </table>

    <TABLE border="1">
    <tr><td><b>Code </b></td><td><b>Descr iption 1</b></td><td><b>Descr iption
    2</b></td><td><b>Qty</b></td><td><b>Price </b></td><td><b>Total </b></td></tr>
    <%

    dim rsTree
    set rsTree = server.createob ject("adodb.rec ordset")
    rsTree.activeco nnection = DSN_Oracle

    dim txt
    txt = "select blah!"
    rsTree.Open(txt )

    do while not rsTree.eof
    taso=""
    for J=1 to cint(field_valu e(2,rsTree))
    taso = taso & "&nbsp;&nbsp;&n bsp;&nbsp;&nbsp ;&nbsp;"
    next

    '************** *******
    response.write( "<tr><td>" + taso + field_value(0,r sTree) +
    "</td><td>" + _
    field_value(1,r sTree) + "</td><td>" + field_value(6,r sTree) +
    "</td><td>" + field_value(5,r sTree) + "</td><td>a</td><td>b</td></tr>")
    response.write( chr(10))

    rsTree.movenext
    loop
    rsTree.close
    %>

    </TABLE>
    </form>
    </BODY>
    </HTML>

Working...