You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2018/12/01 08:54:24 UTC

[Bug 62969] HYPERLINK() function needs a way to return link reference when display label is also specified

https://bz.apache.org/bugzilla/show_bug.cgi?id=62969

--- Comment #3 from Dominik Stadler <do...@gmx.at> ---
Created attachment 36288
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=36288&action=edit
Workaround by overloading FunctionEval.functions

I had the same problem some time ago and used a workaround by putting a class
into the org.apache.poi.ss.formula.eval package and accessing the protected
FunctionEval.functions-array this way, see the attached sample code.

// MyHyperlink returns the URL Value instead of the normal text-value returned
usually by the Hyperlink function
Function func = new MyHyperlink();

BuiltinFunctionsOverloader.replaceBuiltinFunction(359, func);


Maybe we can make it possible to override functions this way in FunctionEval
natively via a static FunctionEval.replaceBuiltinFunction() and provide the
alternative implementation of Hyperlink together with sample code? This would
spare us from breaking existing interfaces.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


Re: [Bug 62969] HYPERLINK() function needs a way to return link reference when display label is also specified

Posted by Greg Woolsey <gr...@gmail.com>.
That replacement method is no longer available, and the maps appear to be
static, so making a change would affect all threads, so I don't like that
option.  Perhaps a separate override map local to an evaluator instance
would be a possibility, but then it would need to be available in the
proper function lookup context, which may or may not be a simple option.

Good thought though, about allowing function customization, especially if
there are other functions that have side effects or multiple possible
values needed to implement Excel behavior.

On Sat, Dec 1, 2018 at 12:54 AM <bu...@apache.org> wrote:

> https://bz.apache.org/bugzilla/show_bug.cgi?id=62969
>
> --- Comment #3 from Dominik Stadler <do...@gmx.at> ---
> Created attachment 36288
>   --> https://bz.apache.org/bugzilla/attachment.cgi?id=36288&action=edit
> Workaround by overloading FunctionEval.functions
>
> I had the same problem some time ago and used a workaround by putting a
> class
> into the org.apache.poi.ss.formula.eval package and accessing the protected
> FunctionEval.functions-array this way, see the attached sample code.
>
> // MyHyperlink returns the URL Value instead of the normal text-value
> returned
> usually by the Hyperlink function
> Function func = new MyHyperlink();
>
> BuiltinFunctionsOverloader.replaceBuiltinFunction(359, func);
>
>
> Maybe we can make it possible to override functions this way in
> FunctionEval
> natively via a static FunctionEval.replaceBuiltinFunction() and provide the
> alternative implementation of Hyperlink together with sample code? This
> would
> spare us from breaking existing interfaces.
>
> --
> You are receiving this mail because:
> You are the assignee for the bug.
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
> For additional commands, e-mail: dev-help@poi.apache.org
>
>