mirror of https://github.com/apache/poi.git
Added implementation for ISNA()
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@786696 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
4f3bb9841e
commit
5766414a69
|
@ -33,6 +33,7 @@
|
|||
|
||||
<changes>
|
||||
<release version="3.5-beta7" date="2009-??-??">
|
||||
<action dev="POI-DEVELOPERS" type="add">Added implementation for ISNA()</action>
|
||||
<action dev="POI-DEVELOPERS" type="add">46793 - fixed SimpleShape#getLineWidth to handle default line width </action>
|
||||
<action dev="POI-DEVELOPERS" type="add">47356 - removed unused private fields in HWPF BorderCode</action>
|
||||
<action dev="POI-DEVELOPERS" type="add">47355 - Improved HWPF TableCell to expose TableCellDescriptor</action>
|
||||
|
|
|
@ -26,7 +26,6 @@ import org.apache.poi.hssf.record.formula.functions.*;
|
|||
|
||||
/**
|
||||
* @author Amol S. Deshmukh < amolweb at ya hoo dot com >
|
||||
*
|
||||
*/
|
||||
public abstract class FunctionEval implements OperationEval {
|
||||
/**
|
||||
|
@ -79,6 +78,7 @@ public abstract class FunctionEval implements OperationEval {
|
|||
|
||||
retval[0] = new Count();
|
||||
retval[1] = new If();
|
||||
retval[2] = new IsNa();
|
||||
|
||||
retval[3] = new IsError();
|
||||
retval[ID.SUM] = AggregateFunction.SUM;
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
/* ====================================================================
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
==================================================================== */
|
||||
|
||||
package org.apache.poi.hssf.record.formula.functions;
|
||||
|
||||
import org.apache.poi.hssf.record.formula.eval.BoolEval;
|
||||
import org.apache.poi.hssf.record.formula.eval.ErrorEval;
|
||||
import org.apache.poi.hssf.record.formula.eval.Eval;
|
||||
import org.apache.poi.hssf.record.formula.eval.EvaluationException;
|
||||
import org.apache.poi.hssf.record.formula.eval.OperandResolver;
|
||||
import org.apache.poi.ss.usermodel.ErrorConstants;
|
||||
|
||||
/**
|
||||
* Implementation for Excel ISNA() function.<p/>
|
||||
*
|
||||
* <b>Syntax</b>:<br/>
|
||||
* <b>ISNA</b>(<b>value</b>)<p/>
|
||||
*
|
||||
* <b>value</b> The value to be tested<br/>
|
||||
* <br/>
|
||||
* Returns <tt>TRUE</tt> if the specified value is '#N/A', <tt>FALSE</tt> otherwise.
|
||||
*
|
||||
* @author Josh Micich
|
||||
*/
|
||||
public final class IsNa implements Function {
|
||||
|
||||
public Eval evaluate(Eval[] args, int srcCellRow, short srcCellCol) {
|
||||
if(args.length != 1) {
|
||||
return ErrorEval.VALUE_INVALID;
|
||||
}
|
||||
Eval arg = args[0];
|
||||
|
||||
try {
|
||||
OperandResolver.getSingleValue(arg, srcCellRow, srcCellCol);
|
||||
} catch (EvaluationException e) {
|
||||
if (e.getErrorEval().getErrorCode() == ErrorConstants.ERROR_NA) {
|
||||
return BoolEval.TRUE;
|
||||
}
|
||||
}
|
||||
return BoolEval.FALSE;
|
||||
}
|
||||
}
|
Binary file not shown.
Loading…
Reference in New Issue