org.apache.poi.ss.usermodel.Hyperlink.getAddress()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(3.6k)|赞(0)|评价(0)|浏览(101)

本文整理了Java中org.apache.poi.ss.usermodel.Hyperlink.getAddress()方法的一些代码示例,展示了Hyperlink.getAddress()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Hyperlink.getAddress()方法的具体详情如下:
包路径:org.apache.poi.ss.usermodel.Hyperlink
类名称:Hyperlink
方法名:getAddress

Hyperlink.getAddress介绍

暂无

代码示例

代码示例来源:origin: org.apache.poi/poi-ooxml

/**
 * Create a new XSSFHyperlink. This method is for Internal use only.
 * XSSFHyperlinks can be created by {@link XSSFCreationHelper}.
 * See the <a href="https://poi.apache.org/spreadsheet/quick-guide.html#Hyperlinks">spreadsheet quick-guide</a>
 * for an example.
 *
 * @param other the hyperlink to copy
 */
@Internal //FIXME: change to protected if/when SXSSFHyperlink class is created
public XSSFHyperlink(Hyperlink other) {
  if (other instanceof XSSFHyperlink) {
    XSSFHyperlink xlink = (XSSFHyperlink) other;
    _type = xlink.getType();
    _location = xlink._location;
    _externalRel = xlink._externalRel;
    _ctHyperlink = (CTHyperlink) xlink._ctHyperlink.copy();
  }
  else {
    _type = other.getType();
    _location = other.getAddress();
    _externalRel = null;
    _ctHyperlink = CTHyperlink.Factory.newInstance();
    setCellReference(new CellReference(other.getFirstRow(), other.getFirstColumn()));
  }
}
/**

代码示例来源:origin: tobyweston/simple-excel

private boolean containsUrl(org.apache.poi.ss.usermodel.Hyperlink hyperlink) {
    return hyperlink.getAddress().startsWith("http://") || hyperlink.getAddress().startsWith("file://");
  }
},

代码示例来源:origin: stackoverflow.com

Workbook wb = WorkbookFactory.create(new File(FilePath));
Sheet TestSheet = wb.getSheetAt(0);
Cell cell = TestSheet.getRow(0).getCell(0);
Hyperlink linkAddress = cell.getHyperlink();
if(linkAddress != null){
  System.out.println(linkAddress .getAddress());
}

代码示例来源:origin: stackoverflow.com

Workbook wb = WorkbookFactory.create(new File("test.xls"));
Sheet s = wb.getSheetAt(0);
Row r2 = s.getRow(1); // Rows in POI are 0 based
Cell cB2 = r2.getCell(1); // Cells are 0 based

Hyperlink h = cB2.getHyperlink();
if (h == null) {
  System.err.println("Cell B2 didn't have a hyperlink!");
} else {
  System.out.println("B2 : " + h.getLabel() + " -> " + h.getAddress());
}

代码示例来源:origin: stackoverflow.com

ex[2] = h.getAddress();

代码示例来源:origin: com.itelg/texin

if (cell.getHyperlink() != null)
  return cell.getHyperlink().getAddress();

代码示例来源:origin: tobyweston/simple-excel

@Override
public Cell adapt(org.apache.poi.ss.usermodel.Cell cell) {
  if (cell.getHyperlink() != null && containsUrl(cell.getHyperlink()))
    return new HyperlinkCell(hyperlink(cell.getStringCellValue(), cell.getHyperlink().getAddress()));
  
  if (cell.getStringCellValue() == null || "".equals(cell.getStringCellValue()))
    return new BlankCell();
  
  return new StringCell(cell.getStringCellValue());
}

代码示例来源:origin: hellojavaer/poi-excel-utils

Hyperlink hyperlink = cell.getHyperlink();
if (hyperlink != null) {
  address = hyperlink.getAddress();

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi

/**
 * Create a new XSSFHyperlink. This method is for Internal use only.
 * XSSFHyperlinks can be created by {@link XSSFCreationHelper}.
 * See the <a href="https://poi.apache.org/spreadsheet/quick-guide.html#Hyperlinks">spreadsheet quick-guide</a>
 * for an example.
 *
 * @param other the hyperlink to copy
 */
@Internal //FIXME: change to protected if/when SXSSFHyperlink class is created
public XSSFHyperlink(Hyperlink other) {
  if (other instanceof XSSFHyperlink) {
    XSSFHyperlink xlink = (XSSFHyperlink) other;
    _type = xlink.getType();
    _location = xlink._location;
    _externalRel = xlink._externalRel;
    _ctHyperlink = (CTHyperlink) xlink._ctHyperlink.copy();
  }
  else {
    _type = other.getType();
    _location = other.getAddress();
    _externalRel = null;
    _ctHyperlink = CTHyperlink.Factory.newInstance();
    setCellReference(new CellReference(other.getFirstRow(), other.getFirstColumn()));
  }
}
/**

相关文章