Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_components thread: create and SAVE Excel file from asp


Message #1 by "bloch" <myriambloch@l...> on Thu, 7 Jun 2001 10:15:10
I Hello, I already created  my excel file from asp by using :

    Response.ContentType = "application/vnd.ms-excel"

but I need now to find the code to save this file right after its creation.



I also tried with :

Set xls = CreateObject("Excel.Application")

but it bugs  :

ActiveX component cannot create object: 'Excel.Application' 



Thank.



Message #2 by Steve Driscoll <SteveD@D...> on Thu, 7 Jun 2001 10:12:50 +0100
I Hello, I already created  my excel file from asp by using :

    Response.ContentType =3D "application/vnd.ms-excel"

but I need now to find the code to save this file right after its 

creation.



I also tried with :

Set xls =3D CreateObject("Excel.Application")

but it bugs  :

ActiveX component cannot create object: 'Excel.Application'



Thank.





Message #3 by Yash from India <cool.yash@u...> on 7 Jun 2001 06:43:32 MDT

hi,



Why can't u try with server.createObject method to instantiate the Excel 

dll.



<%

response.contenttype =3D "application/excel"

set objExcel=3D server.createObject("componet name")



%>



"bloch" <myriambloch@l...> wrote:

I Hello, I already created  my excel file from asp by using :

    Response.ContentType =3D "application/vnd.ms-excel"

but I need now to find the code to save this file right after its creatio

n.



I also tried with :

Set xls =3D CreateObject("Excel.Application")

but it bugs  :

ActiveX component cannot create object: 'Excel.Application' 





Thank.

Message #4 by Steve Driscoll <SteveD@D...> on Thu, 7 Jun 2001 13:50:17 +0100
That would try to instantiate it on the server, not on the client.



-----Original Message-----

From: Yash from India [mailto:cool.yash@u...]

Sent: 07 June 2001 13:44

To: ASP components

Subject: [asp_components] Re: [create and SAVE Excel file from asp]







hi,



Why can't u try with server.createObject method to instantiate the 

Excel

dll.



<%

response.contenttype =3D "application/excel"

set objExcel=3D server.createObject("componet name")



%>



"bloch" <myriambloch@l...> wrote:

I Hello, I already created  my excel file from asp by using :

    Response.ContentType =3D "application/vnd.ms-excel"

but I need now to find the code to save this file right after its 

creation.



I also tried with :

Set xls =3D CreateObject("Excel.Application")

but it bugs  :

ActiveX component cannot create object: 'Excel.Application'



Thank.





Message #5 by abdul_kesington@c... on Tue, 19 Jun 2001 16:10:45
Try this:



Response.ContentType = "application/vnd.ms-excel"

		'create the recordset object

		set rstExcel = Server.CreateObject

("ADODB.Recordset")

		'get the stored proc for the selected view

		'create the query

		SQL = "SELECT * FROM Employer

		'open the recordset

		rstExcel.Open SQL, conn, adOpenKeyset, 

adLockReadOnly



%>		

		<table border="0">

<%	

		'loop

		do while not rstExcel.EOF

%>

                                          <tr>

				<td valign="top"><%

=rstExcel.Fields(iLoop).value %></td>

<%	

rstExcel.MoveNext 

		loop

		'close the recordset

		rstExcel.Close

		'disconnect the recordset

		set rstExcel.ActiveConnection = nothing

		'release the object

		set rstExcel = nothing

%>

</table>	

  Return to Index