Package org.apache.poi.hssf.record.formula.functions

Examples of org.apache.poi.hssf.record.formula.functions.FreeRefFunction


    if(nIncomingArgs < 1) {
      throw new RuntimeException("function name argument missing");
    }
   
    Eval nameArg = args[0];
    FreeRefFunction targetFunc;
    try {
      if (nameArg instanceof NameEval) {
        targetFunc = findInternalUserDefinedFunction((NameEval) nameArg);
      } else if (nameArg instanceof NameXEval) {
        targetFunc = findExternalUserDefinedFunction(workbook, (NameXEval) nameArg);
      } else {
        throw new RuntimeException("First argument should be a NameEval, but got ("
            + nameArg.getClass().getName() + ")");
      }
    } catch (EvaluationException e) {
      return e.getErrorEval();
    }
    int nOutGoingArgs = nIncomingArgs -1;
    Eval[] outGoingArgs = new Eval[nOutGoingArgs];
    System.arraycopy(args, 1, outGoingArgs, 0, nOutGoingArgs);
    return targetFunc.evaluate(outGoingArgs, workbook, srcCellSheet, srcCellRow, srcCellCol);
  }
View Full Code Here


    if(false) {
      System.out.println("received call to external user defined function (" + functionName + ")");
    }
    // currently only looking for functions from the 'Analysis TookPak'  e.g. "YEARFRAC" or "ISEVEN"
    // not sure how much this logic would need to change to support other or multiple add-ins.
    FreeRefFunction result = AnalysisToolPak.findFunction(functionName);
    if (result != null) {
      return result;
    }
    throw new EvaluationException(ErrorEval.FUNCTION_NOT_IMPLEMENTED);
  }
View Full Code Here

   
    return m;
  }

  private static void r(Map m, String functionName, FreeRefFunction pFunc) {
    FreeRefFunction func = pFunc == null ? NotImplemented : pFunc;
    m.put(functionName, func);
  }
View Full Code Here

TOP

Related Classes of org.apache.poi.hssf.record.formula.functions.FreeRefFunction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.