本文整理了Java中org.apache.poi.ss.usermodel.Hyperlink.setAddress()
方法的一些代码示例,展示了Hyperlink.setAddress()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Hyperlink.setAddress()
方法的具体详情如下:
包路径:org.apache.poi.ss.usermodel.Hyperlink
类名称:Hyperlink
方法名:setAddress
暂无
代码示例来源:origin: pentaho/pentaho-kettle
hyperLink.setAddress( link );
cell.setHyperlink( hyperLink );
代码示例来源:origin: apache/tika
@Override
public void applyStyleAndValue(int dbColNum, ResultSet resultSet, Cell cell) throws SQLException {
if (links < MAX_HYPERLINKS) {
Hyperlink hyperlink = workbook.getCreationHelper().createHyperlink(linkType);
String path = resultSet.getString(dbColNum);
String address = urlBase+path;
hyperlink.setAddress(address);
cell.setHyperlink(hyperlink);
cell.setCellStyle(style);
String fName = Paths.get(path).getFileName().toString();
cell.setCellValue(fName);
links++;
} else {
//silently stop adding hyperlinks
}
}
}
代码示例来源:origin: stackoverflow.com
cell = sheet.createRow(3).createCell((short)0);
cell.setCellValue("Worksheet Link");
Hyperlink link2 = createHelper.createHyperlink(Hyperlink.LINK_DOCUMENT);
link2.setAddress("'Target Sheet'!A1");
cell.setHyperlink(link2);
cell.setCellStyle(hlink_style);
代码示例来源:origin: stackoverflow.com
if(row.get(j) instanceof Link){
Hyperlink link = createHelper.createHyperlink(Hyperlink.LINK_URL);
link.setAddress("http://poi.apache.org/");
cell.setHyperlink(link);
}else{
Your code..
}
代码示例来源:origin: stackoverflow.com
Elements tds = row.select("td");
count = 0; //cell location at that row
for (Element element : tds) {
cell = header.createCell(count);
cell.setCellValue(element.text());
Element href = element.select("a[href]").first();
if (href != null){
Hyperlink link = createHelper.createHyperlink(Hyperlink.LINK_URL);
link.setAddress(href.attr("href"));
cell.setHyperlink(link);
}
count++;
}
代码示例来源:origin: stackoverflow.com
Hyperlink hyperlink = creationHelper.createHyperlink(Hyperlink.LINK_FILE);
String relativePath = "../parentdir/fileToLink.txt";
hyperlink.setAddress(relativePath);
hyperlink.setLabel("Link to file");
cell.setHyperlink(hyperlink);
cell.setCellValue("Link to file");
cell.setCellType(Cell.CELL_TYPE_STRING);
代码示例来源:origin: stackoverflow.com
CreationHelper creationHelper = getWorkbook().getCreationHelper();
Hyperlink link = creationHelper.createHyperlink(Hyperlink.LINK_URL);
link.setAddress("www.google.com");
代码示例来源:origin: tobyweston/simple-excel
private Hyperlink createHyperlink(Workbook workbook) {
Hyperlink hyperlink = workbook.getCreationHelper().createHyperlink(LINK_URL);
hyperlink.setAddress(link.toExternalForm());
return hyperlink;
}
}
代码示例来源:origin: stackoverflow.com
Cell cell = row.createCell(0);
Hyperlink fileLink = wb.getCreationHelper().createHyperlink(Hyperlink.LINK_FILE);
fileLink.setAddress(filePDF.toURI().toString());
cell.setCellValue("link to absolute file URI");
cell.setHyperlink(fileLink);
cell = row.createCell(0);
fileLink = wb.getCreationHelper().createHyperlink(Hyperlink.LINK_FILE);
fileLink.setAddress(relativeURI);
cell.setCellValue("link to relative file URI");
cell.setHyperlink(fileLink);
代码示例来源:origin: stackoverflow.com
Workbook wb = new XSSFWorkbook();
CreationHelper createHelper = wb.getCreationHelper();
Sheet sheet = wb.createSheet("Hyperlinks");
cell = sheet.createRow(0).createCell(Cell.CELL_TYPE_STRING);
cell.setCellValue("URL Link");
Hyperlink link = createHelper.createHyperlink(Hyperlink.LINK_URL);
link.setAddress("http://poi.apache.org/");
cell.setHyperlink(link);
代码示例来源:origin: stackoverflow.com
Workbook wb = new XSSFWorkbook();
CreationHelper createHelper = wb.getCreationHelper();
Sheet sheet = wb.createSheet("AHyperLink");
Cell cell = sheet.createRow(0).createCell(0);
cell.setCellValue("Google");
Hyperlink link = createHelper.createHyperlink(Hyperlink.LINK_URL);
link.setAddress("http://www.google.com/");
cell.setHyperlink(link);
代码示例来源:origin: stackoverflow.com
CellStyle hlink_style = workbook.createCellStyle();
Font hlink_font = workbook.createFont();
hlink_font.setUnderline(Font.U_SINGLE);
hlink_font.setColor(Font.COLOR_RED);
hlink_style.setFont(hlink_font);
Hyperlink link = createHelper.createHyperlink(Hyperlink.LINK_FILE);
Cell cell = null;
cell=row.createCell((short) 1);
cell.setCellValue("Go to Result");
path_f="D://Result.xls";
link.setAddress(path_f);
cell.setHyperlink(link);
cell.setCellStyle(hlink_style);
代码示例来源:origin: stackoverflow.com
Hyperlink hp = createHelper.createHyperlink(Hyperlink.LINK_FILE);
FileAddress=FileAddress.replace("\\", "/");
hp.setAddress(FileAddress);
cell.setHyperlink(hp);
cell.setCellStyle(hlink_style);
代码示例来源:origin: net.paissad.tools.reqcoco/reqcoco-core
private void configureHyperlinkCell(final Cell cell, final Font cellFont, final CreationHelper creationHelper, String cellContent) {
cellFont.setUnderline(Font.U_SINGLE);
cellFont.setColor(IndexedColors.BLUE.getIndex());
final Hyperlink link = creationHelper.createHyperlink(HyperlinkType.URL);
link.setAddress(cellContent);
cell.setHyperlink(link);
}
代码示例来源:origin: org.jxls/jxls-poi
public Object writeToCell(Cell cell, Context context) {
Workbook workbook = cell.getSheet().getWorkbook();
CreationHelper createHelper = workbook.getCreationHelper();
Hyperlink hyperlink = createHelper.createHyperlink(linkType);
hyperlink.setAddress(address);
cell.setHyperlink(hyperlink);
cell.setCellValue(title);
if( linkStyle == null ){
linkStyle = cell.getCellStyle();
}
cell.setCellStyle(linkStyle);
return cell;
}
代码示例来源:origin: com.b2international.snowowl/com.b2international.snowowl.datastore.server
/**
* Creates the index sheet based on the given sheet names.
*
* @param sheetNames
*/
protected void createIndexSheet(final Collection<T> components) {
final Sheet indexSheet = workbook.createSheet("INDEX");
final List<T> filteredComponents = Lists.newArrayList(Iterables.filter(components, new Predicate<T>() {
@Override
public boolean apply(T input) {
return isToExport(getComponentId(input));
}
}));
final List<String> sheetNames = extractSheetNamesFromTerminologyComponents(filteredComponents);
final Row firstRow = indexSheet.createRow(0);
createCell(firstRow, getIndexSheetHeaderName(), BOLD_STYLE, 0);
for (int i = 0; i < sheetNames.size(); i++) {
final String sheetName = getFinalSheetName(i + 1, sheetNames.get(i));
final Hyperlink hyperlink = workbook.getCreationHelper().createHyperlink(XSSFHyperlink.LINK_DOCUMENT);
hyperlink.setLabel(sheetName);
hyperlink.setAddress(String.format("'%s'!A1", sheetName));
final Row row = indexSheet.createRow(i + 1);
final Cell cell = row.createCell(0);
cell.setCellValue(sheetName);
cell.setCellStyle(hyperlinkStyle);
cell.setHyperlink(hyperlink);
}
indexSheet.autoSizeColumn(0);
}
代码示例来源:origin: Appendium/objectlabkit
public ExcelCell link(String url, String label) {
final CreationHelper creationHelper = row().sheet().workbook().poiWorkbook().getCreationHelper();
final Hyperlink hl = creationHelper.createHyperlink(HyperlinkType.URL);
hl.setAddress(url);
hl.setLabel(label);
currentCell.setCellValue(label);
currentCell.setHyperlink(hl);
style(LINK);
return this;
}
代码示例来源:origin: stackoverflow.com
public static void hyperlinkScreenshot(XSSFCell cell, String FileAddress){
XSSFWorkbook wb=cell.getRow().getSheet().getWorkbook();
CreationHelper createHelper = wb.getCreationHelper();
CellStyle hlink_style = wb.createCellStyle();
Font hlink_font = wb.createFont();
hlink_font.setUnderline(Font.U_SINGLE);
hlink_font.setColor(IndexedColors.BLUE.getIndex());
hlink_style.setFont(hlink_font);
Hyperlink hp = createHelper.createHyperlink(Hyperlink.LINK_FILE);
FileAddress=FileAddress.replace("\\", "/");
hp.setAddress(FileAddress);
cell.setHyperlink(hp);
cell.setCellStyle(hlink_style);
}
代码示例来源:origin: paypal/SeLion
link.setAddress(dataString.get(i));
row.getCell(iColNum).setCellStyle(Styles.getHyperLinkStyle());
row.getCell(iColNum).setCellValue("Link to details");
代码示例来源:origin: com.blackducksoftware.tools/common-framework
private void populateHyperlinkCell(Record record, FieldDef fieldDef,
Cell cell) throws Exception {
String cellValue = record.getHyperlinkFieldValue(fieldDef.getName())
.getDisplayText();
cell.setCellValue(cellValue);
// cell style for hyperlinks
// by default hyperlinks are blue and underlined
CellStyle hlink_style = workbook.createCellStyle();
Font hlink_font = workbook.createFont();
hlink_font.setUnderline(Font.U_SINGLE);
hlink_font.setColor(IndexedColors.BLUE.getIndex());
hlink_style.setFont(hlink_font);
// Make it a hyperlink
CreationHelper createHelper = workbook.getCreationHelper();
Hyperlink link = createHelper.createHyperlink(Hyperlink.LINK_URL);
link.setAddress(record.getHyperlinkFieldValue(fieldDef.getName())
.getHyperlinkText());
cell.setHyperlink(link);
cell.setCellStyle(hlink_style);
}
内容来源于网络,如有侵权,请联系作者删除!