File tree Expand file tree Collapse file tree 1 file changed +46
-0
lines changed Expand file tree Collapse file tree 1 file changed +46
-0
lines changed Original file line number Diff line number Diff line change @@ -540,6 +540,52 @@ public static string? NativeGetAssemblyName(System.Reflection.Assembly assembly)
540540| A1 | =NativeGetExecutingAssembly() | NativeGetExecutingAssembly:1
541541| A2 | =NativeGetAssemblyName(A1) | ExcelDna.AddIn.RuntimeTestsAOT64
542542
543+ # User defined parameter and return value conversions
544+
545+ ``` csharp
546+ public class TestType1
547+ {
548+ public string Value ;
549+
550+ public TestType1 (string value )
551+ {
552+ Value = value ;
553+ }
554+ }
555+
556+ public class Conversions
557+ {
558+ [ExcelParameterConversion ]
559+ public static Version ToVersion (string s )
560+ {
561+ return new Version (s );
562+ }
563+
564+ [ExcelReturnConversion ]
565+ public static string FromTestType1 (TestType1 value )
566+ {
567+ return value .Value ;
568+ }
569+ }
570+
571+ [ExcelFunction ]
572+ public static string NativeVersion2 (Version v )
573+ {
574+ return " The Native Version value with field count 2 is " + v .ToString (2 );
575+ }
576+
577+ [ExcelFunction ]
578+ public static TestType1 NativeReturnTestType1 (string s )
579+ {
580+ return new TestType1 (" The Native TestType1 return value is " + s );
581+ }
582+ ```
583+
584+ | Cell | Formula | Result
585+ | ----- | ----------------------------------| ------
586+ | A1 | =NativeVersion2("4.3.2.1") | The Native Version value with field count 2 is 4.3
587+ | A2 | =NativeReturnTestType1("world") | The Native TestType1 return value is world
588+
543589# Not supported functionality in native add-ins
544590
545591Loading images for ribbon controls.
You can’t perform that action at this time.
0 commit comments