HSSFFormulaEvaluator exception

Jan 25, 2010 at 10:21 PM

NullReferenceException - "Object reference not set to an instance of an object."

The relevant stack trace is shown below:

at NPOI.SS.Formula.WorkbookEvaluator.GetSheetIndex(EvaluationSheet sheet)
   at NPOI.SS.Formula.WorkbookEvaluator.Evaluate(EvaluationCell srcCell)
   at NPOI.HSSF.UserModel.HSSFFormulaEvaluator.EvaluateFormulaCellValue(HSSFCell cell)
   at NPOI.HSSF.UserModel.HSSFFormulaEvaluator.Evaluate(HSSFCell cell)
   [Application Code Cut]

I create the evaluator with:

HSSFFormulaEvaluator formulaEvaluator = new HSSFFormulaEvaluator(Workbook);

and just give it a cell:

formulaEvaluator.Evaluate(currentCell); // currentCell is a formula cell.
I thought I'd ask before I have to delve into the source code.  Or does this functionality only work for SS models?  Is there some step I'm missing?


Jan 26, 2010 at 4:11 AM

Please let me know the version of NPOI you are using and the formula in the cell

Jan 26, 2010 at 1:39 PM

Jan 26, 2010 at 1:51 PM

Nevermind - I'm an idiot.

I was passing null into HSSFFormulaEvaluator constructor.  You'd think that the constructor would throw.