Class FormulaParserManager
Provides access to various functionality regarding excel formula evaluation.
Inheritance
Inherited Members
Namespace: OfficeOpenXml.FormulaParsing
Assembly: EPPlus.dll
Syntax
public class FormulaParserManager
Methods
AddOrReplaceFunction(String, ExcelFunction)
If the supplied functionName does not exist, the supplied
functionImpl implementation will be added to the formula parser.
If it exists, the existing function will be replaced by the supplied functionImpl
Declaration
public void AddOrReplaceFunction(string functionName, ExcelFunction functionImpl)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | functionName | |
| ExcelFunction | functionImpl |
AttachLogger(IFormulaParserLogger)
Attaches a logger to the FormulaParser.
Declaration
public void AttachLogger(IFormulaParserLogger logger)
Parameters
| Type | Name | Description |
|---|---|---|
| IFormulaParserLogger | logger | An instance of IFormulaParserLogger |
AttachLogger(FileInfo)
Attaches a logger to the formula parser that produces output to the supplied logfile.
Declaration
public void AttachLogger(FileInfo logfile)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IO.FileInfo | logfile |
CopyFunctionsFrom(ExcelWorkbook)
Copies existing ExcelFunction´s from one workbook to another.
Declaration
public void CopyFunctionsFrom(ExcelWorkbook otherWorkbook)
Parameters
| Type | Name | Description |
|---|---|---|
| ExcelWorkbook | otherWorkbook | The workbook containing the forumulas to be copied. |
DetachLogger()
Detaches any attached logger from the formula parser.
Declaration
public void DetachLogger()
GetImplementedFunctionNames()
Returns an enumeration of the names of all functions implemented, both the built in functions and functions added using the LoadFunctionModule method of this class.
Declaration
public IEnumerable<string> GetImplementedFunctionNames()
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<System.String> | Function names in lower case |
GetImplementedFunctions()
Returns an enumeration of all implemented functions, including the implementing ExcelFunction instance.
Declaration
public IEnumerable<KeyValuePair<string, ExcelFunction>> GetImplementedFunctions()
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<System.String, ExcelFunction>> | An enumeration of System.Collections.Generic.KeyValuePair`2, where the key is the function name |
LoadFunctionModule(IFunctionModule)
Loads a module containing custom functions to the formula parser. By using this method you can add your own implementations of Excel functions, by implementing a IFunctionModule.
Declaration
public void LoadFunctionModule(IFunctionModule module)
Parameters
| Type | Name | Description |
|---|---|---|
| IFunctionModule | module | A IFunctionModule containing ExcelFunctions. |
Parse(String)
Parses the supplied formula and returns the result.
Declaration
public object Parse(string formula)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | formula | The formula to parse |
Returns
| Type | Description |
|---|---|
| System.Object | The result of the parsed formula |
Parse(String, String)
Parses the supplied formula and returns the result.
Declaration
public object Parse(string formula, string address)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | formula | The formula to parse |
| System.String | address | The full address in the workbook where the |
Returns
| Type | Description |
|---|---|
| System.Object | The result of the parsed formula |