Using ExcelAsyncUtil CalculationCanceled and CalculationEnded

124 views
Skip to first unread message

Vincent Bouret

unread,
Jan 28, 2015, 10:57:14 AM1/28/15
to exce...@googlegroups.com
Hello,

I have been using ExcelDNA for many years now with great success and stability. ExcelAsyncUtil.Run is simple to use and very useful for dispatching calculations made on a remote server.

A common case that happens however is that a user has let's say 1000 cells with a UDF formula based on a single Date cell which returns something different for all of them based on the date. The processing takes some relative time (remote server with heavy calculation). The performance is still very good, but sometimes the user makes a mistake on the Date cell, changes it fast, before the previous 1000 cells have been calculated, and it triggers a new recalculation of the 1000 cells.

I have recently upgraded to ExcelDNA 0.32 and I have seen the new ExcelAsyncUtil.CalculationCanceled and CalculationEnded events, as well as samples on how to use them and Task Delay something based on a CaclulationTokenSource.

I would like to know when these events will get triggered and if they might help me trap "expired" calculations since the calculation model has changed?

Kind regards,

Vincent





Govert van Drimmelen

unread,
Feb 1, 2015, 4:25:28 PM2/1/15
to exce...@googlegroups.com
Hi Vincent,

ExcelAsyncUtil.Run provides async support based on Excel's RTD feature, while the CalculationXXX events relate to the built-in Excel 2010 async support. These are very different mechanisms. 

I think it is possible to provide the kind of cancellation support for the RTD-base mechanism. 
You might want to look at the ExcelTaskUtil.cs sample file in the Distribution\Samples\Async folder of the full Excel-DNA distribution on CodePlex. It follows the Task-based API with cancellation support.

-Govert
Reply all
Reply to author
Forward
0 new messages