Line | |
---|
1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Linq;
|
---|
4 | using System.Text;
|
---|
5 | using OfficeOpenXml.FormulaParsing.ExpressionGraph;
|
---|
6 | using OfficeOpenXml.Utils;
|
---|
7 |
|
---|
8 | namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Information
|
---|
9 | {
|
---|
10 | public class IsEven : ExcelFunction
|
---|
11 | {
|
---|
12 | public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
|
---|
13 | {
|
---|
14 | ValidateArguments(arguments, 1);
|
---|
15 | var arg1 = GetFirstValue(arguments);//arguments.ElementAt(0);
|
---|
16 | if (!ConvertUtil.IsNumeric(arg1))
|
---|
17 | {
|
---|
18 | ThrowExcelErrorValueException(eErrorType.Value);
|
---|
19 | }
|
---|
20 | var number = (int)System.Math.Floor(ConvertUtil.GetValueDouble(arg1));
|
---|
21 | return CreateResult(number % 2 == 0, DataType.Boolean);
|
---|
22 | }
|
---|
23 | }
|
---|
24 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.