如何在C#中没有Interop方法检索VBProject属性? [英] How to retrieve VBProject properties without Interop methodology in C#?

查看:140
本文介绍了如何在C#中没有Interop方法检索VBProject属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我创建了winform应用程序 - 从桌面检索活动的Excel应用程序详细信息。目前我使用Microsoft.Office.Interop.Excel获取所有excel文件属性。



我正在寻找方法来检索所有excel文件属性而不使用Interop。



我已经通过这么多博客进行了分析,我尝试通过后期绑定方法来获取excel文件属性。在这种方法中我无法获得以下值宏名称,宏属性,内置属性。



请指导我,如果有任何方法可以帮助我获取所有excel文件属性。



谢谢,



Meenakshi K

Hi,

I have created winform application - to retrieve active excel application details fro desktop. Currently i am using Microsoft.Office.Interop.Excel to get all excel file properties.

I am looking for methodology to retrieve all excel file properties without using Interop.

I have analyzed through so many blogs and I have tried through "Late binding" approach to get excel file properties.In this approach I am unable to get following values "Macro Names","Macro properties","Built-in properties" .

Kindly guide me , If any approach which helps me to get all excel file properties.

Thanks,

Meenakshi K

推荐答案

如果用VBProject表示VB.NET项目,则没有任何与interop相关的内容。如果您指的是生成的程序集的属性,则也没有任何与interop相关的内容,因为程序集是受管理的。你提到的所有术语后期绑定,宏也完全无关紧要。



唯一与互操作相关的是Office互操作,你可以通过Microsoft Office Interop使用Office应用程序(非托管应用程序)。但是,如果要读取或写入某些Excel文件,也不需要使用它。相反,您可以使用Microsoft Open XML SDK。请参阅本文中引用的过去的答案:如何从MS Visual中添加参考添加microsoft excel 15.0对象库Studio 2010 [ ^ ] 。



另请参阅此CodeProject文章:使用Open XML创建基本的Excel工作簿 [ ^ ]。



-SA
If by "VBProject" you mean VB.NET project, there is nothing related to "interop". If you mean the properties of the resulting assembly, there is also nothing related to "interop", because the assembly is managed. And all the terms you mentioned "late binding", "macro" are also totally irrelevant.

The only thing related to "interop" is Office interop, as you can use Office applications (unmanaged ones) through Microsoft Office Interop. But you also don't need to use it, if you want to read or write some Excel files. Instead, you can use Microsoft Open XML SDK. Please see my past answers referenced in this one: How to add microsoft excel 15.0 object library from Add Reference in MS Visual Studio 2010[^].

See also this CodeProject article: Creating basic Excel workbook with Open XML[^].

—SA


这篇关于如何在C#中没有Interop方法检索VBProject属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