简体   繁体   English

Office 2003:无法找到Microsoft.Office.Interop.Powerpoint dll

[英]Office 2003: Unable to find Microsoft.Office.Interop.Powerpoint dll

I have created a windows application which makes use of Office.dll and PowerPoint dlls of Microsoft office 2003. At design time, when I am adding reference to these dlls to my project it refers following path: 我创建了一个Windows应用程序,该应用程序使用Microsoft Office 2003的Office.dllPowerPoint dll。在设计时,当我将对这些dll的引用添加到我的项目中时,它引用以下路径:

C:\\WINDOWS\\assembly\\GAC\\Microsoft.Office.Interop.PowerPoint\\

The application runs perfect on the machine where it is developed, but when I am trying to run it on other machine it fails. 该应用程序可以在开发它的机器上完美运行,但是当我尝试在其他机器上运行它时却失败了。 The exception it is throwing is: 它抛出的异常是:

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. System.Reflection.TargetInvocationException:调用的目标引发了异常。 ---> System.IO.FileNotFoundException -> System.IO.FileNotFoundException

I tried to locate the above path on my test machine, but I am surprised that, though office 2003 and 2007 is installed (2 different machines), this folder is not present over there. 我试图在测试计算机上找到上述路径,但是令我感到惊讶的是,尽管安装了Office 2003和2007(两台不同的计算机),但该文件夹不存在。

Can anybody help me resolving this issue? 有人可以帮我解决这个问题吗?

1.There is an Office 2003 Primary Interop Assemblies (PIA) redistributable is a Microsoft Windows Installer package that contains the Primary Interop Assemblies for Microsoft Office 2003 products you can get it from here it includes an assembly you need 1.有一个可重新分发的Office 2003主互操作程序集(PIA)是Microsoft Windows Installer程序包,其中包含Microsoft Office 2003产品的主互操作程序集,您可以从此处获取它,其中包括所需的程序集

2.You can set true to the "Copy Local" key for this assembly in your project references properties, in this case it would be copied into the output folder of your project 2.您可以在项目引用属性中将该程序集的“复制本地”键设置为true,在这种情况下,它将被复制到项目的输出文件夹中

3.You don't really need it to work with MS Office applications, though it makes it easier. 3,尽管它使它变得更容易,但实际上并不需要它与MS Office应用程序一起使用。 Below is an example of how you can open a presentation without interop classes 以下是如何在没有互操作类的情况下打开演示文稿的示例

Type officeType = Type.GetTypeFromProgID("PowerPoint.Application");
object officeInstance = Activator.CreateInstance(officeType);
// set visible
object value = -1;
officeType.InvokeMember("Visible", BindingFlags.SetProperty, null, officeInstance, new object[] { value });
// open presenation
object objTrue = -1;
object objFalse = 0;
object fileNameObj = presentation_file_name;
object documents = officeType.InvokeMember("Presentations", BindingFlags.GetProperty, null, officeInstance, null);
documents.GetType().InvokeMember("Open", BindingFlags.InvokeMethod, null, documents, new object[] { fileNameObj, objTrue, objFalse, objTrue });

didn't test this exact one, but smth like this works fine for me, regards 没有测试这个确切的东西,但是像这样的东西对我来说很好

The interop dll you are looking for is installled on your deevelopment machine in the GAC. 您要查找的interop dll已安装在GAC中的开发计算机上。 As such it is not a part of the standard deployment. 因此,它不是标准部署的一部分。 You need to copy it over by hand. 您需要手工复制它。

Another option (and may be a cleaner one) would be to run the Office installation on the target machine and let it install all what's necessary. 另一种选择(可能更清洁)是在目标计算机上运行Office安装,并让其安装所有必需的东西。 Just make sure that you selected proper options 只要确保您选择了正确的选项

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

相关问题 Office 2003互操作仅安装了Office 2010 - Office 2003 interop with only Office 2010 installed 在哪里可以找到 Microsoft.Office.Interop.Word.dll (2010)? - Where can I find Microsoft.Office.Interop.Word.dll (2010)? TeamCity不复制Microsoft.Office.Interop.Excel.dll - TeamCity not copying Microsoft.Office.Interop.Excel.dll 无法加载文件或程序集Microsoft.Office.Interop.Excel.dll - Could not load file or assembly Microsoft.Office.Interop.Excel.dll 将Microsoft.Office.Interop.Excel.dll捆绑为无法正常工作的资源 - Bundling Microsoft.Office.Interop.Excel.dll as a resource not working Microsoft.Office.Interop.Excel COM Dll的用法 - Microsoft.Office.Interop.Excel COM Dll usage ClickOnce 应用程序突然下载失败 dll (Interop.Microsoft.Office.Interop.Word.dll) - ClickOnce application suddenly fails on download dll (Interop.Microsoft.Office.Interop.Word.dll) (C# / VB.NET) Microsoft.Office.Interop.PowerPoint.Shape.AddComment - 当“Microsoft Office”版本高于 2010 时出现“NotImplementedException” - (C# / VB.NET) Microsoft.Office.Interop.PowerPoint.Shape.AddComment - "NotImplementedException" when "Microsoft Office"-Version is newer than 2010 Microsoft.Office.Interop.Outlook - Microsoft.Office.Interop.Outlook 我是否需要安装办公室才能使用Microsoft.Office.Interop.Excel.dll - Do i need to have office installed to use Microsoft.Office.Interop.Excel.dll
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM