Following on from yesterday’s post on developing a simple RTD COM server, today’s post will show how to do the equivalent in Excel-DNA.
The first task is to download Excel-Dna – I am using version 0.29. Next we copy ExcelDna.xll (or ExcelDna64.xll if developing against 64bit) to a suitable location (I have a release directory), and rename it to something suitable. Next create a text file and give it the same name (and with .dna suffix) as you have done for ExcelDna.dll – see highlighted files below.

We then create a static class (this is where the magic happens) that will be the interface between our sheet and code. We also need to add a reference to ExcelDna.Integration
Below you can see the code – note that we are passing our ICDSQuote identifiers as discussed yesterday – this call will be passed through to ConnectData. “ExcelDNA.RealtimeCreditDataDNA” is the progID of our RTD class

You will recall from yesterday that we had to add Guid, ProgID, and ComVisible attributes to the RTD code – this is no longer required. The IRTDServer is now referencing ExcelDna.Integration.Rtd.

Excel-DNA differs in that we don’t need to Register for COM Interop when debugging,

and don’t need to Register with Regasm (this can be a big bonus if the end machines have limited registry permissions), meaning that we don’t need register/unregister functions (shown below)

Top deploy, all we need to do is copy the xll, the dna file, and the dll, or if we want to combine to one file, we can use ExcelDnaPack.exe – this can be used to merge the dll files into the xll (simple dna file shown below – note we have to specify runtime version if we are using 4.0, and use Pack=true to include a dll (case sensitive)).

The way we use the C# RTD server differs as well.
For the COM server, we add as an Automation server

whereas for Excel-DNA we add via the add-ins

You will recall the SubscribeToCDS method mentioned earlier - to call from Excel, we call as though it were a conventional function rather than a call to RTD

After implementing, we can see that both our implementations match with BBG
