[]
        
(Showing Draft Content)

IFormulaResolver

Interface IFormulaResolver


public interface IFormulaResolver
Provides custom name resolution used by formulas.

Implement this interface when formulas need to resolve names that are not defined by workbook names or worksheet names. The custom resolver can then be passed to a worksheet formula evaluation overload that accepts an IFormulaResolver.


 IFormulaResolver resolver = new CustomFormulaResolver();
 Object result = worksheet.evaluate("=100*TaxRate", resolver);
 
  • Method Summary

    Modifier and Type
    Method
    Description
    Evaluates the specified custom name and returns its resolved value.
    boolean
    Determines whether the specified text is a custom name that this resolver handles.
  • Method Details

    • isCustomName

      boolean isCustomName(String text)
      Determines whether the specified text is a custom name that this resolver handles.
      
       IFormulaResolver resolver = new CustomFormulaResolver();
       boolean isCustomName = resolver.isCustomName("TaxRate");
       
      Parameters:
      text - The formula text or name to check.
      Returns:
      true if the specified text is a custom name; otherwise, false.
    • evaluate

      Object evaluate(String text)
      Evaluates the specified custom name and returns its resolved value.
      
       IFormulaResolver resolver = new CustomFormulaResolver();
       Object value = resolver.evaluate("TaxRate");
       
      Parameters:
      text - The custom name to evaluate.
      Returns:
      The value resolved for the specified custom name.