[ExcelDna] RTD and ExcelDNA

229 views
Skip to first unread message

Montgomery Panzram

unread,
May 3, 2010, 10:56:53 AM5/3/10
to ExcelDna
First off, I love ExcelDNA! It's the best thing since the wheel.

I have a little problem that I hope that someone here has an idea how
to solve. I've written a financial RTD that fetches data from an XML
file. When an instrument feature, eg price, is updated it outputs it
to Excel. Everything works superbly. However, I want to deploy it
without using the registry. I've used the GenMan32 to create the
manifest file, but it doesn't work on other computers. My guess is
that I must add a dependency tag to the Interop.Excel.dll. This,
however, is unmanaged so it doesn't work with the reference flag.

I rely heavily on Bloomberg, Reuter and other price feeds. The idea is
to create instrument objects in Excel through ExcelDNA which in turn
outputs a set of attributes to the XML file. It works splendidly on my
machine where it's registered.

I'm kind of new at this manifest stuff so a little help would be
greatly appreciated.

Is there a way to somehow create the RTD within the ExcelDNA?

Can I use Excel through System.Net and avoid the Interop.Excel.dll?

Is there another simple solution?

Am happy to share my results if anybody needs it.

Thanks.

--
You received this message because you are subscribed to the Google Groups "ExcelDna" group.
To post to this group, send email to exce...@googlegroups.com.
To unsubscribe from this group, send email to exceldna+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/exceldna?hl=en.

Govert van Drimmelen

unread,
May 3, 2010, 2:20:37 PM5/3/10
to ExcelDna
Hi,

I have started implementing registration-free Ribbon and RTD support
in ExcelDna. (Both use COM interfaces to load the add-in, so the
issues are similar.)
I think I have some of the tricky bits figured out, but it needs some
more attention before we can start testing. I'm also still figuring
out RTD and SxS manifests and Activation Contexts.

I'm not sure whether this would necessarily address your requirement,
but it does seems some support in ExcelDna can help make RTD servers
easier to use and implement.

If you would like to get involved with testing and designing how RTD
should be surfaced in ExcelDna, and it can be done on and off over the
next month or so, I'd be really grateful for the help - please get in
touch via e-mail.

Regards,
Govert




On May 3, 4:56 pm, Montgomery Panzram <montgomery.panz...@gmail.com>
wrote:

Brendan Fitzgerald

unread,
May 6, 2010, 8:29:28 AM5/6/10
to exce...@googlegroups.com
Hi Govert,

Let me know what you have planned, wrt ExcelDNA and RTD happy to help with
testing and input.

I currently have a compiled add-in (c#) which exposes several functions to
Excel via Excel DNA and also exposes the RTD functions.

It seems to register itself via the ExcelDna add-in load. But the big
drawback seems to be that the add-in will run in separate Appdomains for RTD
(default) and ExcelDNA, so it is not possible to "share" objects or data
between the RTD and Excel DNA functions without writing some sort of
interprocess interface. So maybe if there is some way to control the start
up of the .NET process and add-in, it will be possible to run a common
add-in in one process.

My 2c on using both is that RTD provides a fast lightweight notification
mechanism, but that one value return per set of RTD argument is limiting. So
ideally I would use the RTD call to request data and provide notification
updates. ExcelDNA could then be used to bring ranges or part ranges of data
cached in the add-in.

Regards
Brendan

sverrirs

unread,
May 7, 2010, 5:07:26 AM5/7/10
to ExcelDna
I had a similar problem when using ExcelDNA and RTD servers that both
needed to access/share a common resource. The problem being that it
depends on if you're creating a new sheet or opening an existing one
which AppDomain the RTD is loaded into (when opening an existing sheet
Excel loads the RTD into its DefaultDomain otherwise it ends up in
ExcelDna's)

It is possible to use remoting and either serialize your objects
between them or marshal them by ref. However this is slow and in many
cases not really a feasible option.

What I found worked best was to simply force the XLL to load the .NET
assemblies into the domain already created by Excel. The modifications
to the cpp code is rather straight forward and basically involves
removing all the custom appdomain creation logic from bool
XlLibraryInitialize(XlAddInExportInfo* pExportInfo) in
ExcelDnaLoader.cpp and replacing the:
hr = pHost->CreateDomainEx(appDomainName, pAppDomainSetupUnk, 0,
&pAppDomainUnk);
line with:
hr = pHost->GetDefaultDomain(&pAppDomainUnk);

However you also need to make a few "tweeks" in the C# code to make
sure that during assembly resolution (in the AssemblyManager.cs) you
explicitly set the current working path to the path of your XLL file
(assuming that all your assemblies reside in the same directory).

I'm running this modified version of the ExcelDna library and it is
working like a charm :)

Regards
Sverrir S.

Montgomery Panzram

unread,
May 8, 2010, 4:20:22 AM5/8/10
to ExcelDna
Hi all,

It sounds like you've solved alot of issues. The thing I would really,
really like is to have a RTD that will expose ExcelDNA data to Excel.
Correct me if I'm wrong, but isn't enough with 1 RTD with a Callback
function that ExcelDNA can call and send data to:

public void Callback(object state, object[,] data)
{
for (int i = 0; i < data.GetUpperBound(0); i++)
{
if (TopicList.ContainsValue(data[0, i]))
{
foreach (Topic x in TopicList)
{
if (x.Property == data[0, i])
{
x.PropertyValue = data[1, i];
}
}
}
}
IRTDServerThing.UpdateNotify(); // push the notify to
Excel
}

Then you could just call the callback function from anywhere in
ExcelDNA and it will update Excel with whatever data you want and when
you want it. It seems to me like you've already done the hard bits -
get ExcelDNA and RTD talking. Is there an easy way to get this
working?

It's not the nicest solution since you'ld have to call
=RTD("ExcelDNA.RTD","","MyObject","MyProperty") from Excel, but at
least it's real-time.

Regards

Brendan Fitzgerald

unread,
May 9, 2010, 3:51:37 PM5/9/10
to exce...@googlegroups.com
Thanks - this looks like a nice clean way to share objects between Excel
DNA and RTD - will give it a try.
Reply all
Reply to author
Forward
0 new messages