org.apache.poi.xwpf.usermodel.XWPFHyperlink类的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(5.0k)|赞(0)|评价(0)|浏览(285)

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

XWPFHyperlink介绍

[英]Sketch of XWPF hyperlink class
[中]XWPF超链接类示意图

代码示例

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

XWPFHyperlink link = ((XWPFHyperlinkRun) run).getHyperlink(document);
if (link != null)
  text.append(" <").append(link.getURL()).append(">");

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

private void initHyperlinks() {
  // Get the hyperlinks
  // TODO: make me optional/separated in private function
  try {
    for (PackageRelationship rel : getPackagePart().getRelationshipsByType(XWPFRelation.HYPERLINK.getRelation())) {
      hyperlinks.add(new XWPFHyperlink(rel.getId(), rel.getTargetURI().toString()));
    }
  } catch (InvalidFormatException e) {
    throw new POIXMLException(e);
  }
}

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

public XWPFHyperlink getHyperlinkByID(String id) {
  for (XWPFHyperlink link : hyperlinks) {
    if (link.getId().equals(id)) {
      return link;
    }
  }
  return null;
}

代码示例来源:origin: apache/tika

fmtg = closeStyleTags(xhtml, fmtg);
XWPFHyperlink link = hyperlinkRun.getHyperlink(document);
if (link != null && link.getURL() != null) {
  xhtml.startElement("a", "href", link.getURL());
  inHyperlink = true;
} else if (hyperlinkRun.getAnchor() != null && hyperlinkRun.getAnchor().length() > 0) {

代码示例来源:origin: org.openl.rules/org.openl.lib.poi.dev

private void initHyperlinks(){
  // Get the hyperlinks
  // TODO: make me optional/separated in private function
  try {
    Iterator<PackageRelationship> relIter =
      getPackagePart().getRelationshipsByType(XWPFRelation.HYPERLINK.getRelation()).iterator();
    while(relIter.hasNext()) {
      PackageRelationship rel = relIter.next();
      hyperlinks.add(new XWPFHyperlink(rel.getId(), rel.getTargetURI().toString()));
    }
  } catch (InvalidFormatException e){
    throw new POIXMLException(e);
  }
}

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

public XWPFHyperlink getHyperlinkByID(String id) {
  for (XWPFHyperlink link : hyperlinks) {
    if (link.getId().equals(id)) {
      return link;
    }
  }
  return null;
}

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

XWPFHyperlink link = ((XWPFHyperlinkRun) run).getHyperlink(document);
if (link != null)
  text.append(" <").append(link.getURL()).append(">");

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

private void initHyperlinks() {
  // Get the hyperlinks
  // TODO: make me optional/separated in private function
  try {
    for (PackageRelationship rel : getPackagePart().getRelationshipsByType(XWPFRelation.HYPERLINK.getRelation())) {
      hyperlinks.add(new XWPFHyperlink(rel.getId(), rel.getTargetURI().toString()));
    }
  } catch (InvalidFormatException e) {
    throw new POIXMLException(e);
  }
}

代码示例来源:origin: org.openl.rules/org.openl.lib.poi.dev

public XWPFHyperlink getHyperlinkByID(String id) {
  Iterator<XWPFHyperlink> iter = hyperlinks.iterator();
  while (iter.hasNext()) {
    XWPFHyperlink link = iter.next();
    if(link.getId().equals(id))
      return link;
  }
  return null;
}

代码示例来源:origin: org.openl.rules/org.openl.lib.poi.dev

/**
 * @param prgrph The paragraph of text to work on
 * @param outputHyperlinkUrls Should we output the links too, or just the link text?
 */
public XWPFHyperlinkDecorator(XWPFParagraph prgrph, XWPFParagraphDecorator nextDecorator, boolean outputHyperlinkUrls) {
  super(prgrph, nextDecorator);
  
  hyperlinkText = new StringBuffer();
  
  // loop over hyperlink anchors
  for(CTHyperlink link : paragraph.getCTP().getHyperlinkList()){
    for (CTR r : link.getRList()) {
      // Loop over text runs
      for (CTText text : r.getTList()){
        hyperlinkText.append(text.getStringValue());
      }
    }
    if(outputHyperlinkUrls && paragraph.getDocument().getHyperlinkByID(link.getId()) != null) {
      hyperlinkText.append(" <"+paragraph.getDocument().getHyperlinkByID(link.getId()).getURL()+">");
    }
  }
}

代码示例来源:origin: org.openl.rules/org.openl.lib.poi.dev

XWPFHyperlink link = ((XWPFHyperlinkRun)run).getHyperlink(document);
if(link != null)
  text.append(" <" + link.getURL() + ">");

代码示例来源:origin: com.github.lafa.tikaNoExternal/tika-parsers

fmtg = closeStyleTags(xhtml, fmtg);
XWPFHyperlink link = hyperlinkRun.getHyperlink(document);
if (link != null && link.getURL() != null) {
  xhtml.startElement("a", "href", link.getURL());
  inHyperlink = true;
} else if (hyperlinkRun.getAnchor() != null && hyperlinkRun.getAnchor().length() > 0) {

代码示例来源:origin: org.apache.tika/tika-parsers

fmtg = closeStyleTags(xhtml, fmtg);
XWPFHyperlink link = hyperlinkRun.getHyperlink(document);
if (link != null && link.getURL() != null) {
  xhtml.startElement("a", "href", link.getURL());
  inHyperlink = true;
} else if (hyperlinkRun.getAnchor() != null && hyperlinkRun.getAnchor().length() > 0) {

代码示例来源:origin: com.github.livesense/org.liveSense.framework.xdocreport

href = hyperlink != null ? hyperlink.getURL() : null;

代码示例来源:origin: fr.opensagres.xdocreport/org.apache.poi.xwpf.converter.core

href = hyperlink != null ? hyperlink.getURL() : null;

代码示例来源:origin: fr.opensagres.xdocreport/org.apache.poi.xwpf.converter.core-gae

href = hyperlink != null ? hyperlink.getURL() : null;

相关文章