问题描述
我必须从C#程序中将数百个单元格输入到excel工作表中.每次我设置一个单元格或范围时,excel都会缓慢响应...大概是在我添加的每个输入之间更新各种输出.有没有一种方法可以禁用我的C#程序中的计算,并在设置完单元格并准备读取输出之后重新启用它?
I have to input several hundred cells into an excel sheet from a C# program. Each time I set a cell or a range, excel slowly responds... presumably updating various outputs between each input I add. Is there a way to disable calculations from my C# program, and re-enable it after I am done setting cells and ready to read the outputs?
推荐答案
是的,将Application.Calculation
设置为xlCalculationManual
,然后又返回到xlCalculationAutomatic
.
Yes, set the Application.Calculation
to xlCalculationManual
, then back to xlCalculationAutomatic
.
您还可以考虑将Application.ScreenUpdating
设置为false
,然后再返回到true
.
You can also consider setting Application.ScreenUpdating
to false
and then back to true
.
这篇关于在互操作C#中延迟excel计算的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!