| using System.Collections.Generic; | |
| namespace AppsheetEpplus; | |
| public class IsErr : ErrorHandlingFunction { | |
| public override CompileResult Execute( | |
| IEnumerable<FunctionArgument> arguments, | |
| ParsingContext context) { | |
| var isError = new IsError(); | |
| var result = isError.Execute(arguments, context); | |
| if ((bool)result.Result) { | |
| var arg = GetFirstValue(arguments); | |
| if (arg is ExcelDataProvider.IRangeInfo info) { | |
| var e = info.GetValue(info.Address._fromRow, info.Address._fromCol) as ExcelErrorValue; | |
| if (e != null && e.Type == eErrorType.Na) { | |
| return CreateResult(false, DataType.Boolean); | |
| } | |
| } else { | |
| if (arg is ExcelErrorValue value && value.Type == eErrorType.Na) { | |
| return CreateResult(false, DataType.Boolean); | |
| } | |
| } | |
| } | |
| return result; | |
| } | |
| public override CompileResult HandleError(string errorCode) { | |
| return CreateResult(true, DataType.Boolean); | |
| } | |
| } |