org.apache.poi.xwpf.usermodel.XWPFDocument.getPartById()方法的使用及代码示例

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

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

XWPFDocument.getPartById介绍

[英]Get the document part that's defined as the given relationship of the core document.
[中]

代码示例

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

protected XWPFHeader getXWPFHeader( CTHdrFtrRef headerRef )
  throws XmlException, IOException
{
  PackagePart hdrPart = document.getPartById( headerRef.getId() );
  HdrDocument hdrDoc = HdrDocument.Factory.parse( hdrPart.getInputStream() );
  CTHdrFtr hdrFtr = hdrDoc.getHdr();
  XWPFHeader hdr = new XWPFHeader( document, hdrFtr);
  return hdr;
}

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

protected XWPFFooter getXWPFFooter( CTHdrFtrRef footerRef )
  throws XmlException, IOException
{
  PackagePart hdrPart = document.getPartById( footerRef.getId() );
  FtrDocument hdrDoc = FtrDocument.Factory.parse( hdrPart.getInputStream() );
  CTHdrFtr hdrFtr = hdrDoc.getFtr();
  XWPFFooter ftr = new XWPFFooter(document, hdrFtr);
  return ftr;
}

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

/**
 * Returns the {@link XWPFHeader} of the given header reference.
 * 
 * @param headerref the header reference.
 * @return
 * @throws XmlException
 * @throws IOException
 */
protected XWPFHeader getXWPFHeader( CTHdrFtrRef headerRef )
  throws XmlException, IOException
{
  PackagePart hdrPart = document.getPartById( headerRef.getId() );
  List<XWPFHeader> headers = document.getHeaderList();
  for ( XWPFHeader header : headers )
  {
    if ( header.getPackagePart().equals( hdrPart ) )
    {
      // header is aleady loaded, return it.
      return header;
    }
  }
  // should never come, but load the header if needed.
  HdrDocument hdrDoc = HdrDocument.Factory.parse( hdrPart.getInputStream() );
  CTHdrFtr hdrFtr = hdrDoc.getHdr();
  XWPFHeader hdr = new XWPFHeader( document, hdrFtr );
  return hdr;
}

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

/**
 * Returns the {@link XWPFFooter} of the given footer reference.
 * 
 * @param footerRef the footer reference.
 * @return
 * @throws XmlException
 * @throws IOException
 */
protected XWPFFooter getXWPFFooter( CTHdrFtrRef footerRef )
  throws XmlException, IOException
{
  PackagePart hdrPart = document.getPartById( footerRef.getId() );
  List<XWPFFooter> footers = document.getFooterList();
  for ( XWPFFooter footer : footers )
  {
    if ( footer.getPackagePart().equals( hdrPart ) )
    {
      // footer is aleady loaded, return it.
      return footer;
    }
  }
  // should never come, but load the footer if needed.
  FtrDocument hdrDoc = FtrDocument.Factory.parse( hdrPart.getInputStream() );
  CTHdrFtr hdrFtr = hdrDoc.getFtr();
  XWPFFooter ftr = new XWPFFooter( document, hdrFtr );
  return ftr;
}

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

/**
 * Returns the {@link XWPFFooter} of the given footer reference.
 * 
 * @param footerRef the footer reference.
 * @return
 * @throws XmlException
 * @throws IOException
 */
protected XWPFFooter getXWPFFooter( CTHdrFtrRef footerRef )
  throws XmlException, IOException
{
  PackagePart hdrPart = document.getPartById( footerRef.getId() );
  List<XWPFFooter> footers = document.getFooterList();
  for ( XWPFFooter footer : footers )
  {
    if ( footer.getPackagePart().equals( hdrPart ) )
    {
      // footer is aleady loaded, return it.
      return footer;
    }
  }
  // should never come, but load the footer if needed.
  FtrDocument hdrDoc = FtrDocument.Factory.parse( hdrPart.getInputStream() );
  CTHdrFtr hdrFtr = hdrDoc.getFtr();
  XWPFFooter ftr = new XWPFFooter( document, hdrFtr );
  return ftr;
}

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

/**
 * Returns the {@link XWPFHeader} of the given header reference.
 * 
 * @param headerref the header reference.
 * @return
 * @throws XmlException
 * @throws IOException
 */
protected XWPFHeader getXWPFHeader( CTHdrFtrRef headerRef )
  throws XmlException, IOException
{
  PackagePart hdrPart = document.getPartById( headerRef.getId() );
  List<XWPFHeader> headers = document.getHeaderList();
  for ( XWPFHeader header : headers )
  {
    if ( header.getPackagePart().equals( hdrPart ) )
    {
      // header is aleady loaded, return it.
      return header;
    }
  }
  // should never come, but load the header if needed.
  HdrDocument hdrDoc = HdrDocument.Factory.parse( hdrPart.getInputStream() );
  CTHdrFtr hdrFtr = hdrDoc.getHdr();
  XWPFHeader hdr = new XWPFHeader( document, hdrFtr );
  return hdr;
}

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

/**
 * Returns the {@link XWPFFooter} of the given footer reference.
 * 
 * @param footerRef the footer reference.
 * @return
 * @throws XmlException
 * @throws IOException
 */
protected XWPFFooter getXWPFFooter( CTHdrFtrRef footerRef )
  throws XmlException, IOException
{
  PackagePart hdrPart = document.getPartById( footerRef.getId() );
  List<XWPFFooter> footers = document.getFooterList();
  for ( XWPFFooter footer : footers )
  {
    if ( footer.getPackagePart().equals( hdrPart ) )
    {
      // footer is aleady loaded, return it.
      return footer;
    }
  }
  // should never come, but load the footer if needed.
  FtrDocument hdrDoc = FtrDocument.Factory.parse( hdrPart.getInputStream() );
  CTHdrFtr hdrFtr = hdrDoc.getFtr();
  XWPFFooter ftr = new XWPFFooter( document, hdrFtr );
  return ftr;
}

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

/**
 * Returns the {@link XWPFHeader} of the given header reference.
 * 
 * @param headerref the header reference.
 * @return
 * @throws XmlException
 * @throws IOException
 */
protected XWPFHeader getXWPFHeader( CTHdrFtrRef headerRef )
  throws XmlException, IOException
{
  PackagePart hdrPart = document.getPartById( headerRef.getId() );
  List<XWPFHeader> headers = document.getHeaderList();
  for ( XWPFHeader header : headers )
  {
    if ( header.getPackagePart().equals( hdrPart ) )
    {
      // header is aleady loaded, return it.
      return header;
    }
  }
  // should never come, but load the header if needed.
  HdrDocument hdrDoc = HdrDocument.Factory.parse( hdrPart.getInputStream() );
  CTHdrFtr hdrFtr = hdrDoc.getHdr();
  XWPFHeader hdr = new XWPFHeader( document, hdrFtr );
  return hdr;
}

相关文章

XWPFDocument类方法