揭露.NET方法为Excel函数? [英] Exposing .net methods as Excel functions?
问题描述
我有一组计算方法坐在一个.net DLL。我想提出这些方法可到Excel(2003+)的用户,使他们能够利用他们在US preadsheets。
I have a set of calculation methods sitting in a .Net DLL. I would like to make those methods available to Excel (2003+) users so they can use them in their spreadsheets.
例如,我的.NET方法:
For example, my .net method:
public double CalculateSomethingReallyComplex(double a, double b) {...}
我想使他们只需键入一个公式中的随机电池调用这个方法:
I would like enable them to call this method just by typing a formula in a random cell:
=CalculateSomethingReallyComplex(A1, B1)
什么是实现这一目标的最佳方式是什么?
What would be the best way to accomplish this?
推荐答案
有两种方法 - 您可以使用Visual Studio工具用于Office(VSTO):
There are two methods - you can used Visual Studio Tools for Office (VSTO):
http://blogs.msdn.com/pstubbs/存档/ 2004/12/31 / 344964.aspx
也可以使用COM:
http://blogs.msdn.com/eric_carter/存档/ 2004/12/01 / 273127.aspx
我不知道,如果VSTO方法将工作在旧版本的Excel,但COM方法应该很好地工作。
I'm not sure if the VSTO method would work in older versions of Excel, but the COM method should work fine.
这篇关于揭露.NET方法为Excel函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!