poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nick Burch <apa...@gagravarr.org>
Subject Re: POI, Excel 2010 - howto remove Hyperlink from cell
Date Fri, 07 Dec 2012 10:53:22 GMT
On Fri, 7 Dec 2012, Yegor Kozlov wrote:
> There is no method to remove a hyperlink from sheet. There are methid
> to add/get but not to delete.
> The collection of hyperlinks in XSSFSheet is private but you can
> access it via reflection:
>
>        XSSFHyperlink link = ....; // the hyperlink to remove
>        XSSFSheet sheet = ...; // sheet containing the hyperlink
>
>        // access the private field XSSFSheet.hyperlinks
>        Field f = XSSFSheet.class.getDeclaredField("hyperlinks");
>        f.setAccessible(true);
>        List<XSSFHyperlink> hyperlinks = (List<XSSFHyperlink>)f.get(sheet);
>
>        hyperlinks.remove(link);  // remove the link

If you do follow Yegor's advice, and get it working properly, a patch to 
update POI to do it for you would be very much welcome :)

kNick

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


Mime
View raw message