WPF 应用程序在单独线程上从 Excel 读取的性能较差
我的项目中有一些代码使用 Excel COM API 读取和写入 Excel 2003。现在这段代码是从两个地方调用的:
1. 从 Excel 加载项本身内部,在同一线程上。
2. 从 WPF 应用程序中,在单独的线程上调用 WPF 窗口。
问题是,当 WPF 应用程序调用代码时,从 Excel 读取的正常操作本应花费 10 秒,但现在却花费了 2 分钟。我认为这是因为来自新线程的调用,但我不能 100% 确定。
有什么想法吗?
I have some code in my project that reads from and writes into Excel 2003 using Excel COM API. Now this piece of code is called from two places:
1. From within the Excel add-in itself, on the same thread.
2. From a WPF application, where the WPF window was invoked on a separate thread.
The issue is, when the WPF application invokes the code, the normal operation of reading from Excel that should take 10 seconds is taking 2 minutes. I think it is because of the invocation from a new thread, but I'm not 100% sure.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要考虑很多事情:
抱歉,这不是直接答案,但它提供了一些值得探索的要点。
You have a number of things to consider:
Sorry this isn't a direct answer, but it gives some points to explore.