Export aspx/vb .net to multi-tabbed Excel?

B

bill

I have been searching everywhere AND am a bit new to vb .net/aspx, but can't
seem to find anything that works. Specifically, I need to export a dataset
from a webapp written in vb .net to a new excel spreadsheet with multiple
tabs (each tab would contain different rows from the dataset). Does anyone
have any sample code or examples I might look at?

tia,
Bill
 
B

bill

Thanks for the quick reply!!

That method is how I am currently doing it just for a quick-and-dirty
export. Unfortunately, the client needs multiple worksheets within the
workbook to hold data (the method I am using and that which is outlined in
your link creates a single workbook with a single sheet)....

Bill
 
M

Mark Rae [MVP]

Bill,

here is a link for you: http://support.microsoft.com/kb/306023

Use Office API

Ignore this completely...

Server-side automation is completely unsupported by Microsoft because it's
far too risky and unstable - Office just wasn't designed to be run in this
way:
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q257757#kb2
http://support.microsoft.com/default.aspx/kb/288367

If you need multiple worksheets, you have two choices:

1) OpenXML
http://www.microsoft.com/downloads/...52-3547-420A-A412-00A2662442D9&displaylang=en
http://www.microsoft.com/downloads/...80-f2c0-4b80-9ad1-2cb0c300aef9&displaylang=en

2) Aspose
http://www.aspose.com/Products/Aspose.Cells/Default.aspx
 
B

bill

Mark,

Thanks for the heads-up! I have never worked with xml before, so am quite
green in this area. Aside from the documentation links provided, do you
have any examples or links for openXML and asp.net?

thanks again,
Bill
 
M

Mark Rae [MVP]

I have never worked with XML before, so am quite green in this area.

Then I have to say that I think you'll find OpenXML a bit of a challenge...
Even seasoned XML gurus think twice about it...

I would strongly urge you to consider the Aspose alternative... You'll find
that it works almost identically to Office automation - without using Office
automation...

It's not free, of course, so I guess you'll make your choice according to
how much your time is worth... :)
 
L

LVP

hay it works for me...


Mark Rae said:
Ignore this completely...

Server-side automation is completely unsupported by Microsoft because it's
far too risky and unstable - Office just wasn't designed to be run in this
way:
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q257757#kb2
http://support.microsoft.com/default.aspx/kb/288367

If you need multiple worksheets, you have two choices:

1) OpenXML
http://www.microsoft.com/downloads/...52-3547-420A-A412-00A2662442D9&displaylang=en
http://www.microsoft.com/downloads/...80-f2c0-4b80-9ad1-2cb0c300aef9&displaylang=en

2) Aspose
http://www.aspose.com/Products/Aspose.Cells/Default.aspx
 
B

bill

LVP - a couple of quick questions:

1. When you create the spreadsheet on the server, do you do a
response.redirect so the user can then see the spreadsheet? And if so, how
do you clean up the spreadsheet from the server?

2. How many users do you have using this method and have you encountered
many issues?

thanks again!
Bill


LVP said:
hay it works for me...
 
L

LVP

To be safe go with Mark's Recommendations.

1. I create my spreadsheet saving it with a Unique Name. can do GUID+.
2. I stream it to the user. on one screen I have links of only available
docs
3. I clean all docs that are older than 2 hours. can be different.
4. I have hundreds of user but not concurrent. ( few concurrent ).

As I said it works for me, in my environment for my needs

All servers have issues, with or without this.


bill said:
LVP - a couple of quick questions:

1. When you create the spreadsheet on the server, do you do a
response.redirect so the user can then see the spreadsheet? And if so,
how do you clean up the spreadsheet from the server?

2. How many users do you have using this method and have you encountered
many issues?

thanks again!
Bill
 
B

bill

Thanks for the reply and information!! I am leaning in your direction as
well, for a few different reasons, which is why I am asking a few more
questions... :)

How you streaming the file to the user?

Thanks again for the info!
Bill
 
L

LVP

I but the file into a buffer byte[] array and Response.write(......
I have one aspx page that dishes out PDFs, Excel, JPG, GIF etc...
Response.ContentType = "MimeTypeHere" application/excel,
application/pdf, application/octet-stream
http://www.webmaster-toolkit.com/mime-types.shtml

Response.OutputStream.Write(Buffer, 0, Buffer.Length)

Response.Flush()

Response.End()



set the mimetype etc... So the browser can recognize it properly and the
client will decide to open or save.

Also you can do a Link and let IIS dish it out.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,233
Members
46,820
Latest member
GilbertoA5

Latest Threads

Top