简体   繁体   中英

When I use xlApp.CutCopyMode in my timer my application does not close. Why does this happen?

I am working on an excel plugin. I am checking if the user is copying anything in excel then the plugin will not run Worksheet.calculate method.

My code is:

 if (xlApp.CutCopyMode == 0)
 {
     _activeSheet.Calculate();
 }

This code is running inside a timer. When I close excel there is some memory leak. Excel still runs in the background. If I comment 'if (xlApp.CutCopyMode == 0)' then everything works fine. Can anyone explain why does excel has this behavior?

Thanks in advance.

I found the solution. We need to check it in UI thread throw Dispatcher.

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