gpt4 book ai didi

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

转载 作者:知者 更新时间:2024-03-26 07:07:05 26 4
gpt4 key购买 nike

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

XWPFHeaderFooter介绍

[英]Parent of XWPF headers and footers
[中]XWPF页眉和页脚的父级

代码示例

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

/**
 * save and commit footer
 */
@Override
protected void commit() throws IOException {
  XmlOptions xmlOptions = new XmlOptions(DEFAULT_XML_OPTIONS);
  xmlOptions.setSaveSyntheticDocumentElement(new QName(CTNumbering.type.getName().getNamespaceURI(), "ftr"));
  PackagePart part = getPackagePart();
  OutputStream out = part.getOutputStream();
  super._getHdrFtr().save(out, xmlOptions);
  out.close();
}

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

/**
 * Returns the textual content of the header/footer,
 * by flattening out the text of its paragraph(s)
 */
public String getText() {
  StringBuilder t = new StringBuilder(64);
  //TODO: simplify this to get ibody elements in order
  for (int i = 0; i < paragraphs.size(); i++) {
    if (!paragraphs.get(i).isEmpty()) {
      String text = paragraphs.get(i).getText();
      if (text != null && text.length() > 0) {
        t.append(text);
        t.append('\n');
      }
    }
  }
  for (int i = 0; i < tables.size(); i++) {
    String text = tables.get(i).getText();
    if (text != null && text.length() > 0) {
      t.append(text);
      t.append('\n');
    }
  }
  for (IBodyElement bodyElement : getBodyElements()) {
    if (bodyElement instanceof XWPFSDT) {
      t.append(((XWPFSDT) bodyElement).getContent().getText() + '\n');
    }
  }
  return t.toString();
}

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

/**
 * Adds a picture to the document.
 *
 * @param is     The stream to read image from
 * @param format The format of the picture.
 * @return the index to this picture (0 based), the added picture can be obtained from {@link #getAllPictures()} .
 * @throws InvalidFormatException If the format of the picture is not known.
 * @throws IOException If reading the picture-data from the stream fails.
 */
public String addPictureData(InputStream is, int format) throws InvalidFormatException, IOException {
  byte[] data = IOUtils.toByteArray(is);
  return addPictureData(data, format);
}

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

