Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
| Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 26th, 2008, 08:20 AM
Registered User
 
Join Date: Feb 2007
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Error 'Exception from HRESULT: 0x800A03EC'

Hi All,

In one the intranet sites which I have developed, i'm creating an excel file from C#.Net 2005-ASP.NET 2.0

application. In my local machine which runs on Windows XP the application works perfectly, but when I try to run

the application in windows 2008 server machine it throws an exception.

'Exception from HRESULT: 0x800A03EC'

What is running in the windows 2008 server machine is the published version of my application. I have all the

required dlls and other application dependency files in the bin folder including Interop.Excel.dll and

Interop.Microsoft.Office.Core.dll.

The windows 2008 server machine has MS Office 2003 version installed. I have also configured DCOM in this machine.

Here is my code

            string fileName = "", strSaveFileAs = "";//To Save the File Name of the Excel File
            ItemMaster itemInfo;
            Excel.Application xlApp = new Excel.Application();//initialise Xl app
            Excel.Workbook xlWorkBook = xlApp.Workbooks.Add(true);
            object worksheet = xlWorkBook.ActiveSheet;// set work sheet
            object objMissing = System.Reflection.Missing.Value;
            if (arList.Count > 0)
            {
                ((Excel.Worksheet)xlApp.ActiveSheet).Cells[1,1] = "SINO";
                ((Excel.Worksheet)xlApp.ActiveSheet).Cells[1, 2] = "ItemGroupName";
                ((Excel.Worksheet)xlApp.ActiveSheet).Cells[1, 3] = "ItemCode";
                ((Excel.Worksheet)xlApp.ActiveSheet).Cells[1, 4] = "ItemName";
                ((Excel.Worksheet)xlApp.ActiveSheet).Cells[1, 5] = "QTY";
                ((Excel.Worksheet)xlApp.ActiveSheet).Cells[1, 6] = "Rate";

                int SINo = 0;// To Show Serial No in excel.
                for (int iRows = 1; iRows <= arList.Count; iRows++)
                {
                    itemInfo = new ItemMaster();
                    itemInfo = (ItemMaster)arList[SINo];
                    ((Excel.Worksheet)xlApp.ActiveSheet).Cells[iRows + 1, 1] = (SINo + 1).ToString();
                    //Here GroupId actually contains group name
                    ((Excel.Worksheet)xlApp.ActiveSheet).Cells[iRows + 1, 2] = itemInfo.GroupID.ToString();
                    ((Excel.Worksheet)xlApp.ActiveSheet).Cells[iRows + 1, 3] = itemInfo.ItemCode.ToString();
                    ((Excel.Worksheet)xlApp.ActiveSheet).Cells[iRows + 1, 4] = itemInfo.ItemName.ToString();
                    ((Excel.Worksheet)xlApp.ActiveSheet).Cells[iRows + 1, 5] = "";
                    ((Excel.Worksheet)xlApp.ActiveSheet).Cells[iRows + 1, 6] = itemInfo.Rate.ToString();
                    ((Excel.Worksheet)xlApp.ActiveSheet).Cells[iRows + 1, 7] = "";
                    ((Excel.Worksheet)worksheet).Columns.AutoFit(); //format
                    xlApp.ScreenUpdating = true;
                    SINo++;
                }
                /* FileName format of xls is: QuoteNo_CustomerName_Date*/
                strSaveFileAs = txtCode.Text + "_" + ddlCustomer.SelectedItem.ToString() + "_" + txtDate.Text;


                string filePath = Server.MapPath("..//Sales//Quote/");
                fileName = filePath + "QuoteFile" + ".xls";
                if (File.Exists(fileName))
                    File.Delete(fileName);
                  //Save file in the Location 'fileName'
                xlWorkBook.SaveAs((object)(fileName), objMissing, objMissing, objMissing, objMissing, objMissing,

Excel.XlSaveAsAccessMode.xlNoChange, objMissing, objMissing, objMissing, objMissing, objMissing);

"Exception from HRESULT: 0x800A03EC" exception is thrown when the line of code

xlWorkBook.SaveAs((object)(fileName), objMissing, objMissing, objMissing, objMissing, objMissing, Excel.XlSaveAsAccessMode.xlNoChange, objMissing, objMissing, objMissing, objMissing, objMissing); is executed.

Looking forward to hear from you soon.

 
Old November 27th, 2008, 04:56 AM
Registered User
 
Join Date: Feb 2007
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

the exact error i'm getting is System.Runtime.InteropServices.COMException: Exception from HRESULT: 0x800A03EC


 
Old March 12th, 2009, 05:17 PM
Registered User
 
Join Date: Mar 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am having a similar problem... did you ever find the solution to this
 
Old November 6th, 2009, 09:17 AM
Registered User
 
Join Date: Nov 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default HRESULT: 0x800A03EC

I came here trying to find an answer. Finding none I went back to my code. I discovered that I was attempting to reference a cell with a 0 in the column parameter. For example mySheet.Cells[1,0]. When I fixed that it ran OK.

Hope this helps.




Similar Threads
Thread Thread Starter Forum Replies Last Post
Needhelp Error- Exception from HRESULT: 0x800A0057 remya1000 General .NET 1 November 6th, 2008 11:45 AM
Exception from HRESULT: 0x800A03EC adorable.ashish General .NET 0 February 18th, 2008 06:33 AM
access denied. [exception from HRESULT: 0x80070005 p2ptolu Internet Information Services 0 December 18th, 2007 02:58 PM
Exception from HRESULT : 0x800A2740. remya1000 .NET Framework 1.x 0 November 8th, 2007 04:29 PM
Exception from HRESULT: 0x80131524. kschori Crystal Reports 0 May 7th, 2004 03:27 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.