Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 Export .NET Data Table to EXCEL file

Author  Topic 

BigRetina
Posting Yak Master

144 Posts

Posted - 2003-01-13 : 08:10:08
How can I do that?..
Thanks In Advance

joldham
Wiseass Yak Posting Master

300 Posts

Posted - 2003-01-13 : 09:26:48
Either use the Excel Object Model by creating a reference to the Excel .dll in the project or change the Response.contentType = "application/vnd.ms-excel" in the code-behind file.

The first option will require you to either save the created file to the web server or stream it back to the client. You could then create a link or redirect to the saved file. The second option will generate an html file, but use Excel to read the file.

I prefer the second option, because you do not have to worry about accumulating temporary Excel files on the server in response to users request. It is simply a html file read by Excel.

Hope this helps.

Jeremy

Go to Top of Page

BigRetina
Posting Yak Master

144 Posts

Posted - 2003-01-14 : 03:09:14
Thanks
But maybe I should have mad eit clearer..I am working on a Windows Forms app. No ASP!


Go to Top of Page

rihardh
Constraint Violating Yak Guru

307 Posts

Posted - 2003-01-14 : 03:43:41
By the way, this is a MSSQL forum...

Go to Top of Page

Andraax
Aged Yak Warrior

790 Posts

Posted - 2003-01-14 : 04:06:46
rihardh, have you read the description of this particular forum??

Nah. Didn't think so

Go to Top of Page

rihardh
Constraint Violating Yak Guru

307 Posts

Posted - 2003-01-14 : 04:13:37
Yes I did. My intention was to reroute "big retina" to a more specialized .NET forum.


Go to Top of Page

Andraax
Aged Yak Warrior

790 Posts

Posted - 2003-01-14 : 04:15:02
OK, I apologize then. Sorry!

Go to Top of Page

joldham
Wiseass Yak Posting Master

300 Posts

Posted - 2003-01-14 : 07:17:34
If you are using a Windows app then you will definitely need to use the Excel Object model. I have never tried to program this in .Net so I am afraid I cannot be much help beyond that. Hopefully this will give you a starting point.

Jeremy



Edited by - joldham on 01/14/2003 07:18:18
Go to Top of Page

BigRetina
Posting Yak Master

144 Posts

Posted - 2003-01-15 : 03:48:25
rihardh..
I dont think that your statement was an appropriate one to reroute me to a more specilized forum!. This section was ADDED to the forum with mainly the .NET issues in mind..as i understood!

The issue that I have not used the EXCEL object model in .NET that was why i am asking!.
Thanks To The Others!

Go to Top of Page

setbasedisthetruepath
Used SQL Salesman

992 Posts

Posted - 2003-01-15 : 10:14:21
Hmmmm. Let's have Graz or Rob weigh in on this issue. I would side with rihardh initially; this is a SQL Server site, and as the question has absolutely nothing to do with SQL Server, this should be moved elsewhere.

Jonathan
{0}
Go to Top of Page

ValterBorges
Master Smack Fu Yak Hacker

1429 Posts

Posted - 2003-01-15 : 10:32:48
use ado.net see here
http://groups.google.com/groups?q=.net+inherits+for+excel&hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=J%23lN4srlCHA.1832%40cpmsftngxa09&rnum=3


Go to Top of Page

Andraax
Aged Yak Warrior

790 Posts

Posted - 2003-01-15 : 16:31:06
Description of this forum: "This is for ASP.NET, ASP, Visual Basic or anything else that is used to write applications that access SQL Server. "

Obviously, the data table was fetched from an SQL server so i think the question is posted in the right forum. But perhaps it would be easier to get an answer at a forum full of .NET geeks instead of this forum which is full of SQL geeks :)



Go to Top of Page

ValterBorges
Master Smack Fu Yak Hacker

1429 Posts

Posted - 2003-01-15 : 17:49:23
What about all around geeks

Go to Top of Page

rihardh
Constraint Violating Yak Guru

307 Posts

Posted - 2003-01-16 : 04:23:04
BigRetina

I don't think that you're the one who decides what's appropriate or not!

The fact is, that this forum lives mainly from problems linked directly to MSSQL server (please look at the number of posts at the forums section). There is no doubt that .NET and MSSQL go along and are unbreakably connected and that in the future, maybe this forum will see more posts like your's. But for the time being, there are other .NET forums which host people specialized on that issue, who can provide better knowledge.

I REPEAT FOR THE LAST TIME that my intention was purely to help, not to drive you away, but as noticed, some people are so full of themselves, they just don't get it...

Go to Top of Page

harshal_in
Aged Yak Warrior

633 Posts

Posted - 2003-01-16 : 04:47:09


Expect the UnExpected
Go to Top of Page

BigRetina
Posting Yak Master

144 Posts

Posted - 2003-01-16 : 08:26:47
rihardh...
This is becoming silly and boring!..
So I wont comment any further!


Go to Top of Page
   

- Advertisement -