创建使用Apache POI的超级链接 [英] Creating a hyperlink using apache poi
问题描述
我想用下面的code创建超链接
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);
它工作正常,并将它添加一个链接 点击这里
的以细胞
但我怎么可以设置部分文本,并使用同一类型的code的一个链接,结果我的意思是链接需要像 您的文件
的 此处
的,只有这里是链接
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
推荐答案
据我知道,我不认为这是可能的,因为它不是由 Excel的支持
为好。为了实现在 Excel中
太没有笔直的路,你必须做一些技巧来实现这一目标。不是从 Excel中
右键支持的东西不能用的Apache POI
了。
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.
这篇关于创建使用Apache POI的超级链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!