关于asp.net导出excel的问题(1)

有时调用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://hi.baidu.com/iceglaze/blog/item/4b63c3c4ed2fcead8226ac8e.html

posted on 2008-07-31 15:23  小白鸭  阅读(241)  评论(0)    收藏  举报

导航