Good afternoon,

I'm trying to set a formula set in my ExcelSheet template, which contains a VB function to do some calculations. I followed this example http://svn.apache.org/repos/asf/poi/trunk/src/examples/src/org/apache/poi/ss/examples/formula/SettingExternalFunction.java but when I create the ExcelSheet, the Cell where I set the formula doesn't show the value, it shows a "name error". Here is my code:

                Workbook wb2 = WorkbookFactory.create(fis);
                String[] functionNames = {"Calculo_VPS"};
                 FreeRefFunction[] functionImpls = {new FreeRefFunction() {
                   
                        @Override
                        public ValueEval evaluate(ValueEval[] arg0,
                                OperationEvaluationContext arg1) {
                             // 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
                     wb2.addToolPack(udfToolpack);

                        row2.createCell(19).setCellFormula(formulaC19);
                wb2.setForceFormulaRecalculation(true);

I've also tried with this one:
row2.createCell(19).setCellType(HSSFCell.CELL_TYPE_FORMULA);
row2.getCell(19)..setCellFormula(formulaC19);

Could anyone help me with this?
--

Reply via email to