无法调用方法:GetVstoObject
。
我已经创建了一个 Word2007 文档项目,并且尝试通过 GetVSTOObject 方法检索页面上的内容控件,但在引用 Microsoft.Office.Tools.Word.Extensions 库后,它找不到 Microsoft.Office.Tools.Word.Extensions 库 按照 MSDN 站点上的建议,使用 Office.Tools.Word.v9.dll。
我将非常感谢任何帮助。
以下是错误消息:
“Microsoft.Office.Interop.Word.Document”不包含“GetVstoObject”的定义,并且没有扩展方法“GetVstoObject”接受类型为“Microsoft.Office.Interop.Word.Document”的第一个参数可以找到(您是否缺少 using 指令或程序集引用?)
All, Cannot
I have created a Word2007 Document Project and I'm trying to retrieve the content controls on the page via the GetVSTOObject method but it can not find the Microsoft.Office.Tools.Word.Extensions library after I have referenced the Microsoft.Office.Tools.Word.v9.dll as suggested on the MSDN site.
I would greatly appreciate any help.
Below is the error message:
'Microsoft.Office.Interop.Word.Document' does not contain a definition for 'GetVstoObject' and no extension method 'GetVstoObject' accepting a first argument of type 'Microsoft.Office.Interop.Word.Document' could be found (are you missing a using directive or an assembly reference?)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
确保为扩展命名空间添加 using 语句:
如果您已经这样做了,您可以分享您尝试使用扩展方法的代码吗?
编辑:
正如您在图像中看到的,您使用的是 Visual Studio 2008 RTM(发布到制造)版本,并且尚未安装 Visual Studio SP1。右侧提到的 SP1 适用于 .NET Framework。
关于 Visual Studio 对话框 http://img337.imageshack.us/img337/9041/vs2008sp1 .png
尝试安装 Visual Studio SP1。您可以从此处下载它。
Make sure that you add a using statement for the extensions namespace:
If you already did this, can you share the code where you are trying to use the extension method?
Edit:
As you can see in the image you're using Visual Studio 2008 RTM (Release To Manufacturing) version and you have not installed the Visual Studio SP1. The SP1 mentioned in the right is for the .NET Framework.
About Dialog for Visual Studio http://img337.imageshack.us/img337/9041/vs2008sp1.png
Try installing the SP1 for Visual Studio. You can download it from here.