Microsoft.Office.Interop.Excel

  • Thread starter Thread starter wendell_lucas
  • Start date Start date
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
 
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
 
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...
 
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...
 
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
 
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!!!!!
 
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...>





Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
 
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();
 
Back
Top