更改默认Excel [英] Change default Excel

查看:97
本文介绍了更改默认Excel的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,



我创建了一个新的Excel应用程序:



 Application xlApp =  new  Application(); 
工作簿wbs = xlsApp.Workbooks;
工作簿wb = wbs.Add( 1 );
...





如果用户手动打开Excel文件,它将在此实例中打开。 br />


如果在执行代码之前打开了Excel文件,那么它就会打开Excel文件。



总之,Excel文件打开:



- 在新实例中如果之前没有

- 在第一个实例中Excel打开



因此我会将Excel xlApp设置为打开Excel文件的默认,特别是如果之前打开了另一个Excel实例。



谢谢你,

解决方案

看看这个类似问题的解决方案和评论(如果对此解决方案发表评论,请留言它并没有解决你的问题)



Excel对象的问题 [ ^ ]


如果要检查MS Excel之前是否已打开,请参阅:< a href =http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.marshal.getactiveobject.aspx> http://msdn.microsoft.com/en-us/library/system .runtime.interopservices.marshal.getactiveobject.aspx [ ^ ]。如果没有,请更具体并发表评论,我保证会改进我的答案。


您可以在Windows注册表中更改.xls的默认程序的值。 />


指向Registry类的链接

Hello,

I created a new Excel application with:

Application xlApp = new Application ();
Workbooks wbs = xlsApp.Workbooks;
Workbook wb = wbs.Add (1);
...



If the user opens "by hand" an Excel file, it will open in this instance.

If an Excel file is opened before the code is executed, then it is in it that will open Excel files.

In summary, Excel files open :

- in a new instance if there was not before
- in the first instance of Excel open

So I would make my Excel xlApp "default" for open Excel file, especially if another instance of Excel is opened before.

thank you,

解决方案

Have a look at the solutions and comments to this similar problem (leave a comment to this solution if it doesn''t quite fix your problem)

Problem with Excel object[^]


If you want to check if MS Excel has been previously opened, see this: http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.marshal.getactiveobject.aspx[^]. If not, please, be more specific and post a comment, and i promise to improve my answer.


You can change values of the default program for .xls in the Windows registry.

A link to the Registry class


这篇关于更改默认Excel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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