Following Exception is thrown if I try to open an excel file on a client machine:
Exception from HRESULT: 0x800A03EC
Inner Exceptions: (empty)
Stack Trace:
at Microsoft.Office.Interop.Excel.Workbooks.Open(String Filename, Object UpdateLinks, Object ReadOnly, Object Format, Object Password, Object WriteResPassword, Object IgnoreReadOnlyRecommended, Object Origin, Object Delimiter, Object Editable, Object Notify, Object Converter, Object AddToMru, Object Local, Object CorruptLoad)
at (own assembly)
This HResult is a very generic Error, I could not find any useful informations by it.
My Setup:
WCF Service running inside a Windows Service. The exact same Setup is working on three other machines.
Things I can rule out:
Things I've done:
Some Observations:
What am I missing here?
Typically, Excel Error Hresult 0X800A03Ec errors are caused by a corrupt or missing Microsoft Excel-associated file, sometimes due to malware infection. File replacement is typically the best and easiest way to resolve errors related to Microsoft Corporation files.
To fix it, try close the excel from Task Manager once and re-run the BoT. It should work. Per our earlier experiences, HRESULT occurs when the Excel session used has not been gracefully closed before or when multiple instances of Excel are open.
Sorry - I know this is an indirect answer, although I would recommend you follow on. I personally have very bad experiences with Excel Interop services (ASP.NET application). As I am aware Microsoft does not recommend Interop server automation.
Even if you solve this issue you might stumble into issues with memory leakage, performance etc. In my previous project we were advanced with Excel interop automation until deployment. We stumbled into so many issues (Excel Interop processes not closing properly etc.) that we had to rewrite everything to OpenXML.
If possible use the new OpenXML format. There is a ClosedXML library that makes working with very easy.
Why OpenXML vs Interop?:
Efficiency (OpenXML is lightweight)
No memory leakage risk
Ease of use
Before trying this solution be sure that you read the "Things I've done" paragraph from the question (and tried what applies to you)
The Exception was thrown upon opening the Document; on the machine which generated the Excels, the files were generated invalid.
The solution was to change the Format of the numbers.
Go into System Configuration -> Time, Language and Region -> Language
Tap on the highlighted Hyperlink
Open Advanced Settings
Change the delimiter to a point "."
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With