poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian <chris_am_appa...@yahoo.de>
Subject Re: Problems with WorkbookEvaluator.registerFunction() using German names of Excel functions
Date Wed, 23 May 2012 16:59:07 GMT
Thanks Nick,

it is indeed as you have suggested. When I register a "built-in" 
function such as IPMT that is not yet supported by POI, then POI will 
recognize my implementation of this function. (The "built-in" functions 
must implement the Function interface in POI.)

To register the function, I used the    
WorkbookEvaluator.registerFunction("IPMT", new IPTM())    method, in 
this case.

On the other hand, when I implement a not supported function that is not 
"built-in", and belongs to the ATP (Analysis Tool Pack) of Excel, and I 
use a German version of Excel (or Open Office Calc), then POI will do 
the following:

(a) if I register my function under the English name of the function, 
for example:

WorkbookEvaluator.registerFunction("SERIESSUM", new SERIESSUM())

then POI will recognize my code and register the function. But now POI 
will not recognize that it should apply this implementation of the 
"SERIESSUM" function to the equivalent German "POTENZREIHE" function 
that it will read from the Excel file. This is because it works by 
"name" of the function, as you have suggested before. But the English 
and the German name of a function differ in these cases.

(b) if I register my function under the German name of the function, for 
example:

WorkbookEvaluator.registerFunction("POTENZREIHE", new SERIESSUM())

then POI won't register my function at all. This is because, internally, 
it works only with the English names of ATP functions, and "potenzreihe" 
is, of course, not in that list of functions that POI works with.


(c) The fact that POI works with function names for ATP functions, is 
also supported by the few functions that have the same name in the 
English and German version of Excel. For example, "DURATION" is the name 
for the English function, and for the German function, as well.

In this case, when I register my function under the English = German 
name of the function, that is,

WorkbookEvaluator.registerFunction("DURATION", new DURATION())

then POI will register my function - because it knows the English name - 
AND it will apply this implementation to the function that it finds in 
the Excel file - because it will find the German name of the function 
that it reads from the Excel file in its list of English function names 
- simply because they are both identical.

*****************************


Is there any solution to this problem?

Of course, one could "register" the German functions as user-defined 
functions (UDF), but this is not really what is intended. Is there any 
simple bypass to this problem?

Thanks for any suggestions...
Christian

Am 09.05.2012 19:30, schrieb Nick Burch:
> On Wed, 9 May 2012, Christian wrote:
>> ==> Does Excel not work internally with the English function names? 
>> How can I solve this problem and register EDATE as EDATE (English 
>> name)??
>
> Depends on the kind of function it is. Almost all of the "built-in" 
> functions are stored in a .xls file by ID. Extension ones (eg user 
> defined, analysis pack etc) are handled differently, and IIRC are done 
> effectively by name.
>
> See org/apache/poi/ss/formula/function/functionMetadata.txt for the 
> details of the built-in ones
>
> Nick
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
> For additional commands, e-mail: dev-help@poi.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


Mime
View raw message