首页 > 解决方案 > 在 Excel 中发生缓慢计算时,如何让计算百分比显示在我的 WinForm 中?

问题描述

我有一个 WinForms 应用程序,它在后台执行一些 excel 工作。如随附的屏幕截图所示,Excel 显示了大型计算的计算完成百分比。

计算百分比

我希望能够访问此实时百分比以显示在我的表单上,如下所示:

...

// Method to update my status label on the form
UpdateStatus("Starting heavy calculation . . .");

// The heavy calculation I'm sending to Excel
Range rngEBOMTotals = sheetMathResults.Range["D2"];
rngEBOMTotals.Formula = "=SUMIF(PLM_EBOM!G:G,Results!A2,PLM_EBOM!O:O)";
sheetMathResults.Range["D2:D" + endRange.End(XlDirection.xlUp).Row].FillDown();

// I would like to access the Percentage complete from Excel and show it in my status label.
UpdateStatus( /* Code to get the percent complete */ );
...

这是可能的还是可行的?

是否有更简单的解决方案来获取我缺少的计算状态?

我的研究没有运气。

标签: c#excel

解决方案


推荐阅读