简体   繁体   English

可以在Office 2007中运行Excel VSTO 2010加载项吗?

[英]Can an Excel VSTO 2010 add-in be run in Office 2007?

We've created an VSTO 2010 project, containing a ribbon bar for Excel, which runs nicely, however it now turns out some of our customers will be running Office 2007. 我们已经创建了一个VSTO 2010项目,其中包含一个用于Excel的功能区,它可以很好地运行,但现在我们的一些客户将会运行Office 2007。

We've attempted to install it on 2007, with no luck (the ribbon is listed as a running add-in, however it doesn't appear among the ribbon tabs in Excel). 我们已经尝试在2007年安装它,没有运气(功能区被列为正在运行的插件,但它不会出现在Excel的功能区选项卡中)。 I've tried following the steps mentioned in this SO question (replacing the 2010 references dlls with 2007 reference dlls), with no success. 我已经尝试按照这个SO问题中提到的步骤(用2007参考dll替换2010参考dll),但没有成功。

Any suggestions that avoid having to create a new 2007 project (which as I understand would involve uninstalling Office 2010 on our development machines, and installing 2007 instead) would be very much appreciated. 任何建议,避免必须创建一个新的2007项目(据我所知,将涉及在我们的开发机器上卸载Office 2010,而不是安装2007)将非常感谢。

Thanks! 谢谢!

Gah. 嘎。 It turned out to be a problem with the schema on the ribbon XML, which we spotted when we'd stripped the ribbon XML down to a single label, to see if it was any of the controls etc in the XML causing the incompatibility. 事实证明,功能区XML上的架构存在问题,当我们将功能区XML剥离到单个标签时,我们发现它是否存在导致不兼容的XML中的任何控件等。

We were using (quite possibly copied from an example) 我们正在使用(很可能从一个例子中复制)

xmlns="http://schemas.microsoft.com/office/2009/07/customui"

but once we changed it to: 但是一旦我们将其改为:

xmlns="http://schemas.microsoft.com/office/2006/01/customui"

the ribbon appeared immediately, which fitted in with the symptoms of the ribbon appearing as a running add-in, but not being visible in Excel itself. 色带立即出现,其中出现了作为运行插件出现的色带的症状,但在Excel本身中不可见。 As mentioned previously (see this SO post for the details), it was necessary to use the v12 office and interop dlls. 如前所述(有关详细信息,请参阅此SO帖子 ),有必要使用v12办公室和互操作dll。

You can install 2007 and 2010 side by side, and avoid any issues switching between the two by running the following in command line, or placing this in a batch file, either works: 您可以并排安装2007和2010,并通过在命令行中运行以下命令或将其置于批处理文件中来避免在两者之间切换任何问题,或者可以正常工作:

reg add HKCUSoftwareMicrosoftOffice14.0WordOptions /f /v NoReReg /t REG_DWORD /d 1
reg add HKCUSoftwareMicrosoftOffice14.0ExcelOptions /f /v NoReReg /t REG_DWORD /d 1
reg add HKCUSoftwareMicrosoftOffice14.0PowerPointOptions /f /v NoReReg /t REG_DWORD /d 1
reg add HKCUSoftwareMicrosoftOffice14.0AccessOptions /f /v NoRepairNeeded /t REG_DWORD /d 1

reg add HKCUSoftwareMicrosoftOffice12.0WordOptions /f /v NoReReg /t REG_DWORD /d 1
reg add HKCUSoftwareMicrosoftOffice12.0ExcelOptions /f /v NoReReg /t REG_DWORD /d 1
reg add HKCUSoftwareMicrosoftOffice12.0PowerPointOptions /f /v NoReReg /t REG_DWORD /d 1
reg add HKCUSoftwareMicrosoftOffice12.0AccessOptions /f /v NoRepairNeeded /t REG_DWORD /d 1

As for your code, I find that the Excel Interop code for 12 and 14 is more or less interchangable. 至于你的代码,我发现12和14的Excel Interop代码或多或少是可互换的。 Are you using anything in Excel Interop 14 that isn't in 12? 你在Excel Interop 14中使用的不是12的东西吗?

Two projects may not seem ideal, but you may need to go this route. 两个项目可能看起来不太理想,但您可能需要走这条路。 The upside is that you will be able to more or less copy and paste everything, espicially if you write everything for the 2007 project, and copy/paste across to the 2010 project, as opposed to the other way around. 好处是,您可以或多或少地复制和粘贴所有内容,特别是如果您为2007项目编写所有内容,并复制/粘贴到2010项目,而不是相反。

Hope this helps 希望这可以帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM