[英]Microsoft.office.interop.excel is very slow while updating the PageSetup
Earlier I had a same issue(slow), while updating the data into excel Rows, that time i used appl.screenupdating =false.早些时候我遇到了同样的问题(慢),在将数据更新到 excel 行时,我使用了 appl.screenupdating = false。 it gets 200% speed and increased the speed while updating the excel rows.
它在更新 excel 行时获得 200% 的速度并提高了速度。 but, still it is slow while updating PageSetup.
但是,更新 PageSetup 时仍然很慢。 Here is my code, could you please help me on this.
这是我的代码,你能帮我吗?
ExcelApp.ScreenUpdating = false;
sheettExcel.PageSetup.LeftFooter = "Test";
ExcelApp.ScreenUpdating = true;
If you really want to optimize your code you need:如果你真的想优化你的代码,你需要:
Application.ScreenUpdating = False
Application.EnableEvents = False
Application.Calculation = xlCalculateManual
[YOUR CODE HERE]
Application.Calculation = xlAutomatic
Application.ScreenUpdating = True
Application.EnableEvents = True
The Application.Calculation property allows setting an XlCalculation
value that represents the calculation mode. Application.Calculation属性允许设置表示计算模式的
XlCalculation
值。 See How Excel determines the current mode of calculation for more information.有关详细信息,请参阅Excel 如何确定当前计算模式。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.