I am trying to create a hyperlink using the following code
CreationHelper createHelper = wb.getCreationHelper();
cell.setCellValue("Click Here");
Hyperlink link = createHelper.createHyperlink(Hyperlink.LINK_FILE);
File f = new File("C:\\Test\\1.pdf");
link.setAddress(f.getCanonicalPath());
cell.setHyperlink((org.apache.poi.ss.usermodel.Hyperlink) link);
It works fine and it adds a link Click Here
to the cell
But how i can set a partial text and a link using same type of code,
I mean the link need to be like your file is
here
, where only here is the link
As far as I know I don't think it is possible, as it is not supported by Excel
as well. To achieve that in Excel
too there is no straight way and you have to do some tricks to achieve that. Something that is not supported right from Excel
cannot be supported by Apache POI
too.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With