简体   繁体   English

在Excel中使用剪贴板复制粘贴(VSTO代码)会冻结其他Microsoft Office应用程序

[英]Using Clipboard Copy Paste in Excel (VSTO code) freezes other Microsoft Office application

Operating System : Microsoft Windows SP1 (64 bit) 操作系统:Microsoft Windows SP1(64位)

Office Suite : Microsoft Office 2010 Office套件:Microsoft Office 2010

.Net Framework : 4.0 .Net Framework:4.0

Subject : Microsoft suites of applications (Word, Outlook) does not respond for the time slice when a excel plugin code is running 主题:运行Excel插件代码时,Microsoft应用程序套件(Word,Outlook)在该时间段内无响应

Details : We have written VSTO (in C#) based add-in for excel application. 详细信息:我们已经为excel应用程序编写了基于VSTO(用C#语言编写)的加载项。 This add-in is used for refreshing data in current sheet. 此加载项用于刷新当前工作表中的数据。

Following steps of events occurs on click of a "Refresh" button 单击“刷新”按钮会发生以下事件步骤

•A call is made to internal web service by passing some metadata to download a file •通过传递一些元数据来下载文件来对内部Web服务进行调用

•File is downloaded and stored on windows Temp folder. •文件已下载并存储在Windows Temp文件夹中。

•A VSTO code is executed to copy data from downloaded sheet to current sheet using Clipboard Copy / Paste. •执行VSTO代码,以使用剪贴板复制/粘贴将数据从下载的工作表复制到当前工作表。 Data is copied row by row. 数据逐行复制。

At any point in time, we'll have one row of data in Clipboard. 在任何时间点,剪贴板中都会有一行数据。 Also the number of rows and columns varies between request. 此外,行和列的数量在请求之间有所不同。

Issue: While refresh functionality is working as expected, we are experiencing issue with other Office suites applications (Word, Outlook). 问题:当刷新功能按预期工作时,我们在其他Office套件应用程序(Word,Outlook)中遇到问题。

For the time slice refresh is running, all Office suites of application stops responding. 对于正在运行的时间片刷新,所有Office应用程序套件都停止响应。

Can some one help with this issue? 有人可以帮助解决这个问题吗?

I think you can not control other office suites application. 我认为您无法控制其他Office Suite应用程序。 But what you can do is, try to decrease the time slice for refresh button By using different concept like 但是您可以做的是,尝试通过使用不同的概念来减少刷新按钮的时间片

•A call is made to internal web service by passing some metadata to download a file •通过传递一些元数据来下载文件来对内部Web服务进行调用

•File is downloaded and stored on windows Temp folder. •文件已下载并存储在Windows Temp文件夹中。

I don't know for above two point whether you have used separate thread for that or not? 对于以上两点,我不知道您是否为此使用了单独的线程? If not use separate thread for that. 如果没有使用单独的线程。

You can also use some Optimization trick while copy pasting data from one sheet to another. 将粘贴数据从一张纸复制到另一张纸时,也可以使用一些优化技巧。

Here are some tricks to optimize vba / vsto code 这是一些优化VBA / VSTO代码的技巧

http://tchhabhaiya.blogspot.in/2012/06/17-ways-to-optimize-vba-code-for-faster.html http://tchhabhaiya.blogspot.in/2012/06/17-ways-to-optimize-vba-code-for-faster.html

I think below code will help a lot to you if you haven't used this. 我认为以下代码对您有很大帮助,如果您还没有使用过的话。

Application.ScreenUpdating = False //To Turn Off at the start of code.
Application.ScreenUpdating = True //To Turn on at the end of the code.

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用剪贴板复制对象并将其粘贴为对象或文本 - Copy object using Clipboard and paste it as object or text VSTO Excel粘贴失败 - VSTO excel paste failed 使用XMLSpreadsheet从Excel粘贴到剪贴板 - Paste from Excel to clipboard using XMLSpreadsheet Office Excel VSTO工作簿项目Application.ThisWorkbook COMException - Office Excel VSTO Workbook Project Application.ThisWorkbook COMException 如何从任何Windows应用程序(第二个剪贴板)复制和粘贴文本 - How to copy and paste text from any windows application (second clipboard) 我的c#应用程序的发行版在其他计算机“ Microsoft Office Interop Excel”上不起作用 - Release of my c# application doesn't work on other machines “Microsoft office Interop Excel” 将图像保存在剪贴板上,并可以粘贴到其他应用程序上的textview - Save image on Clipboard, and can paste to textview on other application 应用程序使用 Microsoft.Office.Interop.Excel 打开 Excel 文件与服务器上的 RDP 会话冲突 - Application using Microsoft.Office.Interop.Excel to open excel file conflict with RDP sessions on the server 使用C#进行Windows 7剪贴板复制粘贴操作 - Windows 7 clipboard copy paste operation using C# C# 使用 Microsoft.Office.Interop.Excel 添加新的 SERIES 与其他工作表的范围 - C# using Microsoft.Office.Interop.Excel Add new SERIES With range from other WorkSheet
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM