https://issues.apache.org/bugzilla/show_bug.cgi?id=54125
--- Comment #3 from Yegor Kozlov <[email protected]> --- I added an example in svn: https://svn.apache.org/repos/asf/poi/trunk/src/examples/src/org/apache/poi/ss/examples/formula/SettingExternalFunction.java (In reply to comment #2) > Thanks a lot! It worked as you said > > (In reply to comment #1) > > You are doing it wrong, you need to register external functions in a > > toolpack instead of using a named range: > > > > > > Workbook wb = new XSSFWorkbook(); > > > > String[] functionNames = {"BDP"}; > > FreeRefFunction[] functionImpls = {new FreeRefFunction() { > > public ValueEval evaluate(ValueEval[] args, > > OperationEvaluationContext ec) { > > // don't care about the returned result. we are not going to > > evaluate BDP > > return ErrorEval.NA; > > } > > }}; > > > > UDFFinder udfToolpack = new DefaultUDFFinder(functionNames, > > functionImpls); > > > > // register the user-defined function in the workbook > > wb.addToolPack(udfToolpack); > > > > Sheet sheet = wb.createSheet(); > > Cell cell = sheet.createRow(0).createCell(0); > > cell.setCellFormula("BDP(\"GOOG Equity\",\"CHG_PCT_YTD\")/100"); > > > > this way it should work. > > > > Yegor -- You are receiving this mail because: You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
