简体   繁体   English

Excel插件和Excel Interopt

[英]Excel Addin and Excel Interopt

Ok I am creating an Excel Addin almost like the one from TFS It retrieves information Then when changes needs to be saved. 好的,我几乎像从TFS中创建一个Excel加载项一样。它检索信息,然后需要保存更改时。

I succeeded in all of that but I have a flickering Issue with excel. 我在所有这些方面都取得了成功,但是我遇到了一个excel闪烁的问题。 As it loads the information from the server and then writes to cells in excel its like the mouse is flickering and each row is filled cell by cell very very slowly 当它从服务器加载信息,然后将其写入excel中的单元格时,就像鼠标在闪烁一样,每行非常缓慢地逐格填充单元格

But with TFS when you retrieve all tasks it is like one shot and its there in excel, no flickering. 但是,使用TFS检索所有任务时,就像一枪,而且在excel中没有闪烁。

How can this be achieved ? 如何实现呢?

Here is how I add the data into Excel 这是我将数据添加到Excel中的方法

//Get the table (Index never changes and the addin checks an "VeryHiden" Contentsheet for compatibility)
var tableRetainer = _workingsheet.ListObjects[2];
for(var rowRetainer = 1; rowRetainer++;
{
 //get the specific devision from the List<Dictionary<string,object>>
 rangeRetainer[rowRetainer, 1].Value2 = devision["FeeAgreementID"];
 rangeRetainer[rowRetainer, 2].Value2 = devision["Task"];
 rangeRetainer[rowRetainer, 3].Value2 = devision["Tariff"];
 rangeRetainer[rowRetainer, 4].Value2 = devision["Quantity"];
}

Do you write to each cell individually? 您是否分别写每个单元格? If yes, try optimizing by pasting large ranges at once. 如果是,请尝试一次粘贴较大范围进行优化。 Anyway, you should try to make as few calls through Interop boundary as possible. 无论如何,您应该尝试通过Interop边界进行尽可能少的呼叫。

Plus you might consider alternatives like writing via ACE OleDB if you don't care about formatting. 另外,如果您不关心格式设置,那么您可能会考虑通过ACE OleDB编写等替代方法。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM