如何确保使用VSTO 4打开的是哪个版本的Excel?
我使用 VSTO 填充 Excel 工作表,如下所示:
Application app = new Application();
var wBook = app.Workbooks.Add();
var wSheet = (wBook.Worksheets[1] as Worksheet);
/* Population algorithm */
app.Visible=true;
工作表已创建,一切都很好,只是我在工作环境中安装了两个版本的 Excel(Excel 2003 和 Excel 2010)。
上周,当我第一次创建代码时,Excel 2010 就出现了。然而,本周,打开的是 Excel 2003。
我的项目引用最新版本的 Microsoft.Office.Interop.Excel
(C:\Program Files (x86)\Microsoft Visual Studio 10.0\Visual Studio Tools for Office\PIA\Office14\Microsoft .Office.Interop.Excel.dll,版本 14)。
这是 Windows 中的某种首选项,还是我在创建应用程序实例时必须指定的内容?
I am population an Excel sheet using VSTO as follow:
Application app = new Application();
var wBook = app.Workbooks.Add();
var wSheet = (wBook.Worksheets[1] as Worksheet);
/* Population algorithm */
app.Visible=true;
The sheet is created and everything is fine, except that I have two versions of Excel installed in the envrionment I work in (Excel 2003 and Excel 2010).
Last week, when I first created the code, Excel 2010 was showing up. However, this week, it's Excel 2003 that opens up.
My project references Microsoft.Office.Interop.Excel
with the latest version (C:\Program Files (x86)\Microsoft Visual Studio 10.0\Visual Studio Tools for Office\PIA\Office14\Microsoft.Office.Interop.Excel.dll
, Version 14).
Is this somehow a preference in Windows, or is it something I have to specify when I create the instance of the application?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许启动 excel 2010 并处理它,下面的代码可能会有所帮助
}
maybe start excel 2010 and get handle to it, below code may help
}