Here is what I had to do to getting it working on 3.7:

            UDFFinder udfs = new DefaultUDFFinder( functionNames, functionImpls 
) ;
            UDFFinder udfToolpack = new AggregatingUDFFinder( udfs ) ;    
                      

//            workbook.addToolPack(udfToolpack);
            
//            FormulaEvaluator evaluator = 
workbook.getCreationHelper().createFormulaEvaluator();
            
            HSSFFormulaEvaluator evaluator = HSSFFormulaEvaluator.create(
                    (HSSFWorkbook) workbook, null, udfToolpack ) ;

This is how it works in pre-3.8.  The big difference here is that the 
HSSFFormulaEvaluator is not agnostic when it comes to file types; it expects a 
.xls and NOT a .xlsx file.  The FormulaEvaluator is higher level interface that 
lets your code be more flexible.  I am sure you can work around this as needed.

HTH,

Jon








________________________________
From: "Hilbert, Jerome  (External Staff)" <[email protected]>
To: POI Users List <[email protected]>
Sent: Mon, May 9, 2011 1:21:23 AM
Subject: RE: Spreadsheet user-defined

Hi Jon,

I'm not really happy for using a beta version for our developments, wasn't 
there 
already a way to handle user-defined functions in version 3.7 ?

Thanks for any help,

Jérôme

-----Original Message-----
From: Jon Svede [mailto:[email protected]] 
Sent: vendredi 6 mai 2011 16:29
To: POI Users List
Subject: Re: Spreadsheet user-defined

Hi Jerome,

Can you try using the latest beta instead?  When these docs were written 
against 
the code that is going into 3.8.

Sincerely,

Jon





________________________________
From: "Hilbert, Jerome  (External Staff)" <[email protected]>
To: [email protected]
Sent: Fri, May 6, 2011 8:11:34 AM
Subject: Spreadsheet user-defined

Hi,

I would like to use User-defined functions and followed the instructions on the 
following link to do this.
http://poi.apache.org/spreadsheet/user-defined-functions.html 

Although, the method Workbook.addToolPack(UDFFinder) which is used in the 
example and defined in the Java Doc isn't present inside the jar file, neither 
inside the sources.

I'm using the latest stable version of apache-poi poi-bin-3.7-20101029.zip 
<http://www.apache.org/dyn/closer.cgi/poi/release/bin/poi-bin-3.7-20101029.zip> 
 



Has this method been removed, renamed, deprecated ? I cannot find any updates 
on 

this.

Thank you for any advices,

Jérôme

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to