Creating objects with Excel-DNA

360 views
Skip to first unread message

insomniac

unread,
Aug 28, 2010, 6:18:28 AM8/28/10
to Excel-Dna
Hello Govert,

Well done on ExcelDNA, it's a beauty! Suppose I have a numerical
routine written in C#, and rather than pass a dozen parameters to the
necessary static methods, I want to pass objects that I create in the
worksheet and that contain all the necessary properties. Is this
possible?

Thanks.

Govert van Drimmelen

unread,
Aug 28, 2010, 5:27:00 PM8/28/10
to Excel-Dna
Hi,

There is currently no built-in support for object handles of this type
in Excel-Dna. There have been a few discussions about this in the
group - you might search for 'object handle' or 'object handler'.

It is not too hard to build a simple object system yourself - you make
an object store and have a scheme for managing handles which are
passed back and forth. Typically lifetime management becomes an issue
(how do you know when to delete an object?). With the recent addition
of RTD support in Excel-Dna, I think the right plumbing is now in
place to do object handles properly, since the Excel reliably notifies
the RTD server when a topic is no longer referenced. You might look
through the RTD-related messages that have been posted to the group, I
remember one RTD-based object example, though not quite doing what you
talk about.

Over the long term I expect something like this to find its way into
the Excel-Dna Runtime itself, but it is likely to follow having a good
user-level implementation tried out first.

Regards,
Govert

insomniac

unread,
Aug 29, 2010, 9:15:23 AM8/29/10
to Excel-Dna
Thank you, I did just that and some very useful information. Answes
all my questions!
Reply all
Reply to author
Forward
0 new messages