问题描述
嗨!
Hi!
我有一个带有datagrid的WPF应用程序,需要将此网格绑定到Excel。我发现一些文章说我需要创建.dll并将其添加为Excel加载项。然后,Excel将创建RTDServer的实例并与之通信。但它是另一个
的过程...我应该与WPF应用程序实现额外的通信。
I've a WPF application with datagrid and need to bind this grid to Excel. I found some articles which say that I need to create .dll and add it as Excel add-in. Then Excel will create an instance of the RTDServer and will communicate with it. But it's another process... And I should implement additional communication with WPF app.
我应该做些什么来使Excel与我的WPF应用程序通信(它正在启动.exe在另一个进程中)?换句话说,如何将RTDServer嵌入我的应用程序?
What I should to do to make Excel communicate with my WPF application (which is launching as .exe in another process)? In another words, how to embed RTDServer to my app?
也许WPF团队将来会为标准数据网格添加RTD支持?
Maybe WPF team will add RTD support to the standard datagrid in the future?
如果没有这样的机会,听到你使用现有功能(可能不是RTD)在WPF和Excel之间进行沟通的建议会很好。
If there is no such opportunity it will be good to hear your suggestions of communication between WPF and Excel using the existing features (can be not RTD).
非常感谢你!
推荐答案
>>我发现一些文章说我需要创建.dll并将其添加为Excel加载项。
你的意思是您想将数据从WPF同步到Excel吗?根据您的描述,您的Excel似乎用作数据库。
是用于自动化Microsoft Office应用程序,扩展应用程序的功能以及自定义应用程序的用户界面(UI)。我认为这对你的情况不起作用。
Do you mean you want to sync up data from WPF to Excel? Based on your description, it seems your Excel is used as a Database.Excel add-ins is used to automate Microsoft Office applications, extend features of the application, and customize the user interface (UI) of the application. I think it will not work for your situation.
基于您之前的线程,您使用哪种方式读取和写入数据?据我所知,没有Excel对象模型可以实时写入数据,它需要你调用该方法来写入数据。
您可以参考下面的链接,了解如何使用Excel对象模型自动化Excel。
#如何从Microsoft Visual C#.NET自动化Microsoft Excel
https://support.microsoft.com/en-us/kb/302084
最诚挚的问候,
爱德华
这篇关于WPF数据网格和实时数据(RTD)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!