Package org.apache.poi.xslf.usermodel
Class XSLFPictureShape
- java.lang.Object
-
- org.apache.poi.xslf.usermodel.XSLFShape
-
- org.apache.poi.xslf.usermodel.XSLFSimpleShape
-
- org.apache.poi.xslf.usermodel.XSLFPictureShape
-
- All Implemented Interfaces:
IAdjustableShape
,PictureShape<XSLFShape,XSLFTextParagraph>
,PlaceableShape<XSLFShape,XSLFTextParagraph>
,Shape<XSLFShape,XSLFTextParagraph>
,SimpleShape<XSLFShape,XSLFTextParagraph>
@Beta public class XSLFPictureShape extends XSLFSimpleShape implements PictureShape<XSLFShape,XSLFTextParagraph>
Represents a picture shape
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.poi.xslf.usermodel.XSLFShape
XSLFShape.ReparseFactory<T extends XmlObject>
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static XSLFPictureShape
addSvgImage(XSLFSheet sheet, XSLFPictureData svgPic, PictureData.PictureType previewType, java.awt.geom.Rectangle2D anchor)
Convenience method for adding SVG images, which generates the preview imagePictureData
getAlternativePictureData()
Returns an alternative picture data, e.g.java.awt.Insets
getClipping()
Returns the clipping values as percent ratio relatively to the image size.java.lang.String
getName()
XSLFPictureData
getPictureData()
Return the data on the (internal) picture.java.net.URI
getPictureLink()
For an external linked picture, return the last-seen path to the picture.XSLFPictureData
getSvgImage()
java.lang.String
getVideoFileLink()
boolean
isExternalLinkedPicture()
Is this an internal picture (image data included within the PowerPoint file), or an external linked picture (image lives outside)?boolean
isVideoFile()
boolean
setName(java.lang.String name)
void
setPlaceholder(Placeholder placeholder)
Specifies that the corresponding shape should be represented by the generating application as a placeholder.void
setSvgImage(XSLFPictureData svgPic)
Add a SVG image reference-
Methods inherited from class org.apache.poi.xslf.usermodel.XSLFSimpleShape
createHyperlink, getAdjustValue, getAnchor, getFillColor, getFillStyle, getFlipHorizontal, getFlipVertical, getGeometry, getHyperlink, getLineCap, getLineColor, getLineCompound, getLineDash, getLineDecoration, getLineHeadDecoration, getLineHeadLength, getLineHeadWidth, getLineTailDecoration, getLineTailLength, getLineTailWidth, getLineWidth, getRotation, getShadow, getShapeType, getStrokeStyle, setAnchor, setFillColor, setFlipHorizontal, setFlipVertical, setLineCap, setLineColor, setLineCompound, setLineDash, setLineHeadDecoration, setLineHeadLength, setLineHeadWidth, setLineTailDecoration, setLineTailLength, setLineTailWidth, setLineWidth, setRotation, setShapeType, setStrokeStyle
-
Methods inherited from class org.apache.poi.xslf.usermodel.XSLFShape
draw, fetchShapeProperty, getParent, getPlaceholder, getPlaceholderDetails, getShapeId, getShapeName, getSheet, getXmlObject, isPlaceholder, setParent
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.poi.sl.draw.geom.IAdjustableShape
getAdjustValue
-
Methods inherited from interface org.apache.poi.sl.usermodel.PlaceableShape
getAnchor, getFlipHorizontal, getFlipVertical, getParent, getRotation, getSheet, setAnchor, setFlipHorizontal, setFlipVertical, setRotation
-
Methods inherited from interface org.apache.poi.sl.usermodel.Shape
draw, getAnchor, getParent, getShapeId, getShapeName, getSheet
-
Methods inherited from interface org.apache.poi.sl.usermodel.SimpleShape
createHyperlink, getFillColor, getFillStyle, getGeometry, getHyperlink, getLineDecoration, getPlaceholder, getPlaceholderDetails, getShadow, getShapeType, getStrokeStyle, isPlaceholder, setFillColor, setShapeType, setStrokeStyle
-
-
-
-
Method Detail
-
isExternalLinkedPicture
public boolean isExternalLinkedPicture()
Is this an internal picture (image data included within the PowerPoint file), or an external linked picture (image lives outside)?
-
getPictureData
public XSLFPictureData getPictureData()
Return the data on the (internal) picture. For an external linked picture, will return null- Specified by:
getPictureData
in interfacePictureShape<XSLFShape,XSLFTextParagraph>
- Returns:
- the picture data for this picture.
-
setPlaceholder
public void setPlaceholder(Placeholder placeholder)
Description copied from interface:SimpleShape
Specifies that the corresponding shape should be represented by the generating application as a placeholder. When a shape is considered a placeholder by the generating application it can have special properties to alert the user that they may enter content into the shape.- Specified by:
setPlaceholder
in interfaceSimpleShape<XSLFShape,XSLFTextParagraph>
- Overrides:
setPlaceholder
in classXSLFShape
- Parameters:
placeholder
- the placeholder or null to remove the reference to the placeholder- See Also:
PlaceholderDetails.setPlaceholder(Placeholder)
-
getPictureLink
public java.net.URI getPictureLink()
For an external linked picture, return the last-seen path to the picture. For an internal picture, returns null.
-
getClipping
public java.awt.Insets getClipping()
Description copied from interface:PictureShape
Returns the clipping values as percent ratio relatively to the image size. The clipping are returned as insets converted/scaled to 100000 (=100%).- Specified by:
getClipping
in interfacePictureShape<XSLFShape,XSLFTextParagraph>
- Returns:
- the clipping rectangle, which is given in percent in relation to the image width/height
-
setSvgImage
public void setSvgImage(XSLFPictureData svgPic)
Add a SVG image reference- Parameters:
svgPic
- a previously imported svg image- Since:
- POI 4.1.0
-
getAlternativePictureData
public PictureData getAlternativePictureData()
Description copied from interface:PictureShape
Returns an alternative picture data, e.g. an embedded SVG image- Specified by:
getAlternativePictureData
in interfacePictureShape<XSLFShape,XSLFTextParagraph>
- Returns:
- an alternative picture data
-
getName
public java.lang.String getName()
- Returns:
- picture name, can be null
- Since:
- POI 5.1.0
-
setName
public boolean setName(java.lang.String name)
- Parameters:
name
- picture name- Returns:
- returns true if the name was set
- Since:
- POI 5.1.0
-
getSvgImage
public XSLFPictureData getSvgImage()
- Returns:
- SVG image data -- can return null if no SVG image is found
-
addSvgImage
public static XSLFPictureShape addSvgImage(XSLFSheet sheet, XSLFPictureData svgPic, PictureData.PictureType previewType, java.awt.geom.Rectangle2D anchor) throws java.io.IOException
Convenience method for adding SVG images, which generates the preview image- Parameters:
sheet
- the sheet to addsvgPic
- the svg picture to addpreviewType
- the preview picture type or null (defaults to PNG) - currently only JPEG,GIF,PNG are allowedanchor
- the image anchor (for calculating the preview image size) or null (the preview size is taken from the svg picture bounds)- Throws:
java.io.IOException
- Since:
- POI 4.1.0
-
isVideoFile
public boolean isVideoFile()
- Returns:
- boolean; true if the picture is a video
- Since:
- POI 5.2.0
-
getVideoFileLink
public java.lang.String getVideoFileLink()
- Returns:
- the link ID for the video file
- Since:
- POI 5.2.0
-
-