使用C#.net打开现有的excel文件 [英] opening of the existing excel file using C#.net

查看:208
本文介绍了使用C#.net打开现有的excel文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



在Windows应用程序中,我正在使用C#.net.

我的要求是打开驱动器中已经存在的Excel文件.
我正在使用此示例代码,但是我的问题是它一次显示了错误,而下一次却可以正常工作.

请帮我,我哪里出问题了?

这是我的示例代码;

Hi,

In windows applications I am using C#.net.

My requirement is to open an excel file that already exists in my drive.
I am using this sample code, but my problem is it was showing the error one time and it was working perfectly the next.

Please help me, where am I going wrong?

Here''s my sample code;

Excel.Application xlApp;
Excel.Workbook xlWorkBook;
object misValue = System.Reflection.Missing.Value;
xlApp = new Excel.Application();
xlApp.Visible = true;
xlWorkBook = xlApp.Workbooks.Open("C:\\Documents and Settings\\Owner\\Desktop\\intetrfacetest.xlsx", misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue);




错误是:
由于以下错误,从IClassFactory创建具有CLSID {00024500-0000-0000-C000-000000000046}的COM组件实例失败:80010001.




error is :
Creating an instance of the COM component with CLSID {00024500-0000-0000-C000-000000000046} from the IClassFactory failed due to the following error: 80010001.

推荐答案

I想想您需要编辑正在使用的地址...

I think straight off you need to edit the address being used...

<br />
C:\\Documents and Settings\\Owner\\Desktop\\intetrfacetest.xlsx<br />



很明显那里出了什么问题.



It should be obvious what is wrong there.


这篇关于使用C#.net打开现有的excel文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