当前位置: 首页>>代码示例>>Java>>正文


Java Hyperlink类代码示例

本文整理汇总了Java中org.apache.poi.common.usermodel.Hyperlink的典型用法代码示例。如果您正苦于以下问题:Java Hyperlink类的具体用法?Java Hyperlink怎么用?Java Hyperlink使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Hyperlink类属于org.apache.poi.common.usermodel包,在下文中一共展示了Hyperlink类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setHyperlink

import org.apache.poi.common.usermodel.Hyperlink; //导入依赖的package包/类
/** 设置超链接属性
 * @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);
}
 
开发者ID:long47964,项目名称:excel-utils,代码行数:39,代码来源:ExcelExportUtil.java

示例2: setLinkField

import org.apache.poi.common.usermodel.Hyperlink; //导入依赖的package包/类
public ExcelWriteFieldMappingAttribute setLinkField(String linkField) {
    this.linkField = linkField;
    this.linkType = Hyperlink.LINK_URL;
    return this;
}
 
开发者ID:hellojavaer,项目名称:poi-excel-utils,代码行数:6,代码来源:ExcelWriteFieldMapping.java

示例3: setLink

import org.apache.poi.common.usermodel.Hyperlink; //导入依赖的package包/类
public ExcelWriteFieldMappingAttribute setLink(String linkFieldName, int linkType) {
    this.linkField = linkFieldName;
    this.linkType = Hyperlink.LINK_URL;
    return this;
}
 
开发者ID:hellojavaer,项目名称:poi-excel-utils,代码行数:6,代码来源:ExcelWriteFieldMapping.java

示例4: extractCell

import org.apache.poi.common.usermodel.Hyperlink; //导入依赖的package包/类
static protected Cell extractCell(org.apache.poi.ss.usermodel.Cell cell, Map<String, Recon> reconMap) {
    Serializable value = extractCell(cell);
    
    if (value != null) {
        Recon recon = null;
        
        Hyperlink hyperlink = cell.getHyperlink();
        if (hyperlink != null) {
            String url = hyperlink.getAddress();
            
            if (url != null && (url.startsWith("http://") ||
                url.startsWith("https://"))) {
                
                final String sig = "freebase.com/view";
                
                int i = url.indexOf(sig);
                if (i > 0) {
                    String id = url.substring(i + sig.length());
                    
                    int q = id.indexOf('?');
                    if (q > 0) {
                        id = id.substring(0, q);
                    }
                    int h = id.indexOf('#');
                    if (h > 0) {
                        id = id.substring(0, h);
                    }
                    
                    if (reconMap.containsKey(id)) {
                        recon = reconMap.get(id);
                        recon.judgmentBatchSize++;
                    } else {
                        recon = new Recon(0, null, null);
                        recon.service = "import";
                        recon.match = new ReconCandidate(id, value.toString(), new String[0], 100);
                        recon.matchRank = 0;
                        recon.judgment = Judgment.Matched;
                        recon.judgmentAction = "auto";
                        recon.judgmentBatchSize = 1;
                        recon.addCandidate(recon.match);
                        
                        reconMap.put(id, recon);
                    }
                    
                }
            }
        }
        
        return new Cell(value, recon);
    } else {
        return null;
    }
}
 
开发者ID:dfci-cccb,项目名称:mev,代码行数:54,代码来源:ExcelImporter.java


注:本文中的org.apache.poi.common.usermodel.Hyperlink类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。