Creating a hyperlink using apache poi

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 adds a Click Here link to the cell

But how can I set partial text and link using the same type of code,
I mean, the link should be like your file is here , where only the link is here

+4
source share
1 answer

As far as I know, I do not think that this is possible, since it is not supported by Excel . There is no direct way to achieve this in Excel either, and for this you need to do some tricks. Something that is not supported using Excel is also not supported by the Apache POI .

+3
source

Source: https://habr.com/ru/post/1486777/


All Articles