C#:操作 Excel 异常:Old format or invalid type library. (Exception from HRESULT: 0x80028018 (TYPE_E_INVDATAREAD))
2011-07-15 15:54
627 查看
今天在调用excel.Application.Workbooks.Add(Missing.Value)时遇到如下错误:
Exception:
Old format or invalid type library. (Exception from HRESULT: 0x80028018 (TYPE_E_INVDATAREAD))
这是Excel自身的一个bug,当本地系统环境被设置成非英文的,而Excel是英文的时候,就会出现,需要临时设定英文环境,代码如下:
System.Globalization.CultureInfo CurrentCI = System.Threading.Thread.CurrentThread.CurrentCulture;
System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");
转载:http://blog.csdn.net/wgy2750/archive/2010/01/20/5217892.aspx
Exception:
Old format or invalid type library. (Exception from HRESULT: 0x80028018 (TYPE_E_INVDATAREAD))
这是Excel自身的一个bug,当本地系统环境被设置成非英文的,而Excel是英文的时候,就会出现,需要临时设定英文环境,代码如下:
System.Globalization.CultureInfo CurrentCI = System.Threading.Thread.CurrentThread.CurrentCulture;
System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");
转载:http://blog.csdn.net/wgy2750/archive/2010/01/20/5217892.aspx
相关文章推荐
- C#:操作 Excel 异常:Old format or invalid type library. (Exception from HRESULT: 0x80028018 (TYPE_E_INVDATAREAD))
- Exce报表生成时出现“Workbook Add(System.Object) Message:Old format or invalid type library. (Exception from HRESULT: 0x80028018 (TYPE_E_
- C#Excel导出:Old format or invalid type library. (Exception from HRESULT: 0x80028018)
- C# 生成excel时报错,异常来自:HRESULT:0x80028018(TYPE_E_INVDAIAREAD)
- C#操作IIS创建应用程序池出现异常:无效索引(Exception from HRESULT:0x80070585)
- Office PIA:绕过Bug Q320369:Old format or invalid type library" error when automating Excel
- Excel Old format or invalid type library 错误原因
- COMException was unhandled:Old format or invalid type library
- BUG: "Old format or invalid type library" error when automating Excel on 64 bit server 2008
- Excel Old format or invalid type library 错误原因
- [问题解决] asp.net 中调用 Excel 出现以下提示: Old format or invalid type library.
- 格式太旧或是类型库无效。 (Exception from HRESULT: 0x80028019 (TYPE_E_UNSUPFORMAT))
- [问题解决]Old format or invalid type library.
- Configure file like format of ini and read data from ini file or write data to ini file
- C# 未能加载文件或程序集“xxx”或它的某一个依赖项。参数错误。(异常来自 HRESULT-0x80070057 (E_INVALIDARG))
- 使用POI插件对EXCEL 进行操作RecordFormatException:unable to construct record instance异常
- TypeError:exceptions must be old-style classes or derived from BaseException, not str
- 加载类型库/DLL 时出错。 (Exception from HRESULT: 0x80029C4A (TYPE_E_CANTLOADLIBRARY)
- ASP.NET - Exception from HRESULT: 0x80070057 (E_INVALIDARG)
- C# 调用Excel 出现服务器出现意外情况. (异常来自 HRESULT:0x80010105 (RPC_E_SERVERFAULT)