Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Microsoft.Office.Interop.Excel

Reply
Thread Tools

Microsoft.Office.Interop.Excel

 
 
Cika Pero
Guest
Posts: n/a
 
      04-06-2011
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();


> On Tuesday, June 26, 2007 3:56 PM wendell_luca wrote:


> 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



>> On Tuesday, June 26, 2007 5:00 PM Mark Rae wrote:


>> <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed) oups.com...
>>
>>
>> Server-side Office automation does not work, and Microsoft does not support
>> it:
>> http://support.microsoft.com/default...US;q257757#kb2
>>
>> You'll need to come up with a different solution e.g.:
>> http://www.aspose.com/Products/Aspos...s/Default.aspx
>>
>>
>> --
>> http://www.markrae.net



>>> On Wednesday, June 27, 2007 7:10 AM braulio121NOSPA wrote:


>>> Maybe is too late for this advise...
>>>
>>> Office interop is not recommeded for ASP .net application:
>>>
>>> http://support.microsoft.com/default...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
>>> /// ------------------------------
>>>
>>>
>>>
>>>
>>> "(E-Mail Removed)" wrote:



>>>> On Wednesday, June 27, 2007 1:52 PM wendell_luca wrote:


>>>> On Jun 27, 7:10 am, Braulio Diez <(E-Mail Removed)> wrote:
>>>>
>>>> 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



>>>>> On Wednesday, June 27, 2007 2:29 PM Mark Rae wrote:


>>>>> <(E-Mail Removed)> wrote in message
>>>>> news:(E-Mail Removed) oups.com...
>>>>>
>>>>>
>>>>> 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...
>>>>>
>>>>>
>>>>> 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...
>>>>>
>>>>>
>>>>> --
>>>>> http://www.markrae.net



>>>>>> On Thursday, June 28, 2007 2:06 AM braulio121NOSPA wrote:


>>>>>> 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
>>>>>> /// ------------------------------
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> "(E-Mail Removed)" wrote:




 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments