[]
        
立即试用
(Showing Draft Content)

CustomFunction

Class CustomFunction

java.lang.Object
com.grapecity.documents.excel.CustomFunction
Direct Known Subclasses:
AsyncCustomFunction

public abstract class CustomFunction extends Object
表示自定义函数的基础类型。
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    初始化自定义函数的实例。
    CustomFunction(String name, FunctionValueType result, Parameter[] parameters)
    初始化自定义函数的实例。
    CustomFunction(String name, String description, FunctionValueType result, Parameter[] parameters)
    初始化自定义函数的实例。
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract Object
    evaluate(Object[] arguments, ICalcContext context)
    计算该函数。
    boolean
    获取函数是否可以接受错误值作为参数。 当设为true时,错误值(例如#N/A#VALUE!)会传递给函数进行处理。 当设为false时(默认值),如果存在参数是错误值,函数将立即返回参数中的首个错误。
    boolean
    获取是否允许自定义公式使用缓存。
    void
    setAcceptErrors(boolean acceptErrors)
    设置函数是否接受错误值作为参数。 当设置为true时,错误值(如#N/A#VALUE!)将传递给函数内部处理。 当设置为false时(默认值),若存在参数为错误值,函数将立即返回参数中的首个错误。
    void
    setIsVolatile(boolean aVolatile)
    设置是否允许自定义公式使用缓存。

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • CustomFunction

      public CustomFunction(String name, FunctionValueType result)
      初始化自定义函数的实例。
      Parameters:
      name - 自定义函数的名称。
      result - 指定自定义函数的返回类型。
    • CustomFunction

      public CustomFunction(String name, FunctionValueType result, Parameter[] parameters)
      初始化自定义函数的实例。
      Parameters:
      name - 自定义函数的名称。
      result - 指定自定义函数的返回类型。
      parameters - 指定自定义函数的参数。
    • CustomFunction

      public CustomFunction(String name, String description, FunctionValueType result, Parameter[] parameters)
      初始化自定义函数的实例。
      Parameters:
      name - 自定义函数的名称。
      description - 自定义函数的描述。
      result - 指定自定义函数的返回类型。
      parameters - 指定自定义函数的参数。
  • Method Details

    • setAcceptErrors

      public void setAcceptErrors(boolean acceptErrors)
      设置函数是否接受错误值作为参数。 当设置为true时,错误值(如#N/A#VALUE!)将传递给函数内部处理。 当设置为false时(默认值),若存在参数为错误值,函数将立即返回参数中的首个错误。
    • getAcceptErrors

      public boolean getAcceptErrors()
      获取函数是否可以接受错误值作为参数。 当设为true时,错误值(例如#N/A#VALUE!)会传递给函数进行处理。 当设为false时(默认值),如果存在参数是错误值,函数将立即返回参数中的首个错误。
    • getIsVolatile

      public boolean getIsVolatile()
      获取是否允许自定义公式使用缓存。
    • setIsVolatile

      public void setIsVolatile(boolean aVolatile)
      设置是否允许自定义公式使用缓存。
    • evaluate

      public abstract Object evaluate(Object[] arguments, ICalcContext context)
      计算该函数。
      Parameters:
      arguments - 参数值的集合
      context - 计算的上下文
      Returns:
      函数的结果。