https://issues.apache.org/bugzilla/show_bug.cgi?id=54125

Yegor Kozlov <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID

--- Comment #1 from Yegor Kozlov <[email protected]> ---
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]

Reply via email to