3

i am getting following error while creating the excel file

System.UnauthorizedAccessException: Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)). at QA.CreateExcel.createDoc() in e:\~~CreateExcel.cs:line 33

i am using this code.

private Office.Excel.Application app =new Office.Excel.Application();

m using fw 4.0 and its a webapplication

4
  • 2
    Do not automate excel in a web application. It won't work well. Commented Feb 24, 2011 at 12:36
  • but its required, no other option Commented Feb 24, 2011 at 12:39
  • 2
    support.microsoft.com/kb/257757 And, there are other options. Commented Feb 24, 2011 at 12:48
  • There are several libraries that allow you to produce and read Excel and other office documents without office. Commented Feb 24, 2011 at 13:17

2 Answers 2

2

Office 2007/2010 file formats are XML files wrapped inside of zips and can be created server-side without needing Office installed. Some searching online will reveal solutions for simplifying the task of doing so.

For example, Codeplex has a project that makes doing so almost as easy as automating Excel, but with none of the issues you are encountering.

http://www.codeproject.com/KB/office/ExcelPackage.aspx

Sign up to request clarification or add additional context in comments.

Comments

0

Well, install Excel on the server and give IIS the rights to use it. This will not be stable, and chances are that your hosting provider won't even let you (unless you are hosting it on your own servers). This would also cost you an Office license..

Microsoft advises against installing Office on servers because of stability and reliability issues. http://support.microsoft.com/kb/257757 focusses on some of these problems and also mentions some alternatives.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.