Export Data to Excel Using ASP.NET without Server-side install

C

Chase Kang #52

Using VB.NET, I've created a report that takes data from a stored
procedure, which goes into some aspx page controls, and inserts that
data into a pre-formatted Excel spreadsheet template by using Office
2003 COM objects. Unfortunately, I just found out that I can't install
Office on the server, so I need an alternative method. The report
needs to be in a certain format with specified fonts, bolds, colors,
etc..

Is there any way I can still create the Excel report without an install
to the server? I think I can assume the end-user will have Office on
his/her computer.
 
M

Mark Rae

Unfortunately, I just found out that I can't install Office on the server,

Lucky you! Server-side automation is not recommended, and any solution which
uses it wouldn't be supported by Microsoft anyway...
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q257757#kb2
so I need an alternative method.

No problem.
The report needs to be in a certain format with specified fonts, bolds,
colors,
etc..

No problem.
Is there any way I can still create the Excel report without an install
to the server?

Yes.

1) Create the report in HTML and give it a .xls extension.

2) Create the report in Excel XML - download the schema here:
http://www.microsoft.com/downloads/...52-3547-420a-a412-00a2662442d9&displaylang=en

3) Use this:
http://www.aspose.com/Products/Aspose.Cells/Default.aspx

While you're there, click the "Why Not Automation?" hyperlink...
I think I can assume the end-user will have Office on
his/her computer.

If not, they can install this:
http://www.microsoft.com/downloads/...f4-996c-4569-b547-75edbd03aaf0&displaylang=EN
 
C

Chase Kang #52

Thanks for the reply. I've been looking into option 2 for a while, but
it looked a pain in the you know what so I haven't had to resort to it
yet. I'll take a crack at option 1, but if not, then I guess XML is
the way to go. I don't think option 3 is viable since I'd have to go
through a bunch of yellow tape which I don't want to do.
 
M

Mark Rae

Thanks for the reply. I've been looking into option 2 for a while, but
it looked a pain in the you know what so I haven't had to resort to it
yet. I'll take a crack at option 1, but if not, then I guess XML is
the way to go.

XML is a bit more work, certainly. With HTML you will (AFAIK) be restricted
to 1 worksheet in your workbook, but it's a lot easier to write...

I don't think option 3 is viable since I'd have to go
through a bunch of yellow tape which I don't want to do.

Fair enough - I guess it's pound per poke. With the Aspose product, you get
a totally managed assembly and simply use its methods and properties, just
like any other .NET class, and you get a binary .xls file at the end of it.
Not sure if there is an update to support the new Excel 2007 .xlsx file
format, though...
 
C

Chase Kang #52

Right now, I need to do one of two things:
1. Create the report from scratch
2. Open an existing report and editing the contents.

For one of the reports, option 1 is no problem since the report is
pretty plain and simple. I managed to get this one working using the
HTML method you suggested. But for my other report, it's a bit more
sophisticated since it involves multiple spreadsheets. Ideally, I
would like to open a pre-existing Excel file, edit some of the cell
contents, and save the changes, since creating this one from scratch
would be much harder.

How would you go about doing this one? Is there another way rather
than using the XML method?

Thanks for your help Mark. I'm pretty new to the .NET environment, and
even more so to all this Excel import/export stuff, so you've been a
big help.
 
M

Mark Rae

How would you go about doing this one? Is there another way rather
than using the XML method?

Aspose.

If you're looking for a justification for the cost of the Aspose software,
ask yourself how long it would take you and/or your colleagues to go down
the XML route and then compare that in terms of salary to the cost of the
Aspose licence(s)...

It's pretty much the industry standard, and is designed *precisely* to solve
the problem you're currently facing...
Thanks for your help Mark. I'm pretty new to the .NET environment, and
even more so to all this Excel import/export stuff, so you've been a
big help.

No problem.
 

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,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top