本文整理汇总了Java中org.apache.poi.common.usermodel.Hyperlink.LINK_URL属性的典型用法代码示例。如果您正苦于以下问题:Java Hyperlink.LINK_URL属性的具体用法?Java Hyperlink.LINK_URL怎么用?Java Hyperlink.LINK_URL使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.poi.common.usermodel.Hyperlink
的用法示例。
在下文中一共展示了Hyperlink.LINK_URL属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setHyperlink
/** 设置超链接属性
* @param cell
* @param processor
* @param returnVal
* @param current
*/
private static void setHyperlink(Cell cell, LinkProcessor processor, Object returnVal, Object current) {
int linkType = 0 ;
String prefix = "";
switch (processor.getLinkType()) {
case Url:
linkType = Hyperlink.LINK_URL;
prefix = "http";
break;
case Document:
linkType = Hyperlink.LINK_DOCUMENT;
break;
case Email:
linkType = Hyperlink.LINK_EMAIL;
prefix = "mailto:";
break;
case File:
linkType = Hyperlink.LINK_FILE;
break;
}
CreationHelper creationHelper = cell.getSheet().getWorkbook().getCreationHelper();
org.apache.poi.ss.usermodel.Hyperlink hyperlink = creationHelper.createHyperlink(linkType);
String address = processor.getLinkAddress(returnVal, current);
if(!address.startsWith(prefix)){
if(linkType == Hyperlink.LINK_EMAIL){
address = prefix + address;
}else{
address = "http://" + address;
}
}
hyperlink.setAddress(address);
cell.setHyperlink(hyperlink);
}
示例2: setLinkField
public ExcelWriteFieldMappingAttribute setLinkField(String linkField) {
this.linkField = linkField;
this.linkType = Hyperlink.LINK_URL;
return this;
}
示例3: setLink
public ExcelWriteFieldMappingAttribute setLink(String linkFieldName, int linkType) {
this.linkField = linkFieldName;
this.linkType = Hyperlink.LINK_URL;
return this;
}