Skip to content

Commit e2c0681

Browse files
committed
Add problem function (with IsMacroType=true)
1 parent 1faf484 commit e2c0681

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

RtdArrayTest/TestFunctions.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,26 @@ public static object RtdArrayTest(string prefix)
2525
result[1, 0] = parts[1];
2626
return result;
2727
}
28+
29+
// NOTE: This is that problem case discussed in https://groups.google.com/d/topic/exceldna/62cgmRMVtfQ/discussion
30+
// It seems that the DisconnectData will not be called on updates triggered by parameters from the sheet
31+
// for RTD functions that are marked IsMacroType=true.
32+
[ExcelFunction(IsMacroType=true)]
33+
public static object RtdArrayTestMT(string prefix)
34+
{
35+
object rtdValue = XlCall.RTD("RtdArrayTest.TestRtdServer", null, "X" + prefix);
36+
37+
var resultString = rtdValue as string;
38+
if (resultString == null)
39+
return rtdValue;
40+
41+
// We have a string value, parse and return as an 2x1 array
42+
var parts = resultString.Split(';');
43+
Debug.Assert(parts.Length == 2);
44+
var result = new object[2, 1];
45+
result[0, 0] = parts[0];
46+
result[1, 0] = parts[1];
47+
return result;
48+
}
2849
}
2950
}

0 commit comments

Comments
 (0)