Excel自定义无法打开使用Office2007PIA创建的xlsm文件

时间:2014-09-11 20:19:36

标签: c# excel vsto office-pia

我们将Excel自定义分发为xlsm文档后面的代码。以前,我们的构建服务器安装了Office 2007,我们使用Office 2007主互操作程序集构建了xlsm(并将它们添加为安装先决条件)。

最近,我们将构建服务器升级到Office 2013,并开始使用Microsoft Visual Studio 2010 Tools for Office Runtime构建xlsm(并将其添加为安装先决条件)。

问题:以前保存对旧xlsm文件(使用Office2007PIA构建)的更改的用户在其计算机上安装了新版本的自定义后无法打开旧文件。他们得到以下例外:

************** Exception Text **************
System.Runtime.InteropServices.COMException (0x80070490): Element not found. (Exception from HRESULT: 0x80070490)
at Microsoft.VisualStudio.Tools.Office.Runtime.Interop.IHostItemProvider.GetHostExtender(String extenderType, String extenderCookie, IntPtr& extenderObject)
at Microsoft.VisualStudio.Tools.Office.Runtime.DomainCreator.ExecuteCustomization.Microsoft.Office.Tools.IHostItemProvider.GetHostExtender(Type primaryType, String primaryCookie)
at Microsoft.Office.Tools.Excel.ControlSiteImpl..ctor(IServiceProvider serviceProvider, IHostItemProvider hostItemProvider, String primaryCookie, String identifier, Object containerComponent, UInt32 officeVersion, Control control, _OLEObject extenderControl, Boolean isDynamic)
at Microsoft.Office.Tools.Excel.FactoryImpl.Microsoft.Office.Tools.Excel.Factory.CreateControlSite(IServiceProvider serviceProvider, IHostItemProvider hostItemProvider, String primaryCookie, String identifier, Object containerComponent, Control control)
at Microsoft.Office.Tools.Excel.Controls.Label..ctor(Factory factory, IHostItemProvider hostItemProvider, IServiceProvider serviceProvider, String cookie, String extenderCookie, Object container, String identifier)
at MyCustomization.Sheet1.InitializeControls()
at MyCustomization.Sheet1.Initialize()
at Microsoft.Office.Tools.Excel.WorksheetBase.Microsoft.Office.Tools.EntryPoint.Initialize()
at Microsoft.VisualStudio.Tools.Office.Runtime.DomainCreator.ExecuteCustomization.ExecutePhase(ExecutionPhases executionPhases)
at Microsoft.VisualStudio.Tools.Office.Runtime.DomainCreator.ExecuteCustomization.Microsoft.VisualStudio.Tools.Office.Runtime.Interop.IExecuteCustomization2.LoadEntryPoints(IntPtr serviceProvider)

问题:如何使新版本向后兼容使用旧版本保存的xlsm文件?

0 个答案:

没有答案