In that article, We need to use IDE to write C# program.
On ther other hand, Excel-DNA give us easier way to create XLL.
Let me show you one example.
In last post, I downloaded two libraries.
If you don't download these files yet, please do it.
And, put the files which I showed below together into some folder.
I changed the file name of ExcelDna.xll and ExcelDna.dna to SimpleExample.xll and SimpleExample.dna.
It is no problem for you to change these names as you like.
Next, Please copy and paste below codes to SimpleExample.dna by notepad or such a editor and save & close dna file.
If you use or install another version R, modify "SetDllDirectory" function call.
Lanch SimpleExample.xll and create new Excel sheet. As you'll see below, you can use your own function defined in C# language !
Enjoy !
*R.NET seems to be compiled with .NET framework 4.0. you may have to install these to try this example.
0 件のコメント:
コメントを投稿