Skip to content

Commit b94a0b3

Browse files
committed
Added an object handle example with [ExcelHandle] class attribute.
1 parent f53e733 commit b94a0b3

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

docs/guides-basic/dotnet-native-aot-support.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,42 @@ public static double NativeCalcSum([ExcelHandle] Calc c)
483483
| A1 | =NativeCreateCalc(1.2, 3.4) | NativeCreateCalc:1
484484
| A2 | =NativeCalcSum(A1) | 4.6
485485

486+
```csharp
487+
[ExcelHandle]
488+
public class CalcExcelHandle
489+
{
490+
private double d1, d2;
491+
492+
public CalcExcelHandle(double d1, double d2)
493+
{
494+
this.d1 = d1;
495+
this.d2 = d2;
496+
}
497+
498+
public double Mul()
499+
{
500+
return d1 * d2;
501+
}
502+
}
503+
504+
[ExcelFunction]
505+
public static CalcExcelHandle NativeCreateCalcExcelHandle(double d1, double d2)
506+
{
507+
return new CalcExcelHandle(d1, d2);
508+
}
509+
510+
[ExcelFunction]
511+
public static double NativeCalcExcelHandleMul(CalcExcelHandle c)
512+
{
513+
return c.Mul();
514+
}
515+
```
516+
517+
| Cell | Formula | Result
518+
| ----- | ---------------------------------------| ------
519+
| A1 | =NativeCreateCalcExcelHandle(1.4, 0.5) | NativeCreateCalcExcelHandle:1
520+
| A2 | =NativeCalcExcelHandleMul(A1) | 0.7
521+
486522
# Not supported functionality in native add-ins
487523

488524
Loading images for ribbon controls.

0 commit comments

Comments
 (0)