POI公式解析错误,APACHE,你好狠

按照官方文档
http://poi.apache.org/hssf/eval.html
上面的源代码
CellReference cellReference = new CellReference("B3");
HSSFRow row = sheet.getRow(cellReference.getRow());
HSSFCell cell = row.getCell(cellReference.getCol());
HSSFFormulaEvaluator.CellValue cellValue = evaluator.evaluate(cell);

得到百分之百是一个空指针错误,郁闷啊,查了半天,总算知道了

CellReference cellReference = new CellReference("B3");
HSSFRow row = sheet.getRow(cellReference.getRow());
HSSFCell cell = row.getCell(cellReference.getCol());
evaluator.setCurrentRow(row);
HSSFFormulaEvaluator.CellValue cellValue = evaluator.evaluate(cell);

就这么一行,靠,查了我半个小时,郁闷中

你可能感兴趣的:(apache)