gpt4 book ai didi

org.apache.poi.xslf.usermodel.XSLFShape.getXmlObject()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-19 03:56:40 28 4
gpt4 key购买 nike

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

XSLFShape.getXmlObject介绍

暂无

代码示例

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

/**
 * As there's no xmlbeans hierarchy, but XSLF works with subclassing, not all
 * child classes work with a {@link CTShape} object, but often contain the same
 * properties. This method is the generalized form of selecting and casting those
 * properties.
 *
 * @param resultClass the requested result class
 * @param xquery the simple (xmlbean) xpath expression to the property
 * @return the xml object at the xpath location, or null if not found
 */
@SuppressWarnings({"unchecked", "WeakerAccess"})
protected <T extends XmlObject> T selectProperty(Class<T> resultClass, String xquery) {
  XmlObject[] rs = getXmlObject().selectPath(xquery);
  if (rs.length == 0) {
    return null;
  }
  return (resultClass.isInstance(rs[0])) ? (T)rs[0] : null;
}

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

public boolean fetch(XSLFShape shape) {
  XmlObject[] o = shape.getXmlObject().selectPath(
      "declare namespace p='http://schemas.openxmlformats.org/presentationml/2006/main' " +
      "declare namespace a='http://schemas.openxmlformats.org/drawingml/2006/main' " +
      ".//p:txBody/a:lstStyle/a:lvl" + (_level + 1) + "pPr"
  );
  if (o.length == 1) {
    CTTextParagraphProperties props = (CTTextParagraphProperties) o[0];
    return fetch(props);
  }
  return false;
}

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

public boolean fetch(XSLFShape shape) {
  XmlObject[] o = shape.getXmlObject().selectPath(
      "declare namespace p='http://schemas.openxmlformats.org/presentationml/2006/main' " +
      "declare namespace a='http://schemas.openxmlformats.org/drawingml/2006/main' " +
      ".//p:txBody/a:bodyPr"
  );
  if (o.length == 1) {
    CTTextBodyProperties props = (CTTextBodyProperties) o[0];
    return fetch(props);
  }
  return false;
}

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

XmlObject obj = xShape.getXmlObject();
CTGroupShape spTree = getSpTree();
deregisterShapeId(xShape.getShapeId());

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

/**
 * Remove the specified shape from this group
 */
@Override
public boolean removeShape(XSLFShape xShape) {
  XmlObject obj = xShape.getXmlObject();
  CTGroupShape grpSp = (CTGroupShape)getXmlObject();
  getSheet().deregisterShapeId(xShape.getShapeId());
  if(obj instanceof CTShape){
    grpSp.getSpList().remove(obj);
  } else if (obj instanceof CTGroupShape){
    XSLFGroupShape gs = (XSLFGroupShape)xShape;
    new ArrayList<>(gs.getShapes()).forEach(gs::removeShape);
    grpSp.getGrpSpList().remove(obj);
  } else if (obj instanceof CTConnector){
    grpSp.getCxnSpList().remove(obj);
  } else if (obj instanceof CTGraphicalObjectFrame) {
    grpSp.getGraphicFrameList().remove(obj);
  } else if (obj instanceof CTPicture) {
    XSLFPictureShape ps = (XSLFPictureShape)xShape;
    XSLFSheet sh = getSheet();
    if (sh != null) {
      sh.removePictureRelation(ps);
    }
    grpSp.getPicList().remove(obj);
  } else {
    throw new IllegalArgumentException("Unsupported shape: " + xShape);
  }
  return _shapes.remove(xShape);
}

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

/**
 * Return direct child objects of this shape
 *
 * @param childClass the class to cast the properties to
 * @param namespace the namespace - usually it is {@code "http://schemas.openxmlformats.org/presentationml/2006/main"}
 * @param nodename the node name, without prefix
 * @return the properties object or null if it can't be found
 */
@SuppressWarnings({"unchecked", "WeakerAccess", "unused", "SameParameterValue"})
protected <T extends XmlObject> T getChild(Class<T> childClass, String namespace, String nodename) {
  XmlCursor cur = getXmlObject().newCursor();
  T child = null;
  if (cur.toChild(namespace, nodename)) {
    child = (T)cur.getObject();
  }
  if (cur.toChild(XSLFRelation.NS_DRAWINGML, nodename)) {
    child = (T)cur.getObject();
  }
  cur.dispose();
  return child;
}

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

