diff options
author | PJ Fanning <fanningpj@apache.org> | 2021-10-23 09:18:17 +0000 |
---|---|---|
committer | PJ Fanning <fanningpj@apache.org> | 2021-10-23 09:18:17 +0000 |
commit | 03fc88b18b0a8ecab6ecaa2c8a877d5ad24a28fb (patch) | |
tree | 26a0374c5e135847f3111fb9c6499fcd892d63b6 /poi-ooxml/src/main | |
parent | b3a64e0bcafd1f69de3ce488a3fff6af98f1dd0a (diff) | |
download | poi-03fc88b18b0a8ecab6ecaa2c8a877d5ad24a28fb.tar.gz poi-03fc88b18b0a8ecab6ecaa2c8a877d5ad24a28fb.zip |
add XSLFPictureShape getName
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1894504 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi-ooxml/src/main')
-rw-r--r-- | poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFPictureShape.java | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFPictureShape.java b/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFPictureShape.java index 21462607d9..9205a74112 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFPictureShape.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFPictureShape.java @@ -273,6 +273,29 @@ public class XSLFPictureShape extends XSLFSimpleShape return getSvgImage(); } + /** + * @return picture name, can be null + * @since POI 5.1.0 + */ + public String getName() { + String name = null; + XmlObject xmlObject = getXmlObject(); + if (xmlObject instanceof CTPicture) { + CTPicture ctPicture = (CTPicture)xmlObject; + CTPictureNonVisual nvSpPr = ctPicture.getNvPicPr(); + if (nvSpPr != null) { + CTNonVisualDrawingProps cnv = nvSpPr.getCNvPr(); + if (cnv != null) { + name = cnv.getName(); + } + } + } + return name; + } + + /** + * @return SVG image data -- can return null if no SVG image is found + */ public XSLFPictureData getSvgImage() { CTBlip blip = getBlip(); if (blip == null) { @@ -299,7 +322,7 @@ public class XSLFPictureShape extends XSLFSimpleShape } /** - * Convienence method for adding SVG images, which generates the preview image + * Convenience method for adding SVG images, which generates the preview image * @param sheet the sheet to add * @param svgPic the svg picture to add * @param previewType the preview picture type or null (defaults to PNG) - currently only JPEG,GIF,PNG are allowed @@ -351,7 +374,7 @@ public class XSLFPictureShape extends XSLFSimpleShape @Override - void copy(XSLFShape sh){ + void copy(XSLFShape sh) { super.copy(sh); XSLFPictureShape p = (XSLFPictureShape)sh; |