使用 C# 创建 Excel 加载项应用程序
我想创建一个 Excel 加载项。但我希望它有一种特殊的行为。
那么问题是我开发的 Excel 插件保留在 Excel 中。即使我从 Windows 运行普通的 Excel 实例...
所以,更准确地说,我想要的是添加一个 Excel,它仅在由我自己的 C#_made 应用程序启动时才会出现在 Excel 的功能区中。
我该怎么做呢?
行为将是:
- 运行我的 C# 应用程序
- 我的 C# 应用程序调用新的 Excel 实例
- 我的 C# 应用程序将新选项卡(及其元素)添加到此 Excel 实例的功能区
- 我的 C# 应用程序添加绑定到选项卡元素的操作
- Excel 实例正在执行关闭>删除所有添加的组件、函数、方法...
- 关闭我的 C# 应用程序
I'd like to create an Excel Add In. But I want it to have a special behavior.
Then problem is that the Excel Add In I developed stays within Excel. Even when I run a normal Excel instance from Windows...
So what I want, to be more precise, is to have an Excel add in that will only appear in the Excel's ribbon when launched by my own C#_made application.
How should I do that ?
The behavior would be :
- Run my C# application
- My C# application calls a new Excel's instance
- My C# application adds a new tab (and its elements) to the ribbon of this Excel's instance
- My C# application adds actions binded to the tab's elements
- Excel's instance is being closed > Remove all added components, functions, methods, ...
- Close my C# appliclation
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是一个很好的教程:http://www. add-in-express.com/free-addins/net-excel-addin.php
编辑:
您是否考虑过禁用插件,然后在使用在后台运行的服务器启动应用程序时重新启用它当 excel 关闭时,禁用插件?
这是我 发现的一些卸载代码这里:
Here's a nice tutorial for you: http://www.add-in-express.com/free-addins/net-excel-addin.php
Edit:
Have you considered just disabling the addin, then reenabling it whenever you launch the app with a server that runs in the background and when excel is closed, disables the addin?
Here's some unload code I found here:
我在
Microsoft.Office.Interop.Excel.Application
类上找到了以下两个属性:也许这些可以帮助您在应用程序运行期间以编程方式添加/删除加载项?
I have found the following two properties on the
Microsoft.Office.Interop.Excel.Application
class:Maybe these can help you programmatically add/remove addins during your application run?