if (!skipPlaceholders && (sh.getXmlObject() instanceof CTPicture)) {
  CTPicture ctPic = ((CTPicture) sh.getXmlObject());
  if (ctPic.getBlipFill() != null && ctPic.getBlipFill().getBlip() != null) {
    String relID = ctPic.getBlipFill().getBlip().getEmbed();

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

/**
 * As there's no xmlbeans hierarchy, but XSLF works with subclassing, not all
 * child classes work with a {@link CTShape} object, but often contain the same
 * properties. This method is the generalized form of selecting and casting those
 * properties.
 *
 * @param resultClass the requested result class
 * @param xquery the simple (xmlbean) xpath expression to the property
 * @return the xml object at the xpath location, or null if not found
 */
@SuppressWarnings({"unchecked", "WeakerAccess"})
protected <T extends XmlObject> T selectProperty(Class<T> resultClass, String xquery) {
  XmlObject[] rs = getXmlObject().selectPath(xquery);
  if (rs.length == 0) {
    return null;
  }
  return (resultClass.isInstance(rs[0])) ? (T)rs[0] : null;
}

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

public boolean fetch(XSLFShape shape) {
  XmlObject[] o = shape.getXmlObject().selectPath(
      "declare namespace p='http://schemas.openxmlformats.org/presentationml/2006/main' " +
      "declare namespace a='http://schemas.openxmlformats.org/drawingml/2006/main' " +
      ".//p:txBody/a:bodyPr"
  );
  if (o.length == 1) {
    CTTextBodyProperties props = (CTTextBodyProperties) o[0];
    return fetch(props);
  }
  return false;
}

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

public boolean fetch(XSLFShape shape) {
  XmlObject[] o = shape.getXmlObject().selectPath(
      "declare namespace p='http://schemas.openxmlformats.org/presentationml/2006/main' " +
      "declare namespace a='http://schemas.openxmlformats.org/drawingml/2006/main' " +
      ".//p:txBody/a:lstStyle/a:lvl" + (_level + 1) + "pPr"
  );
  if (o.length == 1) {
    CTTextParagraphProperties props = (CTTextParagraphProperties) o[0];
    return fetch(props);
  }
  return false;
}

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

/**
 * Remove the specified shape from this group
 */
public boolean removeShape(XSLFShape xShape) {
  XmlObject obj = xShape.getXmlObject();
  if(obj instanceof CTShape){
    _shape.getSpList().remove(obj);
  } else if (obj instanceof CTGroupShape){
    _shape.getGrpSpList().remove(obj);
  } else if (obj instanceof CTConnector){
    _shape.getCxnSpList().remove(obj);
  } else {
    throw new IllegalArgumentException("Unsupported shape: " + xShape);
  }
  return _shapes.remove(xShape);
}

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

/**
 * Removes the specified shape from this sheet, if it is present
 * (optional operation).  If this sheet does not contain the element,
 * it is unchanged.
 *
 * @param xShape shape to be removed from this sheet, if present
 * @return <tt>true</tt> if this sheet contained the specified element
 * @throws IllegalArgumentException if the type of the specified shape
 *         is incompatible with this sheet (optional)
 */
public boolean removeShape(XSLFShape xShape) {
  XmlObject obj = xShape.getXmlObject();
  CTGroupShape spTree = getSpTree();
  if(obj instanceof CTShape){
    spTree.getSpList().remove(obj);
  } else if (obj instanceof CTGroupShape){
    spTree.getGrpSpList().remove(obj);
  } else if (obj instanceof CTConnector){
    spTree.getCxnSpList().remove(obj);
  } else {
    throw new IllegalArgumentException("Unsupported shape: " + xShape);
  }
  return getShapeList().remove(xShape);
}

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

XmlObject obj = xShape.getXmlObject();
CTGroupShape spTree = getSpTree();
deregisterShapeId(xShape.getShapeId());

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

/**
 * Remove the specified shape from this group
 */
@Override
public boolean removeShape(XSLFShape xShape) {
  XmlObject obj = xShape.getXmlObject();
  CTGroupShape grpSp = (CTGroupShape)getXmlObject();
  getSheet().deregisterShapeId(xShape.getShapeId());
  if(obj instanceof CTShape){
    grpSp.getSpList().remove(obj);
  } else if (obj instanceof CTGroupShape){
    XSLFGroupShape gs = (XSLFGroupShape)xShape;
    new ArrayList<>(gs.getShapes()).forEach(gs::removeShape);
    grpSp.getGrpSpList().remove(obj);
  } else if (obj instanceof CTConnector){
    grpSp.getCxnSpList().remove(obj);
  } else if (obj instanceof CTGraphicalObjectFrame) {
    grpSp.getGraphicFrameList().remove(obj);
  } else if (obj instanceof CTPicture) {
    XSLFPictureShape ps = (XSLFPictureShape)xShape;
    XSLFSheet sh = getSheet();
    if (sh != null) {
      sh.removePictureRelation(ps);
    }
    grpSp.getPicList().remove(obj);
  } else {
    throw new IllegalArgumentException("Unsupported shape: " + xShape);
  }
  return _shapes.remove(xShape);
}

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

/**
 * Return direct child objects of this shape
 *
 * @param childClass the class to cast the properties to
 * @param namespace the namespace - usually it is {@code "http://schemas.openxmlformats.org/presentationml/2006/main"}
 * @param nodename the node name, without prefix
 * @return the properties object or null if it can't be found
 */
@SuppressWarnings({"unchecked", "WeakerAccess", "unused", "SameParameterValue"})
protected <T extends XmlObject> T getChild(Class<T> childClass, String namespace, String nodename) {
  XmlCursor cur = getXmlObject().newCursor();
  T child = null;
  if (cur.toChild(namespace, nodename)) {
    child = (T)cur.getObject();
  }
  if (cur.toChild(XSLFRelation.NS_DRAWINGML, nodename)) {
    child = (T)cur.getObject();
  }
  cur.dispose();
  return child;
}

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

if (!skipPlaceholders && (sh.getXmlObject() instanceof CTPicture)) {
  CTPicture ctPic = ((CTPicture) sh.getXmlObject());
  if (ctPic.getBlipFill() != null && ctPic.getBlipFill().getBlip() != null) {
    String relID = ctPic.getBlipFill().getBlip().getEmbed();

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

if (!skipPlaceholders && (sh.getXmlObject() instanceof CTPicture)) {
  CTPicture ctPic = ((CTPicture) sh.getXmlObject());
  if (ctPic.getBlipFill() != null && ctPic.getBlipFill().getBlip() != null) {
    String relID = ctPic.getBlipFill().getBlip().getEmbed();

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