p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

proasp_codeclinic thread: ASP output to Excel worksheet


Message #1 by "Schoolcraft, Jeffrey" <JSchoolcraft@S...> on Tue, 12 Jun 2001 15:09:06 -0400
I'm not sure if this helps or not, but in Excel 2002 you can write out an
XML Excel format that Excel can read and use.  Details about this format are
here:
http://msdn.microsoft.com/msdnnews/2001/may/Excel/Excel.asp

----- Original Message -----
From: "Schoolcraft, Jeffrey" <JSchoolcraft@S...>
To: "Code Clinic" <proasp_codeclinic@p...>
Sent: Tuesday, June 12, 2001 2:09 PM
Subject: [proasp_codeclinic] ASP output to Excel worksheet


> I've done probably 50 searches on the topic and they aren't really doing
> what I want.
>
> What I don't want to do is:
> use a third party tool I have to pay for
> change the content-type header (nasty under netscapes)
> use OWC
> save the worksheet on the server
> take up unecessary resources on the server
>
> What I'd like to do:
>
> Use a DSNLess connection to an Excel worksheet, build table, fill it with
> data from an ADO
> recordset, and then give the user a link to download the worksheet (or
view
> it).
>
> I've got some ugly code right now:
>
> -------------------code block---------------------
> <%@ Language=VBScript %>
> <%
> filename = Server.MapPath("foo.xls")
>
> set testConn = server.CreateObject("ADODB.connection")
> testConn.Open "driver={Microsoft Excel Driver (*.xls)};dbq=" & filename &
> ";",,,
>
> set testRS = server.CreateObject("ADODB.recordset")
> testRS.Open "create table food (test1 TEXT, myname TEXT, blah number)",
> testConn
>
> with testRS
> .AddNew
> .Fields("test1") = "1234"
> .Fields("myname") = "Foobar"
> .Fields("blah") = 23221
> .Update
> end with
> %>
> -------------------code block---------------------
>
> Thanks in advance for help
>
> Jeffrey Schoolcraft
>
> 

  Return to Index