Microsoft.Office.Interop.Excel

W

wendell_lucas

Hi,
I have an ASP.NET application that creates reports in Excel. It works
fine in development but not on our production Windows 2003 server
running IIS 6.0 Excel does not show up. I had a DCOM access error
which was fixed by giving Network Service Local Launch and Activation
Permissions. The application runs now but Excel does open up. I don't
see it as a process on the server either. Office 2003 was recently
installed on the server for this application. Has anyone had a problem
like this?

Thanks,
Wendell
 
W

wendell_lucas

Maybe is too late for this advise...

Office interop is not recommeded for ASP .net application:

http://support.microsoft.com/default.aspx?scid=kb;EN-US;q257757#kb2

Too dangerous to have it on server side applicatons.

You could use XMLSS, or other lite approached.

Good luck
Braulio

/// ------------------------------
/// Braulio Díez
///
///http://www.tipsdotnet.com
/// ------------------------------






- Show quoted text -

Thanks, for your quick replys. After reading the suggested articles,
it seems clear that we shall have to go to XML or a 3rd party tool
going forward. Unfortunately, it is too late to change directions for
this initial piece of the project. Do you have any idea why Excel is
not availible when running the application from the server?

Thanks,
Wendell
 
M

Mark Rae

After reading the suggested articles, it seems clear that we shall
have to go to XML or a 3rd party tool going forward.
Unfortunately, it is too late to change directions for this initial
piece of the project.

Moving from Office Automation to Aspose is simplicity itself - they have
deliberately made their object model resemble the Office object model as
closely as possible precisely for this reason...
Do you have any idea why Excel is not availible when
running the application from the server?

Excel, as with the rest of Office, was simply not designed to be run in this
way.

The main reason is to do with threading, but there are others...
 
M

Mark Rae

I think somebody in a previoius thread has pointed the official Ms doc.
about
how to configure Excel automation on ASP .net.

Which also include, in bold, a warning that Microsoft will not support any
solution which tries to use server-side automation because it doesn't
work...
Mmmm... anyway take a look at this link, I think it give good tips:

http://www.eggheadcafe.com/articles/20021012.asp

On the contrary - it demonstrates server-side automation, so should be
ignored...
 
W

wendell_lucas

I think somebody in a previoius thread has pointed the official Ms doc. about
how to configure Excel automation on ASP .net.

Mmmm... anyway take a look at this link, I think it give good tips:

http://www.eggheadcafe.com/articles/20021012.asp

Good luck
Braulio

/// ------------------------------
/// Braulio Díez
///
///http://www.tipsdotnet.com
/// ------------------------------







- Show quoted text -

Braulio, that is a good article. It sould get us over.
Thanks all for your help.
Wendell
 
M

Mark Rae

Braulio, that is a good article. It sould get us over.

Sigh...

The code in that article uses server-side automation.

THERE IS A VERY STRONG POSSIBILITY THAT IT WILL NOT WORK!!!!!
 
J

Juan T. Llibre

re:
!> THERE IS A VERY STRONG POSSIBILITY THAT IT WILL NOT WORK!!!!!

Or worse, that it *will* work...screwing up the server in any of a zillion ways.

<g, d & r...>
 
C

Cika Pero

Hi,

maybe you could try some 3rd party alternative. I am using this <a href="http://www.gemboxsoftware.com/GBSpreadsheet.htm">Excel C#</a> library in my <a href="http://www.gemboxsoftware.com/LA/ASP-.NET-Excel.htm">Excel ASP.NET</a> and it is running well.

Here is a sample code how to use it:

DataTable people = (DataTable)Session["people"];
// Create excel file.
ExcelFile ef = new ExcelFile();
ExcelWorksheet ws = ef.Worksheets.Add("DataSheet");
ws.InsertDataTable(people, "A1", true);

Response.Clear();

// Stream file to browser, in required type.
switch (this.RadioButtonList1.SelectedValue)
{
case "XLS":
Response.ContentType = "application/vnd.ms-excel";
Response.AddHeader("Content-Disposition", "attachment; filename="
+ "Report.xls");
ef.SaveXls(Response.OutputStream);
break;

case "XLSX":
Response.ContentType = "application/vnd.openxmlformats";
Response.AddHeader("Content-Disposition", "attachment; filename="
+ "Report.xlsx");
// With XLSX it is a bit more complicated as MS Packaging API
// can't write directly to Response.OutputStream.
// Therefore we use temporary MemoryStream.
MemoryStream ms = new MemoryStream();
ef.SaveXlsx(ms);
ms.WriteTo(Response.OutputStream);
break;
}

Response.End();
 

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,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top