xwpfPicData = (XWPFPictureData) createRelationship(relDesc, XWPFFactory.getInstance(), idx);
  return getRelationId(xwpfPicData);
} else if (!getRelations().contains(xwpfPicData)) {
  RelationPart rp = addRelation(null, XWPFRelation.IMAGES, xwpfPicData);
  pictures.add(xwpfPicData);
  return rp.getRelationship().getId();
} else {
  return getRelationId(xwpfPicData);

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

if (isCursorInHdrF(cursor)) {
  String uri = CTP.type.getName().getNamespaceURI();
  String localPart = "p";
    paragraphs.add(0, newP);
  } else {
    int pos = paragraphs.indexOf(getParagraph((CTP) o)) + 1;
    paragraphs.add(pos, newP);

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

relationId = headerFooter.addPictureData(pictureData, pictureType);
  picData = (XWPFPictureData) headerFooter.getRelationById(relationId);
} else {
  @SuppressWarnings("resource")

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

public XWPFDocument getXWPFDocument() {
  if (document != null) {
    return document;
  } else {
    return (XWPFDocument) getParent();
  }
}

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

@Override
protected void onDocumentRead() throws IOException {
  for (POIXMLDocumentPart poixmlDocumentPart : getRelations()) {
    if (poixmlDocumentPart instanceof XWPFPictureData) {
      XWPFPictureData xwpfPicData = (XWPFPictureData) poixmlDocumentPart;
      pictures.add(xwpfPicData);
      document.registerPackagePictureData(xwpfPicData);
    }
  }
}

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

/**
 * returns the PictureData by blipID
 *
 * @param blipID
 * @return XWPFPictureData of a specificID
 * @throws Exception
 */
public XWPFPictureData getPictureDataByID(String blipID) {
  POIXMLDocumentPart relatedPart = getRelationById(blipID);
  if (relatedPart != null && relatedPart instanceof XWPFPictureData) {
    return (XWPFPictureData) relatedPart;
  }
  return null;
}

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

xwpfPicData = (XWPFPictureData) createRelationship(relDesc, XWPFFactory.getInstance(), idx);
  return getRelationId(xwpfPicData);
} else if (!getRelations().contains(xwpfPicData)) {
  RelationPart rp = addRelation(null, XWPFRelation.IMAGES, xwpfPicData);
  pictures.add(xwpfPicData);
  return rp.getRelationship().getId();
} else {
  return getRelationId(xwpfPicData);

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

if(isCursorInHdrF(cursor)){
  String uri = CTP.type.getName().getNamespaceURI();
  String localPart = "p";
    int pos = paragraphs.indexOf(getParagraph((CTP)o))+1;
    paragraphs.add(pos,newP);

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

relationId = headerFooter.addPictureData(pictureData, pictureType);
  picData = (XWPFPictureData) headerFooter.getRelationById(relationId);
} else {
  @SuppressWarnings("resource")

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

/**
 * @since by POI 3.14-Beta1
 */
public XWPFHeaderFooter(POIXMLDocumentPart parent, PackagePart part) throws IOException {
  super(parent, part);
  this.document = (XWPFDocument) getParent();
  if (this.document == null) {
    throw new NullPointerException();
  }
}

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

@Override
protected void onDocumentRead() throws IOException {
  for (POIXMLDocumentPart poixmlDocumentPart : getRelations()){
    if(poixmlDocumentPart instanceof XWPFPictureData){
      XWPFPictureData xwpfPicData = (XWPFPictureData) poixmlDocumentPart;
      pictures.add(xwpfPicData);
      document.registerPackagePictureData(xwpfPicData);
    }
  }
}

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

/**
 * returns the PictureData by blipID
 * @param blipID
 * @return XWPFPictureData of a specificID
 * @throws Exception 
 */
public XWPFPictureData getPictureDataByID(String blipID) {
  POIXMLDocumentPart relatedPart = getRelationById(blipID);
  if (relatedPart != null && relatedPart instanceof XWPFPictureData) {
    return (XWPFPictureData) relatedPart;
  }
  return null;	    	
}

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

xwpfPicData = (XWPFPictureData) createRelationship(relDesc, XWPFFactory.getInstance(),idx);
  return getRelationId(xwpfPicData);
else if (!getRelations().contains(xwpfPicData))
  PackagePartName partName = picDataPart.getPartName();
  String relation = relDesc.getRelation();
  PackageRelationship relShip = getPackagePart().addRelationship(partName,targetMode,relation);
  String id = relShip.getId();
  addRelation(id,xwpfPicData);
  pictures.add(xwpfPicData);
  return id;
  return getRelationId(xwpfPicData);

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

/**
 * save and commit footer
 */
@Override
protected void commit() throws IOException {
  XmlOptions xmlOptions = new XmlOptions(DEFAULT_XML_OPTIONS);
  xmlOptions.setSaveSyntheticDocumentElement(new QName(CTNumbering.type.getName().getNamespaceURI(), "hdr"));
  PackagePart part = getPackagePart();
  OutputStream out = part.getOutputStream();
  super._getHdrFtr().save(out, xmlOptions);
  out.close();
}

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

if (isCursorInHdrF(cursor)) {
  String uri = CTP.type.getName().getNamespaceURI();
  String localPart = "p";
    paragraphs.add(0, newP);
  } else {
    int pos = paragraphs.indexOf(getParagraph((CTP) o)) + 1;
    paragraphs.add(pos, newP);

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

private void extractHeaderText(XHTMLContentHandler xhtml, XWPFHeaderFooter header, XWPFListManager listManager) throws SAXException, XmlException, IOException {
  for (IBodyElement e : header.getBodyElements()) {
    if (e instanceof XWPFParagraph) {
      extractParagraph((XWPFParagraph) e, listManager, xhtml);
    } else if (e instanceof XWPFTable) {
      extractTable((XWPFTable) e, listManager, xhtml);
    } else if (e instanceof XWPFSDT) {
      extractSDT((XWPFSDT) e, xhtml);
    }
  }
}

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

public XWPFDocument getXWPFDocument() {
  if (document!=null) {
   return document;
  } else {
   return (XWPFDocument)getParent();
  }
}

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com