|
|
 |
| 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 p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.
|
 |

November 26th, 2008, 08:20 AM
|
|
Registered User
|
|
Join Date: Feb 2007
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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.
|

November 27th, 2008, 04:56 AM
|
|
Registered User
|
|
Join Date: Feb 2007
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
the exact error i'm getting is System.Runtime.InteropServices.COMException: Exception from HRESULT: 0x800A03EC
|

March 12th, 2009, 06:17 PM
|
|
Registered User
|
|
Join Date: Mar 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I am having a similar problem... did you ever find the solution to this
|

November 6th, 2009, 09:17 AM
|
|
Registered User
|
|
Join Date: Nov 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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.
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |