简体   繁体   中英

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. it gets 200% speed and increased the speed while updating the excel rows. but, still it is slow while updating 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. See How Excel determines the current mode of calculation for more information.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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