问题
I want to create a UDF
which is like GetPath(parameter)
, where parameter can be a cell reference like "B1"
, or a string
what the GetPath
does, based on input, it will call web service to get path for input
e.g. formula of cell A1=GetPath(B1)
, cell B1
has some string, the function should return path and put it in cell A1, i.e. "Value2"
of A1 should be path of B1.
Now in C#, when I did sth FormulaCell.Value2 = path
, its formula changes, too
but I want "Formula" & "Value2" to be different.
I know this is possible in VBA, but I am using C#.
Anyone knows how to accomplish this?
thanks
I googled, googled and still not found a solution. This sounds like a basic feature but impossible in C#. at least that's what I got through research. I am sure some of you have encountered the same issue before, just wonder how you work it out?
I am going to try this in VB.NET if that works then I will reference it in C#. If anyone knows in VB.NET, pls also post. thanks
回答1:
My addin was COM AddIn which is not possible to have range.value2 different from range.formula no matter it is C# or VB.NET.
This can be done using VBA, Automation AddIn in .NET, or xll addin. For xll addin, you can either write in C/C++, or use existing tools like ExcelDNA, managedXLL, XLW, etc.
来源:https://stackoverflow.com/questions/6023012/can-range-value2-range-formula-have-different-values-in-c-not-vba