Package org.apache.poi.xssf.usermodel
Class XSSFPicture
- java.lang.Object
-
- org.apache.poi.xssf.usermodel.XSSFShape
-
- org.apache.poi.xssf.usermodel.XSSFPicture
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description XSSFClientAnchor
getClientAnchor()
CTPicture
getCTPicture()
Return the underlying CTPicture bean that holds all properties for this pictureDimension
getImageDimension()
Return the dimension of the embedded image in pixelXSSFPictureData
getPictureData()
Return picture data for this shapeXSSFClientAnchor
getPreferredSize()
Calculate the preferred size for this picture.XSSFClientAnchor
getPreferredSize(double scale)
Calculate the preferred size for this picture.XSSFClientAnchor
getPreferredSize(double scaleX, double scaleY)
Calculate the preferred size for this picture.String
getShapeName()
XSSFSheet
getSheet()
void
resize()
Reset the image to the dimension of the embedded imagevoid
resize(double scale)
Resize the image proportionally.void
resize(double scaleX, double scaleY)
Resize the image relatively to its current size.-
Methods inherited from class org.apache.poi.xssf.usermodel.XSSFShape
getAnchor, getDrawing, getParent, isNoFill, setFillColor, setLineStyle, setLineStyleColor, setLineWidth, setNoFill
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.poi.ss.usermodel.Shape
getAnchor, getParent, isNoFill, setFillColor, setLineStyleColor, setNoFill
-
-
-
-
Method Detail
-
getCTPicture
@Internal public CTPicture getCTPicture()
Return the underlying CTPicture bean that holds all properties for this picture- Returns:
- the underlying CTPicture bean
-
resize
public void resize()
Reset the image to the dimension of the embedded image- Specified by:
resize
in interfacePicture
- See Also:
resize(double, double)
-
resize
public void resize(double scale)
Resize the image proportionally.- Specified by:
resize
in interfacePicture
- See Also:
resize(double, double)
-
resize
public void resize(double scaleX, double scaleY)
Resize the image relatively to its current size.Please note, that this method works correctly only for workbooks with the default font size (Calibri 11pt for .xlsx). If the default font is changed the resized image can be streched vertically or horizontally.
resize(1.0,1.0)
keeps the original size,
resize(0.5,0.5)
resize to 50% of the original,
resize(2.0,2.0)
resizes to 200% of the original.
resize(
resizes to the dimension of the embedded image.Double.MAX_VALUE
,Double.MAX_VALUE
)- Specified by:
resize
in interfacePicture
- Parameters:
scaleX
- the amount by which the image width is multiplied relative to the original width, when set toDouble.MAX_VALUE
the width of the embedded image is usedscaleY
- the amount by which the image height is multiplied relative to the original height, when set toDouble.MAX_VALUE
the height of the embedded image is used
-
getPreferredSize
public XSSFClientAnchor getPreferredSize()
Calculate the preferred size for this picture.- Specified by:
getPreferredSize
in interfacePicture
- Returns:
- XSSFClientAnchor with the preferred size for this image
-
getPreferredSize
public XSSFClientAnchor getPreferredSize(double scale)
Calculate the preferred size for this picture.- Parameters:
scale
- the amount by which image dimensions are multiplied relative to the original size.- Returns:
- XSSFClientAnchor with the preferred size for this image
-
getPreferredSize
public XSSFClientAnchor getPreferredSize(double scaleX, double scaleY)
Calculate the preferred size for this picture.- Specified by:
getPreferredSize
in interfacePicture
- Parameters:
scaleX
- the amount by which image width is multiplied relative to the original width.scaleY
- the amount by which image height is multiplied relative to the original height.- Returns:
- XSSFClientAnchor with the preferred size for this image
-
getImageDimension
public Dimension getImageDimension()
Return the dimension of the embedded image in pixel- Specified by:
getImageDimension
in interfacePicture
- Returns:
- image dimension in pixels
-
getPictureData
public XSSFPictureData getPictureData()
Return picture data for this shape- Specified by:
getPictureData
in interfacePicture
- Returns:
- picture data for this shape
-
getClientAnchor
public XSSFClientAnchor getClientAnchor()
- Specified by:
getClientAnchor
in interfacePicture
- Returns:
- the anchor that is used by this shape.
-
getSheet
public XSSFSheet getSheet()
-
getShapeName
public String getShapeName()
- Specified by:
getShapeName
in interfaceShape
- Returns:
- the name of this shape
-
-