HRESULT 예외 : 0x800A03EC 오류
다음 코드를 사용하여 Excel 추가 기능을 실행할 때 "HRESULT : 0x800A03EC"오류가 발생합니다.
Excel.Range rng = ActiveSheet.Cells[x, y] as Excel.Range;
string before = rng.Value2;
string cleanV = System.Text.RegularExpressions.Regex.Replace(before, @"\s+", "");
rng.set_Value(cleanV);
에러 발생시 X, Y를 1로 설정하여 엑셀 범위를 위반하지 않습니다. 광범위하게 검색하고 셀 값을 설정하는 여러 방법 (예 : Cells [x, y], range.set_Value ())을 시도했지만이 오류가 발생하는 이유와이를 피하는 방법을 잃어 버렸습니다.
어떤 도움이라도 대단히 감사합니다.
다음은 예외 세부 정보입니다.
System.Runtime.InteropServices.COMException was unhandled by user code
HResult=-2146827284
Message=Exception from HRESULT: 0x800A03EC
Source=""
ErrorCode=-2146827284
StackTrace:
at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
at Microsoft.Office.Interop.Excel.Range.set_Value(Object RangeValueDataType, Object value)
at ImportValidation.ThisAddIn.removeAnySpaces(Int32 x, Int32 y) in c:\Users\dshevelev\Documents\Visual Studio 2012\Projects\ImportValidation\ImportValidation\ThisAddIn.cs:line 354
at ImportValidation.ThisAddIn.ReadHeaders(Hashtable columnAddress) in c:\Users\dshevelev\Documents\Visual Studio 2012\Projects\ImportValidation\ImportValidation\ThisAddIn.cs:line 123
at ImportValidation.ThisAddIn.mapColumns() in c:\Users\dshevelev\Documents\Visual Studio 2012\Projects\ImportValidation\ImportValidation\ThisAddIn.cs:line 493
at ImportValidation.Ribbon1.button6_Click(Object sender, RibbonControlEventArgs e) in c:\Users\dshevelev\Documents\Visual Studio 2012\Projects\ImportValidation\ImportValidation\Ribbon1.cs:line 55
at Microsoft.Office.Tools.Ribbon.RibbonPropertyStorage.ControlActionRaise(IRibbonControl control)
at Microsoft.Office.Tools.Ribbon.RibbonPropertyStorage.ButtonClickCallback(RibbonComponentImpl component, Object[] args)
at Microsoft.Office.Tools.Ribbon.RibbonManagerImpl.Invoke(RibbonComponentCallback callback, Object[] args)
at Microsoft.Office.Tools.Ribbon.RibbonMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Microsoft.Office.Tools.Ribbon.RibbonManagerImpl.System.Reflection.IReflect.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParameters)
InnerException:
이 줄에서 동일한 오류가 발생했습니다.
Object temp = range.Cells[i][0].Value;
0이 아닌 기반 인덱스로 해결됨
Object temp = range.Cells[i][1].Value;
이 라이브러리를 만든 사람들이 0이 아닌 기반 인덱싱을 사용하는 것이 좋은 생각이라고 생각한 것이 어떻게 가능합니까?
이것은 일반적이지만 제대로 문서화되지 않은 Excel COM 오류입니다. "NAME_NOT_FOUND"로 문서화되어 Excel의 COM 레이어가 비활성화되어 있고 COM 속성 또는 메서드 이름을 찾을 수 없음을 확인했습니다.
예를 들어 코드를 시작하는 타이머를 설정하고 사용자가 셀을 편집하거나 마우스 버튼을 누르는 동안 코드가 실행되기 시작하는 경우와 같이 Excel이 '사용 중'일 때 COM 코드를 실행할 때이 오류가 지속적으로 발생합니다. 항상이 오류가 발생합니다. 이 오류는 코드가 주 Excel 스레드에서 실행될 때만 발생하지만 Excel이 '사용 중'인 동안 다른 스레드에서 Excel COM 개체 모델을 호출 할 때 발생하는 오류 VBA_E_IGNORE = 0x800AC472와 동일한 것으로 보입니다.
유일한 해결 방법은 Excel이 더 이상 '사용 중'이 아닐 때 성공할 때까지 COM 호출을 약간의 지연으로 다시 시도하는 것 같습니다.
시작 색인을 확인하십시오. Microsoft.Office.Interop.Excel 범위 개체의 경우 0이 아닌 1부터 시작합니다. 루프 시작 값 때문에 같은 오류가 발생했습니다.
Excel 옵션> 저장>이 형식으로 파일 저장> "Excel 통합 문서 (* .xlsx)"선택으로 이동합니다. 이 문제는 .xlsx 대신 이전 버전의 Excel 파일 (.xls)을 사용하는 경우 발생합니다. 이전 버전은 Excel 시트에서 65k 이상의 행을 허용하지 않습니다.
.xslx로 저장 한 후 코드를 다시 실행 해보십시오.
편집하다 ----
문제를 자세히 살펴보면 문제가 로케일에 따라 다를 수 있습니다. 코드가 다른 컴퓨터에서 작동합니까? 세포에는 어떤 가치가 있습니까? datetime 형식입니까? 여기를보세요 :
http://support.microsoft.com/kb/320369
http://blogs.msdn.com/b/eric_carter/archive/2005/06/15/429515.aspx
우리는 같은 문제가 있었고 해결책을 찾았습니다.
이 폴더를 만드십시오. C : \ Windows \ SysWOW64 \ config \ systemprofile \ Desktop · Windows 2008 Server x86
이 폴더를 만드십시오. C : \ Windows \ System32 \ config \ systemprofile \ Desktop
이 오류도 있습니다 ....
내 경우에는 파일 경로에 저장에 잘못된 문자가 포함되어있을 때 발생합니다.
path = "C:/somefolder/anotherfolder\file.xls";
\
및 둘 다의 존재에 유의하십시오./
* 아직 존재하지 않는 디렉토리에 저장하려고 할 때도 발생할 수 있습니다.
큰 Excel 파일 (~ 150.000 행)을 내보내려고 할 때 동일한 오류가 발생했습니다. 다음 코드로 수정되었습니다.
Application xlApp = new Application();
xlApp.DefaultSaveFormat = XlFileFormat.xlOpenXMLWorkbook;
나는 이것이 오래되었다는 것을 알고 있지만 단지 내 경험에 반영하기 위해. 오늘 아침에 만났어요. 내 오류가 .xls 줄 제한 또는 배열 인덱스와 관련이 없습니다. 잘못된 공식으로 인해 발생합니다.
I was exporting from database to Excel a sheet about my customers. Someone fill in the customer name as =90Erickson-King
and apparently this is fine as a string-type field in the database, however will result in an error as a formula in Excel. Instead of showing #N/A
like when you're using Excel, the program just froze and spilt that 0x800A03EC error a while later.
I corrected this by deleting the equal sign and the dash in the customer's name. After that exporting went well.
I guess this error code is a bit too general as people are seen reporting quite a range of different possible causes.
I got the same error whilst using Excel 2003 DLLs and trying to write to the 257th column. Excel 2003 limits maximum column per worksheet to 256, thus raising this exception.
For detailed limitations of Excel 2003, see http://office.microsoft.com/en-001/excel-help/excel-specifications-and-limits-HP005199291.aspx
Starting from Excel 2007, column limitation is increased to 16384 columns, see http://office.microsoft.com/en-001/excel-help/excel-specifications-and-limits-HP010073849.aspx
I was receiving the same error some time back. The issue was that my XLS file contained more than 65531 records(500 thousand to be precise). I was attempting to read a range of cells.
Excel.Range rng = (Excel.Range) myExcelWorkbookObj.UsedRange.Rows[i];
The exception was thrown while trying to read the range of cells when my counter, i.e. 'i', exceeded this limit of 65531 records.
Adding one more possible issue causing this: the formula was wrong because I was using the wrong list separator according to my locale. Using CultureInfo.CurrentCulture.TextInfo.ListSeparator;
corrected the issue.
Note that the exception was thrown on the following line of code...
This must be the world's most generic error message because I got it today on the following command using Excel Interop:
Excel.WorkbookConnection conn;
conn.ODBCConnection.Connection = "DSN=myserver;";
What fixed it was specifying ODBC in the connection string:
conn.ODBCConnection.Connection = "ODBC;DSN=myserver;";
On the off chance anyone else has this error, I hope it helps.
참고URL : https://stackoverflow.com/questions/12714626/exception-from-hresult-0x800a03ec-error
'IT Share you' 카테고리의 다른 글
영구 테이블과 동일한 열 및 유형으로 임시 테이블을 만드는 가장 좋은 방법 (0) | 2020.12.10 |
---|---|
해당 값을 기준으로 사전 키를 필터링하는 방법 (0) | 2020.12.10 |
Xcode Guard Malloc 및 장치 디버깅 : 'libgmalloc.dylib'이미지를 찾을 수 없음 (0) | 2020.12.10 |
iOS, Android 및 WP에서 개발하는 데 드는 비용은 얼마입니까? (0) | 2020.12.10 |
transcluded 범위가있는 지시문에서 양방향 바인딩이 작동하지 않음 (0) | 2020.12.10 |